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

Compare commits

..

3 commits

Author SHA1 Message Date
Emmanouil Papadeas 94735fc08b [skip ci] Update Translations.pot 2024-11-15 02:08:30 +02:00
Emmanouil Papadeas 8077262b32 [skip ci] Update CHANGELOG.md 2024-11-15 02:04:59 +02:00
Emmanouil Papadeas 0d6b140dea Add border selection, fix some missing translation strings 2024-11-15 01:41:44 +02:00
8 changed files with 85 additions and 17 deletions

View file

@ -11,6 +11,8 @@ Fayez Akhtar ([@Variable-ind](https://github.com/Variable-ind))
Built using Godot 4.3
### Added
- Add density to the square & circle brushes. 100% density means that the brush gets completely drawn. Anything less leaves gaps inside the brush, acting like a spray tool.
- Selection expanding, shrinking and borders have been added as options in the Select menu.
- Mouse buttons can now be used as menu shortcuts. [#1070](https://github.com/Orama-Interactive/Pixelorama/issues/1070)
- Added confirm and cancel buttons in the selection tool options to confirm/cancel an active transformation.
- OKHSL Lightness sorting in palettes has been implemented. [#1126](https://github.com/Orama-Interactive/Pixelorama/pull/1126)
@ -20,9 +22,14 @@ Built using Godot 4.3
- The Recorder panel now automatically records for the current project. This also allows for multiple projects to be recorded at the same time.
### Fixed
- Panels no longer get scrolled when using the mouse wheel over a slider.
- Fixed layer effect slider values being rounded to the nearest integer.
- Fixed memory leak where the project remained referenced by a drawing tool, even when its tab was closed.
- Fixed memory leak where the first project remained forever references in memory by the Recorder panel.
- Slightly optimize circle brushes by only calling the ellipse algorithms once while drawing
### Removed
- The Recorder panel has been removed from the Web version. It wasn't functional anyway in a way that was useful, and it's unsure if we can find a way to make it work.
## [v1.0.4] - 2024-10-25
This update has been brought to you by the contributions of:

View file

@ -205,6 +205,43 @@ msgstr ""
msgid "Invert"
msgstr ""
msgid "Modify"
msgstr ""
#. Found under the Select menu, in the Modify submenu. When selected, it shows a window that lets users expand the active selection.
msgid "Expand"
msgstr ""
#. Title of a window that lets users expand the active selection.
msgid "Expand Selection"
msgstr ""
#. Found under the Select menu, in the Modify submenu. When selected, it shows a window that lets users shrink the active selection.
msgid "Shrink"
msgstr ""
#. Title of a window that lets users shrink the active selection.
msgid "Shrink Selection"
msgstr ""
#. Found under the Select menu, in the Modify submenu. When selected, it shows a window that lets users create a border of the active selection.
msgid "Border"
msgstr ""
#. Title of a window that lets users create a border of the active selection.
msgid "Border Selection"
msgstr ""
#. Refers to a diamond-like shape.
msgid "Diamond"
msgstr ""
msgid "Circle"
msgstr ""
msgid "Square"
msgstr ""
msgid "Grayscale View"
msgstr ""
@ -2812,6 +2849,10 @@ msgstr ""
msgid "Sort by value"
msgstr ""
#. An option of the Sort palette button found in the palette panel. When selected, the colors of the palette are being sorted based on their OKHSL Lightness.
msgid "Sort by lightness"
msgstr ""
#. An option of the Sort palette button found in the palette panel. When selected, the colors of the palette are being sorted based on their red channel value.
msgid "Sort by red"
msgstr ""

View file

@ -185,22 +185,34 @@ func resize_bitmap_values(
blit_rect(smaller_image, Rect2i(Vector2i.ZERO, new_bitmap_size), dst)
func expand(width: int, pattern: int) -> void:
func expand(width: int, brush: int) -> void:
var params := {
"color": Color(1, 1, 1, 1),
"width": width,
"pattern": pattern,
"brush": brush,
}
var gen := ShaderImageEffect.new()
gen.generate_image(self, OUTLINE_INLINE_SHADER, params, get_size())
func shrink(width: int, pattern: int) -> void:
func shrink(width: int, brush: int) -> void:
var params := {
"color": Color(0),
"inside": true,
"width": width,
"pattern": pattern,
"brush": brush,
"inside": true,
}
var gen := ShaderImageEffect.new()
gen.generate_image(self, OUTLINE_INLINE_SHADER, params, get_size())
func border(width: int, brush: int) -> void:
var params := {
"color": Color(1, 1, 1, 1),
"width": width,
"brush": brush,
"inside": true,
"keep_border_only": true,
}
var gen := ShaderImageEffect.new()
gen.generate_image(self, OUTLINE_INLINE_SHADER, params, get_size())

View file

@ -4,9 +4,10 @@ render_mode unshaded;
uniform vec4 color : source_color = vec4(1.0);
uniform float width : hint_range(0, 10, 1) = 1.0;
// uniform_data pattern type:: OptionButton [Diamond||Circle||Square]
uniform int pattern : hint_range(0, 2) = 0;
// uniform_data brush type:: OptionButton [Diamond||Circle||Square]
uniform int brush : hint_range(0, 2) = 0;
uniform bool inside = false;
uniform bool keep_border_only = false;
uniform sampler2D selection : filter_nearest;
bool is_zero_approx(float num) {
@ -17,11 +18,11 @@ bool has_contrary_neighbour(vec2 uv, vec2 texture_pixel_size, sampler2D tex) {
for (float i = -ceil(width); i <= ceil(width); i++) {
float offset;
if (pattern == 0) {
if (brush == 0) {
offset = width - abs(i);
} else if (pattern == 1) {
} else if (brush == 1) {
offset = floor(sqrt(pow(width + 0.5, 2) - i * i));
} else if (pattern == 2) {
} else if (brush == 2) {
offset = width;
}
@ -51,6 +52,9 @@ void fragment() {
output.a += (1.0 - output.a) * color.a;
}
}
else if (keep_border_only) {
output.a = 0.0;
}
COLOR = mix(original_color, output, selection_color.a);
}

View file

@ -31,7 +31,7 @@ func commit_action(cel: Image, project := Global.current_project) -> void:
var params := {
"color": color,
"width": anim_thickness,
"pattern": pattern,
"brush": pattern,
"inside": inside_image,
"selection": selection_tex
}

View file

@ -51,16 +51,15 @@ size_flags_horizontal = 3
[node name="PatternLabel" type="Label" parent="VBoxContainer/OutlineOptions" index="4"]
layout_mode = 2
size_flags_horizontal = 3
text = "Pattern:"
text = "Brush:"
[node name="PatternOptionButton" type="OptionButton" parent="VBoxContainer/OutlineOptions" index="5"]
layout_mode = 2
size_flags_horizontal = 3
mouse_default_cursor_shape = 2
item_count = 3
selected = 0
item_count = 3
popup/item_0/text = "Diamond"
popup/item_0/id = 0
popup/item_1/text = "Circle"
popup/item_1/id = 1
popup/item_2/text = "Square"

View file

@ -1,14 +1,16 @@
extends ConfirmationDialog
enum Types { EXPAND, SHRINK }
enum Types { EXPAND, SHRINK, BORDER }
@export var type := Types.EXPAND:
set(value):
type = value
if type == Types.EXPAND:
title = "Expand Selection"
else:
elif type == Types.SHRINK:
title = "Shrink Selection"
else:
title = "Border Selection"
@onready var width_slider: ValueSlider = $GridContainer/WidthSlider
@onready var brush_option_button: OptionButton = $GridContainer/BrushOptionButton
@ -31,8 +33,10 @@ func _on_confirmed() -> void:
project.selection_map.crop(project.size.x, project.size.y)
if type == Types.EXPAND:
project.selection_map.expand(width, brush)
else:
elif type == Types.SHRINK:
project.selection_map.shrink(width, brush)
else:
project.selection_map.border(width, brush)
selection_node.big_bounding_rectangle = project.selection_map.get_used_rect()
project.selection_offset = Vector2.ZERO
selection_node.commit_undo("Modify Selection", undo_data_tmp)

View file

@ -460,6 +460,7 @@ func _setup_selection_modify_submenu(item: String) -> void:
selection_modify_submenu.set_name("selection_modify_submenu")
selection_modify_submenu.add_item("Expand")
selection_modify_submenu.add_item("Shrink")
selection_modify_submenu.add_item("Border")
selection_modify_submenu.id_pressed.connect(_selection_modify_submenu_id_pressed)
select_menu.add_child(selection_modify_submenu)
select_menu.add_submenu_item(item, selection_modify_submenu.get_name())