mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-26 16:54:43 -04:00
Created a Projects class
A Project class contains project-specific data like name, undo_redo, frames, layers, tags and brushes. These variables have been moved from Global. This is the first step towards multiple tab support, where each tab will be a different Project.
This commit is contained in:
parent
9d38cbd13e
commit
4e111a7ac0
21 changed files with 656 additions and 627 deletions
|
@ -4,13 +4,14 @@ var fps := 6.0
|
|||
var animation_loop := 1 # 0 is no loop, 1 is cycle loop, 2 is ping-pong loop
|
||||
var animation_forward := true
|
||||
var first_frame := 0
|
||||
var last_frame : int = Global.frames.size() - 1
|
||||
var last_frame := 0
|
||||
|
||||
var timeline_scroll : ScrollContainer
|
||||
var tag_scroll_container : ScrollContainer
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
last_frame = Global.current_project.frames.size() - 1
|
||||
timeline_scroll = Global.find_node_by_name(self, "TimelineScroll")
|
||||
tag_scroll_container = Global.find_node_by_name(self, "TagScroll")
|
||||
timeline_scroll.get_h_scrollbar().connect("value_changed", self, "_h_scroll_changed")
|
||||
|
@ -25,9 +26,9 @@ func _h_scroll_changed(value : float) -> void:
|
|||
|
||||
func add_frame() -> void:
|
||||
var frame : Frame = Global.canvas.new_empty_frame()
|
||||
var new_frames : Array = Global.frames.duplicate()
|
||||
var new_frames : Array = Global.current_project.frames.duplicate()
|
||||
new_frames.append(frame)
|
||||
var new_layers : Array = Global.layers.duplicate()
|
||||
var new_layers : Array = Global.current_project.layers.duplicate()
|
||||
# Loop through the array to create new classes for each element, so that they
|
||||
# won't be the same as the original array's classes. Needed for undo/redo to work properly.
|
||||
for i in new_layers.size():
|
||||
|
@ -40,37 +41,37 @@ func add_frame() -> void:
|
|||
frame.cels[l_i].image = new_layers[l_i].linked_cels[0].cels[l_i].image
|
||||
frame.cels[l_i].image_texture = new_layers[l_i].linked_cels[0].cels[l_i].image_texture
|
||||
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Add Frame")
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undos += 1
|
||||
Global.current_project.undo_redo.create_action("Add Frame")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
|
||||
Global.undo_redo.add_do_property(Global, "frames", new_frames)
|
||||
Global.undo_redo.add_do_property(Global, "current_frame", new_frames.size() - 1)
|
||||
Global.undo_redo.add_do_property(Global, "layers", new_layers)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "frames", new_frames)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_frame", new_frames.size() - 1)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "layers", new_layers)
|
||||
|
||||
Global.undo_redo.add_undo_property(Global, "frames", Global.frames)
|
||||
Global.undo_redo.add_undo_property(Global, "current_frame", Global.current_frame)
|
||||
Global.undo_redo.add_undo_property(Global, "layers", Global.layers)
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "frames", Global.current_project.frames)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "current_frame", Global.current_project.current_frame)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "layers", Global.current_project.layers)
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
||||
|
||||
func _on_DeleteFrame_pressed(frame := -1) -> void:
|
||||
if Global.frames.size() == 1:
|
||||
if Global.current_project.frames.size() == 1:
|
||||
return
|
||||
if frame == -1:
|
||||
frame = Global.current_frame
|
||||
frame = Global.current_project.current_frame
|
||||
|
||||
var frame_to_delete : Frame = Global.frames[frame]
|
||||
var new_frames : Array = Global.frames.duplicate()
|
||||
var frame_to_delete : Frame = Global.current_project.frames[frame]
|
||||
var new_frames : Array = Global.current_project.frames.duplicate()
|
||||
new_frames.erase(frame_to_delete)
|
||||
var current_frame := Global.current_frame
|
||||
var current_frame := Global.current_project.current_frame
|
||||
if current_frame > 0 && current_frame == new_frames.size(): # If it's the last frame
|
||||
current_frame -= 1
|
||||
|
||||
var new_animation_tags := Global.animation_tags.duplicate()
|
||||
var new_animation_tags := Global.current_project.animation_tags.duplicate()
|
||||
# Loop through the tags to create new classes for them, so that they won't be the same
|
||||
# as Global.animation_tags's classes. Needed for undo/redo to work properly.
|
||||
# as Global.current_project.animation_tags's classes. Needed for undo/redo to work properly.
|
||||
for i in new_animation_tags.size():
|
||||
new_animation_tags[i] = AnimationTag.new(new_animation_tags[i].name, new_animation_tags[i].color, new_animation_tags[i].from, new_animation_tags[i].to)
|
||||
|
||||
|
@ -88,7 +89,7 @@ func _on_DeleteFrame_pressed(frame := -1) -> void:
|
|||
# Check if one of the cels of the frame is linked
|
||||
# if they are, unlink them too
|
||||
# this prevents removed cels being kept in linked memory
|
||||
var new_layers : Array = Global.layers.duplicate()
|
||||
var new_layers : Array = Global.current_project.layers.duplicate()
|
||||
# Loop through the array to create new classes for each element, so that they
|
||||
# won't be the same as the original array's classes. Needed for undo/redo to work properly.
|
||||
for i in new_layers.size():
|
||||
|
@ -97,45 +98,45 @@ func _on_DeleteFrame_pressed(frame := -1) -> void:
|
|||
|
||||
for layer in new_layers:
|
||||
for linked in layer.linked_cels:
|
||||
if linked == Global.frames[frame]:
|
||||
if linked == Global.current_project.frames[frame]:
|
||||
layer.linked_cels.erase(linked)
|
||||
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Remove Frame")
|
||||
Global.current_project.undos += 1
|
||||
Global.current_project.undo_redo.create_action("Remove Frame")
|
||||
|
||||
Global.undo_redo.add_do_property(Global, "frames", new_frames)
|
||||
Global.undo_redo.add_do_property(Global, "current_frame", current_frame)
|
||||
Global.undo_redo.add_do_property(Global, "animation_tags", new_animation_tags)
|
||||
Global.undo_redo.add_do_property(Global, "layers", new_layers)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "frames", new_frames)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_frame", current_frame)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "animation_tags", new_animation_tags)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "layers", new_layers)
|
||||
|
||||
Global.undo_redo.add_undo_property(Global, "frames", Global.frames)
|
||||
Global.undo_redo.add_undo_property(Global, "current_frame", Global.current_frame)
|
||||
Global.undo_redo.add_undo_property(Global, "animation_tags", Global.animation_tags)
|
||||
Global.undo_redo.add_undo_property(Global, "layers", Global.layers)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "frames", Global.current_project.frames)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "current_frame", Global.current_project.current_frame)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "animation_tags", Global.current_project.animation_tags)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "layers", Global.current_project.layers)
|
||||
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
||||
|
||||
func _on_CopyFrame_pressed(frame := -1) -> void:
|
||||
if frame == -1:
|
||||
frame = Global.current_frame
|
||||
frame = Global.current_project.current_frame
|
||||
|
||||
var new_frame := Frame.new()
|
||||
|
||||
var new_frames := Global.frames.duplicate()
|
||||
var new_frames := Global.current_project.frames.duplicate()
|
||||
new_frames.insert(frame + 1, new_frame)
|
||||
|
||||
for cel in Global.frames[frame].cels: # Copy every cel
|
||||
for cel in Global.current_project.frames[frame].cels: # Copy every cel
|
||||
var sprite := Image.new()
|
||||
sprite.copy_from(cel.image)
|
||||
sprite.lock()
|
||||
new_frame.cels.append(Cel.new(sprite, cel.opacity))
|
||||
|
||||
var new_animation_tags := Global.animation_tags.duplicate()
|
||||
var new_animation_tags := Global.current_project.animation_tags.duplicate()
|
||||
# Loop through the tags to create new classes for them, so that they won't be the same
|
||||
# as Global.animation_tags's classes. Needed for undo/redo to work properly.
|
||||
# as Global.current_project.animation_tags's classes. Needed for undo/redo to work properly.
|
||||
for i in new_animation_tags.size():
|
||||
new_animation_tags[i] = AnimationTag.new(new_animation_tags[i].name, new_animation_tags[i].color, new_animation_tags[i].from, new_animation_tags[i].to)
|
||||
|
||||
|
@ -144,23 +145,23 @@ func _on_CopyFrame_pressed(frame := -1) -> void:
|
|||
if frame + 1 >= tag.from && frame + 1 <= tag.to:
|
||||
tag.to += 1
|
||||
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Add Frame")
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undos += 1
|
||||
Global.current_project.undo_redo.create_action("Add Frame")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
|
||||
Global.undo_redo.add_do_property(Global, "frames", new_frames)
|
||||
Global.undo_redo.add_do_property(Global, "current_frame", frame + 1)
|
||||
Global.undo_redo.add_do_property(Global, "animation_tags", new_animation_tags)
|
||||
for i in range(Global.layers.size()):
|
||||
for child in Global.layers[i].frame_container.get_children():
|
||||
Global.undo_redo.add_do_property(child, "pressed", false)
|
||||
Global.undo_redo.add_undo_property(child, "pressed", child.pressed)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "frames", new_frames)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_frame", frame + 1)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "animation_tags", new_animation_tags)
|
||||
for i in range(Global.current_project.layers.size()):
|
||||
for child in Global.current_project.layers[i].frame_container.get_children():
|
||||
Global.current_project.undo_redo.add_do_property(child, "pressed", false)
|
||||
Global.current_project.undo_redo.add_undo_property(child, "pressed", child.pressed)
|
||||
|
||||
Global.undo_redo.add_undo_property(Global, "frames", Global.frames)
|
||||
Global.undo_redo.add_undo_property(Global, "current_frame", frame)
|
||||
Global.undo_redo.add_undo_property(Global, "animation_tags", Global.animation_tags)
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "frames", Global.current_project.frames)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "current_frame", frame)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "animation_tags", Global.current_project.animation_tags)
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
||||
|
||||
func _on_FrameTagButton_pressed() -> void:
|
||||
|
@ -222,8 +223,8 @@ func _on_AnimationTimer_timeout() -> void:
|
|||
return
|
||||
|
||||
if animation_forward:
|
||||
if Global.current_frame < last_frame:
|
||||
Global.current_frame += 1
|
||||
if Global.current_project.current_frame < last_frame:
|
||||
Global.current_project.current_frame += 1
|
||||
else:
|
||||
match animation_loop:
|
||||
0: # No loop
|
||||
|
@ -231,14 +232,14 @@ func _on_AnimationTimer_timeout() -> void:
|
|||
Global.play_backwards.pressed = false
|
||||
Global.animation_timer.stop()
|
||||
1: # Cycle loop
|
||||
Global.current_frame = first_frame
|
||||
Global.current_project.current_frame = first_frame
|
||||
2: # Ping pong loop
|
||||
animation_forward = false
|
||||
_on_AnimationTimer_timeout()
|
||||
|
||||
else:
|
||||
if Global.current_frame > first_frame:
|
||||
Global.current_frame -= 1
|
||||
if Global.current_project.current_frame > first_frame:
|
||||
Global.current_project.current_frame -= 1
|
||||
else:
|
||||
match animation_loop:
|
||||
0: # No loop
|
||||
|
@ -246,7 +247,7 @@ func _on_AnimationTimer_timeout() -> void:
|
|||
Global.play_forward.pressed = false
|
||||
Global.animation_timer.stop()
|
||||
1: # Cycle loop
|
||||
Global.current_frame = last_frame
|
||||
Global.current_project.current_frame = last_frame
|
||||
2: # Ping pong loop
|
||||
animation_forward = true
|
||||
_on_AnimationTimer_timeout()
|
||||
|
@ -254,12 +255,12 @@ func _on_AnimationTimer_timeout() -> void:
|
|||
|
||||
func play_animation(play : bool, forward_dir : bool) -> void:
|
||||
first_frame = 0
|
||||
last_frame = Global.frames.size() - 1
|
||||
last_frame = Global.current_project.frames.size() - 1
|
||||
if Global.play_only_tags:
|
||||
for tag in Global.animation_tags:
|
||||
if Global.current_frame + 1 >= tag.from && Global.current_frame + 1 <= tag.to:
|
||||
for tag in Global.current_project.animation_tags:
|
||||
if Global.current_project.current_frame + 1 >= tag.from && Global.current_project.current_frame + 1 <= tag.to:
|
||||
first_frame = tag.from - 1
|
||||
last_frame = min(Global.frames.size() - 1, tag.to - 1)
|
||||
last_frame = min(Global.current_project.frames.size() - 1, tag.to - 1)
|
||||
|
||||
if first_frame == last_frame:
|
||||
if forward_dir:
|
||||
|
@ -288,21 +289,21 @@ func play_animation(play : bool, forward_dir : bool) -> void:
|
|||
|
||||
|
||||
func _on_NextFrame_pressed() -> void:
|
||||
if Global.current_frame < Global.frames.size() - 1:
|
||||
Global.current_frame += 1
|
||||
if Global.current_project.current_frame < Global.current_project.frames.size() - 1:
|
||||
Global.current_project.current_frame += 1
|
||||
|
||||
|
||||
func _on_PreviousFrame_pressed() -> void:
|
||||
if Global.current_frame > 0:
|
||||
Global.current_frame -= 1
|
||||
if Global.current_project.current_frame > 0:
|
||||
Global.current_project.current_frame -= 1
|
||||
|
||||
|
||||
func _on_LastFrame_pressed() -> void:
|
||||
Global.current_frame = Global.frames.size() - 1
|
||||
Global.current_project.current_frame = Global.current_project.frames.size() - 1
|
||||
|
||||
|
||||
func _on_FirstFrame_pressed() -> void:
|
||||
Global.current_frame = 0
|
||||
Global.current_project.current_frame = 0
|
||||
|
||||
|
||||
func _on_FPSValue_value_changed(value : float) -> void:
|
||||
|
@ -328,142 +329,142 @@ func _on_BlueRedMode_toggled(button_pressed : bool) -> void:
|
|||
# Layer buttons
|
||||
|
||||
func add_layer(is_new := true) -> void:
|
||||
var new_layers : Array = Global.layers.duplicate()
|
||||
var new_layers : Array = Global.current_project.layers.duplicate()
|
||||
var l := Layer.new()
|
||||
if !is_new: # Clone layer
|
||||
l.name = Global.layers[Global.current_layer].name + " (" + tr("copy") + ")"
|
||||
l.name = Global.current_project.layers[Global.current_project.current_layer].name + " (" + tr("copy") + ")"
|
||||
new_layers.append(l)
|
||||
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Add Layer")
|
||||
Global.current_project.undos += 1
|
||||
Global.current_project.undo_redo.create_action("Add Layer")
|
||||
|
||||
for f in Global.frames:
|
||||
for f in Global.current_project.frames:
|
||||
var new_layer := Image.new()
|
||||
if is_new:
|
||||
new_layer.create(Global.canvas.size.x, Global.canvas.size.y, false, Image.FORMAT_RGBA8)
|
||||
else: # Clone layer
|
||||
new_layer.copy_from(f.cels[Global.current_layer].image)
|
||||
new_layer.copy_from(f.cels[Global.current_project.current_layer].image)
|
||||
|
||||
new_layer.lock()
|
||||
|
||||
var new_cels : Array = f.cels.duplicate()
|
||||
new_cels.append(Cel.new(new_layer, 1))
|
||||
Global.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
Global.current_project.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.current_project.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
|
||||
Global.undo_redo.add_do_property(Global, "current_layer", Global.current_layer + 1)
|
||||
Global.undo_redo.add_do_property(Global, "layers", new_layers)
|
||||
Global.undo_redo.add_undo_property(Global, "current_layer", Global.current_layer)
|
||||
Global.undo_redo.add_undo_property(Global, "layers", Global.layers)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_layer", Global.current_project.current_layer + 1)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "layers", new_layers)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "current_layer", Global.current_project.current_layer)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "layers", Global.current_project.layers)
|
||||
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
||||
|
||||
func _on_RemoveLayer_pressed() -> void:
|
||||
var new_layers : Array = Global.layers.duplicate()
|
||||
new_layers.remove(Global.current_layer)
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Remove Layer")
|
||||
if Global.current_layer > 0:
|
||||
Global.undo_redo.add_do_property(Global, "current_layer", Global.current_layer - 1)
|
||||
var new_layers : Array = Global.current_project.layers.duplicate()
|
||||
new_layers.remove(Global.current_project.current_layer)
|
||||
Global.current_project.undos += 1
|
||||
Global.current_project.undo_redo.create_action("Remove Layer")
|
||||
if Global.current_project.current_layer > 0:
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_layer", Global.current_project.current_layer - 1)
|
||||
else:
|
||||
Global.undo_redo.add_do_property(Global, "current_layer", Global.current_layer)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_layer", Global.current_project.current_layer)
|
||||
|
||||
for f in Global.frames:
|
||||
for f in Global.current_project.frames:
|
||||
var new_cels : Array = f.cels.duplicate()
|
||||
new_cels.remove(Global.current_layer)
|
||||
Global.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
new_cels.remove(Global.current_project.current_layer)
|
||||
Global.current_project.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.current_project.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
|
||||
Global.undo_redo.add_do_property(Global, "layers", new_layers)
|
||||
Global.undo_redo.add_undo_property(Global, "current_layer", Global.current_layer)
|
||||
Global.undo_redo.add_undo_property(Global, "layers", Global.layers)
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "layers", new_layers)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "current_layer", Global.current_project.current_layer)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "layers", Global.current_project.layers)
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
||||
|
||||
func change_layer_order(rate : int) -> void:
|
||||
var change = Global.current_layer + rate
|
||||
var change = Global.current_project.current_layer + rate
|
||||
|
||||
var new_layers : Array = Global.layers.duplicate()
|
||||
var temp = new_layers[Global.current_layer]
|
||||
new_layers[Global.current_layer] = new_layers[change]
|
||||
var new_layers : Array = Global.current_project.layers.duplicate()
|
||||
var temp = new_layers[Global.current_project.current_layer]
|
||||
new_layers[Global.current_project.current_layer] = new_layers[change]
|
||||
new_layers[change] = temp
|
||||
Global.undo_redo.create_action("Change Layer Order")
|
||||
for f in Global.frames:
|
||||
Global.current_project.undo_redo.create_action("Change Layer Order")
|
||||
for f in Global.current_project.frames:
|
||||
var new_cels : Array = f.cels.duplicate()
|
||||
var temp_canvas = new_cels[Global.current_layer]
|
||||
new_cels[Global.current_layer] = new_cels[change]
|
||||
var temp_canvas = new_cels[Global.current_project.current_layer]
|
||||
new_cels[Global.current_project.current_layer] = new_cels[change]
|
||||
new_cels[change] = temp_canvas
|
||||
Global.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
Global.current_project.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.current_project.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
|
||||
Global.undo_redo.add_do_property(Global, "current_layer", change)
|
||||
Global.undo_redo.add_do_property(Global, "layers", new_layers)
|
||||
Global.undo_redo.add_undo_property(Global, "layers", Global.layers)
|
||||
Global.undo_redo.add_undo_property(Global, "current_layer", Global.current_layer)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_layer", change)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "layers", new_layers)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "layers", Global.current_project.layers)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "current_layer", Global.current_project.current_layer)
|
||||
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
||||
|
||||
func _on_MergeDownLayer_pressed() -> void:
|
||||
var new_layers : Array = Global.layers.duplicate()
|
||||
var new_layers : Array = Global.current_project.layers.duplicate()
|
||||
# Loop through the array to create new classes for each element, so that they
|
||||
# won't be the same as the original array's classes. Needed for undo/redo to work properly.
|
||||
for i in new_layers.size():
|
||||
var new_linked_cels = new_layers[i].linked_cels.duplicate()
|
||||
new_layers[i] = Layer.new(new_layers[i].name, new_layers[i].visible, new_layers[i].locked, new_layers[i].frame_container, new_layers[i].new_cels_linked, new_linked_cels)
|
||||
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Merge Layer")
|
||||
for f in Global.frames:
|
||||
Global.current_project.undos += 1
|
||||
Global.current_project.undo_redo.create_action("Merge Layer")
|
||||
for f in Global.current_project.frames:
|
||||
var new_cels : Array = f.cels.duplicate()
|
||||
for i in new_cels.size():
|
||||
new_cels[i] = Cel.new(new_cels[i].image, new_cels[i].opacity)
|
||||
var selected_layer := Image.new()
|
||||
selected_layer.copy_from(new_cels[Global.current_layer].image)
|
||||
selected_layer.copy_from(new_cels[Global.current_project.current_layer].image)
|
||||
selected_layer.lock()
|
||||
|
||||
if f.cels[Global.current_layer].opacity < 1: # If we have layer transparency
|
||||
if f.cels[Global.current_project.current_layer].opacity < 1: # If we have layer transparency
|
||||
for xx in selected_layer.get_size().x:
|
||||
for yy in selected_layer.get_size().y:
|
||||
var pixel_color : Color = selected_layer.get_pixel(xx, yy)
|
||||
var alpha : float = pixel_color.a * f.cels[Global.current_layer].opacity
|
||||
var alpha : float = pixel_color.a * f.cels[Global.current_project.current_layer].opacity
|
||||
selected_layer.set_pixel(xx, yy, Color(pixel_color.r, pixel_color.g, pixel_color.b, alpha))
|
||||
|
||||
var new_layer := Image.new()
|
||||
new_layer.copy_from(f.cels[Global.current_layer - 1].image)
|
||||
new_layer.copy_from(f.cels[Global.current_project.current_layer - 1].image)
|
||||
new_layer.lock()
|
||||
DrawingAlgos.blend_rect(new_layer, selected_layer, Rect2(Global.canvas.location, Global.canvas.size), Vector2.ZERO)
|
||||
new_cels.remove(Global.current_layer)
|
||||
if !selected_layer.is_invisible() and Global.layers[Global.current_layer - 1].linked_cels.size() > 1 and (f in Global.layers[Global.current_layer - 1].linked_cels):
|
||||
new_layers[Global.current_layer - 1].linked_cels.erase(f)
|
||||
new_cels[Global.current_layer - 1].image = new_layer
|
||||
new_cels.remove(Global.current_project.current_layer)
|
||||
if !selected_layer.is_invisible() and Global.current_project.layers[Global.current_project.current_layer - 1].linked_cels.size() > 1 and (f in Global.current_project.layers[Global.current_project.current_layer - 1].linked_cels):
|
||||
new_layers[Global.current_project.current_layer - 1].linked_cels.erase(f)
|
||||
new_cels[Global.current_project.current_layer - 1].image = new_layer
|
||||
else:
|
||||
Global.undo_redo.add_do_property(f.cels[Global.current_layer - 1].image, "data", new_layer.data)
|
||||
Global.undo_redo.add_undo_property(f.cels[Global.current_layer - 1].image, "data", f.cels[Global.current_layer - 1].image.data)
|
||||
Global.current_project.undo_redo.add_do_property(f.cels[Global.current_project.current_layer - 1].image, "data", new_layer.data)
|
||||
Global.current_project.undo_redo.add_undo_property(f.cels[Global.current_project.current_layer - 1].image, "data", f.cels[Global.current_project.current_layer - 1].image.data)
|
||||
|
||||
Global.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
Global.current_project.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.current_project.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
|
||||
new_layers.remove(Global.current_layer)
|
||||
Global.undo_redo.add_do_property(Global, "current_layer", Global.current_layer - 1)
|
||||
Global.undo_redo.add_do_property(Global, "layers", new_layers)
|
||||
Global.undo_redo.add_undo_property(Global, "layers", Global.layers)
|
||||
Global.undo_redo.add_undo_property(Global, "current_layer", Global.current_layer)
|
||||
new_layers.remove(Global.current_project.current_layer)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_layer", Global.current_project.current_layer - 1)
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "layers", new_layers)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "layers", Global.current_project.layers)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "current_layer", Global.current_project.current_layer)
|
||||
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
||||
|
||||
func _on_OpacitySlider_value_changed(value) -> void:
|
||||
Global.frames[Global.current_frame].cels[Global.current_layer].opacity = value / 100
|
||||
Global.current_project.frames[Global.current_project.current_frame].cels[Global.current_project.current_layer].opacity = value / 100
|
||||
Global.layer_opacity_slider.value = value
|
||||
Global.layer_opacity_slider.value = value
|
||||
Global.layer_opacity_spinbox.value = value
|
||||
|
|
|
@ -8,7 +8,7 @@ onready var popup_menu : PopupMenu = $PopupMenu
|
|||
|
||||
func _ready() -> void:
|
||||
hint_tooltip = "Frame: %s, Layer: %s" % [frame + 1, layer]
|
||||
if Global.frames[frame] in Global.layers[layer].linked_cels:
|
||||
if Global.current_project.frames[frame] in Global.current_project.layers[layer].linked_cels:
|
||||
get_node("LinkedIndicator").visible = true
|
||||
popup_menu.set_item_text(4, "Unlink Cel")
|
||||
popup_menu.set_item_metadata(4, "Unlink Cel")
|
||||
|
@ -20,10 +20,10 @@ func _ready() -> void:
|
|||
|
||||
func _on_CelButton_pressed() -> void:
|
||||
if Input.is_action_just_released("left_mouse"):
|
||||
Global.current_frame = frame
|
||||
Global.current_layer = layer
|
||||
Global.current_project.current_frame = frame
|
||||
Global.current_project.current_layer = layer
|
||||
elif Input.is_action_just_released("right_mouse"):
|
||||
if Global.frames.size() == 1:
|
||||
if Global.current_project.frames.size() == 1:
|
||||
popup_menu.set_item_disabled(0, true)
|
||||
popup_menu.set_item_disabled(2, true)
|
||||
popup_menu.set_item_disabled(3, true)
|
||||
|
@ -31,7 +31,7 @@ func _on_CelButton_pressed() -> void:
|
|||
popup_menu.set_item_disabled(0, false)
|
||||
if frame > 0:
|
||||
popup_menu.set_item_disabled(2, false)
|
||||
if frame < Global.frames.size() - 1:
|
||||
if frame < Global.current_project.frames.size() - 1:
|
||||
popup_menu.set_item_disabled(3, false)
|
||||
popup_menu.popup(Rect2(get_global_mouse_position(), Vector2.ONE))
|
||||
pressed = !pressed
|
||||
|
@ -53,9 +53,9 @@ func _on_PopupMenu_id_pressed(ID : int) -> void:
|
|||
3: # Move Right
|
||||
change_frame_order(1)
|
||||
4: # Unlink Cel
|
||||
var cel_index : int = Global.layers[layer].linked_cels.find(Global.frames[frame])
|
||||
var f = Global.frames[frame]
|
||||
var new_layers : Array = Global.layers.duplicate()
|
||||
var cel_index : int = Global.current_project.layers[layer].linked_cels.find(Global.current_project.frames[frame])
|
||||
var f = Global.current_project.frames[frame]
|
||||
var new_layers : Array = Global.current_project.layers.duplicate()
|
||||
# Loop through the array to create new classes for each element, so that they
|
||||
# won't be the same as the original array's classes. Needed for undo/redo to work properly.
|
||||
for i in new_layers.size():
|
||||
|
@ -68,53 +68,53 @@ func _on_PopupMenu_id_pressed(ID : int) -> void:
|
|||
if popup_menu.get_item_metadata(4) == "Unlink Cel":
|
||||
new_layers[layer].linked_cels.remove(cel_index)
|
||||
var sprite := Image.new()
|
||||
sprite.copy_from(Global.frames[frame].cels[layer].image)
|
||||
sprite.copy_from(Global.current_project.frames[frame].cels[layer].image)
|
||||
sprite.lock()
|
||||
new_cels[layer].image = sprite
|
||||
|
||||
Global.undo_redo.create_action("Unlink Cel")
|
||||
Global.undo_redo.add_do_property(Global, "layers", new_layers)
|
||||
Global.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.undo_redo.add_undo_property(Global, "layers", Global.layers)
|
||||
Global.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
Global.current_project.undo_redo.create_action("Unlink Cel")
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "layers", new_layers)
|
||||
Global.current_project.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "layers", Global.current_project.layers)
|
||||
Global.current_project.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
elif popup_menu.get_item_metadata(4) == "Link Cel":
|
||||
new_layers[layer].linked_cels.append(Global.frames[frame])
|
||||
Global.undo_redo.create_action("Link Cel")
|
||||
Global.undo_redo.add_do_property(Global, "layers", new_layers)
|
||||
new_layers[layer].linked_cels.append(Global.current_project.frames[frame])
|
||||
Global.current_project.undo_redo.create_action("Link Cel")
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "layers", new_layers)
|
||||
if new_layers[layer].linked_cels.size() > 1:
|
||||
# If there are already linked cels, set the current cel's image
|
||||
# to the first linked cel's image
|
||||
new_cels[layer].image = new_layers[layer].linked_cels[0].cels[layer].image
|
||||
new_cels[layer].image_texture = new_layers[layer].linked_cels[0].cels[layer].image_texture
|
||||
Global.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
Global.current_project.undo_redo.add_do_property(f, "cels", new_cels)
|
||||
Global.current_project.undo_redo.add_undo_property(f, "cels", f.cels)
|
||||
|
||||
Global.undo_redo.add_undo_property(Global, "layers", Global.layers)
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "layers", Global.current_project.layers)
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
||||
|
||||
func change_frame_order(rate : int) -> void:
|
||||
var change = frame + rate
|
||||
var new_frames : Array = Global.frames.duplicate()
|
||||
var new_frames : Array = Global.current_project.frames.duplicate()
|
||||
var temp = new_frames[frame]
|
||||
new_frames[frame] = new_frames[change]
|
||||
new_frames[change] = temp
|
||||
|
||||
Global.undo_redo.create_action("Change Frame Order")
|
||||
Global.undo_redo.add_do_property(Global, "frames", new_frames)
|
||||
Global.current_project.undo_redo.create_action("Change Frame Order")
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "frames", new_frames)
|
||||
|
||||
if Global.current_frame == frame:
|
||||
Global.undo_redo.add_do_property(Global, "current_frame", change)
|
||||
Global.undo_redo.add_undo_property(Global, "current_frame", Global.current_frame)
|
||||
if Global.current_project.current_frame == frame:
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "current_frame", change)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "current_frame", Global.current_project.current_frame)
|
||||
|
||||
Global.undo_redo.add_undo_property(Global, "frames", Global.frames)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "frames", Global.current_project.frames)
|
||||
|
||||
Global.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.undo_redo.add_do_method(Global, "redo")
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
|
|
@ -21,7 +21,7 @@ func _on_FrameTagDialog_about_to_show() -> void:
|
|||
tag_vboxes.clear()
|
||||
|
||||
var i := 0
|
||||
for tag in Global.animation_tags:
|
||||
for tag in Global.current_project.animation_tags:
|
||||
var vbox_cont := VBoxContainer.new()
|
||||
var hbox_cont := HBoxContainer.new()
|
||||
var tag_label := Label.new()
|
||||
|
@ -62,18 +62,18 @@ func _on_FrameTagDialog_popup_hide() -> void:
|
|||
|
||||
func _on_AddTag_pressed() -> void:
|
||||
options_dialog.popup_centered()
|
||||
current_tag_id = Global.animation_tags.size()
|
||||
options_dialog.get_node("GridContainer/FromSpinBox").value = Global.current_frame + 1
|
||||
options_dialog.get_node("GridContainer/ToSpinBox").value = Global.current_frame + 1
|
||||
current_tag_id = Global.current_project.animation_tags.size()
|
||||
options_dialog.get_node("GridContainer/FromSpinBox").value = Global.current_project.current_frame + 1
|
||||
options_dialog.get_node("GridContainer/ToSpinBox").value = Global.current_project.current_frame + 1
|
||||
|
||||
|
||||
func _on_EditButton_pressed(_tag_id : int) -> void:
|
||||
options_dialog.popup_centered()
|
||||
current_tag_id = _tag_id
|
||||
options_dialog.get_node("GridContainer/NameLineEdit").text = Global.animation_tags[_tag_id].name
|
||||
options_dialog.get_node("GridContainer/ColorPickerButton").color = Global.animation_tags[_tag_id].color
|
||||
options_dialog.get_node("GridContainer/FromSpinBox").value = Global.animation_tags[_tag_id].from
|
||||
options_dialog.get_node("GridContainer/ToSpinBox").value = Global.animation_tags[_tag_id].to
|
||||
options_dialog.get_node("GridContainer/NameLineEdit").text = Global.current_project.animation_tags[_tag_id].name
|
||||
options_dialog.get_node("GridContainer/ColorPickerButton").color = Global.current_project.animation_tags[_tag_id].color
|
||||
options_dialog.get_node("GridContainer/FromSpinBox").value = Global.current_project.animation_tags[_tag_id].from
|
||||
options_dialog.get_node("GridContainer/ToSpinBox").value = Global.current_project.animation_tags[_tag_id].to
|
||||
if !delete_tag_button:
|
||||
delete_tag_button = options_dialog.add_button("Delete Tag", true, "delete_tag")
|
||||
else:
|
||||
|
@ -86,19 +86,19 @@ func _on_TagOptions_confirmed() -> void:
|
|||
var tag_from : int = options_dialog.get_node("GridContainer/FromSpinBox").value
|
||||
var tag_to : int = options_dialog.get_node("GridContainer/ToSpinBox").value
|
||||
|
||||
if tag_to > Global.frames.size():
|
||||
tag_to = Global.frames.size()
|
||||
if tag_to > Global.current_project.frames.size():
|
||||
tag_to = Global.current_project.frames.size()
|
||||
|
||||
if tag_from > tag_to:
|
||||
tag_from = tag_to
|
||||
|
||||
var new_animation_tags := Global.animation_tags.duplicate()
|
||||
var new_animation_tags := Global.current_project.animation_tags.duplicate()
|
||||
# Loop through the tags to create new classes for them, so that they won't be the same
|
||||
# as Global.animation_tags's classes. Needed for undo/redo to work properly.
|
||||
# as Global.current_project.animation_tags's classes. Needed for undo/redo to work properly.
|
||||
for i in new_animation_tags.size():
|
||||
new_animation_tags[i] = AnimationTag.new(new_animation_tags[i].name, new_animation_tags[i].color, new_animation_tags[i].from, new_animation_tags[i].to)
|
||||
|
||||
if current_tag_id == Global.animation_tags.size():
|
||||
if current_tag_id == Global.current_project.animation_tags.size():
|
||||
new_animation_tags.append(AnimationTag.new(tag_name, tag_color, tag_from, tag_to))
|
||||
else:
|
||||
new_animation_tags[current_tag_id].name = tag_name
|
||||
|
@ -107,28 +107,28 @@ func _on_TagOptions_confirmed() -> void:
|
|||
new_animation_tags[current_tag_id].to = tag_to
|
||||
|
||||
# Handle Undo/Redo
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Modify Frame Tag")
|
||||
Global.undo_redo.add_do_method(Global, "general_redo")
|
||||
Global.undo_redo.add_undo_method(Global, "general_undo")
|
||||
Global.undo_redo.add_do_property(Global, "animation_tags", new_animation_tags)
|
||||
Global.undo_redo.add_undo_property(Global, "animation_tags", Global.animation_tags)
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undos += 1
|
||||
Global.current_project.undo_redo.create_action("Modify Frame Tag")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "general_redo")
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "general_undo")
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "animation_tags", new_animation_tags)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "animation_tags", Global.current_project.animation_tags)
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
_on_FrameTagDialog_about_to_show()
|
||||
|
||||
|
||||
func _on_TagOptions_custom_action(action : String) -> void:
|
||||
if action == "delete_tag":
|
||||
var new_animation_tags := Global.animation_tags.duplicate()
|
||||
var new_animation_tags := Global.current_project.animation_tags.duplicate()
|
||||
new_animation_tags.remove(current_tag_id)
|
||||
# Handle Undo/Redo
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Delete Frame Tag")
|
||||
Global.undo_redo.add_do_method(Global, "general_redo")
|
||||
Global.undo_redo.add_undo_method(Global, "general_undo")
|
||||
Global.undo_redo.add_do_property(Global, "animation_tags", new_animation_tags)
|
||||
Global.undo_redo.add_undo_property(Global, "animation_tags", Global.animation_tags)
|
||||
Global.undo_redo.commit_action()
|
||||
Global.current_project.undos += 1
|
||||
Global.current_project.undo_redo.create_action("Delete Frame Tag")
|
||||
Global.current_project.undo_redo.add_do_method(Global, "general_redo")
|
||||
Global.current_project.undo_redo.add_undo_method(Global, "general_undo")
|
||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "animation_tags", new_animation_tags)
|
||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "animation_tags", Global.current_project.animation_tags)
|
||||
Global.current_project.undo_redo.commit_action()
|
||||
|
||||
options_dialog.hide()
|
||||
_on_FrameTagDialog_about_to_show()
|
||||
|
|
|
@ -16,7 +16,7 @@ func _ready() -> void:
|
|||
label = Global.find_node_by_name(self, "Label")
|
||||
line_edit = Global.find_node_by_name(self, "LineEdit")
|
||||
|
||||
if Global.layers[i].visible:
|
||||
if Global.current_project.layers[i].visible:
|
||||
Global.change_button_texturerect(visibility_button.get_child(0), "layer_visible.png")
|
||||
visibility_button.get_child(0).rect_size = Vector2(24, 14)
|
||||
visibility_button.get_child(0).rect_position = Vector2(4, 9)
|
||||
|
@ -25,12 +25,12 @@ func _ready() -> void:
|
|||
visibility_button.get_child(0).rect_size = Vector2(24, 8)
|
||||
visibility_button.get_child(0).rect_position = Vector2(4, 12)
|
||||
|
||||
if Global.layers[i].locked:
|
||||
if Global.current_project.layers[i].locked:
|
||||
Global.change_button_texturerect(lock_button.get_child(0), "lock.png")
|
||||
else:
|
||||
Global.change_button_texturerect(lock_button.get_child(0), "unlock.png")
|
||||
|
||||
if Global.layers[i].new_cels_linked: # If new layers will be linked
|
||||
if Global.current_project.layers[i].new_cels_linked: # If new layers will be linked
|
||||
Global.change_button_texturerect(linked_button.get_child(0), "linked_layer.png")
|
||||
else:
|
||||
Global.change_button_texturerect(linked_button.get_child(0), "unlinked_layer.png")
|
||||
|
@ -59,21 +59,21 @@ func save_layer_name(new_name : String) -> void:
|
|||
line_edit.editable = false
|
||||
label.text = new_name
|
||||
Global.layers_changed_skip = true
|
||||
Global.layers[i].name = new_name
|
||||
Global.current_project.layers[i].name = new_name
|
||||
|
||||
|
||||
func _on_VisibilityButton_pressed() -> void:
|
||||
Global.layers[i].visible = !Global.layers[i].visible
|
||||
Global.current_project.layers[i].visible = !Global.current_project.layers[i].visible
|
||||
Global.canvas.update()
|
||||
|
||||
|
||||
func _on_LockButton_pressed() -> void:
|
||||
Global.layers[i].locked = !Global.layers[i].locked
|
||||
Global.current_project.layers[i].locked = !Global.current_project.layers[i].locked
|
||||
|
||||
|
||||
func _on_LinkButton_pressed() -> void:
|
||||
Global.layers[i].new_cels_linked = !Global.layers[i].new_cels_linked
|
||||
if Global.layers[i].new_cels_linked && !Global.layers[i].linked_cels:
|
||||
Global.current_project.layers[i].new_cels_linked = !Global.current_project.layers[i].new_cels_linked
|
||||
if Global.current_project.layers[i].new_cels_linked && !Global.current_project.layers[i].linked_cels:
|
||||
# If button is pressed and there are no linked cels in the layer
|
||||
Global.layers[i].linked_cels.append(Global.frames[Global.current_frame])
|
||||
Global.layers[i].frame_container.get_child(Global.current_frame)._ready()
|
||||
Global.current_project.layers[i].linked_cels.append(Global.current_project.frames[Global.current_project.current_frame])
|
||||
Global.current_project.layers[i].frame_container.get_child(Global.current_project.current_frame)._ready()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue