From ed937730dfd7a64041aa72f4611a04e2fdc93893 Mon Sep 17 00:00:00 2001 From: Rodz Labs Date: Fri, 10 Nov 2023 15:21:57 +0100 Subject: [PATCH] Minor fixes and improvements --- material_maker/nodes/base.gd | 4 ++-- material_maker/nodes/generic/generic.gd | 2 +- material_maker/nodes/ios/ios.gd | 2 +- material_maker/nodes/remote/remote.gd | 2 +- material_maker/nodes/reroute/reroute.gd | 2 +- material_maker/panels/graph_edit/graph_edit.gd | 5 +++-- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/material_maker/nodes/base.gd b/material_maker/nodes/base.gd index 6dff1bc18..b2117b9a6 100644 --- a/material_maker/nodes/base.gd +++ b/material_maker/nodes/base.gd @@ -246,7 +246,7 @@ func _on_gui_input(event) -> void: elif doubleclicked: doubleclicked = false if generator is MMGenGraph: - get_parent().call_deferred("update_view", generator) + get_parent().update_view.call_deferred(generator) elif generator is MMGenSDF: edit_generator() elif event is InputEventMouseMotion: @@ -334,7 +334,7 @@ func _on_menu_id_pressed(id : int) -> void: add_child(dialog) var result = await dialog.ask() if result == "ok": - get_parent().call_deferred("propagate_node_changes", generator) + get_parent().propagate_node_changes.call_deferred(generator) MENU_SHARE_NODE: # Prepare warning dialog var status : Array = [] diff --git a/material_maker/nodes/generic/generic.gd b/material_maker/nodes/generic/generic.gd index b2885c682..ebae394ef 100644 --- a/material_maker/nodes/generic/generic.gd +++ b/material_maker/nodes/generic/generic.gd @@ -566,7 +566,7 @@ func do_load_generator(file_name : String) -> void: var parent_generator = generator.get_parent() parent_generator.replace_generator(generator, new_generator) generator = new_generator - call_deferred("update_node") + update_node.call_deferred() func save_generator() -> void: var dialog = preload("res://material_maker/windows/file_dialog/file_dialog.tscn").instantiate() diff --git a/material_maker/nodes/ios/ios.gd b/material_maker/nodes/ios/ios.gd index 4d1e6ccbb..77d256c93 100644 --- a/material_maker/nodes/ios/ios.gd +++ b/material_maker/nodes/ios/ios.gd @@ -10,7 +10,7 @@ func set_generator(g) -> void: func on_parameter_changed(p, _v) -> void: if p == "__update_all__": - call_deferred("update_node") + update_node.call_deferred() func update_up_down_buttons() -> void: for c in get_children(): diff --git a/material_maker/nodes/remote/remote.gd b/material_maker/nodes/remote/remote.gd index e4cd1ca04..30b3ca16c 100644 --- a/material_maker/nodes/remote/remote.gd +++ b/material_maker/nodes/remote/remote.gd @@ -73,7 +73,7 @@ func update_node() -> void: # Delete the contents and wait until it's done for c in grid.get_children(): grid.remove_child(c) - c.call_deferred("free") + c.free.call_deferred() title = generator.get_type_name() controls = {} var parameter_count : int = generator.get_parameter_defs().size() diff --git a/material_maker/nodes/reroute/reroute.gd b/material_maker/nodes/reroute/reroute.gd index e77bac1cf..5fcfa1ad7 100644 --- a/material_maker/nodes/reroute/reroute.gd +++ b/material_maker/nodes/reroute/reroute.gd @@ -8,7 +8,7 @@ func _ready() -> void: super._ready() close_button.visible = false set_theme_type("Reroute") - call_deferred("on_connections_changed") + on_connections_changed.call_deferred() func set_generator(g : MMGenBase) -> void: super.set_generator(g) diff --git a/material_maker/panels/graph_edit/graph_edit.gd b/material_maker/panels/graph_edit/graph_edit.gd index e51baa7d1..cebd0ab68 100644 --- a/material_maker/panels/graph_edit/graph_edit.gd +++ b/material_maker/panels/graph_edit/graph_edit.gd @@ -81,7 +81,8 @@ func do_zoom(factor : float): var old_zoom : float = zoom zoom *= factor var global_mouse_position = offset_from_global_position(get_global_transform() * get_local_mouse_position()) - call_deferred("set_scroll_ofs", scroll_offset+((zoom/old_zoom)-1.0)*old_zoom*global_mouse_position) + await get_tree().process_frame + scroll_offset += (zoom/old_zoom-1.0)*old_zoom*global_mouse_position var port_click_node : GraphNode var port_click_port_index : int = -1 @@ -100,7 +101,7 @@ func get_nodes_under_mouse() -> Array: func process_port_click(pressed : bool): for c in get_nodes_under_mouse(): var rect : Rect2 = c.get_global_rect() - var pos = get_global_mouse_position()-rect.position + var pos : Vector2 = get_global_mouse_position()-rect.position var transform_scale : Vector2 = Vector2(1, 1) # c.get_global_transform().get_scale() rect = Rect2(rect.position, rect.size*transform_scale) var output_count : int = c.get_output_port_count()