Files
HelloVulkan/App/editor/ControllerEditorPanel.h
T
atdunbg cc837bc605 Add animation controller system, material assets and skeleton visualization
- .animctrl state machine asset (params/transitions/blend trees, 1D+2D
  directional blending) with Unity Animator-style editor panel: state
  list, transitions, params, directional pad preview driving live
  CrossFade on the selected entity
- Split animation evaluation out of SceneRenderer into
  AnimationSystem/AnimationEvaluator; skin palettes with rest-pose
  fallback and blend-weight epsilon filtering
- MaterialAsset (.material) with reload-safe preview tile pool
  (DropMaterial clears dirty refs before instance destruction)
- EditorGizmoPass skeleton wires + viewport joint overlay; camera
  projection rework (baked Vulkan Y-flip, ortho support)
- Editor/game build split via HELLOVULKAN_EDITOR option
2026-10-07 01:50:04 +08:00

59 lines
2.2 KiB
C++
Raw 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