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:
authorLukas Tönne <lukas.toenne@gmail.com>2014-04-25 14:00:35 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-04-25 14:05:23 +0400
commit005dabbd9ad51b75aef260168c81d5a826d4eb4f (patch)
treecf65862b2f2f685cc587c80b7311bd87f87d6962 /source/blender/compositor/nodes/COM_CompositorNode.cpp
parent1eb13519768f5735c9931fec0da07d92155796f1 (diff)
Fix T39799: Backdrop (compositor) ignores alpha.
This issue is because of a somewhat "special" behavior in old code, which got lost during rB09874df: There was a variant of the `relinkConnections` function which would leave the socket completely unconnected. This is not a valid state really (given that each unconnected input must otherwise connected to a constant `Set` type node), but was used as a way to distinguish connected alpha/depth sockets in composite and viewer output nodes. https://developer.blender.org/diffusion/B/browse/master/source/blender/compositor/intern/COM_InputSocket.cpp;28a829893c702918afc5ac1945a06eaefa611594$69 After the large cleanup patch ({D309}) every socket is now automatically connected to a constant, such that `getInputSocketReader` will never return a NULL pointer. This breaks the previous test method, which needs to be replaced by more explicit flags. Luckily this was done only for very few output nodes (Composite, Viewer, Output-File). These now use the regular SetValueOperation default in case "use alpha" is disabled, but set this to an explicit 1.0 value instead of mapping to the node socket.
Diffstat (limited to 'source/blender/compositor/nodes/COM_CompositorNode.cpp')
-rw-r--r--source/blender/compositor/nodes/COM_CompositorNode.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp
index 868528ade81..3d79eb693ea 100644
--- a/source/blender/compositor/nodes/COM_CompositorNode.cpp
+++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp
@@ -34,6 +34,7 @@ void CompositorNode::convertToOperations(NodeConverter &converter, const Composi
bNode *editorNode = this->getbNode();
bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC) ||
context.isRendering();
+ bool ignore_alpha = editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA;
NodeInput *imageSocket = this->getInputSocket(0);
NodeInput *alphaSocket = this->getInputSocket(1);
@@ -43,12 +44,17 @@ void CompositorNode::convertToOperations(NodeConverter &converter, const Composi
compositorOperation->setSceneName(context.getScene()->id.name);
compositorOperation->setRenderData(context.getRenderData());
compositorOperation->setbNodeTree(context.getbNodeTree());
- compositorOperation->setIgnoreAlpha(editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA);
+ /* alpha socket gives either 1 or a custom alpha value if "use alpha" is enabled */
+ compositorOperation->setUseAlphaInput(ignore_alpha || alphaSocket->isLinked());
compositorOperation->setActive(is_active);
converter.addOperation(compositorOperation);
converter.mapInputSocket(imageSocket, compositorOperation->getInputSocket(0));
- converter.mapInputSocket(alphaSocket, compositorOperation->getInputSocket(1));
+ /* only use alpha link if "use alpha" is enabled */
+ if (ignore_alpha)
+ converter.addInputValue(compositorOperation->getInputSocket(1), 1.0f);
+ else
+ converter.mapInputSocket(alphaSocket, compositorOperation->getInputSocket(1));
converter.mapInputSocket(depthSocket, compositorOperation->getInputSocket(2));
converter.addNodeInputPreview(imageSocket);