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:
Diffstat (limited to 'source/blender/compositor/nodes')
-rw-r--r--source/blender/compositor/nodes/COM_BlurNode.cpp48
-rw-r--r--source/blender/compositor/nodes/COM_ImageNode.cpp3
-rw-r--r--source/blender/compositor/nodes/COM_MapRangeNode.cpp54
-rw-r--r--source/blender/compositor/nodes/COM_MapRangeNode.h38
-rw-r--r--source/blender/compositor/nodes/COM_MuteNode.cpp4
-rw-r--r--source/blender/compositor/nodes/COM_NormalNode.cpp11
-rw-r--r--source/blender/compositor/nodes/COM_OutputFileNode.cpp6
7 files changed, 147 insertions, 17 deletions
diff --git a/source/blender/compositor/nodes/COM_BlurNode.cpp b/source/blender/compositor/nodes/COM_BlurNode.cpp
index 4f120ea5a6e..6a4987c2075 100644
--- a/source/blender/compositor/nodes/COM_BlurNode.cpp
+++ b/source/blender/compositor/nodes/COM_BlurNode.cpp
@@ -31,6 +31,7 @@
#include "COM_FastGaussianBlurOperation.h"
#include "COM_MathBaseOperation.h"
#include "COM_SetValueOperation.h"
+#include "COM_GammaCorrectOperation.h"
BlurNode::BlurNode(bNode *editorNode) : Node(editorNode)
{
@@ -48,16 +49,17 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
const float size = ((const bNodeSocketValueFloat *)sock->default_value)->value;
CompositorQuality quality = context->getQuality();
-
+ NodeOperation *input_operation = NULL, *output_operation = NULL;
+
if (data->filtertype == R_FILTER_FAST_GAUSS) {
FastGaussianBlurOperation *operationfgb = new FastGaussianBlurOperation();
operationfgb->setData(data);
operationfgb->setbNode(editorNode);
- this->getInputSocket(0)->relinkConnections(operationfgb->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operationfgb->getInputSocket(1), 1, graph);
- this->getOutputSocket(0)->relinkConnections(operationfgb->getOutputSocket(0));
graph->addOperation(operationfgb);
- addPreviewOperation(graph, context, operationfgb->getOutputSocket());
+
+ input_operation = operationfgb;
+ output_operation = operationfgb;
}
else if (editorNode->custom1 & CMP_NODEFLAG_BLUR_VARIABLE_SIZE) {
MathAddOperation *clamp = new MathAddOperation();
@@ -93,48 +95,68 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
operation->setData(data);
operation->setbNode(editorNode);
operation->setQuality(quality);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
addLink(graph, operationy->getOutputSocket(), operation->getInputSocket(1));
graph->addOperation(operation);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- addPreviewOperation(graph, context, operation->getOutputSocket());
+
+ output_operation = operation;
+ input_operation = operation;
}
else if (!data->bokeh) {
GaussianXBlurOperation *operationx = new GaussianXBlurOperation();
operationx->setData(data);
operationx->setbNode(editorNode);
operationx->setQuality(quality);
- this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph);
graph->addOperation(operationx);
GaussianYBlurOperation *operationy = new GaussianYBlurOperation();
operationy->setData(data);
operationy->setbNode(editorNode);
operationy->setQuality(quality);
- this->getOutputSocket(0)->relinkConnections(operationy->getOutputSocket());
+
graph->addOperation(operationy);
addLink(graph, operationx->getOutputSocket(), operationy->getInputSocket(0));
addLink(graph, operationx->getInputSocket(1)->getConnection()->getFromSocket(), operationy->getInputSocket(1));
- addPreviewOperation(graph, context, operationy->getOutputSocket());
if (!connectedSizeSocket) {
operationx->setSize(size);
operationy->setSize(size);
}
+
+ input_operation = operationx;
+ output_operation = operationy;
}
else {
GaussianBokehBlurOperation *operation = new GaussianBokehBlurOperation();
operation->setData(data);
operation->setbNode(editorNode);
- this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
this->getInputSocket(1)->relinkConnections(operation->getInputSocket(1), 1, graph);
operation->setQuality(quality);
graph->addOperation(operation);
- this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
- addPreviewOperation(graph, context, operation->getOutputSocket());
if (!connectedSizeSocket) {
operation->setSize(size);
}
+
+ input_operation = operation;
+ output_operation = operation;
+ }
+
+ if (data->gamma) {
+ GammaCorrectOperation *correct = new GammaCorrectOperation();
+ GammaUncorrectOperation *inverse = new GammaUncorrectOperation();
+
+ this->getInputSocket(0)->relinkConnections(correct->getInputSocket(0), 0, graph);
+ addLink(graph, correct->getOutputSocket(), input_operation->getInputSocket(0));
+ addLink(graph, output_operation->getOutputSocket(), inverse->getInputSocket(0));
+ this->getOutputSocket()->relinkConnections(inverse->getOutputSocket());
+ graph->addOperation(correct);
+ graph->addOperation(inverse);
+
+ addPreviewOperation(graph, context, inverse->getOutputSocket());
+ }
+ else {
+ this->getInputSocket(0)->relinkConnections(input_operation->getInputSocket(0), 0, graph);
+ this->getOutputSocket()->relinkConnections(output_operation->getOutputSocket());
+ addPreviewOperation(graph, context, output_operation->getOutputSocket());
}
}
diff --git a/source/blender/compositor/nodes/COM_ImageNode.cpp b/source/blender/compositor/nodes/COM_ImageNode.cpp
index 4ebd28d710a..729cb1b70a0 100644
--- a/source/blender/compositor/nodes/COM_ImageNode.cpp
+++ b/source/blender/compositor/nodes/COM_ImageNode.cpp
@@ -73,7 +73,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
/* force a load, we assume iuser index will be set OK anyway */
if (image && image->type == IMA_TYPE_MULTILAYER) {
bool is_multilayer_ok = false;
- BKE_image_get_ibuf(image, imageuser);
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, imageuser, NULL);
if (image->rr) {
RenderLayer *rl = (RenderLayer *)BLI_findlink(&image->rr->layers, imageuser->layer);
if (rl) {
@@ -118,6 +118,7 @@ void ImageNode::convertToOperations(ExecutionSystem *graph, CompositorContext *c
}
}
}
+ BKE_image_release_ibuf(image, ibuf, NULL);
/* without this, multilayer that fail to load will crash blender [#32490] */
if (is_multilayer_ok == false) {
diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.cpp b/source/blender/compositor/nodes/COM_MapRangeNode.cpp
new file mode 100644
index 00000000000..232be3d41b0
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_MapRangeNode.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Dalai Felinto
+ * Daniel Salazar
+ */
+
+#include "COM_MapRangeNode.h"
+
+#include "COM_MapRangeOperation.h"
+#include "COM_ExecutionSystem.h"
+
+MapRangeNode::MapRangeNode(bNode *editorNode) : Node(editorNode)
+{
+ /* pass */
+}
+
+void MapRangeNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context)
+{
+ InputSocket *valueSocket = this->getInputSocket(0);
+ InputSocket *sourceMinSocket = this->getInputSocket(1);
+ InputSocket *sourceMaxSocket = this->getInputSocket(2);
+ InputSocket *destMinSocket = this->getInputSocket(3);
+ InputSocket *destMaxSocket = this->getInputSocket(4);
+ OutputSocket *outputSocket = this->getOutputSocket(0);
+
+ MapRangeOperation *operation = new MapRangeOperation();
+
+ valueSocket->relinkConnections(operation->getInputSocket(0), 0, graph);
+ sourceMinSocket->relinkConnections(operation->getInputSocket(1), 1, graph);
+ sourceMaxSocket->relinkConnections(operation->getInputSocket(2), 2, graph);
+ destMinSocket->relinkConnections(operation->getInputSocket(3), 3, graph);
+ destMaxSocket->relinkConnections(operation->getInputSocket(4), 4, graph);
+ outputSocket->relinkConnections(operation->getOutputSocket(0));
+
+ operation->setUseClamp(this->getbNode()->custom1);
+
+ graph->addOperation(operation);
+}
diff --git a/source/blender/compositor/nodes/COM_MapRangeNode.h b/source/blender/compositor/nodes/COM_MapRangeNode.h
new file mode 100644
index 00000000000..6667720be3d
--- /dev/null
+++ b/source/blender/compositor/nodes/COM_MapRangeNode.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2012, Blender Foundation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Contributor:
+ * Dalai Felinto
+ * Daniel Salazar
+ */
+
+#ifndef __COM_MAPRANGENODE_H__
+#define __COM_MAPRANGENODE_H__
+
+#include "COM_Node.h"
+#include "DNA_node_types.h"
+/**
+ * @brief MapRangeNode
+ * @ingroup Node
+ */
+class MapRangeNode : public Node {
+public:
+ MapRangeNode(bNode *editorNode);
+ void convertToOperations(ExecutionSystem *graph, CompositorContext *context);
+};
+
+#endif /* __COM_MAPRANGENODE_H__ */
diff --git a/source/blender/compositor/nodes/COM_MuteNode.cpp b/source/blender/compositor/nodes/COM_MuteNode.cpp
index 4502dcf469c..de12fff3591 100644
--- a/source/blender/compositor/nodes/COM_MuteNode.cpp
+++ b/source/blender/compositor/nodes/COM_MuteNode.cpp
@@ -43,6 +43,10 @@ void MuteNode::reconnect(ExecutionSystem *graph, OutputSocket *output)
if (input->getDataType() == output->getDataType()) {
if (input->isConnected()) {
output->relinkConnections(input->getConnection()->getFromSocket(), false);
+ /* output connections have been redirected,
+ * remove the input connection to completely unlink the node.
+ */
+ input->unlinkConnections(graph);
return;
}
}
diff --git a/source/blender/compositor/nodes/COM_NormalNode.cpp b/source/blender/compositor/nodes/COM_NormalNode.cpp
index e00e71e50e9..fbfff8386d0 100644
--- a/source/blender/compositor/nodes/COM_NormalNode.cpp
+++ b/source/blender/compositor/nodes/COM_NormalNode.cpp
@@ -41,9 +41,14 @@ void NormalNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
SetVectorOperation *operationSet = new SetVectorOperation();
bNodeSocket *insock = (bNodeSocket *)editorNode->outputs.first;
bNodeSocketValueVector *dval = (bNodeSocketValueVector *)insock->default_value;
- operationSet->setX(dval->value[0]);
- operationSet->setY(dval->value[1]);
- operationSet->setZ(dval->value[2]);
+ float normal[3];
+
+ /* animation can break normalization, this restores it */
+ normalize_v3_v3(normal, dval->value);
+
+ operationSet->setX(normal[0]);
+ operationSet->setY(normal[1]);
+ operationSet->setZ(normal[2]);
operationSet->setW(0.0f);
outputSocket->relinkConnections(operationSet->getOutputSocket(0));
diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cpp b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
index 921b9e63a73..3b1871b307b 100644
--- a/source/blender/compositor/nodes/COM_OutputFileNode.cpp
+++ b/source/blender/compositor/nodes/COM_OutputFileNode.cpp
@@ -41,6 +41,12 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
* otherwise, it overwrites the output files just
* scrubbing through the timeline when the compositor updates.
*/
+
+ /* still, need to unlink input sockets to remove the node from the graph completely */
+ int num_inputs = getNumberOfInputSockets();
+ for (int i = 0; i < num_inputs; ++i) {
+ getInputSocket(i)->unlinkConnections(graph);
+ }
return;
}