mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Changed frame starting point from 0 to 1
Frame UI now start at 1 instead of 0. Also added a "Current frame:" label.
This commit is contained in:
parent
6ee8095162
commit
0058edbc4a
19
Main.tscn
19
Main.tscn
|
@ -369,7 +369,6 @@ scroll_vertical_enabled = false
|
|||
[node name="FrameContainer" type="HBoxContainer" parent="UI/CanvasAndTimeline/AnimationTimeline/TimelineContainer/ScrollContainer"]
|
||||
|
||||
[node name="LayerPanel" type="Panel" parent="UI"]
|
||||
editor/display_folded = true
|
||||
margin_left = 864.0
|
||||
margin_right = 1024.0
|
||||
margin_bottom = 600.0
|
||||
|
@ -381,7 +380,7 @@ anchor_bottom = 1.0
|
|||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="UI/LayerPanel/LayersAndMisc"]
|
||||
margin_right = 160.0
|
||||
margin_bottom = 538.0
|
||||
margin_bottom = 520.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
|
@ -461,21 +460,27 @@ disabled = true
|
|||
text = "M"
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="UI/LayerPanel/LayersAndMisc"]
|
||||
margin_top = 542.0
|
||||
margin_top = 524.0
|
||||
margin_right = 160.0
|
||||
margin_bottom = 546.0
|
||||
margin_bottom = 528.0
|
||||
|
||||
[node name="CursorPosition" type="Label" parent="UI/LayerPanel/LayersAndMisc"]
|
||||
margin_top = 550.0
|
||||
margin_top = 532.0
|
||||
margin_right = 160.0
|
||||
margin_bottom = 564.0
|
||||
margin_bottom = 546.0
|
||||
text = "[64x64]"
|
||||
|
||||
[node name="ZoomLevel" type="Label" parent="UI/LayerPanel/LayersAndMisc"]
|
||||
margin_top = 550.0
|
||||
margin_right = 160.0
|
||||
margin_bottom = 564.0
|
||||
text = "Zoom: x7.81"
|
||||
|
||||
[node name="CurrentFrame" type="Label" parent="UI/LayerPanel/LayersAndMisc"]
|
||||
margin_top = 568.0
|
||||
margin_right = 160.0
|
||||
margin_bottom = 582.0
|
||||
text = "Zoom: x7.81"
|
||||
text = "Current frame: 1"
|
||||
|
||||
[node name="EmptyLabel" type="Label" parent="UI/LayerPanel/LayersAndMisc"]
|
||||
margin_top = 586.0
|
||||
|
|
|
@ -41,7 +41,7 @@ func _ready() -> void:
|
|||
frame_button = load("res://FrameButton.tscn").instance()
|
||||
frame_button.name = "Frame_%s" % frame
|
||||
frame_button.get_node("FrameButton").frame = frame
|
||||
frame_button.get_node("FrameID").text = str(frame)
|
||||
frame_button.get_node("FrameID").text = str(frame + 1)
|
||||
Global.frame_container.add_child(frame_button)
|
||||
|
||||
frame_texture_rect = Global.find_node_by_name(frame_button, "FrameTexture")
|
||||
|
|
|
@ -39,6 +39,7 @@ var move_down_layer_button : Button
|
|||
var merge_down_layer_button : Button
|
||||
var cursor_position_label : Label
|
||||
var zoom_level_label : Label
|
||||
var current_frame_label : Label
|
||||
# warning-ignore:unused_class_variable
|
||||
var current_left_tool := "Pencil"
|
||||
# warning-ignore:unused_class_variable
|
||||
|
@ -69,6 +70,7 @@ func _ready() -> void:
|
|||
merge_down_layer_button = find_node_by_name(root, "MergeDownLayer")
|
||||
cursor_position_label = find_node_by_name(root, "CursorPosition")
|
||||
zoom_level_label = find_node_by_name(root, "ZoomLevel")
|
||||
current_frame_label = find_node_by_name(root, "CurrentFrame")
|
||||
|
||||
#Thanks to https://godotengine.org/qa/17524/how-to-find-an-instanced-scene-by-its-name
|
||||
func find_node_by_name(root, node_name) -> Node:
|
||||
|
@ -83,6 +85,7 @@ func find_node_by_name(root, node_name) -> Node:
|
|||
return null
|
||||
|
||||
func change_frame() -> void:
|
||||
current_frame_label.text = "Current frame: %s" % str(current_frame + 1)
|
||||
for c in canvases:
|
||||
c.visible = false
|
||||
canvas = canvases[current_frame]
|
||||
|
|
|
@ -164,6 +164,7 @@ func _on_OpenSprite_files_selected(paths) -> void:
|
|||
|
||||
i += 1
|
||||
Global.current_frame = i - 1
|
||||
Global.current_frame_label.text = "Current frame: %s" % str(Global.current_frame + 1)
|
||||
Global.canvas = Global.canvases[Global.canvases.size() - 1]
|
||||
Global.canvas.visible = true
|
||||
Global.handle_layer_order_buttons()
|
||||
|
@ -198,6 +199,7 @@ func new_canvas(size : Vector2, sprite : Image = null) -> void:
|
|||
Global.canvas_parent.add_child(Global.canvas)
|
||||
Global.canvases.append(Global.canvas)
|
||||
Global.current_frame = 0
|
||||
Global.current_frame_label.text = "Current frame: %s" % str(Global.current_frame + 1)
|
||||
Global.remove_frame_button.disabled = true
|
||||
Global.remove_frame_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
||||
|
||||
|
@ -368,6 +370,7 @@ func _on_AddFrame_pressed() -> void:
|
|||
var canvas = load("res://Canvas.tscn").instance()
|
||||
canvas.size = Global.canvas.size
|
||||
Global.current_frame = Global.canvases.size()
|
||||
Global.current_frame_label.text = "Current frame: %s" % str(Global.current_frame + 1)
|
||||
canvas.frame = Global.current_frame
|
||||
for canvas in Global.canvases:
|
||||
canvas.visible = false
|
||||
|
@ -388,9 +391,10 @@ func _on_RemoveFrame_pressed() -> void:
|
|||
if canvas.frame > Global.current_frame:
|
||||
canvas.frame -= 1
|
||||
canvas.frame_button.get_node("FrameButton").frame = canvas.frame
|
||||
canvas.frame_button.get_node("FrameID").text = str(canvas.frame)
|
||||
canvas.frame_button.get_node("FrameID").text = str(canvas.frame + 1)
|
||||
if Global.current_frame > 0:
|
||||
Global.current_frame -= 1
|
||||
Global.current_frame_label.text = "Current frame: %s" % str(Global.current_frame + 1)
|
||||
if len(Global.canvases) == 1:
|
||||
Global.remove_frame_button.disabled = true
|
||||
Global.remove_frame_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
||||
|
@ -412,6 +416,7 @@ func _on_CloneFrame_pressed() -> void:
|
|||
tex.create_from_image(sprite, 0)
|
||||
canvas.layers.append([sprite, tex, layer[2], layer[3]])
|
||||
Global.current_frame = Global.canvases.size()
|
||||
Global.current_frame_label.text = "Current frame: %s" % str(Global.current_frame + 1)
|
||||
canvas.frame = Global.current_frame
|
||||
for canvas in Global.canvases:
|
||||
canvas.visible = false
|
||||
|
@ -446,9 +451,10 @@ func change_frame_order(rate : int) -> void:
|
|||
canvas.frame = Global.canvases.find(canvas)
|
||||
canvas.frame_button.name = "Frame_%s" % canvas.frame
|
||||
canvas.frame_button.get_node("FrameButton").frame = canvas.frame
|
||||
canvas.frame_button.get_node("FrameID").text = str(canvas.frame)
|
||||
canvas.frame_button.get_node("FrameID").text = str(canvas.frame + 1)
|
||||
|
||||
Global.current_frame = change
|
||||
Global.current_frame_label.text = "Current frame: %s" % str(Global.current_frame + 1)
|
||||
Global.frame_container.move_child(frame_button, Global.current_frame)
|
||||
Global.canvas_parent.move_child(Global.canvas, Global.current_frame)
|
||||
#Global.canvas.generate_layer_panels()
|
||||
|
|
Loading…
Reference in a new issue