1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-12 08:43:08 +00:00

Merge branch 'Orama-Interactive:master' into indicex-display

This commit is contained in:
Variable 2024-11-29 16:54:13 +05:00 committed by GitHub
commit ceeab25c87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 76 additions and 13 deletions

View file

@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). All the dates are in YYYY-MM-DD format. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). All the dates are in YYYY-MM-DD format.
<br><br> <br><br>
## [v1.1] - Unreleased
This update has been brought to you by the contributions of:
Fayez Akhtar ([@Variable-ind](https://github.com/Variable-ind))
Built using Godot 4.3
### Added
- Indexed mode has finally been implemented! [#1136](https://github.com/Orama-Interactive/Pixelorama/pull/1136)
- Added a new text tool. Destructive only for now, meaning that once the text is confirmed, it cannot be changed later. [#1134](https://github.com/Orama-Interactive/Pixelorama/pull/1134)
- Implemented support for multiple grids. [#1122](https://github.com/Orama-Interactive/Pixelorama/pull/1122)
### Changed
- System font names are now sorted by alphabetical order.
### Fixed
- Fixed crash when Pixelorama starts without a palette.
- Undo/redo now works again when the cursor is hovering over the timeline.
- Palette swatches now get deleted when the user removes all palettes
- Fixed the Palettize effect and palette exporting to images storing slightly wrong color values. [77f6bcf](https://github.com/Orama-Interactive/Pixelorama/commit/77f6bcf07bd80bc042e478bb883d05900cebe436)
- Fixed some issues with the Palettize effect where the output would be different if the palette size changed and empty swatches were added, even if the colors themselves stayed the same. Initially fixed by [bd7d3b1](https://github.com/Orama-Interactive/Pixelorama/commit/bd7d3b19cc98804e9b99754153c4d553d2048ee3), but [1dcb696](https://github.com/Orama-Interactive/Pixelorama/commit/1dcb696c35121f8208bde699f87bb75deff99d13) is the proper fix.
- Fixed recorder label not updating when project is changed. [#1139](https://github.com/Orama-Interactive/Pixelorama/pull/1139)
## [v1.0.5] - 2024-11-18 ## [v1.0.5] - 2024-11-18
This update has been brought to you by the contributions of: This update has been brought to you by the contributions of:
Fayez Akhtar ([@Variable-ind](https://github.com/Variable-ind)) Fayez Akhtar ([@Variable-ind](https://github.com/Variable-ind))

View file

@ -760,7 +760,11 @@ func _ready() -> void:
func update_grids(grids_data: Dictionary): func update_grids(grids_data: Dictionary):
# Remove old grids
grids.clear() grids.clear()
if is_instance_valid(Global.canvas.grid):
Global.canvas.grid.queue_redraw()
# ADD new ones
for grid_idx in grids_data.size(): for grid_idx in grids_data.size():
Grid.new(grids_data[grid_idx]) # gets auto added to grids array Grid.new(grids_data[grid_idx]) # gets auto added to grids array

View file

@ -90,9 +90,9 @@ func get_brush_files_from_directory(directory: String): # -> Array
func add_randomised_brush(fpaths: Array, tooltip_name: String) -> void: func add_randomised_brush(fpaths: Array, tooltip_name: String) -> void:
# Attempt to load the images from the file paths. # Attempt to load the images from the file paths.
var loaded_images: Array = [] var loaded_images: Array = []
for filen in fpaths: for file in fpaths:
var image := Image.new() var image := Image.new()
var err := image.load(filen) var err := image.load(file)
if err == OK: if err == OK:
image.convert(Image.FORMAT_RGBA8) image.convert(Image.FORMAT_RGBA8)
loaded_images.append(image) loaded_images.append(image)

View file

@ -1,5 +1,19 @@
extends GridContainer extends GridContainer
# We should use pre defined initial grid colors instead of random colors
const INITIAL_GRID_COLORS := [
Color.BLACK,
Color.WHITE,
Color.YELLOW,
Color.GREEN,
Color.BLUE,
Color.GRAY,
Color.ORANGE,
Color.PINK,
Color.SIENNA,
Color.CORAL,
]
var grid_preferences: Array[GridPreference] = [ var grid_preferences: Array[GridPreference] = [
GridPreference.new("grid_type", "GridType", "selected", Global.GridTypes.CARTESIAN), GridPreference.new("grid_type", "GridType", "selected", Global.GridTypes.CARTESIAN),
GridPreference.new("grid_size", "GridSizeValue", "value", Vector2i(2, 2)), GridPreference.new("grid_size", "GridSizeValue", "value", Vector2i(2, 2)),
@ -109,21 +123,42 @@ func _on_grid_pref_value_changed(value, pref: GridPreference, button: RestoreDef
func _on_grids_count_value_changed(value: float) -> void: func _on_grids_count_value_changed(value: float) -> void:
var grid_idx = int(value - 1) var new_grids: Dictionary = Global.config_cache.get_value(
var grids: Dictionary = Global.config_cache.get_value(
"preferences", "grids", {0: create_default_properties()} "preferences", "grids", {0: create_default_properties()}
) )
if grid_idx >= grids_select_container.get_child_count(): var last_grid_idx = int(value - 1)
for key in range(grids_select_container.get_child_count(), grid_idx + 1): if last_grid_idx >= grids_select_container.get_child_count():
if not grids.has(key): # Add missing grids
grids[key] = create_default_properties() for key in range(grids_select_container.get_child_count(), value):
if not new_grids.has(key):
var new_grid := create_default_properties()
if new_grids.has(key - 1): # Failsafe
var last_grid = new_grids[key - 1]
# This small bit of code is there to make ui look a little neater
# Reasons:
# - Usually user intends to make the next grid twice the size.
# - Having all grids being same size initially may cause confusion for some
# users when they try to change color of a middle grid not seeing it's changing
# (due to being covered by grids above it).
if (
new_grid.has("grid_size")
and new_grid.has("isometric_grid_size")
and new_grid.has("grid_color")
):
new_grid["grid_size"] = last_grid["grid_size"] * 2
new_grid["isometric_grid_size"] = last_grid["isometric_grid_size"] * 2
if key < INITIAL_GRID_COLORS.size():
new_grid["grid_color"] = INITIAL_GRID_COLORS[key]
new_grids[key] = new_grid
add_remove_select_button(key) add_remove_select_button(key)
else: else:
for key: int in range(grid_idx + 1, grids.size()): # Remove extra grids
grids.erase(key) for key: int in range(value, new_grids.size()):
new_grids.erase(key)
add_remove_select_button(key, true) add_remove_select_button(key, true)
Global.update_grids(grids) grid_selected = min(grid_selected, last_grid_idx)
Global.config_cache.set_value("preferences", "grids", grids) Global.update_grids(new_grids)
Global.config_cache.set_value("preferences", "grids", new_grids)
func create_default_properties() -> Dictionary: func create_default_properties() -> Dictionary:
@ -152,7 +187,6 @@ func add_remove_select_button(grid_idx: int, remove := false):
else: else:
if grid_idx < grids_select_container.get_child_count(): if grid_idx < grids_select_container.get_child_count():
grids_select_container.get_child(grid_idx).queue_free() grids_select_container.get_child(grid_idx).queue_free()
grid_selected = min(grid_selected, grid_idx - 1)
func update_pref_ui(grid_data: Dictionary): func update_pref_ui(grid_data: Dictionary):
@ -161,3 +195,6 @@ func update_pref_ui(grid_data: Dictionary):
if grid_data.has(key): if grid_data.has(key):
var node := get_node(pref.node_path) var node := get_node(pref.node_path)
node.set(pref.value_type, grid_data[key]) node.set(pref.value_type, grid_data[key])
if pref.value_type == "color":
# the signal doesn't seem to be emitted automatically
node.color_changed.emit(grid_data[key])