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

Compare commits

..

No commits in common. "3bd7e94a5951be5f0d3a3bc93fa2e099d1cf7e41" and "a5efb97d58dd72ec79a4c1e9a0ea2ff066e9776b" have entirely different histories.

8 changed files with 70 additions and 79 deletions

View file

@ -2649,14 +2649,6 @@ msgstr ""
msgid "The character(s) that separate the file name and the frame number"
msgstr ""
#. Found in the export dialog. It is an option that removes the transparent area around non-transparent pixels of the exported images.
msgid "Trim images"
msgstr ""
#. Found in the export dialog. Tooltip of the "trim images" option.
msgid "Trims the exported images to their visible portion, considering each pixel with a non-zero alpha channel as visible."
msgstr ""
msgid "Close"
msgstr ""

View file

@ -51,7 +51,7 @@ var processed_images: Array[ProcessedImage] = []
var blended_frames := {}
var export_json := false
var split_layers := false
var trim_images := false
var trim_sprite := false
# Spritesheet options
var orientation := Orientation.COLUMNS
@ -146,9 +146,6 @@ func external_export(project := Global.current_project) -> void:
func process_data(project := Global.current_project) -> void:
var frames := _calculate_frames(project)
if frames.size() > blended_frames.size():
cache_blended_frames(project)
match current_tab:
ExportTab.IMAGE:
process_animation(project)
@ -269,6 +266,7 @@ func process_spritesheet(project := Global.current_project) -> void:
origin.x = 0
tag_origins[0] += 1
whole_image.blend_rect(blended_frames[frame], Rect2i(Vector2i.ZERO, project.size), origin)
#_blend_layers(whole_image, frame, origin)
processed_images.append(ProcessedImage.new(whole_image, 0))
@ -288,7 +286,7 @@ func process_animation(project := Global.current_project) -> void:
else:
var image := Image.create(project.size.x, project.size.y, false, Image.FORMAT_RGBA8)
image.copy_from(blended_frames[frame])
if trim_images:
if trim_sprite:
image = image.get_region(image.get_used_rect())
var duration := frame.duration * (1.0 / project.fps)
processed_images.append(ProcessedImage.new(image, project.frames.find(frame), duration))

View file

@ -216,7 +216,7 @@ func insert_color(index: int, new_color: Color) -> void:
var c := PaletteColor.new(new_color, index)
# If insert happens on non empty swatch recursively move the original color
# and every other color to its right one swatch to right
if colors.has(index):
if colors[index] != null:
_move_right(index)
colors[index] = c
data_changed.emit()
@ -231,7 +231,7 @@ func _move_right(index: int) -> void:
colors_max = width * height
# If swatch to right to this color is not empty move that color right too
if colors.has(index + 1):
if colors[index + 1] != null:
_move_right(index + 1)
colors[index + 1] = colors[index]

View file

@ -9,7 +9,7 @@ uniform float blur_radius = 1.0;
uniform vec2 blur_direction = vec2(1, 1);
uniform sampler2D selection : filter_nearest;
// Xor's gaussian blur function
// Xor's gaussian blur function
// Link: https://xorshaders.weebly.com/tutorials/blur-shaders-5-part-2
// Defaults from: https://www.shadertoy.com/view/Xltfzj
//
@ -18,12 +18,12 @@ uniform sampler2D selection : filter_nearest;
// BLUR QUALITY (Default 4.0 - More is better but slower)
//
// Desc.: Don't have the best performance but will run on almost
// anything, although, if developing for mobile, is better to use
// anything, although, if developing for mobile, is better to use
// 'texture_nodevgaussian(...) instead'.
vec4 texture_xorgaussian(sampler2D tex, vec2 uv, vec2 pixel_size, float blurriness, int iterations, int quality) {
vec2 radius = blurriness / (1.0 / pixel_size).xy;
vec4 blurred_tex = texture(tex, uv);
for(float d = 0.0; d < TAU; d += TAU / float(iterations)) {
for(float i = 1.0 / float(quality); i <= 1.0; i += 1.0 / float(quality)) {
vec2 directions = uv + vec2(cos(d), sin(d)) * radius * i;
@ -31,7 +31,7 @@ vec4 texture_xorgaussian(sampler2D tex, vec2 uv, vec2 pixel_size, float blurrine
}
}
blurred_tex /= float(quality) * float(iterations) + 1.0;
return blurred_tex;
}
@ -42,14 +42,14 @@ vec4 texture_xorgaussian(sampler2D tex, vec2 uv, vec2 pixel_size, float blurrine
// BLUR DIRECTION (Direction in which the blur is applied, use vec2(1, 0) for first pass and vec2(0, 1) for second pass)
//
// Desc.: ACTUALLY PRETTY SLOW but still pretty good for custom cinematic
// bloom effects, since this needs render 2 passes
// bloom effects, since this needs render 2 passes
vec4 texture_monksgaussian_multipass(sampler2D tex, vec2 uv, vec2 pixel_size, int iterations, vec2 direction) {
vec4 blurred_tex = vec4(0.0);
vec2 resolution = 1.0 / pixel_size;
for (int i = 0; i < iterations; i++ ) {
float size = float(iterations - i);
vec2 off1 = vec2(1.3846153846) * (direction * size);
vec2 off2 = vec2(3.2307692308) * (direction * size);
@ -59,9 +59,9 @@ vec4 texture_monksgaussian_multipass(sampler2D tex, vec2 uv, vec2 pixel_size, in
blurred_tex += texture(tex, uv + (off2 / resolution)) * 0.0702702703;
blurred_tex += texture(tex, uv - (off2 / resolution)) * 0.0702702703;
}
blurred_tex /= float(iterations) + 1.0;
return blurred_tex;
}
@ -89,7 +89,7 @@ vec4 texture_nodevgaussian_singlepass(sampler2D tex, vec2 uv, vec2 pixel_size, f
if (i > 0.0) {n -= 0.0015; }
weight += n;
}
float norm = 1.0 / weight;
blurred_tex *= norm;
return blurred_tex;
@ -99,7 +99,7 @@ vec4 texture_nodevgaussian_multipass(sampler2D tex, vec2 uv, vec2 pixel_size, fl
float n = 0.0015;
vec4 blurred_tex = vec4(0);
float weight;
for (float i = -blurriness; i <= blurriness; i++) {
vec2 directions = uv + pixel_size * (direction * i);
blurred_tex += texture(tex, directions) * n;
@ -107,7 +107,7 @@ vec4 texture_nodevgaussian_multipass(sampler2D tex, vec2 uv, vec2 pixel_size, fl
if (i > 0.0) {n -= 0.0015; }
weight += n;
}
float norm = 1.0 / weight;
blurred_tex *= norm;
return blurred_tex;
@ -120,19 +120,19 @@ void fragment() {
if (blur_type == 0) {
vec4 xorgaussian = texture_xorgaussian(TEXTURE, UV, TEXTURE_PIXEL_SIZE, float(blur_amount), 16, 4);
col = xorgaussian;
}
}
else if (blur_type == 1) {
vec4 monksgaussian_multipass = texture_monksgaussian_multipass(TEXTURE, UV, TEXTURE_PIXEL_SIZE, blur_amount, blur_direction);
col = monksgaussian_multipass;
}
}
else if (blur_type == 2) {
vec4 nodevgaussian_singlepass = texture_nodevgaussian_singlepass(TEXTURE, UV, TEXTURE_PIXEL_SIZE, float(blur_amount), blur_radius);
col = nodevgaussian_singlepass;
}
}
else if (blur_type == 3) {
vec4 nodevgaussian_multipass = texture_nodevgaussian_multipass(TEXTURE, UV, TEXTURE_PIXEL_SIZE, float(blur_amount), blur_direction);
col = nodevgaussian_multipass;
}
}
else {
col = texture(TEXTURE, UV);
}

View file

@ -10,7 +10,7 @@ uniform bool alpha = false;
// respectively instead of color components.
// When you draw, color will be taken from the x-y position in the "Map Texture".
// (end DESCRIPTION)
void fragment() {
void fragment(){
vec4 col = texture(TEXTURE, UV);
vec2 map_size = vec2(textureSize(map_texture, 0));
vec2 lookup_uv = vec2(round(col.x * 255.0)/(map_size.x), round(col.y * 255.0)/(map_size.y));

View file

@ -269,7 +269,7 @@ func set_export_progress_bar(value: float) -> void:
export_progress_bar.value = value
func _on_about_to_popup() -> void:
func _on_ExportDialog_about_to_show() -> void:
get_ok_button().text = "Export"
Global.canvas.selection.transform_content_confirm()
var project := Global.current_project
@ -297,12 +297,12 @@ func _on_about_to_popup() -> void:
checker.size = checker.get_parent().size
func _on_tab_bar_tab_clicked(tab: Export.ExportTab) -> void:
func _on_Tabs_tab_clicked(tab: Export.ExportTab) -> void:
Export.current_tab = tab
show_tab()
func _on_orientation_item_selected(id: Export.Orientation) -> void:
func _on_Orientation_item_selected(id: Export.Orientation) -> void:
Export.orientation = id
_handle_orientation_ui()
spritesheet_lines_count.value = Export.frames_divided_by_spritesheet_lines()
@ -325,14 +325,14 @@ func _handle_orientation_ui() -> void:
spritesheet_lines_count.visible = false
func _on_lines_count_value_changed(value: float) -> void:
func _on_LinesCount_value_changed(value: float) -> void:
Export.lines_count = value
Export.process_spritesheet()
update_dimensions_label()
set_preview()
func _on_direction_item_selected(id: Export.AnimationDirection) -> void:
func _on_Direction_item_selected(id: Export.AnimationDirection) -> void:
Export.direction = id
preview_current_frame = 0
Export.process_data()
@ -340,7 +340,7 @@ func _on_direction_item_selected(id: Export.AnimationDirection) -> void:
update_dimensions_label()
func _on_resize_value_changed(value: float) -> void:
func _on_Resize_value_changed(value: float) -> void:
Export.resize = value
update_dimensions_label()
@ -349,25 +349,25 @@ func _on_quality_value_changed(value: float) -> void:
Export.save_quality = value / 100.0
func _on_interpolation_item_selected(id: Image.Interpolation) -> void:
func _on_Interpolation_item_selected(id: Image.Interpolation) -> void:
Export.interpolation = id
func _on_confirmed() -> void:
func _on_ExportDialog_confirmed() -> void:
Global.current_project.export_overwrite = false
if await Export.export_processed_images(false, self, Global.current_project):
hide()
func _on_path_button_pressed() -> void:
func _on_PathButton_pressed() -> void:
path_dialog_popup.popup_centered()
func _on_path_line_edit_text_changed(new_text: String) -> void:
func _on_PathLineEdit_text_changed(new_text: String) -> void:
Global.current_project.export_directory_path = new_text
func _on_file_line_edit_text_changed(new_text: String) -> void:
func _on_FileLineEdit_text_changed(new_text: String) -> void:
Global.current_project.file_name = new_text
@ -387,7 +387,7 @@ func _on_path_dialog_canceled() -> void:
show()
func _on_file_format_item_selected(idx: int) -> void:
func _on_FileFormat_item_selected(idx: int) -> void:
var id := file_format_options.get_item_id(idx) as Export.FileFormat
Global.current_project.file_format = id
if not Export.is_single_file_format():
@ -405,14 +405,14 @@ func _on_file_format_item_selected(idx: int) -> void:
## Overwrite existing file
func _on_file_exists_alert_confirmed() -> void:
func _on_FileExistsAlert_confirmed() -> void:
file_exists_alert_popup.dialog_text = Export.file_exists_alert
Export.stop_export = false
resume_export_function.emit()
func _on_file_exists_alert_custom_action(action: StringName) -> void:
if action == &"cancel":
func _on_FileExistsAlert_custom_action(action: String) -> void:
if action == "cancel":
# Cancel export
file_exists_alert_popup.dialog_text = Export.file_exists_alert
Export.stop_export = true
@ -420,7 +420,7 @@ func _on_file_exists_alert_custom_action(action: StringName) -> void:
file_exists_alert_popup.hide()
func _on_frame_timer_timeout() -> void:
func _on_FrameTimer_timeout() -> void:
var preview_texture_rect: TextureRect = previews.get_node("PreviewContainer/Preview")
if not preview_texture_rect:
return
@ -449,21 +449,21 @@ func _on_split_layers_toggled(toggled_on: bool) -> void:
set_preview()
func _on_include_tags_in_filename_toggled(button_pressed: bool) -> void:
func _on_IncludeTagsInFilename_toggled(button_pressed: bool) -> void:
Export.include_tag_in_filename = button_pressed
func _on_multiple_animations_directories_toggled(button_pressed: bool) -> void:
func _on_MultipleAnimationsDirectories_toggled(button_pressed: bool) -> void:
Export.new_dir_for_each_frame_tag = button_pressed
func _on_trim_images_toggled(toggled_on: bool) -> void:
Export.trim_images = toggled_on
func _on_TrimSprite_toggled(toggled_on: bool) -> void:
Export.trim_sprite = toggled_on
Export.process_data()
set_preview()
func _on_frames_item_selected(id: int) -> void:
func _on_Frames_item_selected(id: int) -> void:
Export.frame_current_tag = id
Export.process_data()
set_preview()
@ -471,12 +471,12 @@ func _on_frames_item_selected(id: int) -> void:
spritesheet_lines_count.value = Export.lines_count
func _on_layers_item_selected(id: int) -> void:
func _on_Layers_item_selected(id: int) -> void:
Export.export_layers = id
Export.cache_blended_frames()
Export.process_data()
set_preview()
func _on_separator_character_text_changed(new_text: String) -> void:
func _on_SeparatorCharacter_text_changed(new_text: String) -> void:
Export.separator_character = new_text

View file

@ -318,11 +318,11 @@ tooltip_text = "Creates multiple files but every file is stored in different fol
mouse_default_cursor_shape = 2
text = "Create new folder for each frame tag"
[node name="TrimImages" type="CheckBox" parent="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer" groups=["ExportImageOptions", "ExportMultipleFilesOptions"]]
[node name="TrimSprite" type="CheckBox" parent="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer" groups=["ExportImageOptions", "ExportMultipleFilesOptions"]]
layout_mode = 2
tooltip_text = "Trims the exported images to their visible portion, considering each pixel with a non-zero alpha channel as visible."
tooltip_text = "Trims sprite to visible portion of the spirte, considering each pixel with a non-zero alpha channel as visible."
mouse_default_cursor_shape = 2
text = "Trim images"
text = "Trim Sprite"
[node name="PathDialog" type="FileDialog" parent="." groups=["FileDialogs"]]
mode = 2
@ -358,29 +358,29 @@ size_flags_horizontal = 3
[node name="FrameTimer" type="Timer" parent="."]
[connection signal="about_to_popup" from="." to="." method="_on_about_to_popup"]
[connection signal="confirmed" from="." to="." method="_on_confirmed"]
[connection signal="tab_clicked" from="VBoxContainer/TabBar" to="." method="_on_tab_bar_tab_clicked"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Orientation" to="." method="_on_orientation_item_selected"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/LinesCount" to="." method="_on_lines_count_value_changed"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Frames" to="." method="_on_frames_item_selected"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Layers" to="." method="_on_layers_item_selected"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Direction" to="." method="_on_direction_item_selected"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Resize" to="." method="_on_resize_value_changed"]
[connection signal="about_to_popup" from="." to="." method="_on_ExportDialog_about_to_show"]
[connection signal="confirmed" from="." to="." method="_on_ExportDialog_confirmed"]
[connection signal="tab_clicked" from="VBoxContainer/TabBar" to="." method="_on_Tabs_tab_clicked"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Orientation" to="." method="_on_Orientation_item_selected"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/LinesCount" to="." method="_on_LinesCount_value_changed"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Frames" to="." method="_on_Frames_item_selected"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Layers" to="." method="_on_Layers_item_selected"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Direction" to="." method="_on_Direction_item_selected"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Resize" to="." method="_on_Resize_value_changed"]
[connection signal="value_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/GridContainer/Quality" to="." method="_on_quality_value_changed"]
[connection signal="text_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/PathLineEdit" to="." method="_on_path_line_edit_text_changed"]
[connection signal="pressed" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/PathButton" to="." method="_on_path_button_pressed"]
[connection signal="text_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/FileLineEdit" to="." method="_on_file_line_edit_text_changed"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/FileFormat" to="." method="_on_file_format_item_selected"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/Interpolation" to="." method="_on_interpolation_item_selected"]
[connection signal="text_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/SeparatorCharacter" to="." method="_on_separator_character_text_changed"]
[connection signal="text_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/PathLineEdit" to="." method="_on_PathLineEdit_text_changed"]
[connection signal="pressed" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/PathButton" to="." method="_on_PathButton_pressed"]
[connection signal="text_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/FileLineEdit" to="." method="_on_FileLineEdit_text_changed"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/FilePath/FileFormat" to="." method="_on_FileFormat_item_selected"]
[connection signal="item_selected" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/Interpolation" to="." method="_on_Interpolation_item_selected"]
[connection signal="text_changed" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/SeparatorCharacter" to="." method="_on_SeparatorCharacter_text_changed"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/ExportJSON" to="." method="_on_export_json_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/SplitLayers" to="." method="_on_split_layers_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/IncludeTagsInFilename" to="." method="_on_include_tags_in_filename_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/MultipleAnimationsDirectories" to="." method="_on_multiple_animations_directories_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/TrimImages" to="." method="_on_trim_images_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/IncludeTagsInFilename" to="." method="_on_IncludeTagsInFilename_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/MultipleAnimationsDirectories" to="." method="_on_MultipleAnimationsDirectories_toggled"]
[connection signal="toggled" from="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer/TrimSprite" to="." method="_on_TrimSprite_toggled"]
[connection signal="canceled" from="PathDialog" to="." method="_on_path_dialog_canceled"]
[connection signal="dir_selected" from="PathDialog" to="." method="_on_path_dialog_dir_selected"]
[connection signal="confirmed" from="FileExistsAlert" to="." method="_on_file_exists_alert_confirmed"]
[connection signal="custom_action" from="FileExistsAlert" to="." method="_on_file_exists_alert_custom_action"]
[connection signal="timeout" from="FrameTimer" to="." method="_on_frame_timer_timeout"]
[connection signal="confirmed" from="FileExistsAlert" to="." method="_on_FileExistsAlert_confirmed"]
[connection signal="custom_action" from="FileExistsAlert" to="." method="_on_FileExistsAlert_custom_action"]
[connection signal="timeout" from="FrameTimer" to="." method="_on_FrameTimer_timeout"]

View file

@ -8,6 +8,7 @@
[node name="GaussianBlur" instance=ExtResource("1_cuu40")]
title = "Gaussian Blur"
size = Vector2i(427, 437)
visible = true
script = ExtResource("2_37xhl")
[node name="VBoxContainer" parent="." index="3"]