diff --git a/material_maker/graph_edit.gd b/material_maker/graph_edit.gd index e1a78f1..728e5dd 100644 --- a/material_maker/graph_edit.gd +++ b/material_maker/graph_edit.gd @@ -190,11 +190,11 @@ func get_free_name(type) -> String: return "" func create_nodes(data, position : Vector2 = Vector2(0, 0)) -> Array: - if data == null: + if !data is Dictionary: return [] if data.has("type"): data = { nodes=[data], connections=[] } - if typeof(data.nodes) == TYPE_ARRAY and typeof(data.connections) == TYPE_ARRAY: + if data.has("nodes") and typeof(data.nodes) == TYPE_ARRAY and data.has("connections") and typeof(data.connections) == TYPE_ARRAY: var new_stuff = mm_loader.add_to_gen_graph(generator, data.nodes, data.connections) for g in new_stuff.generators: g.position += position diff --git a/material_maker/graph_edit.tscn b/material_maker/graph_edit.tscn index eaf6359..db7c975 100644 --- a/material_maker/graph_edit.tscn +++ b/material_maker/graph_edit.tscn @@ -80,10 +80,12 @@ hint_tooltip = "Show hierarchy" icon = SubResource( 4 ) [connection signal="connection_request" from="." to="." method="connect_node"] [connection signal="connection_to_empty" from="." to="." method="request_popup"] +[connection signal="copy_nodes_request" from="." to="." method="copy"] [connection signal="disconnection_request" from="." to="." method="disconnect_node"] [connection signal="duplicate_nodes_request" from="." to="." method="duplicate_selected"] [connection signal="gui_input" from="." to="." method="_on_GraphEdit_gui_input"] [connection signal="node_selected" from="." to="." method="_on_GraphEdit_node_selected"] +[connection signal="paste_nodes_request" from="." to="." method="paste"] [connection signal="timeout" from="Timer" to="." method="do_send_changed_signal"] [connection signal="text_changed" from="GraphUI/SubGraphUI/Label" to="." method="_on_Label_text_changed"] [connection signal="toggled" from="GraphUI/SubGraphUI/ButtonTransmitsSeed" to="." method="_on_ButtonTransmitsSeed_toggled"]