mirror of
https://github.com/Relintai/material-maker.git
synced 2024-12-23 21:16:54 +01:00
Updated the graph tree to handle the editable attribute correctly
This commit is contained in:
parent
4fc7c11a29
commit
aaa2adc046
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user