mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-15 18:13:15 +00:00
Compare commits
17 commits
0fe4c57e50
...
8290e6671e
Author | SHA1 | Date | |
---|---|---|---|
|
8290e6671e | ||
|
70a6438de5 | ||
|
8b1367494d | ||
|
01b55aca07 | ||
|
5f53a3eb7b | ||
|
658477ed4b | ||
|
3fb8484ac5 | ||
|
0484b1012f | ||
|
b87a8e2ab8 | ||
|
e6c4a72158 | ||
|
1dcb696c35 | ||
|
d580523c6e | ||
|
11da07b9ac | ||
|
7cf87ac142 | ||
|
bd7d3b19cc | ||
|
996a234d0d | ||
|
77f6bcf07b |
17 changed files with 100 additions and 74 deletions
|
@ -10,7 +10,7 @@ msgstr ""
|
||||||
"Content-Type: text/plain; charset=UTF-8\n"
|
"Content-Type: text/plain; charset=UTF-8\n"
|
||||||
"Language-Team: Spanish\n"
|
"Language-Team: Spanish\n"
|
||||||
"Language: es_ES\n"
|
"Language: es_ES\n"
|
||||||
"PO-Revision-Date: 2024-11-20 12:58\n"
|
"PO-Revision-Date: 2024-11-23 17:57\n"
|
||||||
|
|
||||||
msgid "OK"
|
msgid "OK"
|
||||||
msgstr "OK"
|
msgstr "OK"
|
||||||
|
@ -169,15 +169,15 @@ msgstr "Porcentaje"
|
||||||
|
|
||||||
#. Found in the create new image dialog. Allows users to change the color mode of the new project, such as RGBA or indexed mode.
|
#. Found in the create new image dialog. Allows users to change the color mode of the new project, such as RGBA or indexed mode.
|
||||||
msgid "Color mode:"
|
msgid "Color mode:"
|
||||||
msgstr ""
|
msgstr "Modo de color:"
|
||||||
|
|
||||||
#. Found in the image menu. A submenu that allows users to change the color mode of the project, such as RGBA or indexed mode.
|
#. Found in the image menu. A submenu that allows users to change the color mode of the project, such as RGBA or indexed mode.
|
||||||
msgid "Color Mode"
|
msgid "Color Mode"
|
||||||
msgstr ""
|
msgstr "Modo de color"
|
||||||
|
|
||||||
#. Found in the image menu, under the "Color Mode" submenu. Refers to the indexed color mode. See this wikipedia page for more information: https://en.wikipedia.org/wiki/Indexed_color
|
#. Found in the image menu, under the "Color Mode" submenu. Refers to the indexed color mode. See this wikipedia page for more information: https://en.wikipedia.org/wiki/Indexed_color
|
||||||
msgid "Indexed"
|
msgid "Indexed"
|
||||||
msgstr ""
|
msgstr "Indexado"
|
||||||
|
|
||||||
#. Found in the image menu. Sets the size of the project to be the same as the size of the active selection.
|
#. Found in the image menu. Sets the size of the project to be the same as the size of the active selection.
|
||||||
msgid "Crop to Selection"
|
msgid "Crop to Selection"
|
||||||
|
@ -1576,7 +1576,9 @@ msgstr "Herramienta Elipse\n\n"
|
||||||
msgid "Text\n\n"
|
msgid "Text\n\n"
|
||||||
"%s for left mouse button\n"
|
"%s for left mouse button\n"
|
||||||
"%s for right mouse button"
|
"%s for right mouse button"
|
||||||
msgstr ""
|
msgstr "Texto\n\n"
|
||||||
|
"%s para el botón izquierdo del ratón\n"
|
||||||
|
"%s para el botón derecho del ratón"
|
||||||
|
|
||||||
msgid "Rectangle"
|
msgid "Rectangle"
|
||||||
msgstr "Rectángulo"
|
msgstr "Rectángulo"
|
||||||
|
@ -2091,30 +2093,30 @@ msgstr "Intersección de las selecciones"
|
||||||
|
|
||||||
#. Refers to the style of something, such as the style of a text, meaning whether it's regular, bold, italic, etc.
|
#. Refers to the style of something, such as the style of a text, meaning whether it's regular, bold, italic, etc.
|
||||||
msgid "Style:"
|
msgid "Style:"
|
||||||
msgstr ""
|
msgstr "Estilo:"
|
||||||
|
|
||||||
#. Refers to the text. Regular means that the text is not bold or italic.
|
#. Refers to the text. Regular means that the text is not bold or italic.
|
||||||
msgid "Regular"
|
msgid "Regular"
|
||||||
msgstr ""
|
msgstr "Normal"
|
||||||
|
|
||||||
#. Refers to text that is bold.
|
#. Refers to text that is bold.
|
||||||
msgid "Bold"
|
msgid "Bold"
|
||||||
msgstr ""
|
msgstr "Negrita"
|
||||||
|
|
||||||
#. Refers to text that is italic.
|
#. Refers to text that is italic.
|
||||||
msgid "Italic"
|
msgid "Italic"
|
||||||
msgstr ""
|
msgstr "Cursiva"
|
||||||
|
|
||||||
#. Refers to text that is bold and italic.
|
#. Refers to text that is bold and italic.
|
||||||
msgid "Bold Italic"
|
msgid "Bold Italic"
|
||||||
msgstr ""
|
msgstr "Negrita cursiva"
|
||||||
|
|
||||||
#. https://en.wikipedia.org/wiki/Anti-aliasing
|
#. https://en.wikipedia.org/wiki/Anti-aliasing
|
||||||
msgid "Antialiasing"
|
msgid "Antialiasing"
|
||||||
msgstr ""
|
msgstr "Antialiasing"
|
||||||
|
|
||||||
msgid "Grayscale"
|
msgid "Grayscale"
|
||||||
msgstr ""
|
msgstr "Escala de grises"
|
||||||
|
|
||||||
msgid "Mirroring"
|
msgid "Mirroring"
|
||||||
msgstr "Espejar"
|
msgstr "Espejar"
|
||||||
|
|
|
@ -1066,7 +1066,9 @@ func get_available_font_names() -> PackedStringArray:
|
||||||
if font_name in font_names:
|
if font_name in font_names:
|
||||||
continue
|
continue
|
||||||
font_names.append(font_name)
|
font_names.append(font_name)
|
||||||
for system_font_name in OS.get_system_fonts():
|
var system_fonts := OS.get_system_fonts()
|
||||||
|
system_fonts.sort()
|
||||||
|
for system_font_name in system_fonts:
|
||||||
if system_font_name in font_names:
|
if system_font_name in font_names:
|
||||||
continue
|
continue
|
||||||
font_names.append(system_font_name)
|
font_names.append(system_font_name)
|
||||||
|
|
|
@ -36,8 +36,9 @@ func does_palette_exist(palette_name: String) -> bool:
|
||||||
|
|
||||||
|
|
||||||
func select_palette(palette_name: String) -> void:
|
func select_palette(palette_name: String) -> void:
|
||||||
current_palette = palettes.get(palette_name)
|
current_palette = palettes.get(palette_name, null)
|
||||||
_clear_selected_colors()
|
_clear_selected_colors()
|
||||||
|
if is_instance_valid(current_palette):
|
||||||
Global.config_cache.set_value("data", "last_palette", current_palette.name)
|
Global.config_cache.set_value("data", "last_palette", current_palette.name)
|
||||||
palette_selected.emit(palette_name)
|
palette_selected.emit(palette_name)
|
||||||
|
|
||||||
|
@ -224,6 +225,7 @@ func current_palete_delete(permanent := true) -> void:
|
||||||
select_palette(palettes.keys()[0])
|
select_palette(palettes.keys()[0])
|
||||||
else:
|
else:
|
||||||
current_palette = null
|
current_palette = null
|
||||||
|
select_palette("")
|
||||||
|
|
||||||
|
|
||||||
func current_palette_add_color(mouse_button: int, start_index := 0) -> void:
|
func current_palette_add_color(mouse_button: int, start_index := 0) -> void:
|
||||||
|
|
|
@ -8,7 +8,7 @@ var image: ImageExtended:
|
||||||
set = image_changed
|
set = image_changed
|
||||||
|
|
||||||
|
|
||||||
func _init(_image: ImageExtended, _opacity := 1.0) -> void:
|
func _init(_image := ImageExtended.new(), _opacity := 1.0) -> void:
|
||||||
image_texture = ImageTexture.new()
|
image_texture = ImageTexture.new()
|
||||||
image = _image # Set image and call setter
|
image = _image # Set image and call setter
|
||||||
opacity = _opacity
|
opacity = _opacity
|
||||||
|
@ -20,7 +20,7 @@ func image_changed(value: ImageExtended) -> void:
|
||||||
image_texture.set_image(image)
|
image_texture.set_image(image)
|
||||||
|
|
||||||
|
|
||||||
func get_content():
|
func get_content() -> ImageExtended:
|
||||||
return image
|
return image
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,17 +34,19 @@ func set_content(content, texture: ImageTexture = null) -> void:
|
||||||
image_texture.update(image)
|
image_texture.update(image)
|
||||||
|
|
||||||
|
|
||||||
func create_empty_content():
|
func create_empty_content() -> ImageExtended:
|
||||||
var empty_image := Image.create(
|
var empty := Image.create(image.get_width(), image.get_height(), false, image.get_format())
|
||||||
image.get_size().x, image.get_size().y, false, Image.FORMAT_RGBA8
|
var new_image := ImageExtended.new()
|
||||||
)
|
new_image.copy_from_custom(empty, image.is_indexed)
|
||||||
return empty_image
|
return new_image
|
||||||
|
|
||||||
|
|
||||||
func copy_content():
|
func copy_content() -> ImageExtended:
|
||||||
var copy_image := Image.create_from_data(
|
var tmp_image := Image.create_from_data(
|
||||||
image.get_width(), image.get_height(), false, Image.FORMAT_RGBA8, image.get_data()
|
image.get_width(), image.get_height(), false, image.get_format(), image.get_data()
|
||||||
)
|
)
|
||||||
|
var copy_image := ImageExtended.new()
|
||||||
|
copy_image.copy_from_custom(tmp_image, image.is_indexed)
|
||||||
return copy_image
|
return copy_image
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -74,17 +74,20 @@ func select_palette(_name: String, convert_to_rgb := true) -> void:
|
||||||
|
|
||||||
## Updates [member palette] to contain the colors of [member current_palette].
|
## Updates [member palette] to contain the colors of [member current_palette].
|
||||||
func update_palette() -> void:
|
func update_palette() -> void:
|
||||||
if palette.size() != current_palette.colors.size():
|
if not is_instance_valid(current_palette):
|
||||||
palette.resize(current_palette.colors.size())
|
return
|
||||||
|
if palette.size() != current_palette.colors_max:
|
||||||
|
palette.resize(current_palette.colors_max)
|
||||||
|
palette.fill(TRANSPARENT)
|
||||||
for i in current_palette.colors:
|
for i in current_palette.colors:
|
||||||
palette[i] = current_palette.colors[i].color
|
palette[i] = current_palette.colors[i].color
|
||||||
|
|
||||||
|
|
||||||
## Displays the actual RGBA values of each pixel in the image from indexed mode.
|
## Displays the actual RGBA values of each pixel in the image from indexed mode.
|
||||||
func convert_indexed_to_rgb() -> void:
|
func convert_indexed_to_rgb() -> void:
|
||||||
if not is_indexed:
|
if not is_indexed or not is_instance_valid(current_palette):
|
||||||
return
|
return
|
||||||
var palette_image := Palettes.current_palette.convert_to_image()
|
var palette_image := current_palette.convert_to_image(false)
|
||||||
var palette_texture := ImageTexture.create_from_image(palette_image)
|
var palette_texture := ImageTexture.create_from_image(palette_image)
|
||||||
var shader_image_effect := ShaderImageEffect.new()
|
var shader_image_effect := ShaderImageEffect.new()
|
||||||
var indices_texture := ImageTexture.create_from_image(indices_image)
|
var indices_texture := ImageTexture.create_from_image(indices_image)
|
||||||
|
@ -96,9 +99,9 @@ func convert_indexed_to_rgb() -> void:
|
||||||
## Automatically maps each color of the image's pixel to the closest color of the palette,
|
## Automatically maps each color of the image's pixel to the closest color of the palette,
|
||||||
## by finding the palette color's index and storing it in [member indices_image].
|
## by finding the palette color's index and storing it in [member indices_image].
|
||||||
func convert_rgb_to_indexed() -> void:
|
func convert_rgb_to_indexed() -> void:
|
||||||
if not is_indexed:
|
if not is_indexed or not is_instance_valid(current_palette):
|
||||||
return
|
return
|
||||||
var palette_image := Palettes.current_palette.convert_to_image()
|
var palette_image := current_palette.convert_to_image(false)
|
||||||
var palette_texture := ImageTexture.create_from_image(palette_image)
|
var palette_texture := ImageTexture.create_from_image(palette_image)
|
||||||
var params := {
|
var params := {
|
||||||
"palette_texture": palette_texture, "rgb_texture": ImageTexture.create_from_image(self)
|
"palette_texture": palette_texture, "rgb_texture": ImageTexture.create_from_image(self)
|
||||||
|
|
|
@ -25,7 +25,7 @@ var colors_max := 0
|
||||||
|
|
||||||
|
|
||||||
class PaletteColor:
|
class PaletteColor:
|
||||||
var color := Color.TRANSPARENT
|
var color := Color(0, 0, 0, 0)
|
||||||
var index := -1
|
var index := -1
|
||||||
|
|
||||||
func _init(init_color := Color.BLACK, init_index := -1) -> void:
|
func _init(init_color := Color.BLACK, init_index := -1) -> void:
|
||||||
|
@ -358,9 +358,11 @@ static func strip_unvalid_characters(string_to_strip: String) -> String:
|
||||||
return regex.sub(string_to_strip, "", true)
|
return regex.sub(string_to_strip, "", true)
|
||||||
|
|
||||||
|
|
||||||
func convert_to_image() -> Image:
|
func convert_to_image(crop_image := true) -> Image:
|
||||||
var image := Image.create(colors_max, 1, false, Image.FORMAT_RGBA8)
|
var image := Image.create(colors_max, 1, false, Image.FORMAT_RGBA8)
|
||||||
for i in colors_max:
|
for i in colors_max:
|
||||||
if colors.has(i):
|
if colors.has(i):
|
||||||
image.set_pixel(i, 0, colors[i].color)
|
image.set_pixel(i, 0, Color(colors[i].color.to_html()))
|
||||||
|
if crop_image:
|
||||||
|
image.copy_from(image.get_region(image.get_used_rect()))
|
||||||
return image
|
return image
|
||||||
|
|
|
@ -23,10 +23,6 @@ func _ready() -> void:
|
||||||
|
|
||||||
|
|
||||||
func set_palette(new_palette: Palette) -> void:
|
func set_palette(new_palette: Palette) -> void:
|
||||||
# Only display valid palette objects
|
|
||||||
if not new_palette:
|
|
||||||
return
|
|
||||||
|
|
||||||
current_palette = new_palette
|
current_palette = new_palette
|
||||||
grid_window_origin = Vector2.ZERO
|
grid_window_origin = Vector2.ZERO
|
||||||
|
|
||||||
|
@ -87,6 +83,8 @@ func scroll_palette(origin: Vector2i) -> void:
|
||||||
## Called when the color changes, either the left or the right, determined by [param mouse_button].
|
## Called when the color changes, either the left or the right, determined by [param mouse_button].
|
||||||
## If current palette has [param target_color] as a [Color], then select it.
|
## If current palette has [param target_color] as a [Color], then select it.
|
||||||
func find_and_select_color(target_color: Color, mouse_button: int) -> void:
|
func find_and_select_color(target_color: Color, mouse_button: int) -> void:
|
||||||
|
if not is_instance_valid(current_palette):
|
||||||
|
return
|
||||||
var old_index := Palettes.current_palette_get_selected_color_index(mouse_button)
|
var old_index := Palettes.current_palette_get_selected_color_index(mouse_button)
|
||||||
for color_ind in swatches.size():
|
for color_ind in swatches.size():
|
||||||
if (
|
if (
|
||||||
|
@ -115,6 +113,8 @@ func find_and_select_color(target_color: Color, mouse_button: int) -> void:
|
||||||
|
|
||||||
## Displays a left/right highlight over a swatch
|
## Displays a left/right highlight over a swatch
|
||||||
func select_swatch(mouse_button: int, palette_index: int, old_palette_index: int) -> void:
|
func select_swatch(mouse_button: int, palette_index: int, old_palette_index: int) -> void:
|
||||||
|
if not is_instance_valid(current_palette):
|
||||||
|
return
|
||||||
var index := convert_palette_index_to_grid_index(palette_index)
|
var index := convert_palette_index_to_grid_index(palette_index)
|
||||||
var old_index := convert_palette_index_to_grid_index(old_palette_index)
|
var old_index := convert_palette_index_to_grid_index(old_palette_index)
|
||||||
if index >= 0 and index < swatches.size():
|
if index >= 0 and index < swatches.size():
|
||||||
|
@ -159,16 +159,17 @@ func convert_palette_index_to_grid_index(palette_index: int) -> int:
|
||||||
|
|
||||||
|
|
||||||
func resize_grid(new_rect_size: Vector2) -> void:
|
func resize_grid(new_rect_size: Vector2) -> void:
|
||||||
if not is_instance_valid(current_palette):
|
|
||||||
return
|
|
||||||
var grid_x: int = (
|
var grid_x: int = (
|
||||||
new_rect_size.x / (swatch_size.x + get("theme_override_constants/h_separation"))
|
new_rect_size.x / (swatch_size.x + get("theme_override_constants/h_separation"))
|
||||||
)
|
)
|
||||||
var grid_y: int = (
|
var grid_y: int = (
|
||||||
new_rect_size.y / (swatch_size.y + get("theme_override_constants/v_separation"))
|
new_rect_size.y / (swatch_size.y + get("theme_override_constants/v_separation"))
|
||||||
)
|
)
|
||||||
|
if is_instance_valid(current_palette):
|
||||||
grid_size.x = mini(grid_x, current_palette.width)
|
grid_size.x = mini(grid_x, current_palette.width)
|
||||||
grid_size.y = mini(grid_y, current_palette.height)
|
grid_size.y = mini(grid_y, current_palette.height)
|
||||||
|
else:
|
||||||
|
grid_size = Vector2i.ZERO
|
||||||
setup_swatches()
|
setup_swatches()
|
||||||
draw_palette()
|
draw_palette()
|
||||||
|
|
||||||
|
|
|
@ -115,6 +115,8 @@ func redraw_current_palette() -> void:
|
||||||
|
|
||||||
|
|
||||||
func toggle_add_delete_buttons() -> void:
|
func toggle_add_delete_buttons() -> void:
|
||||||
|
if not is_instance_valid(Palettes.current_palette):
|
||||||
|
return
|
||||||
add_color_button.disabled = Palettes.current_palette.is_full()
|
add_color_button.disabled = Palettes.current_palette.is_full()
|
||||||
if add_color_button.disabled:
|
if add_color_button.disabled:
|
||||||
add_color_button.mouse_default_cursor_shape = CURSOR_FORBIDDEN
|
add_color_button.mouse_default_cursor_shape = CURSOR_FORBIDDEN
|
||||||
|
@ -252,6 +254,7 @@ func _on_ColorPicker_color_changed(color: Color) -> void:
|
||||||
== Palettes.current_palette_get_selected_color_index(MOUSE_BUTTON_RIGHT)
|
== Palettes.current_palette_get_selected_color_index(MOUSE_BUTTON_RIGHT)
|
||||||
):
|
):
|
||||||
Tools.assign_color(color, MOUSE_BUTTON_RIGHT)
|
Tools.assign_color(color, MOUSE_BUTTON_RIGHT)
|
||||||
|
Palettes.current_palette_set_color(edited_swatch_index, edited_swatch_color)
|
||||||
|
|
||||||
|
|
||||||
## Saves edited swatch to palette file when color selection dialog is closed
|
## Saves edited swatch to palette file when color selection dialog is closed
|
||||||
|
|
|
@ -4,9 +4,9 @@ var scroll := Vector2i.ZERO
|
||||||
var drag_started := false
|
var drag_started := false
|
||||||
var drag_start_position := Vector2i.ZERO
|
var drag_start_position := Vector2i.ZERO
|
||||||
|
|
||||||
@onready var h_slider := %HScrollBar
|
@onready var h_slider := %HScrollBar as HScrollBar
|
||||||
@onready var v_slider := %VScrollBar
|
@onready var v_slider := %VScrollBar as VScrollBar
|
||||||
@onready var palette_grid := %PaletteGrid
|
@onready var palette_grid := %PaletteGrid as PaletteGrid
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
|
@ -17,16 +17,21 @@ func _input(event: InputEvent) -> void:
|
||||||
|
|
||||||
|
|
||||||
func set_sliders(palette: Palette, origin: Vector2i) -> void:
|
func set_sliders(palette: Palette, origin: Vector2i) -> void:
|
||||||
if not is_instance_valid(palette):
|
if is_instance_valid(palette):
|
||||||
return
|
|
||||||
h_slider.value = origin.x
|
h_slider.value = origin.x
|
||||||
h_slider.max_value = palette.width
|
h_slider.max_value = palette.width
|
||||||
h_slider.page = palette_grid.grid_size.x
|
h_slider.page = palette_grid.grid_size.x
|
||||||
h_slider.visible = false if h_slider.max_value <= palette_grid.grid_size.x else true
|
|
||||||
|
|
||||||
v_slider.value = origin.y
|
v_slider.value = origin.y
|
||||||
v_slider.max_value = palette.height
|
v_slider.max_value = palette.height
|
||||||
v_slider.page = palette_grid.grid_size.y
|
v_slider.page = palette_grid.grid_size.y
|
||||||
|
else:
|
||||||
|
h_slider.value = 0
|
||||||
|
h_slider.max_value = 0
|
||||||
|
h_slider.page = 0
|
||||||
|
v_slider.value = 0
|
||||||
|
v_slider.max_value = 0
|
||||||
|
v_slider.page = 0
|
||||||
|
h_slider.visible = false if h_slider.max_value <= palette_grid.grid_size.x else true
|
||||||
v_slider.visible = false if v_slider.max_value <= palette_grid.grid_size.y else true
|
v_slider.visible = false if v_slider.max_value <= palette_grid.grid_size.y else true
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +63,7 @@ func _on_PaletteGrid_gui_input(event: InputEvent) -> void:
|
||||||
drag_started = true
|
drag_started = true
|
||||||
# Keeps position where the dragging started
|
# Keeps position where the dragging started
|
||||||
drag_start_position = (
|
drag_start_position = (
|
||||||
event.position + Vector2i(h_slider.value, v_slider.value) * palette_grid.swatch_size
|
event.position + Vector2(h_slider.value, v_slider.value) * palette_grid.swatch_size
|
||||||
)
|
)
|
||||||
|
|
||||||
if event is InputEventMouseMotion and drag_started:
|
if event is InputEventMouseMotion and drag_started:
|
||||||
|
|
|
@ -14,7 +14,7 @@ vec4 swap_color(vec4 color) {
|
||||||
|
|
||||||
int n_of_colors = textureSize(palette_texture, 0).x;
|
int n_of_colors = textureSize(palette_texture, 0).x;
|
||||||
int color_index = find_index(color, n_of_colors, palette_texture);
|
int color_index = find_index(color, n_of_colors, palette_texture);
|
||||||
return texture(palette_texture, vec2(float(color_index) / float(n_of_colors), 0.0));
|
return texelFetch(palette_texture, ivec2(color_index, 0), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
|
|
|
@ -2,8 +2,7 @@ int find_index(vec4 color, int n_of_colors, sampler2D palette_texture) {
|
||||||
int color_index = 0;
|
int color_index = 0;
|
||||||
float smaller_distance = distance(color, texture(palette_texture, vec2(0.0)));
|
float smaller_distance = distance(color, texture(palette_texture, vec2(0.0)));
|
||||||
for (int i = 0; i <= n_of_colors; i++) {
|
for (int i = 0; i <= n_of_colors; i++) {
|
||||||
vec2 uv = vec2(float(i) / float(n_of_colors), 0.0);
|
vec4 palette_color = texelFetch(palette_texture, ivec2(i, 0), 0);
|
||||||
vec4 palette_color = texture(palette_texture, uv);
|
|
||||||
float dist = distance(color, palette_color);
|
float dist = distance(color, palette_color);
|
||||||
if (dist < smaller_distance) {
|
if (dist < smaller_distance) {
|
||||||
smaller_distance = dist;
|
smaller_distance = dist;
|
||||||
|
|
|
@ -7,16 +7,16 @@ uniform sampler2D palette_texture : filter_nearest;
|
||||||
uniform sampler2D indices_texture : filter_nearest;
|
uniform sampler2D indices_texture : filter_nearest;
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
float index = texture(indices_texture, UV).r;
|
float index = texture(indices_texture, UV).r * 255.0;
|
||||||
if (index <= EPSILON) { // If index is zero, make it transparent
|
if (index <= EPSILON) { // If index is zero, make it transparent
|
||||||
COLOR = vec4(0.0);
|
COLOR = vec4(0.0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
float n_of_colors = float(textureSize(palette_texture, 0).x);
|
float n_of_colors = float(textureSize(palette_texture, 0).x);
|
||||||
index -= 1.0 / 255.0;
|
index -= 1.0;
|
||||||
float index_normalized = ((index * 255.0)) / n_of_colors;
|
float index_normalized = index / n_of_colors;
|
||||||
if (index_normalized + EPSILON < 1.0) {
|
if (index < n_of_colors) {
|
||||||
COLOR = texture(palette_texture, vec2(index_normalized + EPSILON, 0.0));
|
COLOR = texelFetch(palette_texture, ivec2(int(index), 0), 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If index is bigger than the size of the palette, make it transparent.
|
// If index is bigger than the size of the palette, make it transparent.
|
||||||
|
|
|
@ -8,7 +8,7 @@ uniform sampler2D palette_texture : filter_nearest;
|
||||||
|
|
||||||
void fragment() {
|
void fragment() {
|
||||||
vec4 color = texture(rgb_texture, UV);
|
vec4 color = texture(rgb_texture, UV);
|
||||||
if (color.a <= 0.01) {
|
if (color.a <= 0.0001) {
|
||||||
COLOR.r = 0.0;
|
COLOR.r = 0.0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -269,9 +269,11 @@ func fill_in_selection() -> void:
|
||||||
var selection_map_copy := project.selection_map.return_cropped_copy(project.size)
|
var selection_map_copy := project.selection_map.return_cropped_copy(project.size)
|
||||||
for image in images:
|
for image in images:
|
||||||
image.blit_rect_mask(filler, selection_map_copy, rect, rect.position)
|
image.blit_rect_mask(filler, selection_map_copy, rect, rect.position)
|
||||||
|
image.convert_rgb_to_indexed()
|
||||||
else:
|
else:
|
||||||
for image in images:
|
for image in images:
|
||||||
image.fill(tool_slot.color)
|
image.fill(tool_slot.color)
|
||||||
|
image.convert_rgb_to_indexed()
|
||||||
else:
|
else:
|
||||||
# End early if we are filling with an empty pattern
|
# End early if we are filling with an empty pattern
|
||||||
var pattern_image: Image = _pattern.image
|
var pattern_image: Image = _pattern.image
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=6 format=3 uid="uid://ct4o5i1jeul3k"]
|
[gd_scene load_steps=6 format=3 uid="uid://bdregpkflev7u"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1_1q6ub"]
|
[ext_resource type="PackedScene" uid="uid://ctfgfelg0sho8" path="res://src/Tools/BaseTool.tscn" id="1_1q6ub"]
|
||||||
[ext_resource type="Script" path="res://src/Tools/UtilityTools/Text.gd" id="2_ql5g6"]
|
[ext_resource type="Script" path="res://src/Tools/UtilityTools/Text.gd" id="2_ql5g6"]
|
||||||
|
@ -63,6 +63,8 @@ stretch_margin_bottom = 3
|
||||||
script = ExtResource("3_tidsq")
|
script = ExtResource("3_tidsq")
|
||||||
prefix = "Size:"
|
prefix = "Size:"
|
||||||
suffix = "px"
|
suffix = "px"
|
||||||
|
global_increment_action = "brush_size_increment"
|
||||||
|
global_decrement_action = "brush_size_decrement"
|
||||||
|
|
||||||
[node name="GridContainer" type="GridContainer" parent="." index="4"]
|
[node name="GridContainer" type="GridContainer" parent="." index="4"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
|
@ -808,9 +808,11 @@ func delete(selected_cels := true) -> void:
|
||||||
image.blit_rect_mask(
|
image.blit_rect_mask(
|
||||||
blank, selection_map_copy, big_bounding_rectangle, big_bounding_rectangle.position
|
blank, selection_map_copy, big_bounding_rectangle, big_bounding_rectangle.position
|
||||||
)
|
)
|
||||||
|
image.convert_rgb_to_indexed()
|
||||||
else:
|
else:
|
||||||
for image in images:
|
for image in images:
|
||||||
image.fill(0)
|
image.fill(0)
|
||||||
|
image.convert_rgb_to_indexed()
|
||||||
commit_undo("Draw", undo_data_tmp)
|
commit_undo("Draw", undo_data_tmp)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -421,7 +421,6 @@ func _setup_color_mode_submenu(item: String) -> void:
|
||||||
color_mode_submenu.add_radio_check_item("RGBA", ColorModes.RGBA)
|
color_mode_submenu.add_radio_check_item("RGBA", ColorModes.RGBA)
|
||||||
color_mode_submenu.set_item_checked(ColorModes.RGBA, true)
|
color_mode_submenu.set_item_checked(ColorModes.RGBA, true)
|
||||||
color_mode_submenu.add_radio_check_item("Indexed", ColorModes.INDEXED)
|
color_mode_submenu.add_radio_check_item("Indexed", ColorModes.INDEXED)
|
||||||
color_mode_submenu.hide_on_checkable_item_selection = false
|
|
||||||
|
|
||||||
color_mode_submenu.id_pressed.connect(_color_mode_submenu_id_pressed)
|
color_mode_submenu.id_pressed.connect(_color_mode_submenu_id_pressed)
|
||||||
image_menu.add_child(color_mode_submenu)
|
image_menu.add_child(color_mode_submenu)
|
||||||
|
|
Loading…
Add table
Reference in a new issue