From aaa2adc046910f0580170156867eaeab856312c2 Mon Sep 17 00:00:00 2001 From: RodZill4 Date: Tue, 22 Oct 2019 08:28:24 +0200 Subject: [PATCH] Updated the graph tree to handle the editable attribute correctly --- addons/material_maker/graph_edit.gd | 7 ++++++- addons/material_maker/widgets/graph_tree/graph_tree.gd | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/addons/material_maker/graph_edit.gd b/addons/material_maker/graph_edit.gd index d694a7c..a8d5360 100644 --- a/addons/material_maker/graph_edit.gd +++ b/addons/material_maker/graph_edit.gd @@ -303,5 +303,10 @@ func _on_ButtonShowTree_pressed() -> void: var graph_tree : Popup = preload("res://addons/material_maker/widgets/graph_tree/graph_tree.tscn").instance() graph_tree.init("Top", top_generator) add_child(graph_tree) - graph_tree.connect("item_double_clicked", self, "update_view") + graph_tree.connect("item_double_clicked", self, "edit_subgraph") graph_tree.popup_centered() + +func edit_subgraph(g : MMGenGraph) -> void: + if !g.is_editable(): + g.toggle_editable() + update_view(g) diff --git a/addons/material_maker/widgets/graph_tree/graph_tree.gd b/addons/material_maker/widgets/graph_tree/graph_tree.gd index 714e7c9..a74d8ca 100644 --- a/addons/material_maker/widgets/graph_tree/graph_tree.gd +++ b/addons/material_maker/widgets/graph_tree/graph_tree.gd @@ -7,6 +7,7 @@ func init(graph_name : String, generator : MMGenGraph) -> void: $Tree.clear() var root : TreeItem = $Tree.create_item(null) root.set_text(0, graph_name) + root.set_custom_color(0, Color(1, 1, 1)) root.set_metadata(0, generator) fill_item(root, generator) @@ -15,6 +16,8 @@ func fill_item(parent : TreeItem, generator : MMGenGraph) -> void: if c is MMGenGraph: var item : TreeItem = $Tree.create_item(parent) item.set_text(0, c.get_type_name()) + if c.is_editable(): + item.set_custom_color(0, Color(1, 1, 1)) item.set_metadata(0, c) fill_item(item, c)