Don't connect to the MMnode's changed event in mm_graph_node as it's not needed. Also set ignore changes when a texture is changed.

This commit is contained in:
Relintai 2022-01-21 18:59:55 +01:00
parent edd698504b
commit 2ada5fa3b1

View File

@ -542,7 +542,7 @@ func set_node(material : MMMateial, node : MMNode) -> void:
offset = _node.get_graph_position() offset = _node.get_graph_position()
_node.connect("changed", self, "on_node_changed") #_node.connect("changed", self, "on_node_changed")
func propagate_node_change() -> void: func propagate_node_change() -> void:
pass pass
@ -551,18 +551,17 @@ func on_offset_changed():
if _node: if _node:
_node.set_graph_position(offset) _node.set_graph_position(offset)
func on_node_changed(): #func on_node_changed():
#get all properties again # if _ignore_change_event:
#_node.recalculate_image(_material) # return
#
if _ignore_change_event: # _ignore_change_event = true
return # propagate_node_change()
# _ignore_change_event = false
propagate_node_change()
func on_int_spinbox_value_changed(val : float, slot_idx) -> void: func on_int_spinbox_value_changed(val : float, slot_idx) -> void:
#_node.call(properties[slot_idx][4], int(val)) #_node.call(properties[slot_idx][4], int(val))
ignore_changes(true) ignore_changes(true)
_undo_redo.create_action("MMGD: value changed") _undo_redo.create_action("MMGD: value changed")
_undo_redo.add_do_method(_node, properties[slot_idx][4], int(val)) _undo_redo.add_do_method(_node, properties[slot_idx][4], int(val))
@ -647,6 +646,8 @@ func on_slot_enum_item_selected(val : int, slot_idx : int) -> void:
ignore_changes(false) ignore_changes(false)
func on_universal_texture_changed(slot_idx : int) -> void: func on_universal_texture_changed(slot_idx : int) -> void:
ignore_changes(true)
var img : Image = properties[slot_idx][6].get_active_image() var img : Image = properties[slot_idx][6].get_active_image()
var tex : ImageTexture = properties[slot_idx][5].texture var tex : ImageTexture = properties[slot_idx][5].texture
@ -655,8 +656,12 @@ func on_universal_texture_changed(slot_idx : int) -> void:
properties[slot_idx][5].texture.create_from_image(img, 0) properties[slot_idx][5].texture.create_from_image(img, 0)
else: else:
properties[slot_idx][5].texture = ImageTexture.new() properties[slot_idx][5].texture = ImageTexture.new()
ignore_changes(false)
func on_universal_texture_changed_image_picker(slot_idx : int) -> void: func on_universal_texture_changed_image_picker(slot_idx : int) -> void:
ignore_changes(true)
var img : Image = properties[slot_idx][6].get_active_image() var img : Image = properties[slot_idx][6].get_active_image()
var tex : ImageTexture = properties[slot_idx][5].texture_normal var tex : ImageTexture = properties[slot_idx][5].texture_normal
@ -665,6 +670,8 @@ func on_universal_texture_changed_image_picker(slot_idx : int) -> void:
properties[slot_idx][5].texture_normal.create_from_image(img, 0) properties[slot_idx][5].texture_normal.create_from_image(img, 0)
else: else:
properties[slot_idx][5].texture_normal = ImageTexture.new() properties[slot_idx][5].texture_normal = ImageTexture.new()
ignore_changes(false)
func on_slot_line_edit_text_entered(text : String, slot_idx : int) -> void: func on_slot_line_edit_text_entered(text : String, slot_idx : int) -> void:
#_node.call(properties[slot_idx][4], text) #_node.call(properties[slot_idx][4], text)