diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-06 12:34:22 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-09-06 12:34:22 +0200 |
commit | 042278cb696f40091b3251184a526eceb6ae5974 (patch) | |
tree | f5f6f7039848c5574d8a484aa08bc56a125ff467 /editor/scene_tree_editor.cpp | |
parent | 73026fbde94713ed742364e2b7f9a587023ef317 (diff) | |
parent | 65cc721eb94ee67315bacc9caadb0d36ff221b13 (diff) |
Merge pull request #65413 from Mickeon/fix-scene-tree-script-grayed-icon
Fix tool script button color overriding custom type color
Diffstat (limited to 'editor/scene_tree_editor.cpp')
-rw-r--r-- | editor/scene_tree_editor.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index c120468ecb..50bb6496e1 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -387,17 +387,18 @@ void SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent) { Ref<Script> script = p_node->get_script(); if (!script.is_null()) { String additional_notes; + Color button_color = Color(1, 1, 1); // Can't set tooltip after adding button, need to do it before. if (script->is_tool()) { additional_notes += "\n" + TTR("This script is currently running in the editor."); + button_color = get_theme_color(SNAME("accent_color"), SNAME("Editor")); } - item->add_button(0, get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), BUTTON_SCRIPT, false, TTR("Open Script:") + " " + script->get_path() + additional_notes); if (EditorNode::get_singleton()->get_object_custom_type_base(p_node) == script) { - item->set_button_color(0, item->get_button_count(0) - 1, Color(1, 1, 1, 0.5)); - } - if (script->is_tool()) { - item->set_button_color(0, item->get_button_count(0) - 1, get_theme_color(SNAME("accent_color"), SNAME("Editor"))); + additional_notes += "\n" + TTR("This script is a custom type."); + button_color.a = 0.5; } + item->add_button(0, get_theme_icon(SNAME("Script"), SNAME("EditorIcons")), BUTTON_SCRIPT, false, TTR("Open Script:") + " " + script->get_path() + additional_notes); + item->set_button_color(0, item->get_button_count(0) - 1, button_color); } if (p_node->is_class("CanvasItem")) { |