Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/nodes/COM_Stabilize2dNode.cc
| Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | case eExecutionModel::Tiled: { | ||||
| converter.addLink(rotateOperation->getOutputSocket(), | converter.addLink(rotateOperation->getOutputSocket(), | ||||
| translateOperation->getInputSocket(0)); | translateOperation->getInputSocket(0)); | ||||
| converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); | converter.addLink(translateOperation->getOutputSocket(), psoperation->getInputSocket(0)); | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| case eExecutionModel::FullFrame: { | case eExecutionModel::FullFrame: { | ||||
| TransformOperation *transform_op = new TransformOperation(); | ScaleRelativeOperation *scaleOperation = new ScaleRelativeOperation(); | ||||
| transform_op->set_sampler(sampler); | scaleOperation->setSampler(sampler); | ||||
| transform_op->set_convert_rotate_degree_to_rad(false); | RotateOperation *rotateOperation = new RotateOperation(); | ||||
| transform_op->set_invert(invert); | rotateOperation->setDoDegree2RadConversion(false); | ||||
| converter.addOperation(transform_op); | rotateOperation->set_sampler(sampler); | ||||
| converter.mapInputSocket(imageInput, transform_op->getInputSocket(0)); | TranslateOperation *translateOperation = new TranslateCanvasOperation(); | ||||
| converter.addLink(xAttribute->getOutputSocket(), transform_op->getInputSocket(1)); | |||||
| converter.addLink(yAttribute->getOutputSocket(), transform_op->getInputSocket(2)); | converter.addOperation(scaleOperation); | ||||
| converter.addLink(angleAttribute->getOutputSocket(), transform_op->getInputSocket(3)); | converter.addOperation(translateOperation); | ||||
| converter.addLink(scaleAttribute->getOutputSocket(), transform_op->getInputSocket(4)); | converter.addOperation(rotateOperation); | ||||
| converter.mapOutputSocket(getOutputSocket(), transform_op->getOutputSocket()); | |||||
| 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)); | |||||
| NodeOperationInput *stabilization_socket = nullptr; | |||||
| if (invert) { | |||||
| /* Translate -> Rotate -> Scale. */ | |||||
| stabilization_socket = translateOperation->getInputSocket(0); | |||||
| converter.mapInputSocket(imageInput, translateOperation->getInputSocket(0)); | |||||
| converter.addLink(translateOperation->getOutputSocket(), | |||||
| rotateOperation->getInputSocket(0)); | |||||
| converter.addLink(rotateOperation->getOutputSocket(), scaleOperation->getInputSocket(0)); | |||||
| converter.mapOutputSocket(getOutputSocket(), scaleOperation->getOutputSocket()); | |||||
| } | |||||
| else { | |||||
| /* Scale -> Rotate -> Translate. */ | |||||
| stabilization_socket = scaleOperation->getInputSocket(0); | |||||
| converter.mapInputSocket(imageInput, scaleOperation->getInputSocket(0)); | |||||
| converter.addLink(scaleOperation->getOutputSocket(), rotateOperation->getInputSocket(0)); | |||||
| converter.addLink(rotateOperation->getOutputSocket(), | |||||
| translateOperation->getInputSocket(0)); | |||||
| converter.mapOutputSocket(getOutputSocket(), translateOperation->getOutputSocket()); | |||||
| } | |||||
| xAttribute->set_socket_input_resolution_for_stabilization(stabilization_socket); | |||||
| yAttribute->set_socket_input_resolution_for_stabilization(stabilization_socket); | |||||
| scaleAttribute->set_socket_input_resolution_for_stabilization(stabilization_socket); | |||||
| angleAttribute->set_socket_input_resolution_for_stabilization(stabilization_socket); | |||||
| break; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } // namespace blender::compositor | } // namespace blender::compositor | ||||