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:
authorSergey Sharybin <sergey.vfx@gmail.com>2013-03-01 19:37:15 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-03-01 19:37:15 +0400
commitf186f89a42575622a9939a6fbe3f240d2a1ba85a (patch)
tree97fb62739b7efb67694d78ed54d38ea59578c10d /source/blender/compositor/nodes/COM_ImageNode.cpp
parent69f746d04cdb87d701f0e9ccc56f2fc236f8dd95 (diff)
Fix #34461: Inconsistent behavior of "Color Mix Node" and "Alpha Over Node"
Added compatibility option "Straight Alpha Output" to image input node When this option is enabled, image input node will convert float buffer to straight alpha. This is not what you'll usually want with new alpha pipeline, nit this is needed to preserve compatibility with older files saved in 2.65. In that version byte image are resulting with straight alpha passing to the compositor and alpha-overing required extra premultiplication of inputs. So, that's why Straight Alpha Output is needed -- it's set in versioning code for byte node images so they'll still output straight alpha. This option is currently only available in N-panel. Additional change: added Alpha Mode for image input node to N-panel.
Diffstat (limited to 'source/blender/compositor/nodes/COM_ImageNode.cpp')
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp
index 864d6f08311..e4dd72d79e9 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -25,6 +25,7 @@
#include "COM_ExecutionSystem.h"
#include "COM_ImageOperation.h"
#include "COM_MultilayerImageOperation.h"
+#include "COM_ConvertPremulToStraightOperation.h"
#include "BKE_node.h"
#include "BLI_utildefines.h"
@@ -72,6 +73,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
ImageUser *imageuser = (ImageUser *)editorNode->storage;
int framenumber = context->getFramenumber();
int numberOfOutputs = this->getNumberOfOutputSockets();
+ bool outputStraightAlpha = editorNode->custom1 & CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT;
BKE_image_user_frame_calc(imageuser, context->getFramenumber(), 0);
/* force a load, we assume iuser index will be set OK anyway */
@@ -138,7 +140,15 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
if (numberOfOutputs > 0) {
ImageOperation *operation = new ImageOperation();
if (outputImage->isConnected()) {
- outputImage->relinkConnections(operation->getOutputSocket());
+ if (outputStraightAlpha) {
+ NodeOperation *alphaConvertOperation = new ConvertPremulToStraightOperation();
+ addLink(graph, operation->getOutputSocket(0), alphaConvertOperation->getInputSocket(0));
+ outputImage->relinkConnections(alphaConvertOperation->getOutputSocket());
+ graph->addOperation(alphaConvertOperation);
+ }
+ else {
+ outputImage->relinkConnections(operation->getOutputSocket());
+ }
}
operation->setImage(image);
operation->setImageUser(imageuser);