Implemented Animation Clip asset and animation controller #410

Merged
XiaoQiDigipen merged 66 commits from SP3-22-AnimationController into main 2023-03-09 16:19:40 +08:00
2 changed files with 20 additions and 2 deletions
Showing only changes of commit 6d01bd0b78 - Show all commits

View File

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

View File

@ -100,7 +100,7 @@ namespace SHADE
struct AnimControllerData
{
NodeIndex StartingNode = 0;
std::list<Node> Nodes;
std::unordered_map<std::string, SHAnimationController::AnimParam::Type> Params;
LinkMap Links;