1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Selection fixes (#527)

* Fix for multiple cel selection issue

Now it will only apply selection to the selected cels that are **visible and unlocked**

* Fix for loss of selection data

This will hopefully fix the selection data loss on toggling layer buttons
This commit is contained in:
Variable 2021-08-30 15:24:48 +05:00 committed by GitHub
parent c29254c2e8
commit 75059b5b12
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View file

@ -472,17 +472,18 @@ func transform_content_confirm() -> void:
var frame : int = cel_index[0]
var layer : int = cel_index[1]
if frame < project.frames.size() and layer < project.layers.size():
var cel_image : Image = project.frames[frame].cels[layer].image
var src : Image = preview_image
if not is_pasting and not (frame == project.current_frame and layer == project.current_layer):
src = get_selected_image(cel_image, clear_in_selected_cels)
src.resize(big_bounding_rectangle.size.x, big_bounding_rectangle.size.y, Image.INTERPOLATE_NEAREST)
if temp_rect.size.x < 0:
src.flip_x()
if temp_rect.size.y < 0:
src.flip_y()
if Global.current_project.layers[layer].can_layer_get_drawn():
var cel_image : Image = project.frames[frame].cels[layer].image
var src : Image = preview_image
if not is_pasting and not (frame == project.current_frame and layer == project.current_layer):
src = get_selected_image(cel_image, clear_in_selected_cels)
src.resize(big_bounding_rectangle.size.x, big_bounding_rectangle.size.y, Image.INTERPOLATE_NEAREST)
if temp_rect.size.x < 0:
src.flip_x()
if temp_rect.size.y < 0:
src.flip_y()
cel_image.blit_rect_mask(src, src, Rect2(Vector2.ZERO, project.selection_bitmap.get_size()), big_bounding_rectangle.position)
cel_image.blit_rect_mask(src, src, Rect2(Vector2.ZERO, project.selection_bitmap.get_size()), big_bounding_rectangle.position)
var selected_bitmap_copy = project.selection_bitmap.duplicate()
project.move_bitmap_values(selected_bitmap_copy)
project.selection_bitmap = selected_bitmap_copy

View file

@ -94,15 +94,18 @@ func save_layer_name(new_name : String) -> void:
func _on_VisibilityButton_pressed() -> void:
Global.canvas.selection.transform_content_confirm()
Global.current_project.layers[layer].visible = !Global.current_project.layers[layer].visible
Global.canvas.update()
func _on_LockButton_pressed() -> void:
Global.canvas.selection.transform_content_confirm()
Global.current_project.layers[layer].locked = !Global.current_project.layers[layer].locked
func _on_LinkButton_pressed() -> void:
Global.canvas.selection.transform_content_confirm()
Global.current_project.layers[layer].new_cels_linked = !Global.current_project.layers[layer].new_cels_linked
if Global.current_project.layers[layer].new_cels_linked && !Global.current_project.layers[layer].linked_cels:
# If button is pressed and there are no linked cels in the layer