Use node pointer to check whether we use graph input/output nodes instead of indices.
parent
2f646bc5ec
commit
84a9ef6f14
|
@ -161,9 +161,9 @@ void AnimGraphEditorUpdate() {
|
||||||
|
|
||||||
// Header
|
// Header
|
||||||
ImNodes::BeginNodeTitleBar();
|
ImNodes::BeginNodeTitleBar();
|
||||||
if (i == 0) {
|
if (&node_resource == &graph_resource.getGraphOutputNode()) {
|
||||||
ImGui::TextUnformatted("Graph Outputs");
|
ImGui::TextUnformatted("Graph Outputs");
|
||||||
} else if (i == 1) {
|
} else if (&node_resource == &graph_resource.getGraphInputNode()) {
|
||||||
ImGui::TextUnformatted("Graph Inputs");
|
ImGui::TextUnformatted("Graph Inputs");
|
||||||
} else {
|
} else {
|
||||||
ImGui::TextUnformatted(node_resource.m_type_name.c_str());
|
ImGui::TextUnformatted(node_resource.m_type_name.c_str());
|
||||||
|
|
|
@ -513,6 +513,19 @@ struct AnimGraphResource {
|
||||||
AnimNodeResource& getGraphOutputNode() { return m_nodes[0]; }
|
AnimNodeResource& getGraphOutputNode() { return m_nodes[0]; }
|
||||||
AnimNodeResource& getGraphInputNode() { return m_nodes[1]; }
|
AnimNodeResource& getGraphInputNode() { return m_nodes[1]; }
|
||||||
|
|
||||||
|
const AnimNodeResource& getGraphOutputNode() const { return m_nodes[0]; }
|
||||||
|
const AnimNodeResource& getGraphInputNode() const { return m_nodes[1]; }
|
||||||
|
|
||||||
|
size_t getNodeIndex (const AnimNodeResource& node_resource) const {
|
||||||
|
for (size_t i = 0, n = m_nodes.size(); i < n; i++) {
|
||||||
|
if (&m_nodes[i] == &node_resource) {
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
size_t addNode(AnimNodeResource node_resource) {
|
size_t addNode(AnimNodeResource node_resource) {
|
||||||
m_nodes.push_back(node_resource);
|
m_nodes.push_back(node_resource);
|
||||||
return m_nodes.size() - 1;
|
return m_nodes.size() - 1;
|
||||||
|
|
Loading…
Reference in New Issue