mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Allow clipping to selection during export (#1113)
* Allow clipping to selection during export * linting * removed shader
This commit is contained in:
parent
564b199fa9
commit
b350f436c6
|
@ -52,6 +52,7 @@ var blended_frames := {}
|
|||
var export_json := false
|
||||
var split_layers := false
|
||||
var trim_images := false
|
||||
var erase_unselected_area := false
|
||||
|
||||
# Spritesheet options
|
||||
var orientation := Orientation.COLUMNS
|
||||
|
@ -288,6 +289,13 @@ 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 erase_unselected_area and project.has_selection:
|
||||
var crop := Image.create(project.size.x, project.size.y, false, Image.FORMAT_RGBA8)
|
||||
var selection_image = project.selection_map.return_cropped_copy(project.size)
|
||||
crop.blit_rect_mask(
|
||||
image, selection_image, Rect2i(Vector2i.ZERO, image.get_size()), Vector2i.ZERO
|
||||
)
|
||||
image.copy_from(crop)
|
||||
if trim_images:
|
||||
image = image.get_region(image.get_used_rect())
|
||||
var duration := frame.duration * (1.0 / project.fps)
|
||||
|
|
|
@ -464,6 +464,12 @@ func _on_trim_images_toggled(toggled_on: bool) -> void:
|
|||
set_preview()
|
||||
|
||||
|
||||
func _on_clip_images_selection_toggled(toggled_on: bool) -> void:
|
||||
Export.erase_unselected_area = toggled_on
|
||||
Export.process_data()
|
||||
set_preview()
|
||||
|
||||
|
||||
func _on_frames_item_selected(id: int) -> void:
|
||||
Export.frame_current_tag = id
|
||||
Export.process_data()
|
||||
|
|
|
@ -324,6 +324,12 @@ tooltip_text = "Trims the exported images to their visible portion, considering
|
|||
mouse_default_cursor_shape = 2
|
||||
text = "Trim images"
|
||||
|
||||
[node name="ClipSelection" type="CheckBox" parent="VBoxContainer/VSplitContainer/VBoxContainer/AdvancedOptions/GridContainer" groups=["ExportImageOptions"]]
|
||||
layout_mode = 2
|
||||
tooltip_text = "Only shows content that is within the bounds of a selected area."
|
||||
mouse_default_cursor_shape = 2
|
||||
text = "Clip image content to selection"
|
||||
|
||||
[node name="PathDialog" type="FileDialog" parent="." groups=["FileDialogs"]]
|
||||
mode = 2
|
||||
title = "Open a Directory"
|
||||
|
@ -379,6 +385,7 @@ size_flags_horizontal = 3
|
|||
[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/ClipSelection" to="." method="_on_clip_images_selection_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"]
|
||||
|
|
Loading…
Reference in a new issue