diff options
Diffstat (limited to 'source/blender/compositor/intern/COM_Node.cpp')
-rw-r--r-- | source/blender/compositor/intern/COM_Node.cpp | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/source/blender/compositor/intern/COM_Node.cpp b/source/blender/compositor/intern/COM_Node.cpp index 264725b4b2c..62e030b777c 100644 --- a/source/blender/compositor/intern/COM_Node.cpp +++ b/source/blender/compositor/intern/COM_Node.cpp @@ -43,23 +43,23 @@ Node::Node(bNode *editorNode, bool create_sockets) this->editorNode = editorNode; if (create_sockets) { - bNodeSocket * input = (bNodeSocket*)editorNode->inputs.first; + bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first; while (input != NULL) { DataType dt = COM_DT_VALUE; if (input->type == SOCK_RGBA) dt = COM_DT_COLOR; if (input->type == SOCK_VECTOR) dt = COM_DT_VECTOR; this->addInputSocket(dt, (InputSocketResizeMode)input->resizemode, input); - input = (bNodeSocket*)input->next; + input = (bNodeSocket *)input->next; } - bNodeSocket *output = (bNodeSocket*)editorNode->outputs.first; + bNodeSocket *output = (bNodeSocket *)editorNode->outputs.first; while (output != NULL) { DataType dt = COM_DT_VALUE; if (output->type == SOCK_RGBA) dt = COM_DT_COLOR; if (output->type == SOCK_VECTOR) dt = COM_DT_VECTOR; this->addOutputSocket(dt, output); - output = (bNodeSocket*)output->next; + output = (bNodeSocket *)output->next; } } } @@ -75,9 +75,9 @@ bNode *Node::getbNode() void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex) { - bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex); + bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex); SetValueOperation *operation = new SetValueOperation(); - bNodeSocketValueFloat *val = (bNodeSocketValueFloat*)bSock->default_value; + bNodeSocketValueFloat *val = (bNodeSocketValueFloat *)bSock->default_value; operation->setValue(val->value); this->addLink(graph, operation->getOutputSocket(), inputsocket); graph->addOperation(operation); @@ -85,16 +85,18 @@ void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket void Node::addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket) { - PreviewOperation *operation = new PreviewOperation(); - system->addOperation(operation); - operation->setbNode(this->getbNode()); - operation->setbNodeTree(system->getContext().getbNodeTree()); - this->addLink(system, outputSocket, operation->getInputSocket(0)); + if (this->isInActiveGroup()) { + PreviewOperation *operation = new PreviewOperation(); + system->addOperation(operation); + operation->setbNode(this->getbNode()); + operation->setbNodeTree(system->getContext().getbNodeTree()); + this->addLink(system, outputSocket, operation->getInputSocket(0)); + } } void Node::addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket) { - if (inputSocket->isConnected()) { + if (inputSocket->isConnected() && this->isInActiveGroup()) { OutputSocket *outputsocket = inputSocket->getConnection()->getFromSocket(); this->addPreviewOperation(system, outputsocket); } @@ -116,9 +118,9 @@ SocketConnection *Node::addLink(ExecutionSystem *graph, OutputSocket *outputSock void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex) { - bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex); + bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex); SetColorOperation *operation = new SetColorOperation(); - bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA*)bSock->default_value; + bNodeSocketValueRGBA *val = (bNodeSocketValueRGBA *)bSock->default_value; operation->setChannel1(val->value[0]); operation->setChannel2(val->value[1]); operation->setChannel3(val->value[2]); @@ -129,8 +131,8 @@ void Node::addSetColorOperation(ExecutionSystem *graph, InputSocket *inputsocket void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex) { - bNodeSocket *bSock = (bNodeSocket*)this->getEditorInputSocket(editorNodeInputSocketIndex); - bNodeSocketValueVector *val = (bNodeSocketValueVector*)bSock->default_value; + bNodeSocket *bSock = (bNodeSocket *)this->getEditorInputSocket(editorNodeInputSocketIndex); + bNodeSocketValueVector *val = (bNodeSocketValueVector *)bSock->default_value; SetVectorOperation *operation = new SetVectorOperation(); operation->setX(val->value[0]); operation->setY(val->value[1]); @@ -141,7 +143,7 @@ void Node::addSetVectorOperation(ExecutionSystem *graph, InputSocket *inputsocke bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex) { - bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->inputs.first; + bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->inputs.first; int index = 0; while (bSock != NULL) { if (index == editorNodeInputSocketIndex) { @@ -154,7 +156,7 @@ bNodeSocket *Node::getEditorInputSocket(int editorNodeInputSocketIndex) } bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex) { - bNodeSocket *bSock = (bNodeSocket*)this->getbNode()->outputs.first; + bNodeSocket *bSock = (bNodeSocket *)this->getbNode()->outputs.first; int index = 0; while (bSock != NULL) { if (index == editorNodeInputSocketIndex) { @@ -168,9 +170,9 @@ bNodeSocket *Node::getEditorOutputSocket(int editorNodeInputSocketIndex) InputSocket *Node::findInputSocketBybNodeSocket(bNodeSocket *socket) { - vector<InputSocket*> &inputsockets = this->getInputSockets(); + vector<InputSocket *> &inputsockets = this->getInputSockets(); unsigned int index; - for (index = 0 ; index < inputsockets.size(); index ++) { + for (index = 0; index < inputsockets.size(); index++) { InputSocket *input = inputsockets[index]; if (input->getbNodeSocket() == socket) { return input; @@ -181,9 +183,9 @@ InputSocket *Node::findInputSocketBybNodeSocket(bNodeSocket *socket) OutputSocket *Node::findOutputSocketBybNodeSocket(bNodeSocket *socket) { - vector<OutputSocket*> &outputsockets = this->getOutputSockets(); + vector<OutputSocket *> &outputsockets = this->getOutputSockets(); unsigned int index; - for (index = 0 ; index < outputsockets.size(); index ++) { + for (index = 0; index < outputsockets.size(); index++) { OutputSocket *output = outputsockets[index]; if (output->getbNodeSocket() == socket) { return output; |