diff --git a/material_maker/graph_edit.gd b/material_maker/graph_edit.gd index 728e5dd..6a2fa27 100644 --- a/material_maker/graph_edit.gd +++ b/material_maker/graph_edit.gd @@ -51,7 +51,9 @@ func add_node(node) -> void: node.connect("close_request", self, "remove_node", [ node ]) func connect_node(from, from_slot, to, to_slot): - if generator.connect_children(get_node(from).generator, from_slot, get_node(to).generator, to_slot): + var from_node : MMGraphNodeBase = get_node(from) + var to_node : MMGraphNodeBase = get_node(to) + if generator.connect_children(from_node.generator, from_slot, to_node.generator, to_slot): var disconnect = get_source(to, to_slot) if !disconnect.empty(): .disconnect_node(disconnect.node, disconnect.slot, to, to_slot) diff --git a/material_maker/widgets/graph_tree/graph_tree.gd b/material_maker/widgets/graph_tree/graph_tree.gd index a74d8ca..f7d57dc 100644 --- a/material_maker/widgets/graph_tree/graph_tree.gd +++ b/material_maker/widgets/graph_tree/graph_tree.gd @@ -3,9 +3,11 @@ extends Popup signal item_double_clicked(generator) +onready var tree = $Tree + func init(graph_name : String, generator : MMGenGraph) -> void: - $Tree.clear() - var root : TreeItem = $Tree.create_item(null) + 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) @@ -14,7 +16,7 @@ func init(graph_name : String, generator : MMGenGraph) -> void: func fill_item(parent : TreeItem, generator : MMGenGraph) -> void: for c in generator.get_children(): if c is MMGenGraph: - var item : TreeItem = $Tree.create_item(parent) + 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)) @@ -22,5 +24,5 @@ func fill_item(parent : TreeItem, generator : MMGenGraph) -> void: fill_item(item, c) func _on_Tree_item_double_clicked() -> void: - emit_signal("item_double_clicked", $Tree.get_selected().get_metadata(0)) + emit_signal("item_double_clicked", tree.get_selected().get_metadata(0)) queue_free() diff --git a/start.gd b/start.gd index 80df764..94e3f05 100644 --- a/start.gd +++ b/start.gd @@ -2,6 +2,8 @@ extends Control var loader +onready var progress_bar = $VBoxContainer/ProgressBar + func _ready(): var path : String if Directory.new().file_exists("res://material_maker/main_window.tscn"): @@ -13,7 +15,7 @@ func _ready(): print("error") queue_free() -func _process(delta): +func _process(_delta): var err = loader.poll() if err == ERR_FILE_EOF: var resource = loader.get_resource() @@ -21,7 +23,7 @@ func _process(delta): queue_free() elif err == OK: var progress = float(loader.get_stage()) / loader.get_stage_count() - $VBoxContainer/ProgressBar.value = 100.0*progress + progress_bar.value = 100.0*progress else: # error during loading print("error") queue_free()