1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-15 18:13:15 +00:00

Compare commits

...

3 commits

Author SHA1 Message Date
Emmanouil Papadeas
dd8d217dc3 Changes in formatting due to gdtoolkit's new update
https://github.com/Scony/godot-gdscript-toolkit/releases/tag/4.3.2
2024-10-22 15:54:59 +03:00
Emmanouil Papadeas
17d56bb432 Update tool child scenes to reflect the changes of #1105
Just to fix some warnings
2024-10-22 15:43:07 +03:00
Emmanouil Papadeas
e2b54f70f7 Bump pxo file version to 4 to fix blend mode compatibility with older pxo files
The addition of the erase blend mode from #1117 resulted in loading pxo files from v1.0-v1.0.3 to have incorrect blend modes in their layers, if they are set to anything below normal, because the values of the `BaseLayer.BlendModes` enumerator changed.
2024-10-22 15:39:30 +03:00
14 changed files with 83 additions and 72 deletions

View file

@ -2,6 +2,5 @@ disable:
- no-elif-return - no-elif-return
- no-else-return - no-else-return
- max-returns - max-returns
- private-method-call
max-file-lines: 2000 max-file-lines: 2000

View file

@ -25,7 +25,7 @@ config/icon="res://assets/graphics/icons/icon.png"
config/macos_native_icon="res://assets/graphics/icons/icon.icns" config/macos_native_icon="res://assets/graphics/icons/icon.icns"
config/windows_native_icon="res://assets/graphics/icons/icon.ico" config/windows_native_icon="res://assets/graphics/icons/icon.ico"
config/ExtensionsAPI_Version=5 config/ExtensionsAPI_Version=5
config/Pxo_Version=3 config/Pxo_Version=4
[audio] [audio]

View file

@ -278,6 +278,9 @@ func serialize() -> Dictionary:
func deserialize(dict: Dictionary, zip_reader: ZIPReader = null, file: FileAccess = null) -> void: func deserialize(dict: Dictionary, zip_reader: ZIPReader = null, file: FileAccess = null) -> void:
about_to_deserialize.emit(dict) about_to_deserialize.emit(dict)
var pxo_version = dict.get(
"pxo_version", ProjectSettings.get_setting("application/config/Pxo_Version")
)
if dict.has("size_x") and dict.has("size_y"): if dict.has("size_x") and dict.has("size_y"):
size.x = dict.size_x size.x = dict.size_x
size.y = dict.size_y size.y = dict.size_y
@ -327,8 +330,7 @@ func deserialize(dict: Dictionary, zip_reader: ZIPReader = null, file: FileAcces
# Don't do anything with it, just read it so that the file can move on # Don't do anything with it, just read it so that the file can move on
file.get_buffer(size.x * size.y * 4) file.get_buffer(size.x * size.y * 4)
cels.append(Cel3D.new(size, true)) cels.append(Cel3D.new(size, true))
if dict.has("pxo_version"): cel["pxo_version"] = pxo_version
cel["pxo_version"] = dict["pxo_version"]
cels[cel_i].deserialize(cel) cels[cel_i].deserialize(cel)
_deserialize_metadata(cels[cel_i], cel) _deserialize_metadata(cels[cel_i], cel)
cel_i += 1 cel_i += 1
@ -348,7 +350,15 @@ func deserialize(dict: Dictionary, zip_reader: ZIPReader = null, file: FileAcces
# a layer, so loop again after creating them: # a layer, so loop again after creating them:
for layer_i in dict.layers.size(): for layer_i in dict.layers.size():
layers[layer_i].index = layer_i layers[layer_i].index = layer_i
layers[layer_i].deserialize(dict.layers[layer_i]) var layer_dict: Dictionary = dict.layers[layer_i]
# Ensure that loaded pxo files from v1.0-v1.0.3 have the correct
# blend mode, after the addition of the Erase mode in v1.0.4.
if pxo_version < 4 and layer_dict.has("blend_mode"):
var blend_mode: int = layer_dict.get("blend_mode")
if blend_mode >= BaseLayer.BlendModes.ERASE:
blend_mode += 1
layer_dict["blend_mode"] = blend_mode
layers[layer_i].deserialize(layer_dict)
_deserialize_metadata(layers[layer_i], dict.layers[layer_i]) _deserialize_metadata(layers[layer_i], dict.layers[layer_i])
if dict.has("tags"): if dict.has("tags"):
for tag in dict.tags: for tag in dict.tags:

View file

@ -267,11 +267,12 @@ static func create_ui_for_shader_uniforms(
var mod_button := Button.new() var mod_button := Button.new()
mod_button.text = "Modify" mod_button.text = "Modify"
mod_button.pressed.connect( mod_button.pressed.connect(
func(): _modify_texture_resource( func():
_get_loaded_texture(params, u_name), _modify_texture_resource(
u_name, _get_loaded_texture(params, u_name),
_shader_update_texture.bind(value_changed, u_name) u_name,
) _shader_update_texture.bind(value_changed, u_name)
)
) )
mod_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL mod_button.size_flags_horizontal = Control.SIZE_EXPAND_FILL
mod_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND mod_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND

View file

@ -4,7 +4,7 @@
[ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/BaseDraw.tscn" id="2"] [ext_resource type="PackedScene" uid="uid://ubyatap3sylf" path="res://src/Tools/BaseDraw.tscn" id="2"]
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
[sub_resource type="ButtonGroup" id="ButtonGroup_mvrqm"] [sub_resource type="ButtonGroup" id="ButtonGroup_7w1wt"]
resource_name = "rotate" resource_name = "rotate"
allow_unpress = true allow_unpress = true
@ -26,14 +26,14 @@ tooltip_text = "Fills the drawn shape with color, instead of drawing a hollow sh
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
text = "Fill Shape" text = "Fill Shape"
[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] [node name="Rotate90" parent="RotationOptions/GridContainer/Rotate" index="0"]
button_group = SubResource("ButtonGroup_mvrqm") button_group = SubResource("ButtonGroup_7w1wt")
[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] [node name="Rotate180" parent="RotationOptions/GridContainer/Rotate" index="1"]
button_group = SubResource("ButtonGroup_mvrqm") button_group = SubResource("ButtonGroup_7w1wt")
[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] [node name="Rotate270" parent="RotationOptions/GridContainer/Rotate" index="2"]
button_group = SubResource("ButtonGroup_mvrqm") button_group = SubResource("ButtonGroup_7w1wt")
[node name="Brush" parent="." index="5"] [node name="Brush" parent="." index="5"]
visible = false visible = false

View file

@ -5,7 +5,7 @@
[ext_resource type="Script" path="res://src/Tools/DesignTools/Bucket.gd" id="3"] [ext_resource type="Script" path="res://src/Tools/DesignTools/Bucket.gd" id="3"]
[ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="4_1pngp"] [ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="4_1pngp"]
[sub_resource type="StyleBoxFlat" id="1"] [sub_resource type="StyleBoxFlat" id="2"]
bg_color = Color(1, 1, 1, 1) bg_color = Color(1, 1, 1, 1)
border_color = Color(1, 1, 1, 1) border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 5 corner_radius_top_left = 5
@ -14,7 +14,7 @@ corner_radius_bottom_right = 5
corner_radius_bottom_left = 5 corner_radius_bottom_left = 5
anti_aliasing = false anti_aliasing = false
[sub_resource type="StyleBoxFlat" id="2"] [sub_resource type="StyleBoxFlat" id="1"]
bg_color = Color(1, 1, 1, 1) bg_color = Color(1, 1, 1, 1)
border_color = Color(1, 1, 1, 1) border_color = Color(1, 1, 1, 1)
corner_radius_top_left = 5 corner_radius_top_left = 5
@ -38,10 +38,9 @@ text = "Fill area:"
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
item_count = 3
selected = 0 selected = 0
item_count = 3
popup/item_0/text = "Similar area" popup/item_0/text = "Similar area"
popup/item_0/id = 0
popup/item_1/text = "Similar colors" popup/item_1/text = "Similar colors"
popup/item_1/id = 1 popup/item_1/id = 1
popup/item_2/text = "Whole selection" popup/item_2/text = "Whole selection"
@ -71,10 +70,9 @@ text = "Fill with:"
layout_mode = 2 layout_mode = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
item_count = 2
selected = 0 selected = 0
item_count = 2
popup/item_0/text = "Selected color" popup/item_0/text = "Selected color"
popup/item_0/id = 0
popup/item_1/text = "Pattern" popup/item_1/text = "Pattern"
popup/item_1/id = 1 popup/item_1/id = 1
@ -89,11 +87,11 @@ layout_mode = 2
size_flags_horizontal = 0 size_flags_horizontal = 0
tooltip_text = "Select a brush" tooltip_text = "Select a brush"
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
theme_override_styles/normal = SubResource("1") theme_override_styles/focus = SubResource("2")
theme_override_styles/disabled = SubResource("2")
theme_override_styles/hover = SubResource("1") theme_override_styles/hover = SubResource("1")
theme_override_styles/pressed = SubResource("1") theme_override_styles/pressed = SubResource("1")
theme_override_styles/disabled = SubResource("2") theme_override_styles/normal = SubResource("1")
theme_override_styles/focus = SubResource("2")
[node name="Texture2D" type="TextureRect" parent="FillPattern/Type" index="0"] [node name="Texture2D" type="TextureRect" parent="FillPattern/Type" index="0"]
layout_mode = 0 layout_mode = 0

View file

@ -4,7 +4,7 @@
[ext_resource type="Script" path="res://src/Tools/DesignTools/CurveTool.gd" id="2_tjnp6"] [ext_resource type="Script" path="res://src/Tools/DesignTools/CurveTool.gd" id="2_tjnp6"]
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3_g0nav"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3_g0nav"]
[sub_resource type="ButtonGroup" id="ButtonGroup_ko8wf"] [sub_resource type="ButtonGroup" id="ButtonGroup_drx24"]
resource_name = "rotate" resource_name = "rotate"
allow_unpress = true allow_unpress = true
@ -26,14 +26,14 @@ tooltip_text = "Fills the drawn shape with color, instead of drawing a hollow sh
mouse_default_cursor_shape = 2 mouse_default_cursor_shape = 2
text = "Fill Shape" text = "Fill Shape"
[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] [node name="Rotate90" parent="RotationOptions/GridContainer/Rotate" index="0"]
button_group = SubResource("ButtonGroup_ko8wf") button_group = SubResource("ButtonGroup_drx24")
[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] [node name="Rotate180" parent="RotationOptions/GridContainer/Rotate" index="1"]
button_group = SubResource("ButtonGroup_ko8wf") button_group = SubResource("ButtonGroup_drx24")
[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] [node name="Rotate270" parent="RotationOptions/GridContainer/Rotate" index="2"]
button_group = SubResource("ButtonGroup_ko8wf") button_group = SubResource("ButtonGroup_drx24")
[node name="Brush" parent="." index="5"] [node name="Brush" parent="." index="5"]
visible = false visible = false

View file

@ -3,18 +3,18 @@
[ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/BaseShapeDrawer.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/BaseShapeDrawer.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/DesignTools/EllipseTool.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/EllipseTool.gd" id="2"]
[sub_resource type="ButtonGroup" id="ButtonGroup_q7ttl"] [sub_resource type="ButtonGroup" id="ButtonGroup_nq4ym"]
resource_name = "rotate" resource_name = "rotate"
allow_unpress = true allow_unpress = true
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")
[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] [node name="Rotate90" parent="RotationOptions/GridContainer/Rotate" index="0"]
button_group = SubResource("ButtonGroup_q7ttl") button_group = SubResource("ButtonGroup_nq4ym")
[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] [node name="Rotate180" parent="RotationOptions/GridContainer/Rotate" index="1"]
button_group = SubResource("ButtonGroup_q7ttl") button_group = SubResource("ButtonGroup_nq4ym")
[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] [node name="Rotate270" parent="RotationOptions/GridContainer/Rotate" index="2"]
button_group = SubResource("ButtonGroup_q7ttl") button_group = SubResource("ButtonGroup_nq4ym")

View file

@ -4,21 +4,21 @@
[ext_resource type="Script" path="res://src/Tools/DesignTools/Eraser.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/Eraser.gd" id="2"]
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
[sub_resource type="ButtonGroup" id="ButtonGroup_kkavr"] [sub_resource type="ButtonGroup" id="ButtonGroup_7k1sb"]
resource_name = "rotate" resource_name = "rotate"
allow_unpress = true allow_unpress = true
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")
[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] [node name="Rotate90" parent="RotationOptions/GridContainer/Rotate" index="0"]
button_group = SubResource("ButtonGroup_kkavr") button_group = SubResource("ButtonGroup_7k1sb")
[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] [node name="Rotate180" parent="RotationOptions/GridContainer/Rotate" index="1"]
button_group = SubResource("ButtonGroup_kkavr") button_group = SubResource("ButtonGroup_7k1sb")
[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] [node name="Rotate270" parent="RotationOptions/GridContainer/Rotate" index="2"]
button_group = SubResource("ButtonGroup_kkavr") button_group = SubResource("ButtonGroup_7k1sb")
[node name="OpacitySlider" parent="." index="5" instance=ExtResource("3")] [node name="OpacitySlider" parent="." index="5" instance=ExtResource("3")]
layout_mode = 2 layout_mode = 2

View file

@ -4,7 +4,7 @@
[ext_resource type="Script" path="res://src/Tools/DesignTools/LineTool.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/LineTool.gd" id="2"]
[ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://yjhp0ssng2mp" path="res://src/UI/Nodes/ValueSlider.tscn" id="3"]
[sub_resource type="ButtonGroup" id="ButtonGroup_ko8wf"] [sub_resource type="ButtonGroup" id="ButtonGroup_o5212"]
resource_name = "rotate" resource_name = "rotate"
allow_unpress = true allow_unpress = true
@ -20,14 +20,14 @@ suffix = "px"
global_increment_action = "brush_size_increment" global_increment_action = "brush_size_increment"
global_decrement_action = "brush_size_decrement" global_decrement_action = "brush_size_decrement"
[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] [node name="Rotate90" parent="RotationOptions/GridContainer/Rotate" index="0"]
button_group = SubResource("ButtonGroup_ko8wf") button_group = SubResource("ButtonGroup_o5212")
[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] [node name="Rotate180" parent="RotationOptions/GridContainer/Rotate" index="1"]
button_group = SubResource("ButtonGroup_ko8wf") button_group = SubResource("ButtonGroup_o5212")
[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] [node name="Rotate270" parent="RotationOptions/GridContainer/Rotate" index="2"]
button_group = SubResource("ButtonGroup_ko8wf") button_group = SubResource("ButtonGroup_o5212")
[node name="Brush" parent="." index="4"] [node name="Brush" parent="." index="4"]
visible = false visible = false

View file

@ -4,21 +4,21 @@
[ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="2"] [ext_resource type="PackedScene" path="res://src/UI/Nodes/ValueSliderV2.tscn" id="2"]
[ext_resource type="Script" path="res://src/Tools/DesignTools/Pencil.gd" id="3"] [ext_resource type="Script" path="res://src/Tools/DesignTools/Pencil.gd" id="3"]
[sub_resource type="ButtonGroup" id="ButtonGroup_clato"] [sub_resource type="ButtonGroup" id="ButtonGroup_e3rs3"]
resource_name = "rotate" resource_name = "rotate"
allow_unpress = true allow_unpress = true
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("3") script = ExtResource("3")
[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] [node name="Rotate90" parent="RotationOptions/GridContainer/Rotate" index="0"]
button_group = SubResource("ButtonGroup_clato") button_group = SubResource("ButtonGroup_e3rs3")
[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] [node name="Rotate180" parent="RotationOptions/GridContainer/Rotate" index="1"]
button_group = SubResource("ButtonGroup_clato") button_group = SubResource("ButtonGroup_e3rs3")
[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] [node name="Rotate270" parent="RotationOptions/GridContainer/Rotate" index="2"]
button_group = SubResource("ButtonGroup_clato") button_group = SubResource("ButtonGroup_e3rs3")
[node name="Overwrite" type="CheckBox" parent="." index="5"] [node name="Overwrite" type="CheckBox" parent="." index="5"]
layout_mode = 2 layout_mode = 2

View file

@ -3,18 +3,18 @@
[ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/BaseShapeDrawer.tscn" id="1"] [ext_resource type="PackedScene" uid="uid://n40lhf8hm7o1" path="res://src/Tools/BaseShapeDrawer.tscn" id="1"]
[ext_resource type="Script" path="res://src/Tools/DesignTools/RectangleTool.gd" id="2"] [ext_resource type="Script" path="res://src/Tools/DesignTools/RectangleTool.gd" id="2"]
[sub_resource type="ButtonGroup" id="ButtonGroup_cyxrj"] [sub_resource type="ButtonGroup" id="ButtonGroup_vkkkg"]
resource_name = "rotate" resource_name = "rotate"
allow_unpress = true allow_unpress = true
[node name="ToolOptions" instance=ExtResource("1")] [node name="ToolOptions" instance=ExtResource("1")]
script = ExtResource("2") script = ExtResource("2")
[node name="Rotate90" parent="RotationOptions/Rotate" index="0"] [node name="Rotate90" parent="RotationOptions/GridContainer/Rotate" index="0"]
button_group = SubResource("ButtonGroup_cyxrj") button_group = SubResource("ButtonGroup_vkkkg")
[node name="Rotate180" parent="RotationOptions/Rotate" index="1"] [node name="Rotate180" parent="RotationOptions/GridContainer/Rotate" index="1"]
button_group = SubResource("ButtonGroup_cyxrj") button_group = SubResource("ButtonGroup_vkkkg")
[node name="Rotate270" parent="RotationOptions/Rotate" index="2"] [node name="Rotate270" parent="RotationOptions/GridContainer/Rotate" index="2"]
button_group = SubResource("ButtonGroup_cyxrj") button_group = SubResource("ButtonGroup_vkkkg")

View file

@ -33,7 +33,11 @@ var layer_metadata_texture := ImageTexture.new()
func _ready() -> void: func _ready() -> void:
material.set_shader_parameter("layers", layer_texture_array) material.set_shader_parameter("layers", layer_texture_array)
material.set_shader_parameter("metadata", layer_metadata_texture) material.set_shader_parameter("metadata", layer_metadata_texture)
Global.project_switched.connect(func(): project_changed = true ; queue_redraw()) Global.project_switched.connect(
func():
project_changed = true
queue_redraw()
)
onion_past.type = onion_past.PAST onion_past.type = onion_past.PAST
onion_past.blue_red_color = Global.onion_skinning_past_color onion_past.blue_red_color = Global.onion_skinning_past_color
onion_future.type = onion_future.FUTURE onion_future.type = onion_future.FUTURE

View file

@ -97,9 +97,8 @@ func _on_LayoutSettings_confirmed() -> void:
Global.control.main_ui.layout = layout Global.control.main_ui.layout = layout
layout_list.add_item(layout_name.text) layout_list.add_item(layout_name.text)
Global.layouts.sort_custom( Global.layouts.sort_custom(
func(a: DockableLayout, b: DockableLayout): return ( func(a: DockableLayout, b: DockableLayout):
a.resource_path.get_file() < b.resource_path.get_file() return a.resource_path.get_file() < b.resource_path.get_file()
)
) )
var layout_index := Global.layouts.find(layout) var layout_index := Global.layouts.find(layout)
Global.top_menu_container.populate_layouts_submenu() Global.top_menu_container.populate_layouts_submenu()