Skip to content

Commit dbf2f96

Browse files
committed
added different color for node special name on header
1 parent bf5d2a3 commit dbf2f96

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

src/core/imgui_node_canvas.cpp

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -415,12 +415,29 @@ bool ImGuiEx::NodeCanvas::BeginNode( int nId, const char* _id, std::string name,
415415

416416
// Header info
417417
ImGui::SetCursorScreenPos( curNodeData.outerContentBox.Min+ImVec2(5, ((IMGUI_EX_NODE_HEADER_HEIGHT*scaleFactor)-ImGui::CalcTextSize("").y)*.5f) );//canvasView.translation+pos+ImVec2(5,4));
418-
if(nId == activeNode){
419-
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255,255,255,255));
418+
419+
if (name.find('|') != std::string::npos ){
420+
if(nId == activeNode){
421+
std::string nodeName = name.substr(0, name.find('|')+1);
422+
std::string specialName = name.substr(name.find('|')+2);
423+
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255,255,255,255));
424+
ImGui::Text("%s", nodeName.c_str()); // node name
425+
ImGui::SameLine();
426+
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(200,220,240,255));
427+
ImGui::Text("%s", specialName.c_str()); // special name
428+
}else{
429+
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0,0,0,255));
430+
ImGui::Text("%s", name.c_str()); // title
431+
}
420432
}else{
421-
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0,0,0,255));
433+
if(nId == activeNode){
434+
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255,255,255,255));
435+
}else{
436+
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0,0,0,255));
437+
}
438+
ImGui::Text("%s", name.c_str()); // title
422439
}
423-
ImGui::Text("%s", name.c_str()); // title
440+
424441
ImGui::PopStyleColor();
425442

426443
// Enable drag on title

0 commit comments

Comments
 (0)