diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2014-01-22 17:32:21 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2014-01-22 17:37:40 +0400 |
commit | 9c883a1ecabe387533909b1e3116c2c30418f6e9 (patch) | |
tree | e3fb294597eb3575452e0624aad5536aec1d07ea /source/blender/compositor/nodes | |
parent | 418aafd503617c45c9199c1fb4616910557b6e92 (diff) |
Fix T38011 and cleanup of Lens Distortion node code.
The area-of-interest calculation for that node didn't work reliably.
It tries to estimate the distorted rectangular area based on min/max
distortion and dispersion values, but this fails in some cases and
leaves uninitialized buffer chunks. So now simply use the full input
rect as the area, even though it may not be as efficient - at least it
works ...
Also cleaned up the code somewhat to make it understandable, using
separate functions for common stuff instead of cryptic walls of math.
Diffstat (limited to 'source/blender/compositor/nodes')
-rw-r--r-- | source/blender/compositor/nodes/COM_LensDistortionNode.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp index f91744d88b6..9af1fceaae0 100644 --- a/source/blender/compositor/nodes/COM_LensDistortionNode.cpp +++ b/source/blender/compositor/nodes/COM_LensDistortionNode.cpp @@ -41,21 +41,20 @@ void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorC this->getInputSocket(2)->relinkConnections(operation->getInputSocket(1), 2, graph); this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0)); - operation->setData(data); graph->addOperation(operation); } else { ScreenLensDistortionOperation *operation = new ScreenLensDistortionOperation(); operation->setbNode(editorNode); - operation->setData(data); - if (!(this->getInputSocket(1)->isConnected() || this->getInputSocket(2)->isConnected())) { - // no nodes connected to the distortion and dispersion. We can precalculate some values - float distortion = this->getInputSocket(1)->getEditorValueFloat(); - float dispersion = this->getInputSocket(2)->getEditorValueFloat(); - operation->setDistortionAndDispersion(distortion, dispersion); - } + operation->setFit(data->fit); + operation->setJitter(data->jit); + if (!getInputSocket(1)->isConnected()) + operation->setDistortion(getInputSocket(1)->getEditorValueFloat()); + if (!getInputSocket(2)->isConnected()) + operation->setDispersion(getInputSocket(2)->getEditorValueFloat()); + this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph); this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph); this->getInputSocket(2)->relinkConnections(operation->getInputSocket(2), 2, graph); |