Skip to content

New selection transformation system - #1245

Merged
OverloadedOrama merged 64 commits into
Orama-Interactive:masterfrom
OverloadedOrama:selection-rotation
May 23, 2025
Merged

New selection transformation system#1245
OverloadedOrama merged 64 commits into
Orama-Interactive:masterfrom
OverloadedOrama:selection-rotation

Conversation

@OverloadedOrama

@OverloadedOrama OverloadedOrama commented May 20, 2025

Copy link
Copy Markdown
Member

Completely remade the selection transformation system in order to finally support selection rotation & shearing, with the option to change the pivot. I first made the new system in a separate project (https://github.com/OverloadedOrama/TransformHandles2D) and then implemented it to Pixelorama.

Peek 2025-05-21 20-08

Users can choose between Nearest Neighbor, cleanEdge and OmniScale transformation algorithms. Rotxel is not supported because it works with an angle value and not a matrix.

Transforming a selection without image content now acts the same as transforming with image content, meaning that you need to confirm the change, and you are able to cancel it.

Fixes:

  • The canvas rotation now affects the direction of the arrow keys
  • Applying the bucket now confirms transformation
  • Transformed content no longer gets lost when pressing Control + arrow key
  • Fix bug where pasting images from the clipboard sometimes did not work, due to them being in different formats than the project image.

Tested:

  • ✅ Resizing from all 8 handles,
  • ✅ Resizing while holding Shift and/or Control
  • ✅ Moving with the selection tool
  • ✅ Moving with the move tool
  • ✅ Moving with the selection tool while holding Shift and/or Control
  • ✅ Moving with the move tool while holding Shift and/or Control
  • ✅ Rotating from all 4 handles
  • ✅ Skewing from all 4 handles
  • ✅ Handles work as expected if the image is flipped
  • ✅ Handles work as expected if the image is rotated/skewed
  • ✅ Transforming selections without content
  • ✅ Transforming selections with content
  • ✅ Transforming non-rectangular selection should have a correct position
  • ✅ Handles work as expected if the canvas is flipped
  • ✅ Movement with arrow keys
  • ✅ Only move selection when Alt is pressed Input.is_action_pressed(&"transform_move_selection_only")
  • ✅ Draw tiles mode in rectangular tilemap layers
  • ✅ Undo/redo
  • ✅ Copy
  • ✅ Paste
  • ✅ Delete
  • ✅ Create brushes
  • ✅ Change position, size, rotation and skewing from the tool options
  • ✅ Transform in multiple selected cels
  • ✅ Project switching when a transformation is active
  • ✅ Crop to selection
  • ✅ Fill selection with bucket
  • ✅ Modify selection from Selection menu
  • ✅ Quick copy

The idea is to remove all transformation-related code from Selection.gd and bring it to the new script instead.
…been resized from the left or the top

And sometimes when it was moved. Order of matrix multiplications matter, even if it's a matrix multiplied with a vector.
Not working yet, full of errors. This is going to be a pain.
Selection tools work, but trying to move a selection crashes, which is to be expected.
No preview while transforming yet
Content is not being cut yet when starting moving, and the rest of the transformation types need to call begin_transform. The confirm and cancel buttons in the tool options do not appear correctly, and the preview is wrong, it needs to be rotated and applied to the image, similar to the selection map
…utside of a selected pixel, but inside the bounding rectangle
…egative coords

The content's offset is wrong though, it starts at the top-left position of the selection.
… matrix is the exact same as the original one
Need to fix undo/redo for it to work properly
Does not work 100% of the time, it gives errors sometimes, but it's better than before. Unlike the previous resize system, the transform matrix has its own space instead of being in the canvas space, so clamping its position is trickier.
Remove more references to the now removed big_bounding_rectangle
…making a new selection while a transformation is active
… + arrow key

This is a bug from the master branch.
Does not work properly with the transformation handles though
@OverloadedOrama
OverloadedOrama merged commit 23a1912 into Orama-Interactive:master May 23, 2025
@OverloadedOrama
OverloadedOrama deleted the selection-rotation branch May 23, 2025 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant