diff --git a/src/AnimGraph/AnimGraphEditor.cc b/src/AnimGraph/AnimGraphEditor.cc index 3371bf8..36837ad 100644 --- a/src/AnimGraph/AnimGraphEditor.cc +++ b/src/AnimGraph/AnimGraphEditor.cc @@ -257,6 +257,8 @@ void AnimGraphEditorClear() { } void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) { + ax::NodeEditor::SetCurrentEditor(context); + ImGui::BeginMenuBar(); if (ImGui::Button("Save")) { sGraphGresource.SaveToFile("editor_graph.json"); @@ -268,6 +270,9 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) { if (ImGui::Button("Clear")) { AnimGraphEditorClear(); } + if (ImGui::Button("Content")) { + ax::NodeEditor::NavigateToContent(); + } char graph_name_buffer[256]; memset(graph_name_buffer, 0, sizeof(graph_name_buffer)); strncpy( @@ -280,10 +285,11 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) { ImGui::EndMenuBar(); + ImGui::Columns(2); + // // Node editor canvas // - ax::NodeEditor::SetCurrentEditor(context); ax::NodeEditor::Begin("Graph Editor"); #if 1 @@ -483,7 +489,7 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) { node_type_name = "ConstScalarNode"; } - if (node_type_name.empty()) { + if (!node_type_name.empty()) { AnimNodeResource* node_resource = AnimNodeResourceFactory(node_type_name); size_t node_id = sGraphGresource.m_blend_tree_resource.GetNumNodes(); @@ -499,9 +505,28 @@ void AnimGraphEditorUpdate(ax::NodeEditor::EditorContext* context) { ax::NodeEditor::End(); - sGraphLoadedThisFrame = false; + // + // Sidebar + // + ImGui::NextColumn(); + + if (ax::NodeEditor::GetSelectedObjectCount() > 0) { + ax::NodeEditor::NodeId selected_node_id = 0; + + ax::NodeEditor::GetSelectedNodes(&selected_node_id, 1); + + if (selected_node_id.Get() != 0) { + AnimGraphEditorRenderSidebar( + sGraphGresource.m_blend_tree_resource, + sGraphGresource.m_blend_tree_resource.GetNode( + selected_node_id.Get())); + } + } + + ImGui::Columns(1); ax::NodeEditor::SetCurrentEditor(nullptr); + sGraphLoadedThisFrame = false; } void LegacyAnimGraphEditorUpdate() {