UndoRedo vol 10 - Add/Remove/Clone/Move Frames now have UndoRedo

- UndoRedo for Add/Remove/Clone/Move Frames
- Set functions for frame changes (both on canvases and Global.current_frame)
- Removed unneeded signal methods and put multiple signals on one method instead (for example, add and clone layer button signals both connect to add_layer())
- Fixed bug where, if you opened a .pxo file with multiple frames, the remove frame button would be disabled.
- Probably other small things that I'm forgetting to mention
This commit is contained in:
OverloadedOrama 2019-11-10 03:25:25 +02:00
parent ec7b2129ff
commit e825cc03e5
5 changed files with 263 additions and 228 deletions

View file

@ -6,7 +6,7 @@ var current_layer_index := 0
var trans_background : ImageTexture
var location := Vector2.ZERO
var size := Vector2(64, 64)
var frame := 0
var frame := 0 setget frame_changed
var frame_button : VBoxContainer
var frame_texture_rect : TextureRect
@ -86,7 +86,7 @@ func _process(delta) -> void:
current_mouse_button = "right_mouse"
current_action = Global.current_right_tool
if visible:
if Global.current_frame == frame:
if !mouse_in_canvas:
if !Input.is_mouse_button_pressed(BUTTON_LEFT) && !Input.is_mouse_button_pressed(BUTTON_RIGHT):
if mouse_inside_canvas:
@ -301,6 +301,12 @@ func update_texture(layer_index : int) -> void:
whole_image_texture.create_from_image(whole_image, 0)
frame_texture_rect.texture = whole_image_texture
func frame_changed(value : int) -> void:
frame = value
if frame_button:
frame_button.get_node("FrameButton").frame = frame
frame_button.get_node("FrameID").text = str(frame + 1)
func get_layer_container(layer_index : int) -> LayerContainer:
for container in Global.vbox_layer_container.get_children():
if container is LayerContainer && container.i == layer_index: