Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-08-25 01:40:18 +0300
committerHans Goudey <h.goudey@me.com>2021-08-25 01:40:18 +0300
commit137a5e162c2435662dbb299ff49771e7d2e7598f (patch)
treea40ebf526c1a320c7a9fa0c8456dfe2ffd4db6a6 /source/blender/compositor/nodes/COM_Stabilize2dNode.cc
parentaad18a005026cfaa19c45f2477318c6e06303eae (diff)
parent5ef3afd87c54b47614254d95c9b2e9a17c60f76e (diff)
Merge branch 'master' into refactor-idprop-ui-data
Diffstat (limited to 'source/blender/compositor/nodes/COM_Stabilize2dNode.cc')
-rw-r--r--source/blender/compositor/nodes/COM_Stabilize2dNode.cc100
1 files changed, 62 insertions, 38 deletions
diff --git a/source/blender/compositor/nodes/COM_Stabilize2dNode.cc b/source/blender/compositor/nodes/COM_Stabilize2dNode.cc
index 0262f653d1a..7b2388bebca 100644
--- a/source/blender/compositor/nodes/COM_Stabilize2dNode.cc
+++ b/source/blender/compositor/nodes/COM_Stabilize2dNode.cc
@@ -22,6 +22,7 @@
#include "COM_RotateOperation.h"
#include "COM_ScaleOperation.h"
#include "COM_SetSamplerOperation.h"
+#include "COM_TransformOperation.h"
#include "COM_TranslateOperation.h"
#include "BKE_tracking.h"
@@ -42,18 +43,12 @@ void Stabilize2dNode::convertToOperations(NodeConverter &converter,
NodeInput *imageInput = this->getInputSocket(0);
MovieClip *clip = (MovieClip *)editorNode->id;
bool invert = (editorNode->custom2 & CMP_NODEFLAG_STABILIZE_INVERSE) != 0;
+ const PixelSampler sampler = (PixelSampler)editorNode->custom1;
- ScaleRelativeOperation *scaleOperation = new ScaleRelativeOperation();
- scaleOperation->setSampler((PixelSampler)editorNode->custom1);
- RotateOperation *rotateOperation = new RotateOperation();
- rotateOperation->setDoDegree2RadConversion(false);
- TranslateOperation *translateOperation = new TranslateOperation();
MovieClipAttributeOperation *scaleAttribute = new MovieClipAttributeOperation();
MovieClipAttributeOperation *angleAttribute = new MovieClipAttributeOperation();
MovieClipAttributeOperation *xAttribute = new MovieClipAttributeOperation();
MovieClipAttributeOperation *yAttribute = new MovieClipAttributeOperation();
- SetSamplerOperation *psoperation = new SetSamplerOperation();
- psoperation->setSampler((PixelSampler)editorNode->custom1);
scaleAttribute->setAttribute(MCA_SCALE);
scaleAttribute->setFramenumber(context.getFramenumber());
@@ -79,38 +74,67 @@ void Stabilize2dNode::convertToOperations(NodeConverter &converter,
converter.addOperation(angleAttribute);
converter.addOperation(xAttribute);
converter.addOperation(yAttribute);
- converter.addOperation(scaleOperation);
- converter.addOperation(translateOperation);
- converter.addOperation(rotateOperation);
- converter.addOperation(psoperation);
- converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1));
- converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2));
-
- converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1));
-
- converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1));
- converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2));
-
- converter.mapOutputSocket(getOutputSocket(), psoperation->getOutputSocket());
-
- if (invert) {
- // Translate -> Rotate -> Scale.
- converter.mapInputSocket(imageInput, translateOperation->getInputSocket(0));
-
- converter.addLink(translateOperation->getOutputSocket(), rotateOperation->getInputSocket(0));
- converter.addLink(rotateOperation->getOutputSocket(), scaleOperation->getInputSocket(0));
-
- converter.addLink(scaleOperation->getOutputSocket(), psoperation->getInputSocket(0));
- }
- else {
- // Scale -> Rotate -> Translate.
- converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0));
-
- converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0));
- converter.addLink(rotateOperation->getOutputSocket(), translateOperation->getInputSocket(0));
-
- converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0));
+ switch (context.get_execution_model()) {
+ case eExecutionModel::Tiled: {
+ ScaleRelativeOperation *scaleOperation = new ScaleRelativeOperation();
+ scaleOperation->setSampler(sampler);
+ RotateOperation *rotateOperation = new RotateOperation();
+ rotateOperation->setDoDegree2RadConversion(false);
+ TranslateOperation *translateOperation = new TranslateOperation();
+ SetSamplerOperation *psoperation = new SetSamplerOperation();
+ psoperation->setSampler(sampler);
+
+ converter.addOperation(scaleOperation);
+ converter.addOperation(translateOperation);
+ converter.addOperation(rotateOperation);
+ converter.addOperation(psoperation);
+
+ converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(1));
+ converter.addLink(scaleAttribute->getOutputSocket(), scaleOperation->getInputSocket(2));
+
+ converter.addLink(angleAttribute->getOutputSocket(), rotateOperation->getInputSocket(1));
+
+ converter.addLink(xAttribute->getOutputSocket(), translateOperation->getInputSocket(1));
+ converter.addLink(yAttribute->getOutputSocket(), translateOperation->getInputSocket(2));
+
+ converter.mapOutputSocket(getOutputSocket(), psoperation->getOutputSocket());
+
+ if (invert) {
+ // Translate -> Rotate -> Scale.
+ converter.mapInputSocket(imageInput, translateOperation->getInputSocket(0));
+
+ converter.addLink(translateOperation->getOutputSocket(),
+ rotateOperation->getInputSocket(0));
+ converter.addLink(rotateOperation->getOutputSocket(), scaleOperation->getInputSocket(0));
+
+ converter.addLink(scaleOperation->getOutputSocket(), psoperation->getInputSocket(0));
+ }
+ else {
+ // Scale -> Rotate -> Translate.
+ converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0));
+
+ converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0));
+ converter.addLink(rotateOperation->getOutputSocket(),
+ translateOperation->getInputSocket(0));
+
+ converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0));
+ }
+ break;
+ }
+ case eExecutionModel::FullFrame: {
+ TransformOperation *transform_op = new TransformOperation();
+ transform_op->set_sampler(sampler);
+ transform_op->set_convert_rotate_degree_to_rad(false);
+ transform_op->set_invert(invert);
+ converter.addOperation(transform_op);
+ converter.mapInputSocket(imageInput, transform_op->getInputSocket(0));
+ converter.addLink(xAttribute->getOutputSocket(), transform_op->getInputSocket(1));
+ converter.addLink(yAttribute->getOutputSocket(), transform_op->getInputSocket(2));
+ converter.addLink(angleAttribute->getOutputSocket(), transform_op->getInputSocket(3));
+ converter.addLink(scaleAttribute->getOutputSocket(), transform_op->getInputSocket(4));
+ converter.mapOutputSocket(getOutputSocket(), transform_op->getOutputSocket());
+ }
}
}