mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
Added a boolean to check if new frames will be linked and an array of linked frames to Global.layers
This doesn't add any new functionality right now
This commit is contained in:
parent
f9ee251b01
commit
a60efccbfd
21
Main.tscn
21
Main.tscn
|
@ -1229,7 +1229,6 @@ columns = 5
|
||||||
[node name="SplashDialog" parent="." instance=ExtResource( 27 )]
|
[node name="SplashDialog" parent="." instance=ExtResource( 27 )]
|
||||||
|
|
||||||
[node name="CreateNewImage" parent="." instance=ExtResource( 28 )]
|
[node name="CreateNewImage" parent="." instance=ExtResource( 28 )]
|
||||||
window_title = "Please Confirm..."
|
|
||||||
|
|
||||||
[node name="OpenSprite" type="FileDialog" parent="."]
|
[node name="OpenSprite" type="FileDialog" parent="."]
|
||||||
margin_right = 515.0
|
margin_right = 515.0
|
||||||
|
@ -1239,8 +1238,8 @@ resizable = true
|
||||||
mode = 0
|
mode = 0
|
||||||
access = 2
|
access = 2
|
||||||
filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
|
filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
|
||||||
current_dir = "/home/marco/Pixelorama"
|
current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
|
||||||
current_path = "/home/marco/Pixelorama/"
|
current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
|
||||||
|
|
||||||
[node name="SaveSprite" type="FileDialog" parent="."]
|
[node name="SaveSprite" type="FileDialog" parent="."]
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
|
@ -1255,35 +1254,27 @@ window_title = "Save Sprite as .pxo"
|
||||||
resizable = true
|
resizable = true
|
||||||
access = 2
|
access = 2
|
||||||
filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
|
filters = PoolStringArray( "*.pxo ; Pixelorama Project" )
|
||||||
current_dir = "/home/marco/Pixelorama"
|
current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
|
||||||
current_path = "/home/marco/Pixelorama/"
|
current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
|
||||||
|
|
||||||
[node name="ImportSprites" parent="." instance=ExtResource( 29 )]
|
[node name="ImportSprites" parent="." instance=ExtResource( 29 )]
|
||||||
current_dir = "/home/marco/Pixelorama"
|
|
||||||
current_path = "/home/marco/Pixelorama/"
|
|
||||||
|
|
||||||
[node name="ExportSprites" parent="." instance=ExtResource( 30 )]
|
[node name="ExportSprites" parent="." instance=ExtResource( 30 )]
|
||||||
current_dir = "/home/marco/Pixelorama"
|
|
||||||
current_path = "/home/marco/Pixelorama/"
|
|
||||||
|
|
||||||
[node name="ScaleImage" parent="." instance=ExtResource( 31 )]
|
[node name="ScaleImage" parent="." instance=ExtResource( 31 )]
|
||||||
window_title = "Please Confirm..."
|
|
||||||
|
|
||||||
[node name="PreferencesDialog" parent="." instance=ExtResource( 32 )]
|
[node name="PreferencesDialog" parent="." instance=ExtResource( 32 )]
|
||||||
|
|
||||||
[node name="RotateImage" parent="." instance=ExtResource( 38 )]
|
[node name="RotateImage" parent="." instance=ExtResource( 38 )]
|
||||||
window_title = "Please Confirm..."
|
|
||||||
|
|
||||||
[node name="OutlineDialog" parent="." instance=ExtResource( 33 )]
|
[node name="OutlineDialog" parent="." instance=ExtResource( 33 )]
|
||||||
visible = false
|
visible = false
|
||||||
window_title = "Please Confirm..."
|
|
||||||
|
|
||||||
[node name="AboutDialog" parent="." instance=ExtResource( 34 )]
|
[node name="AboutDialog" parent="." instance=ExtResource( 34 )]
|
||||||
|
|
||||||
[node name="QuitDialog" type="ConfirmationDialog" parent="."]
|
[node name="QuitDialog" type="ConfirmationDialog" parent="."]
|
||||||
margin_right = 200.0
|
margin_right = 200.0
|
||||||
margin_bottom = 70.0
|
margin_bottom = 70.0
|
||||||
window_title = "Please Confirm..."
|
|
||||||
resizable = true
|
resizable = true
|
||||||
dialog_text = "Are you sure you want to exit Pixelorama?"
|
dialog_text = "Are you sure you want to exit Pixelorama?"
|
||||||
|
|
||||||
|
@ -1309,8 +1300,8 @@ dialog_text = "This is an error message!"
|
||||||
|
|
||||||
[node name="PaletteImportFileDialog" parent="." instance=ExtResource( 37 )]
|
[node name="PaletteImportFileDialog" parent="." instance=ExtResource( 37 )]
|
||||||
filters = PoolStringArray( "*.json ; JavaScript Object Notation", "*.gpl ; Gimp Palette Library", "*.png; Portable Network Graphics" )
|
filters = PoolStringArray( "*.json ; JavaScript Object Notation", "*.gpl ; Gimp Palette Library", "*.png; Portable Network Graphics" )
|
||||||
current_dir = "/home/marco/Pixelorama"
|
current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
|
||||||
current_path = "/home/marco/Pixelorama/"
|
current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
|
||||||
|
|
||||||
[node name="LeftCursor" type="Sprite" parent="."]
|
[node name="LeftCursor" type="Sprite" parent="."]
|
||||||
visible = false
|
visible = false
|
||||||
|
|
|
@ -145,8 +145,9 @@ func add_layer(is_new := true) -> void:
|
||||||
|
|
||||||
var new_layers : Array = Global.layers.duplicate()
|
var new_layers : Array = Global.layers.duplicate()
|
||||||
|
|
||||||
# Store [Layer name, Layer visibility boolean, Layer lock boolean, Frame container]
|
# Store [Layer name (0), Layer visibility boolean (1), Layer lock boolean (2), Frame container (3),
|
||||||
new_layers.append([layer_name, true, false, HBoxContainer.new()])
|
# will new frames be linked boolean (4), Array of linked frames (5)]
|
||||||
|
new_layers.append([layer_name, true, false, HBoxContainer.new(), false, []])
|
||||||
|
|
||||||
Global.undos += 1
|
Global.undos += 1
|
||||||
Global.undo_redo.create_action("Add Layer")
|
Global.undo_redo.create_action("Add Layer")
|
||||||
|
|
|
@ -10,8 +10,9 @@ func _on_CreateNewImage_confirmed() -> void:
|
||||||
var fill_color : Color = fill_color_node.color
|
var fill_color : Color = fill_color_node.color
|
||||||
Global.control.clear_canvases()
|
Global.control.clear_canvases()
|
||||||
Global.layers.clear()
|
Global.layers.clear()
|
||||||
# Store [Layer name, Layer visibility boolean, Layer lock boolean, Frame container]
|
# Store [Layer name (0), Layer visibility boolean (1), Layer lock boolean (2), Frame container (3),
|
||||||
Global.layers.append([tr("Layer") + " 0", true, false, HBoxContainer.new()])
|
# will new frames be linked boolean (4), Array of linked frames (5)]
|
||||||
|
Global.layers.append([tr("Layer") + " 0", true, false, HBoxContainer.new(), false, []])
|
||||||
Global.current_layer = 0
|
Global.current_layer = 0
|
||||||
Global.canvas = load("res://Prefabs/Canvas.tscn").instance()
|
Global.canvas = load("res://Prefabs/Canvas.tscn").instance()
|
||||||
Global.canvas.size = Vector2(width, height).floor()
|
Global.canvas.size = Vector2(width, height).floor()
|
||||||
|
|
|
@ -373,8 +373,9 @@ func _ready() -> void:
|
||||||
|
|
||||||
error_dialog = find_node_by_name(root, "ErrorDialog")
|
error_dialog = find_node_by_name(root, "ErrorDialog")
|
||||||
|
|
||||||
# Store [Layer name, Layer visibility boolean, Layer lock boolean, Frame container]
|
# Store [Layer name (0), Layer visibility boolean (1), Layer lock boolean (2), Frame container (3),
|
||||||
layers.append([tr("Layer") + " 0", true, false, HBoxContainer.new()])
|
# will new frames be linked boolean (4), Array of linked frames (5)]
|
||||||
|
layers.append([tr("Layer") + " 0", true, false, HBoxContainer.new(), false, []])
|
||||||
|
|
||||||
# Thanks to https://godotengine.org/qa/17524/how-to-find-an-instanced-scene-by-its-name
|
# 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:
|
func find_node_by_name(root, node_name) -> Node:
|
||||||
|
|
|
@ -4,12 +4,14 @@ extends Button
|
||||||
var i := 0
|
var i := 0
|
||||||
var visibility_button : BaseButton
|
var visibility_button : BaseButton
|
||||||
var lock_button : BaseButton
|
var lock_button : BaseButton
|
||||||
|
var linked_button : BaseButton
|
||||||
var label : Label
|
var label : Label
|
||||||
var line_edit : LineEdit
|
var line_edit : LineEdit
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
visibility_button = Global.find_node_by_name(self, "VisibilityButton")
|
visibility_button = Global.find_node_by_name(self, "VisibilityButton")
|
||||||
lock_button = Global.find_node_by_name(self, "LockButton")
|
lock_button = Global.find_node_by_name(self, "LockButton")
|
||||||
|
linked_button = Global.find_node_by_name(self, "LinkButton")
|
||||||
label = Global.find_node_by_name(self, "Label")
|
label = Global.find_node_by_name(self, "Label")
|
||||||
line_edit = Global.find_node_by_name(self, "LineEdit")
|
line_edit = Global.find_node_by_name(self, "LineEdit")
|
||||||
|
|
||||||
|
@ -27,6 +29,13 @@ func _ready() -> void:
|
||||||
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Unlock.png" % Global.theme_type)
|
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Unlock.png" % Global.theme_type)
|
||||||
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Unlock_Hover.png" % Global.theme_type)
|
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Unlock_Hover.png" % Global.theme_type)
|
||||||
|
|
||||||
|
if Global.layers[i][4]: # If new layers will be linked
|
||||||
|
linked_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Linked_Layer.png" % Global.theme_type)
|
||||||
|
linked_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Linked_Layer_Hover.png" % Global.theme_type)
|
||||||
|
else:
|
||||||
|
linked_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Unlinked_Layer.png" % Global.theme_type)
|
||||||
|
linked_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Unlinked_Layer_Hover.png" % Global.theme_type)
|
||||||
|
|
||||||
func _input(event : InputEvent) -> void:
|
func _input(event : InputEvent) -> void:
|
||||||
if (event.is_action_released("ui_accept") or event.is_action_released("ui_cancel")) and line_edit.visible and event.scancode != KEY_SPACE:
|
if (event.is_action_released("ui_accept") or event.is_action_released("ui_cancel")) and line_edit.visible and event.scancode != KEY_SPACE:
|
||||||
save_layer_name(line_edit.text)
|
save_layer_name(line_edit.text)
|
||||||
|
@ -49,22 +58,11 @@ func save_layer_name(new_name : String) -> void:
|
||||||
Global.layers[i][0] = new_name
|
Global.layers[i][0] = new_name
|
||||||
|
|
||||||
func _on_VisibilityButton_pressed() -> void:
|
func _on_VisibilityButton_pressed() -> void:
|
||||||
if Global.layers[i][1]:
|
Global.layers[i][1] = !Global.layers[i][1]
|
||||||
Global.layers[i][1] = false
|
|
||||||
visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Invisible.png" % Global.theme_type)
|
|
||||||
visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Invisible_Hover.png" % Global.theme_type)
|
|
||||||
else:
|
|
||||||
Global.layers[i][1] = true
|
|
||||||
visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible.png" % Global.theme_type)
|
|
||||||
visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible_Hover.png" % Global.theme_type)
|
|
||||||
Global.canvas.update()
|
Global.canvas.update()
|
||||||
|
|
||||||
func _on_LockButton_pressed() -> void:
|
func _on_LockButton_pressed() -> void:
|
||||||
if Global.layers[i][2]:
|
Global.layers[i][2] = !Global.layers[i][2]
|
||||||
Global.layers[i][2] = false
|
|
||||||
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Unlock.png" % Global.theme_type)
|
func _on_LinkButton_pressed() -> void:
|
||||||
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Unlock_Hover.png" % Global.theme_type)
|
Global.layers[i][4] = !Global.layers[i][4]
|
||||||
else:
|
|
||||||
Global.layers[i][2] = true
|
|
||||||
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Lock.png" % Global.theme_type)
|
|
||||||
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Lock_Hover.png" % Global.theme_type)
|
|
||||||
|
|
|
@ -189,11 +189,11 @@ func _input(event : InputEvent) -> void:
|
||||||
Global.left_cursor.texture = Global.left_cursor_tool_texture
|
Global.left_cursor.texture = Global.left_cursor_tool_texture
|
||||||
Global.right_cursor.position = get_global_mouse_position() + Vector2(32, 32)
|
Global.right_cursor.position = get_global_mouse_position() + Vector2(32, 32)
|
||||||
Global.right_cursor.texture = Global.right_cursor_tool_texture
|
Global.right_cursor.texture = Global.right_cursor_tool_texture
|
||||||
|
|
||||||
if event is InputEventKey && (event.scancode == KEY_ENTER || event.scancode == KEY_KP_ENTER):
|
if event is InputEventKey && (event.scancode == KEY_ENTER || event.scancode == KEY_KP_ENTER):
|
||||||
if get_focus_owner() is LineEdit:
|
if get_focus_owner() is LineEdit:
|
||||||
get_focus_owner().release_focus()
|
get_focus_owner().release_focus()
|
||||||
|
|
||||||
if event.is_action_pressed("toggle_fullscreen"):
|
if event.is_action_pressed("toggle_fullscreen"):
|
||||||
OS.window_fullscreen = !OS.window_fullscreen
|
OS.window_fullscreen = !OS.window_fullscreen
|
||||||
|
|
||||||
|
@ -415,8 +415,12 @@ func _on_OpenSprite_file_selected(path : String) -> void:
|
||||||
var layer_name := file.get_line()
|
var layer_name := file.get_line()
|
||||||
var layer_visibility := file.get_8()
|
var layer_visibility := file.get_8()
|
||||||
var layer_lock := file.get_8()
|
var layer_lock := file.get_8()
|
||||||
# Store [Layer name, Layer visibility boolean, Layer lock boolean, Frame container]
|
var layer_new_frames_linked := file.get_8()
|
||||||
Global.layers.append([layer_name, layer_visibility, layer_lock, HBoxContainer.new()])
|
var linked_frames = file.get_var()
|
||||||
|
|
||||||
|
# Store [Layer name (0), Layer visibility boolean (1), Layer lock boolean (2), Frame container (3),
|
||||||
|
# will new frames be linked boolean (4), Array of linked frames (5)]
|
||||||
|
Global.layers.append([layer_name, layer_visibility, layer_lock, HBoxContainer.new(), layer_new_frames_linked, linked_frames])
|
||||||
global_layer_line = file.get_line()
|
global_layer_line = file.get_line()
|
||||||
|
|
||||||
var frame_line := file.get_line()
|
var frame_line := file.get_line()
|
||||||
|
@ -433,7 +437,9 @@ func _on_OpenSprite_file_selected(path : String) -> void:
|
||||||
if version_number < (0.7 - 0.01):
|
if version_number < (0.7 - 0.01):
|
||||||
var layer_name_old_version = file.get_line()
|
var layer_name_old_version = file.get_line()
|
||||||
if frame == 0:
|
if frame == 0:
|
||||||
Global.layers.append([layer_name_old_version, true, false, HBoxContainer.new()])
|
# Store [Layer name (0), Layer visibility boolean (1), Layer lock boolean (2), Frame container (3),
|
||||||
|
# will new frames be linked boolean (4), Array of linked frames (5)]
|
||||||
|
Global.layers.append([layer_name_old_version, true, false, HBoxContainer.new(), false, []])
|
||||||
var layer_transparency := 1.0
|
var layer_transparency := 1.0
|
||||||
if version_number > 0.5:
|
if version_number > 0.5:
|
||||||
layer_transparency = file.get_float()
|
layer_transparency = file.get_float()
|
||||||
|
@ -528,6 +534,8 @@ func _on_SaveSprite_file_selected(path : String) -> void:
|
||||||
file.store_line(layer[0]) # Layer name
|
file.store_line(layer[0]) # Layer name
|
||||||
file.store_8(layer[1]) # Layer visibility
|
file.store_8(layer[1]) # Layer visibility
|
||||||
file.store_8(layer[2]) # Layer lock
|
file.store_8(layer[2]) # Layer lock
|
||||||
|
file.store_8(layer[4]) # Future frames linked
|
||||||
|
file.store_var(layer[5]) # Linked frames
|
||||||
file.store_line("END_GLOBAL_LAYERS")
|
file.store_line("END_GLOBAL_LAYERS")
|
||||||
|
|
||||||
for canvas in Global.canvases: # Store frames
|
for canvas in Global.canvases: # Store frames
|
||||||
|
|
Loading…
Reference in a new issue