1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Image preferences and its translations

This commit is contained in:
Marco 2020-01-10 20:24:07 +01:00
commit 7b0251fdfa
21 changed files with 223 additions and 26 deletions

View file

@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Added
- Italian localization - thanks to Marco Galli!
- In addition to the middle mouse button, you can now use `Space` to pan around the canvas.
### Changed
- More translatable strings, updates to Greek & Brazilian Portuguese (thanks to YeldhamDev) localizations.
@ -14,10 +15,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Added a VSplitContainer for Palettes and Layers.
- Added a ScrollContainer for the palette buttons on the Edit Palette popup.
- Made Palette .json files more readable, and made "comments" on top of the color data.
- THe grid options are now being updated realtime when they're being changed from the preferences.
- The grid options are now being updated realtime when they're being changed from the preferences.
### Fixed
- Crash that occured when trying to delete contents of a selection, that were outside the canvas.
- Fixed crash that occured when trying to delete contents of a selection, that were outside the canvas.
- Fixed .gpl palettes not being imported correctly - Issue #112
- Fixed crash that occured when pressing the play buttons on the timeline, on Godot 3.2 - Issue #111

File diff suppressed because one or more lines are too long

View file

@ -72,4 +72,5 @@ margin_right = 139.0
margin_bottom = 57.0
rect_min_size = Vector2( 64, 20 )
color = Color( 0, 0, 0, 0 )
[connection signal="about_to_show" from="." to="." method="_on_CreateNewImage_about_to_show"]
[connection signal="confirmed" from="." to="." method="_on_CreateNewImage_confirmed"]

View file

@ -257,7 +257,7 @@ margin_bottom = 618.0
margin_right = 205.0
margin_bottom = 28.0
rect_min_size = Vector2( 0, 28 )
text = "Image options"
text = "Image Options"
[node name="ImageOptions" type="GridContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Image"]
margin_top = 32.0
@ -271,7 +271,7 @@ columns = 2
margin_top = 5.0
margin_right = 92.0
margin_bottom = 19.0
text = "Default width:"
text = "Default Width:"
[node name="ImageDefaultWidth" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions"]
margin_left = 82.0
@ -286,7 +286,7 @@ suffix = "px"
margin_top = 5.0
margin_right = 96.0
margin_bottom = 19.0
text = "Default height:"
text = "Default Height:"
[node name="ImageDefaultHeight" type="SpinBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions"]
margin_left = 82.0
@ -297,13 +297,13 @@ max_value = 16384.0
value = 32.0
suffix = "px"
[node name="DefaultBackgroundLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions"]
[node name="DefaultFillColorLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions"]
margin_top = 5.0
margin_right = 96.0
margin_bottom = 19.0
text = "Default background:"
text = "Default Fill Color:"
[node name="DefaultBackground" type="ColorPickerButton" parent="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions"]
[node name="DefaultFillColor" type="ColorPickerButton" parent="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions"]
margin_left = 82.0
margin_top = 56.0
margin_right = 156.0
@ -319,4 +319,4 @@ color = Color( 0, 0, 0, 0 )
[connection signal="color_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GuideColor" to="." method="_on_GuideColor_color_changed"]
[connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions/ImageDefaultWidth" to="." method="_on_ImageDefaultWidth_value_changed"]
[connection signal="value_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions/ImageDefaultHeight" to="." method="_on_ImageDefaultHeight_value_changed"]
[connection signal="color_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions/DefaultBackground" to="." method="_on_DefaultBackground_color_changed"]
[connection signal="color_changed" from="HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions/DefaultFillColor" to="." method="_on_DefaultBackground_color_changed"]

View file

@ -11,9 +11,9 @@ func _ready() -> void:
func _input(event : InputEvent) -> void:
var mouse_pos := viewport_container.get_local_mouse_position()
var viewport_size := viewport_container.rect_size
if event.is_action_pressed("camera_drag"):
if event.is_action_pressed("camera_drag") || event.is_action_pressed("space"):
drag = true
elif event.is_action_released("camera_drag"):
elif event.is_action_released("camera_drag") || event.is_action_released("space"):
drag = false
if Global.can_draw && Rect2(Vector2.ZERO, viewport_size).has_point(mouse_pos):

View file

@ -32,6 +32,8 @@ func _ready() -> void:
# The sprite itself
if layers.empty():
var sprite := Image.new()
if Global.config_cache.has_section_key("preferences", "default_width") && Global.config_cache.has_section_key("preferences", "default_height"):
size = Vector2(Global.config_cache.get_value("preferences", "default_width"), Global.config_cache.get_value("preferences", "default_height"))
sprite.create(size.x, size.y, false, Image.FORMAT_RGBA8)
sprite.lock()
@ -91,11 +93,11 @@ func _input(event : InputEvent) -> void:
else:
return
current_pixel = get_local_mouse_position() + location
if Global.current_frame == frame && Global.has_focus:
update()
sprite_changed_this_frame = false
current_pixel = get_local_mouse_position() + location
var mouse_pos := current_pixel
var mouse_pos_floored := mouse_pos.floor()
var mouse_pos_ceiled := mouse_pos.ceil()

View file

@ -24,6 +24,7 @@ func _ready() -> void:
contributors.create_item(contributor_root).set_text(0, " Subhang Nanduri")
contributors.create_item(contributor_root).set_text(0, " danielnaoexiste")
contributors.create_item(contributor_root).set_text(0, " huskee")
contributors.create_item(contributor_root).set_text(0, " Gaarco")
var donors_root := donors.create_item()
donors.create_item(donors_root).set_text(0, " pcmxms")

View file

@ -1,5 +1,9 @@
extends ConfirmationDialog
onready var width_value = $VBoxContainer/OptionsContainer/WidthValue
onready var height_value = $VBoxContainer/OptionsContainer/HeightValue
onready var fill_color = $VBoxContainer/OptionsContainer/FillColor
func _on_CreateNewImage_confirmed() -> void:
var width : int = $VBoxContainer/OptionsContainer/WidthValue.value
var height : int = $VBoxContainer/OptionsContainer/HeightValue.value
@ -15,3 +19,8 @@ func _on_CreateNewImage_confirmed() -> void:
Global.canvas.layers[0][0].fill(fill_color)
Global.canvas.layers[0][0].lock()
Global.canvas.update_texture(0)
func _on_CreateNewImage_about_to_show() -> void:
width_value.value = Global.default_image_width
height_value.value = Global.default_image_height
fill_color.color = Global.default_fill_color

View file

@ -7,6 +7,15 @@ onready var themes = $HSplitContainer/ScrollContainer/VBoxContainer/Themes
onready var grid_guides = $"HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides"
onready var image = $HSplitContainer/ScrollContainer/VBoxContainer/Image
onready var default_width_value = $HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions/ImageDefaultWidth
onready var default_height_value = $HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions/ImageDefaultHeight
onready var default_fill_color = $HSplitContainer/ScrollContainer/VBoxContainer/Image/ImageOptions/DefaultFillColor
onready var grid_width_value = $"HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridWidthValue"
onready var grid_height_value = $"HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridHeightValue"
onready var grid_color = $"HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GridColor"
onready var guide_color = $"HSplitContainer/ScrollContainer/VBoxContainer/Grid&Guides/GridOptions/GuideColor"
func _ready() -> void:
for child in languages.get_children():
if child is Button:
@ -24,6 +33,41 @@ func _ready() -> void:
change_theme(0)
themes.get_child(1).pressed = true
# Set default values for Grid & Guide options
if Global.config_cache.has_section_key("preferences", "grid_size"):
var grid_size = Global.config_cache.get_value("preferences", "grid_size")
print(Global.grid_width)
Global.grid_width = int(grid_size.x)
Global.grid_height = int(grid_size.y)
grid_width_value.value = grid_size.x
grid_height_value.value = grid_size.y
if Global.config_cache.has_section_key("preferences", "grid_color"):
Global.grid_color = Global.config_cache.get_value("preferences", "grid_color")
grid_color.color = Global.grid_color
if Global.config_cache.has_section_key("preferences", "guide_color"):
Global.guide_color = Global.config_cache.get_value("preferences", "guide_color")
for canvas in Global.canvases:
for guide in canvas.get_children():
if guide is Guide:
guide.default_color = Global.guide_color
guide_color.color = Global.guide_color
# Set default values for Image
if Global.config_cache.has_section_key("preferences", "default_width") && Global.config_cache.has_section_key("preferences", "default_height"):
var default_width = Global.config_cache.get_value("preferences", "default_width")
var default_height = Global.config_cache.get_value("preferences", "default_height")
Global.default_image_width = int(default_width)
Global.default_image_height = int(default_height)
default_width_value.value = Global.default_image_width
default_height_value.value = Global.default_image_height
if Global.config_cache.has_section_key("preferences", "default_fill_color"):
var fill_color = Global.config_cache.get_value("preferences", "default_fill_color")
Global.default_fill_color = fill_color
default_fill_color.color = Global.default_fill_color
func _on_PreferencesDialog_about_to_show() -> void:
var root := tree.create_item()
var language_button := tree.create_item(root)
@ -179,14 +223,20 @@ func change_theme(ID : int) -> void:
func _on_GridWidthValue_value_changed(value : float) -> void:
Global.grid_width = value
Global.canvas.update()
Global.config_cache.set_value("preferences", "grid_size", Vector2(value, grid_height_value.value))
Global.config_cache.save("user://cache.ini")
func _on_GridHeightValue_value_changed(value : float) -> void:
Global.grid_height = value
Global.canvas.update()
Global.config_cache.set_value("preferences", "grid_size", Vector2(grid_width_value.value, value))
Global.config_cache.save("user://cache.ini")
func _on_GridColor_color_changed(color : Color) -> void:
Global.grid_color = color
Global.canvas.update()
Global.config_cache.set_value("preferences", "grid_color", color)
Global.config_cache.save("user://cache.ini")
func _on_GuideColor_color_changed(color : Color) -> void:
Global.guide_color = color
@ -194,12 +244,21 @@ func _on_GuideColor_color_changed(color : Color) -> void:
for guide in canvas.get_children():
if guide is Guide:
guide.default_color = color
Global.config_cache.set_value("preferences", "guide_color", color)
Global.config_cache.save("user://cache.ini")
func _on_ImageDefaultWidth_value_changed(value: float) -> void:
Global.default_image_width = value
Global.config_cache.set_value("preferences", "default_width", value)
Global.config_cache.save("user://cache.ini")
func _on_ImageDefaultHeight_value_changed(value: float) -> void:
Global.default_image_height = value
Global.config_cache.set_value("preferences", "default_height", value)
Global.config_cache.save("user://cache.ini")
func _on_DefaultBackground_color_changed(color: Color) -> void:
Global.default_background = color
Global.default_fill_color = color
Global.config_cache.set_value("preferences", "default_fill_color", color)
Global.config_cache.save("user://cache.ini")

View file

@ -28,7 +28,7 @@ var default_image_width := 32
# warning-ignore:unused_class_variable
var default_image_height := 32
# warning-ignore:unused_class_variable
var default_background := Color(0, 0, 0, 0)
var default_fill_color := Color(0, 0, 0, 0)
# warning-ignore:unused_class_variable
var grid_width := 1
# warning-ignore:unused_class_variable

View file

@ -644,4 +644,16 @@ msgid "Don't show again"
msgstr ""
msgid "Take this spot!"
msgstr ""
msgid "Image Options"
msgstr ""
msgid "Default Width:"
msgstr ""
msgid "Default Height:"
msgstr ""
msgid "Default Fill Color:"
msgstr ""

View file

@ -728,3 +728,15 @@ msgstr ""
#~ "Geteilter Bildschirm\n"
#~ "\n"
#~ "Verstecke zweite Leinwand"
msgid "Image Options"
msgstr "Image Options"
msgid "Default Width:"
msgstr "Default Width"
msgid "Default Height:"
msgstr "Default Height:"
msgid "Default Fill Color:"
msgstr "Default Fill Color:"

View file

@ -727,3 +727,15 @@ msgstr "Πάρτε αυτή τη θέση!"
#~ "Διπλή οθόνη\n"
#~ "\n"
#~ "Απόκρυψη δεύτερου καμβάf"
msgid "Image Options"
msgstr ""
msgid "Default Width:"
msgstr ""
msgid "Default Height:"
msgstr ""
msgid "Default Fill Color:"
msgstr ""

View file

@ -718,3 +718,15 @@ msgstr "Take this spot!"
#~ "Split screen\n"
#~ "\n"
#~ "Hide second canvas"
msgid "Image Options"
msgstr "Image Options"
msgid "Default Width:"
msgstr "Default Width:"
msgid "Default Height:"
msgstr "Default Height:"
msgid "Default Fill Color:"
msgstr "Default Fill Color:"

View file

@ -743,3 +743,15 @@ msgstr ""
#~ "Écran partagé\n"
#~ "\n"
#~ "Cacher le second canevas"
msgid "Image Options"
msgstr "Image Options"
msgid "Default Width:"
msgstr "Default Width"
msgid "Default Height:"
msgstr "Default Height:"
msgid "Default Fill Color:"
msgstr "Default Fill Color:"

View file

@ -723,3 +723,15 @@ msgstr "Prendi questo posto!"
#~ "Dividi lo schermo\n"
#~ "\n"
#~ "Nascondi il secondo canvas"
msgid "Image Options"
msgstr "Opzioni dell'immagine:"
msgid "Default Width:"
msgstr "Larghezza default:"
msgid "Default Height:"
msgstr "Altezza default:"
msgid "Default Fill Color:"
msgstr "Riempimento default:"

View file

@ -732,3 +732,15 @@ msgstr ""
#~ "Podzielenie ekranu\n"
#~ "\n"
#~ "Ukrywa drugie płótno"
msgid "Image Options"
msgstr ""
msgid "Default Width:"
msgstr ""
msgid "Default Height:"
msgstr ""
msgid "Default Fill Color:"
msgstr ""

View file

@ -709,3 +709,15 @@ msgstr "Não mostrar de novo"
msgid "Take this spot!"
msgstr "Peque este lugar!"
msgid "Image Options"
msgstr "Image Options"
msgid "Default Width:"
msgstr "Default Width"
msgid "Default Height:"
msgstr "Default Height:"
msgid "Default Fill Color:"
msgstr "Default Fill Color:"

View file

@ -731,3 +731,15 @@ msgstr ""
#~ "Разделить экран\n"
#~ "\n"
#~ "Скрыть второй холст"
msgid "Image Options"
msgstr "Image Options"
msgid "Default Width:"
msgstr "Default Width"
msgid "Default Height:"
msgstr "Default Height:"
msgid "Default Fill Color:"
msgstr "Default Fill Color:"

View file

@ -718,3 +718,15 @@ msgstr ""
#~ "分裂畫面\n"
#~ "\n"
#~ "顯示一張畫布"
msgid "Image Options"
msgstr ""
msgid "Default Width:"
msgstr ""
msgid "Default Height:"
msgstr ""
msgid "Default Fill Color:"
msgstr ""

View file

@ -214,6 +214,10 @@ delete={
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777224,"unicode":0,"echo":false,"script":null)
]
}
space={
"deadzone": 0.5,
"events": [ ]
}
[locale]