Files
HelloVulkan/App/editor/panels/ControllerEditorPanel.h
atdunbg f73e52926f Reorganize directory layout: editor panels/, grouped shaders, drop stale header
- App/editor: move 7 panels into panels/ (Editor core stays at root)
- shaders/: group into pbr/ post/ debug/ env/ (runtime load paths updated)
- Delete outdated duplicate Engine/src/Renderer/VulkanAssetUploader.h
2026-10-07 09:52:17 +08:00

59 lines
2.2 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//
// ControllerEditorPanel:动画控制器编辑器窗口(Unity Animator 状态机
// 面板范式,交互对齐 MaterialEditorPanel 的"指派/编辑分离")。
//
// Details 的 Controller 区只做指派(槽/Create/双击打开本面板);
// 结构编辑全在这里:
// - Preview:方向盘(2D 混合树可视化驱动)+ 权重实时读出,拖动
// SetFloat 到当前选中实体(Controller 模式)实时预览
// - States:状态列表(增删/重命名/entry),选中状态详情 = 播放
// 参数 + 混合树类型 + children 逐行编辑(clip 指定/定位/删除)
// - Transitions / Params:列表编辑,cond 字符串 Enter 就地编译
//
// 编辑直接写缓存资产实例(System 下一帧生效,无需保存);Save 落盘
// + ReloadController 重编译(实例换新,本面板每帧重解析不持指针)。
//
#ifndef HELLOVULKAN_CONTROLLEREDITORPANEL_H
#define HELLOVULKAN_CONTROLLEREDITORPANEL_H
#include "EditorContext.h"
#include <Engine/Core/Types.h>
#include <string>
#include <vector>
// .animctrl 拖拽 payload(AssetBrowser → Details Controller 槽指派)
inline constexpr char kControllerDragPayload[] = "CTRL_PATH";
class ControllerEditorPanel {
public:
// 打开 .animctrl 资产(Details 槽位 Edit 按钮 / Content Browser
// 双击入口)
void Open(const std::string& path)
{
m_Path = path;
m_Open = true;
m_SelState = 0;
}
bool IsOpen() const { return m_Open; }
void Draw(const EditorContext& ctx);
private:
void DrawPreview(const EditorContext& ctx);
void DrawStates(const EditorContext& ctx,
Engine::Animation::AnimationController* ctrl);
void DrawTransitions(const EditorContext& ctx,
Engine::Animation::AnimationController* ctrl);
void DrawParams(const EditorContext& ctx,
Engine::Animation::AnimationController* ctrl);
bool m_Open = false;
std::string m_Path;
int m_SelState = 0; // 选中状态(StateOrder 下标)
std::vector<char> m_CondBuf; // cond 输入缓冲(按行复用)
};
#endif //HELLOVULKAN_CONTROLLEREDITORPANEL_H