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>2012-07-30 13:46:14 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-07-30 13:46:14 +0400
commit585bc327e2609768e4f19ee07cee0bd0417ff47d (patch)
treed4b5ad168bf21c355360d8851727e306516b06ba /source/blender/compositor
parent977188e3736db9442bc0c31aa1844d92c5119da0 (diff)
Fix incorrect connections for muted nodes in tile compositor
Not tile compositor would use the same routines to detect which links to add for muted node.
Diffstat (limited to 'source/blender/compositor')
-rw-r--r--source/blender/compositor/nodes/COM_MuteNode.cpp49
-rw-r--r--source/blender/compositor/nodes/COM_MuteNode.h10
2 files changed, 53 insertions, 6 deletions
diff --git a/source/blender/compositor/nodes/COM_MuteNode.cpp b/source/blender/compositor/nodes/COM_MuteNode.cpp
index f52b7216cca..7b9dcf686fc 100644
--- a/source/blender/compositor/nodes/COM_MuteNode.cpp
+++ b/source/blender/compositor/nodes/COM_MuteNode.cpp
@@ -20,14 +20,16 @@
* Monique Dewanchand
*/
-#include <stdio.h>
-
#include "COM_MuteNode.h"
#include "COM_SocketConnection.h"
#include "COM_SetValueOperation.h"
#include "COM_SetVectorOperation.h"
#include "COM_SetColorOperation.h"
+extern "C" {
+ #include "BLI_listbase.h"
+}
+
MuteNode::MuteNode(bNode *editorNode) : Node(editorNode)
{
/* pass */
@@ -84,14 +86,49 @@ void MuteNode::reconnect(ExecutionSystem *graph, OutputSocket *output)
output->clearConnections();
}
+template<class SocketType> void MuteNode::fillSocketMap(vector<SocketType *> &sockets, SocketMap &socketMap)
+{
+ for (typename vector<SocketType *>::iterator it = sockets.begin(); it != sockets.end(); it++) {
+ Socket *socket = (Socket *) *it;
+
+ socketMap.insert(std::pair<bNodeSocket *, Socket *>(socket->getbNodeSocket(), socket));
+ }
+}
+
void MuteNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
{
+ bNode *editorNode = this->getbNode();
vector<OutputSocket *> &outputsockets = this->getOutputSockets();
- for (unsigned int index = 0; index < outputsockets.size(); index++) {
- OutputSocket *output = outputsockets[index];
- if (output->isConnected()) {
- reconnect(graph, output);
+ if (editorNode->typeinfo->internal_connect) {
+ vector<InputSocket *> &inputsockets = this->getInputSockets();
+ bNodeTree *editorTree = (bNodeTree *) context->getbNodeTree();
+ SocketMap socketMap;
+ ListBase intlinks;
+ bNodeLink *link;
+
+ intlinks = editorNode->typeinfo->internal_connect(editorTree, editorNode);
+
+ this->fillSocketMap<OutputSocket>(outputsockets, socketMap);
+ this->fillSocketMap<InputSocket>(inputsockets, socketMap);
+
+ for (link = (bNodeLink *) intlinks.first; link; link = link->next) {
+ if (link->fromnode == editorNode) {
+ InputSocket *fromSocket = (InputSocket *) socketMap.find(link->fromsock)->second;
+ OutputSocket *toSocket = (OutputSocket *) socketMap.find(link->tosock)->second;
+
+ toSocket->relinkConnections(fromSocket->getConnection()->getFromSocket(), false);
+ }
+ }
+
+ BLI_freelistN(&intlinks);
+ }
+ else {
+ for (unsigned int index = 0; index < outputsockets.size(); index++) {
+ OutputSocket *output = outputsockets[index];
+ if (output->isConnected()) {
+ reconnect(graph, output);
+ }
}
}
}
diff --git a/source/blender/compositor/nodes/COM_MuteNode.h b/source/blender/compositor/nodes/COM_MuteNode.h
index aab37e5f888..44fbe6e80c6 100644
--- a/source/blender/compositor/nodes/COM_MuteNode.h
+++ b/source/blender/compositor/nodes/COM_MuteNode.h
@@ -23,8 +23,14 @@
#ifndef _COM_MuteNode_h_
#define _COM_MuteNode_h_
+#include <map>
+
#include "COM_Node.h"
+extern "C" {
+ #include "BKE_node.h"
+}
+
/**
* @brief MuteNode
* @ingroup Node
@@ -34,7 +40,11 @@ public:
MuteNode(bNode *editorNode);
void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
private:
+ typedef std::map<bNodeSocket *, Socket *> SocketMap;
+
void reconnect(ExecutionSystem *graph, OutputSocket *output);
+
+ template<class SocketType> void fillSocketMap(vector<SocketType *> &sockets, SocketMap &socketMap);
};
#endif