mirror of
https://github.com/Relintai/pandemonium_engine.git
synced 2024-12-23 20:36:53 +01:00
Mark Script button if it's tool in Scene Tree Editor
Also adds a note on the tooltip if the Script is tool. The color is the same one used on the Script Editor's script list. (cherry picked from commit ad5ff9f78fe0bab4572085803f224026273fd4aa)
This commit is contained in:
parent
c954a6c9d7
commit
4487e18750
@ -368,10 +368,18 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll
|
|||||||
|
|
||||||
Ref<Script> script = p_node->get_script();
|
Ref<Script> script = p_node->get_script();
|
||||||
if (!script.is_null()) {
|
if (!script.is_null()) {
|
||||||
item->add_button(0, get_theme_icon("Script", "EditorIcons"), BUTTON_SCRIPT, false, TTR("Open Script:") + " " + script->get_path());
|
String additional_notes;
|
||||||
|
// 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.");
|
||||||
|
}
|
||||||
|
item->add_button(0, get_icon("Script", "EditorIcons"), BUTTON_SCRIPT, false, TTR("Open Script:") + " " + script->get_path() + additional_notes);
|
||||||
if (EditorNode::get_singleton()->get_object_custom_type_base(p_node) == script) {
|
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));
|
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_color("accent_color", "Editor"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p_node->is_class("CanvasItem")) {
|
if (p_node->is_class("CanvasItem")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user