Reactivated the sidebar in the new node editor.

RefactorUnifiedBlendTreeStateMachineHandling
Martin Felis 2024-04-25 21:40:09 +02:00
parent 5e34aaf3db
commit 4d1990bea8
1 changed files with 28 additions and 3 deletions

View File

@ -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() {