diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-10-27 17:59:17 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-10-27 18:01:10 +0300 |
commit | ea67f55b87e362e4e46097d88236639e6c2ea472 (patch) | |
tree | bf173a2d962f46c96c8d723f1becb441b0258221 /source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp | |
parent | b2f57190d9f2cc3ece678ef788b42eefb5631a2e (diff) |
Compositor: Add Invert option to the movie clip stabilization node
This appears to be really common workflow when you stabilize shot to make compo
easier (roto, some effects and so) and then re-introduce the motion back.
Surely it's doable with some magic nodes and manual network for transforming
but such workflow is too common in VFX to resist adding one small option in
single node for this.
Diffstat (limited to 'source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp')
-rw-r--r-- | source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp index 040a0315d69..5ddf15f7684 100644 --- a/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp +++ b/source/blender/compositor/operations/COM_MovieClipAttributeOperation.cpp @@ -31,12 +31,14 @@ MovieClipAttributeOperation::MovieClipAttributeOperation() : NodeOperation() this->m_valueSet = false; this->m_framenumber = 0; this->m_attribute = MCA_X; + this->m_invert = false; } void MovieClipAttributeOperation::executePixelSampled(float output[4], float /*x*/, float /*y*/, PixelSampler /*sampler*/) { + /* TODO(sergey): This code isn't really thread-safe. */ if (!this->m_valueSet) { float loc[2], scale, angle; loc[0] = 0.0f; @@ -61,6 +63,14 @@ void MovieClipAttributeOperation::executePixelSampled(float output[4], this->m_value = loc[1]; break; } + if (this->m_invert) { + if (this->m_attribute != MCA_SCALE) { + this->m_value = -this->m_value; + } + else { + this->m_value = 1.0f / this->m_value; + } + } this->m_valueSet = true; } output[0] = this->m_value; |