Skip to content

Commit

Permalink
distinguish functions by colour
Browse files Browse the repository at this point in the history
  • Loading branch information
tadgem committed Mar 3, 2024
1 parent 23ef85f commit b168359
Showing 2 changed files with 14 additions and 7 deletions.
4 changes: 2 additions & 2 deletions sandbox/sample/imgui.ini
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ Collapsed=0

[Window][Root Menu]
Pos=1007,8
Size=441,577
Size=441,900
Collapsed=0

[Window][SampleA]
@@ -49,7 +49,7 @@ DockId=0x00000003,0

[Window][New]
Pos=8,8
Size=997,577
Size=997,900
Collapsed=0

[Window][New [Inspector]]
17 changes: 12 additions & 5 deletions sandbox/src/GraphScriptEditor.cpp
Original file line number Diff line number Diff line change
@@ -50,10 +50,6 @@ void gs::GraphScriptEditor::OnImGui()
// TODO
String data = Serialize();
utils::SaveStringAtPath(data, p_ProjectPath);
// GraphBuilder paths
// Instances
// Arg Sets
// Instance - Arg set mapping
}

ImGui::Separator();
@@ -325,6 +321,14 @@ void gs::GraphScriptEditor::HandleNodes(GraphBuilder* builder, int& idCounter, H
{
Node* node = builder->m_Nodes[j];
int nodeId = idCounter;

bool popColour = false;

if (builder->m_Functions.find(node->m_NodeName) != builder->m_Functions.end())
{
ImNodes::PushColorStyle(ImNodesCol_TitleBar, IM_COL32(230, 100, 120, 255));
popColour = true;
}
ImNodes::BeginNode(nodeId);

if (ImNodes::IsNodeSelected(nodeId))
@@ -404,7 +408,10 @@ void gs::GraphScriptEditor::HandleNodes(GraphBuilder* builder, int& idCounter, H
ImNodes::PopColorStyle();
}
ImNodes::EndNode();

if (popColour)
{
ImNodes::PopColorStyle();
}
ImVec2 nodePos = ImNodes::GetNodeGridSpacePos(nodeId);
p_NodePositions[builder][nodeId] = vec2{ nodePos.x, nodePos.y };
}

0 comments on commit b168359

Please sign in to comment.