diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-04 20:12:42 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-04 20:12:42 +0400 |
commit | 03687b7c66d7064870bbe8d01f889c85de1fad7d (patch) | |
tree | b5a081058b582e3d40b79e58f2c601f31394ea7c /source/blender/compositor/nodes/COM_TranslateNode.cpp | |
parent | 7c9d99334705498932a272f68f74121953d4974a (diff) |
Compositor "Relative" option for Translate node, same as for other nodes this
makes it possible to specify an offset relative to the render resolution (so 0.5
is half the image rather than giving the number of pixels). It's a bit late but
it's a trivial change and needed for 4k mango render.
Diffstat (limited to 'source/blender/compositor/nodes/COM_TranslateNode.cpp')
-rw-r--r-- | source/blender/compositor/nodes/COM_TranslateNode.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/compositor/nodes/COM_TranslateNode.cpp b/source/blender/compositor/nodes/COM_TranslateNode.cpp index 1d21b23fa74..887190b44b9 100644 --- a/source/blender/compositor/nodes/COM_TranslateNode.cpp +++ b/source/blender/compositor/nodes/COM_TranslateNode.cpp @@ -38,10 +38,18 @@ void TranslateNode::convertToOperations(ExecutionSystem *graph, CompositorContex OutputSocket *outputSocket = this->getOutputSocket(0); TranslateOperation *operation = new TranslateOperation(); - bNode *editorNode = this->getbNode(); - NodeTranslateData *data = (NodeTranslateData *)editorNode->storage; + bNode *bnode = this->getbNode(); + NodeTranslateData *data = (NodeTranslateData *)bnode->storage; operation->setWrapping(data->wrap_axis); + if (data->relative) { + const RenderData *rd = context->getRenderData(); + float fx = rd->xsch * rd->size / 100.0f; + float fy = rd->ysch * rd->size / 100.0f; + + operation->setFactorXY(fx, fy); + } + inputSocket->relinkConnections(operation->getInputSocket(0), 0, graph); inputXSocket->relinkConnections(operation->getInputSocket(1), 1, graph); inputYSocket->relinkConnections(operation->getInputSocket(2), 2, graph); |