From 55bc6e5a8b7c116668c7ea8e1c29b7e7db67dbb3 Mon Sep 17 00:00:00 2001 From: Variable <77773850+Variable-ind@users.noreply.github.com> Date: Mon, 15 May 2023 18:26:50 +0500 Subject: [PATCH] [Targeted for 0.11.0] Some more fixes to cel dimming in 3d cel (#856) * hacky way to fix 3d cel dimming * a fix --- src/Tools/3DShapeEdit.gd | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/Tools/3DShapeEdit.gd b/src/Tools/3DShapeEdit.gd index b5ec213d8..a4c67a6bc 100644 --- a/src/Tools/3DShapeEdit.gd +++ b/src/Tools/3DShapeEdit.gd @@ -6,6 +6,8 @@ var _hovering: Cel3DObject = null var _dragging := false var _has_been_dragged := false var _prev_mouse_pos := Vector2.ZERO +var _old_cel_image = null +var _checker_update_qued := false var _object_names := { Cel3DObject.Type.BOX: "Box", Cel3DObject.Type.SPHERE: "Sphere", @@ -71,6 +73,18 @@ onready var object_properties := { } +func sprite_changed_this_frame(): + _checker_update_qued = true + _old_cel_image = _cel.get_image() + + +func _input(_event: InputEvent) -> void: + if _checker_update_qued: + if _old_cel_image != _cel.get_image(): + _checker_update_qued = false + _cel.update_texture() + + func _ready() -> void: Global.connect("cel_changed", self, "_cel_changed") _cel_changed() @@ -153,7 +167,7 @@ func draw_move(position: Vector2) -> void: var proj_prev_mouse_pos := camera.project_position(_prev_mouse_pos, camera.translation.z) _cel.selected.change_transform(proj_mouse_pos, proj_prev_mouse_pos) _prev_mouse_pos = position - Global.canvas.sprite_changed_this_frame = true + sprite_changed_this_frame() func draw_end(_position: Vector2) -> void: @@ -164,7 +178,7 @@ func draw_end(_position: Vector2) -> void: _cel.selected.applying_gizmos = Cel3DObject.Gizmos.NONE _object_property_changed(_cel.selected) _has_been_dragged = false - Global.canvas.sprite_changed_this_frame = true + sprite_changed_this_frame() func cursor_move(position: Vector2) -> void: @@ -215,6 +229,7 @@ func _cel_changed() -> void: object_options.visible = false _set_cel_node_values() _fill_object_option_button() + sprite_changed_this_frame() # two yields are required yield(get_tree(), "idle_frame") @@ -243,6 +258,7 @@ func _add_object(type: int, file_path := "") -> void: undo_redo.add_do_method(Global, "undo_or_redo", false) undo_redo.add_undo_method(Global, "undo_or_redo", true) undo_redo.commit_action() + sprite_changed_this_frame() _cel.current_object_id += 1 @@ -260,6 +276,7 @@ func _on_RemoveObject_pressed() -> void: undo_redo.add_undo_method(Global, "undo_or_redo", true) undo_redo.commit_action() _cel.selected = null + sprite_changed_this_frame() func _object_property_changed(object: Cel3DObject) -> void: