Added preliminary implementation of animation controller connection attributes
This commit is contained in:
parent
41784d4c04
commit
97605cc8fe
|
@ -21,7 +21,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
// Project Includes
|
||||
#include "Editor/IconsMaterialDesign.h"
|
||||
#include "Animation/SHAnimationController.h"
|
||||
#include "../../SHEditorUI.h"
|
||||
#include "Editor/SHEditorUI.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -50,10 +50,29 @@ namespace SHADE
|
|||
|
||||
ImNodes::BeginNodeEditor();
|
||||
{
|
||||
/* Pre Process Nodes */
|
||||
std::unordered_map<Handle<SHAnimationController::Node>, int> inputAttribCount;
|
||||
std::unordered_map<Handle<SHAnimationController::Node>, int> outputAttribCount;
|
||||
for (auto node : controller.GetNodes())
|
||||
{
|
||||
// Have at least one for each
|
||||
inputAttribCount[node] = 1;
|
||||
outputAttribCount[node] = 1;
|
||||
}
|
||||
for (auto node : controller.GetNodes())
|
||||
{
|
||||
for (auto transition : node->Transitions)
|
||||
{
|
||||
++inputAttribCount[transition.Target];
|
||||
}
|
||||
outputAttribCount[node] += node->Transitions.size();
|
||||
}
|
||||
|
||||
/* Draw Nodes */
|
||||
int id = 0;
|
||||
for (auto node : controller.GetNodes())
|
||||
{
|
||||
// Draw the node
|
||||
ImNodes::BeginNode(id);
|
||||
{
|
||||
// Title
|
||||
|
@ -72,6 +91,26 @@ namespace SHADE
|
|||
ImGui::PushItemWidth(80.0f);
|
||||
ImGui::InputText("", buffer.data(), buffer.size());
|
||||
ImGui::PopItemWidth();
|
||||
|
||||
// Input Nodes
|
||||
for (int i = 0; i < inputAttribCount[node]; ++i)
|
||||
{
|
||||
NodeAttributeIndex nidx;
|
||||
nidx.OwnerNodeIndex = id;
|
||||
nidx.AttributeIndex = i;
|
||||
ImNodes::BeginInputAttribute(nidx.Raw);
|
||||
ImNodes::EndInputAttribute();
|
||||
}
|
||||
|
||||
// Output Nodes
|
||||
for (int i = 0; i < outputAttribCount[node]; ++i)
|
||||
{
|
||||
NodeAttributeIndex nidx;
|
||||
nidx.OwnerNodeIndex = id;
|
||||
nidx.AttributeIndex = inputAttribCount[node] + i;
|
||||
ImNodes::BeginOutputAttribute(nidx.Raw);
|
||||
ImNodes::EndOutputAttribute();
|
||||
}
|
||||
}
|
||||
ImNodes::EndNode();
|
||||
++id;
|
||||
|
|
|
@ -60,7 +60,7 @@ namespace SHADE
|
|||
NodeAttributeIndex SourceAttribute;
|
||||
NodeAttributeIndex DestinationAttribute;
|
||||
};
|
||||
}; // What about same source and destination but different link?
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Data Members */
|
||||
|
|
Loading…
Reference in New Issue