diff --git a/SHADE_Engine/src/Editor/EditorWindow/Animation/SHAnimationControllerEditor.cpp b/SHADE_Engine/src/Editor/EditorWindow/Animation/SHAnimationControllerEditor.cpp index 33372760..4be0c7b0 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Animation/SHAnimationControllerEditor.cpp +++ b/SHADE_Engine/src/Editor/EditorWindow/Animation/SHAnimationControllerEditor.cpp @@ -305,7 +305,10 @@ namespace SHADE ImGui::BeginDisabled(ImNodes::NumSelectedNodes() != 1); if (ImGui::Button(std::format("{} Set Starting Node", ICON_MD_HOME).data())) { - + // Get id of selected node + int selectedNode = 0; + ImNodes::GetSelectedNodes(&selectedNode); + controllerData->StartingNode = selectedNode; // We can do this as the ImNodes node index is the same } ImGui::EndDisabled(); } @@ -325,6 +328,15 @@ namespace SHADE // Title ImNodes::BeginNodeTitleBar(); { + // Starting node marker + if (node.Index == controllerData->StartingNode) + { + const float INDENT = NODE_WIDTH * 0.6f; + ImGui::Indent(INDENT); + ImGui::Text(ICON_MD_HOME); + ImGui::Unindent(INDENT); + } + if (node.EditingName) { if (ImGui::Button(ICON_MD_DONE)) @@ -749,6 +761,12 @@ namespace SHADE } } + // Mark starting node + if (nodeMap.contains(controller.GetStartingNode())) + { + data.StartingNode = nodeMap[controller.GetStartingNode()]->Index; + } + return data; } SHAnimationController SHAnimationControllerEditor::serialise(const AnimControllerData& data) diff --git a/SHADE_Engine/src/Editor/EditorWindow/Animation/SHAnimationControllerEditor.h b/SHADE_Engine/src/Editor/EditorWindow/Animation/SHAnimationControllerEditor.h index bafbe4a9..60e939c7 100644 --- a/SHADE_Engine/src/Editor/EditorWindow/Animation/SHAnimationControllerEditor.h +++ b/SHADE_Engine/src/Editor/EditorWindow/Animation/SHAnimationControllerEditor.h @@ -100,7 +100,7 @@ namespace SHADE struct AnimControllerData { - + NodeIndex StartingNode = 0; std::list Nodes; std::unordered_map Params; LinkMap Links;