1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 01:29:49 +00:00
Pixelorama/src/UI/Dialogs/ProjectProperties.gd
Emmanouil Papadeas 2d28136449
Implement indexed mode (#1136)
* Create a custom PixeloramaImage class, initial support for indexed mode

* Convert opened projects and images to indexed mode

* Use shaders for RGB to Indexed conversion and vice versa

* Add `is_indexed` variable in PixeloramaImage

* Basic undo/redo support for indexed mode when drawing

* Make image effects respect indexed mode

* Move code from image effects to ShaderImageEffect instead

* Bucket tool works with indexed mode

* Move and selection tools works with indexed mode

* Brushes respect indexed mode

* Add color_mode variable and some helper methods in Project

Replace hard-coded cases of Image.FORMAT_RGBA8 with `Project.get_image_format()` just in case we want to add more formats in the future

* Add a helper new_empty_image() method to Project

* Set new images to indexed if the project is indexed

* Change color modes from the Image menu

* Fix open image to replace cel

* Load/save indices in pxo files

* Merging layers works with indexed mode

* Layer effects respect indexed mode

* Add an `other_image` parameter to `PixeloramaImage.add_data_to_dictionary()`

* Scale image works with indexed mode

* Resizing works with indexed mode

* Fix non-shader rotation not working with indexed mode

* Minor refactor of PixeloramaImage's set_pixelv_custom()

* Make the text tool work with indexed mode

* Remove print from PixeloramaImage

* Rename "PixeloramaImage" to "ImageExtended"

* Add docstrings in ImageExtended

* Set color mode from the create new image dialog

* Update Translations.pot

* Show the color mode in the project properties dialog
2024-11-20 14:41:37 +02:00

32 lines
1.3 KiB
GDScript

extends AcceptDialog
@onready var size_value_label := $GridContainer/SizeValueLabel as Label
@onready var color_mode_value_label := $GridContainer/ColorModeValueLabel as Label
@onready var frames_value_label := $GridContainer/FramesValueLabel as Label
@onready var layers_value_label := $GridContainer/LayersValueLabel as Label
@onready var name_line_edit := $GridContainer/NameLineEdit as LineEdit
@onready var user_data_text_edit := $GridContainer/UserDataTextEdit as TextEdit
func _on_visibility_changed() -> void:
Global.dialog_open(visible)
size_value_label.text = str(Global.current_project.size)
if Global.current_project.get_image_format() == Image.FORMAT_RGBA8:
color_mode_value_label.text = "RGBA8"
else:
color_mode_value_label.text = str(Global.current_project.get_image_format())
if Global.current_project.is_indexed():
color_mode_value_label.text += " (%s)" % tr("Indexed")
frames_value_label.text = str(Global.current_project.frames.size())
layers_value_label.text = str(Global.current_project.layers.size())
name_line_edit.text = Global.current_project.name
user_data_text_edit.text = Global.current_project.user_data
func _on_name_line_edit_text_changed(new_text: String) -> void:
Global.current_project.name = new_text
func _on_user_data_text_edit_text_changed() -> void:
Global.current_project.user_data = user_data_text_edit.text