Page MenuHome

[WIP] Compositor: Add position to operations
Needs ReviewPublic

Authored by Manuel Castilla (manzanilla) on Jul 2 2021, 2:19 AM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

In current compositor is possible to translate/scale/rotate within buffered groups, taking effect at the end.
On full frame implementation all operations are buffered and take effect inmediatelly, causing image cropping
in these cases because they need to change their resolution and position to contain the result.

This patch replaces operations concept of "resolution" by "canvas" to include position.
Same logic for determining resolutions is kept for determining canvases. ResizeMode works the same way.
Operations may pick any ResizeMode but they must always work in the same position than its input. If it's not the case,
input canvas will be translated to match position (but pixels won't, which may correctly cause cropping).
Currently the only exceptions are translate operations themselves.

Two translate operations:

  • TranslateOperation: Moves input pixels to a new canvas with different position and/or size. Pixels relative position may change. Only used to adapt an input operation canvas to its linked when they are different.
  • TranslateCanvasOperation: Moves input pixels to a new canvas with different position but same size. Pixels keep their relative position. Used by translate node or any other that needs translation.

Notes:
I've looked into implementing the concept of adding positions/offsets
separately from determineResolution, but the logic needed is almost the same
if we don't want to introduce breaking changes. Determining canvas deduplicates it.

All these changes should not break tiled implementation.
Tests are passing at the moment.

Reminders to keep things working as expected:

  • All input operations with sources (images, videos...) must have (0, 0) position.
  • Most generated inputs should have output preferred position.
  • Output operations position must be (0, 0), except Viewer that has same canvas than input.

TODO:

  • Implement determine_canvas for all inputs and outputs. Only tested ImageOperation and CompositeOperation.
  • Same for Scale, Rotate, Transform and Crop.

Diff Detail

Repository
rB Blender
Branch
cmp-canvas (branched from master)
Build Status
Buildable 15552
Build 15552: arc lint + arc unit