1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-31 07:29:49 +00:00

[Targeted for 0.11.0] Some more fixes to cel dimming in 3d cel (#856)

* hacky way to fix 3d cel dimming

* a fix
This commit is contained in:
Variable 2023-05-15 18:26:50 +05:00 committed by GitHub
parent 29b03b0332
commit 55bc6e5a8b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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: