Highlight nodes that are being processed
This commit is contained in:
@@ -217,7 +217,7 @@ class NODE_PT_properties(Panel):
|
||||
class NODE_PT_quality(bpy.types.Panel):
|
||||
bl_space_type = 'NODE_EDITOR'
|
||||
bl_region_type = 'UI'
|
||||
bl_label = "Quality"
|
||||
bl_label = "Performance"
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
@@ -233,6 +233,7 @@ class NODE_PT_quality(bpy.types.Panel):
|
||||
layout.prop(tree, "edit_quality", text="Edit")
|
||||
layout.prop(tree, "chunk_size")
|
||||
layout.prop(tree, "use_opencl")
|
||||
layout.prop(snode, "show_highlight")
|
||||
|
||||
|
||||
class NODE_MT_node_color_presets(Menu):
|
||||
|
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "BLI_math.h"
|
||||
#include "PIL_time.h"
|
||||
#include "WM_api.h"
|
||||
#include "WM_types.h"
|
||||
|
||||
#include "COM_ExecutionGroup.h"
|
||||
#include "COM_InputSocket.h"
|
||||
@@ -347,6 +349,8 @@ void ExecutionGroup::execute(ExecutionSystem *graph)
|
||||
finished = false;
|
||||
startEvaluated = true;
|
||||
numberEvaluated++;
|
||||
|
||||
WM_main_add_notifier(NC_WINDOW | ND_DRAW, NULL);
|
||||
}
|
||||
else if (state == COM_ES_SCHEDULED) {
|
||||
finished = false;
|
||||
|
@@ -39,9 +39,9 @@
|
||||
//#include <stdio.h>
|
||||
#include "COM_defines.h"
|
||||
|
||||
Node::Node(bNode *editorNode, bool create_sockets)
|
||||
Node::Node(bNode *editorNode, bool create_sockets): NodeBase()
|
||||
{
|
||||
this->m_editorNode = editorNode;
|
||||
setbNode(editorNode);
|
||||
|
||||
if (create_sockets) {
|
||||
bNodeSocket *input = (bNodeSocket *)editorNode->inputs.first;
|
||||
@@ -64,15 +64,6 @@ Node::Node(bNode *editorNode, bool create_sockets)
|
||||
}
|
||||
}
|
||||
}
|
||||
Node::Node()
|
||||
{
|
||||
this->m_editorNode = NULL;
|
||||
}
|
||||
|
||||
bNode *Node::getbNode()
|
||||
{
|
||||
return this->m_editorNode;
|
||||
}
|
||||
|
||||
void Node::addSetValueOperation(ExecutionSystem *graph, InputSocket *inputsocket, int editorNodeInputSocketIndex)
|
||||
{
|
||||
|
@@ -48,10 +48,6 @@ typedef pair<NodeIterator, NodeIterator> NodeRange;
|
||||
*/
|
||||
class Node : public NodeBase {
|
||||
private:
|
||||
/**
|
||||
* @brief stores the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode *m_editorNode;
|
||||
|
||||
/**
|
||||
* @brief Is this node part of the active group
|
||||
@@ -61,11 +57,6 @@ private:
|
||||
public:
|
||||
Node(bNode *editorNode, bool create_sockets = true);
|
||||
|
||||
/**
|
||||
* @brief get the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode *getbNode();
|
||||
|
||||
/**
|
||||
* @brief Is this node in the active group (the group that is being edited)
|
||||
* @param isInActiveGroup
|
||||
@@ -137,9 +128,6 @@ public:
|
||||
*/
|
||||
OutputSocket *findOutputSocketBybNodeSocket(bNodeSocket *socket);
|
||||
protected:
|
||||
|
||||
Node();
|
||||
|
||||
void addPreviewOperation(ExecutionSystem *system, InputSocket *inputSocket);
|
||||
void addPreviewOperation(ExecutionSystem *system, OutputSocket *outputSocket);
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
|
||||
NodeBase::NodeBase()
|
||||
{
|
||||
/* pass */
|
||||
this->m_editorNode = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -54,6 +54,11 @@ private:
|
||||
*/
|
||||
vector<OutputSocket *> m_outputsockets;
|
||||
|
||||
/**
|
||||
* @brief stores the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode *m_editorNode;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief get access to the vector of input sockets
|
||||
@@ -73,6 +78,18 @@ public:
|
||||
*/
|
||||
virtual ~NodeBase();
|
||||
|
||||
/**
|
||||
* @brief get the reference to the SDNA bNode struct
|
||||
*/
|
||||
bNode *getbNode() {return m_editorNode;}
|
||||
|
||||
/**
|
||||
* @brief set the reference to the bNode
|
||||
* @note used in Node instances to receive the storage/settings and complex node for highlight during execution
|
||||
* @param bNode
|
||||
*/
|
||||
void setbNode(bNode *bNode) {this->m_editorNode = bNode;}
|
||||
|
||||
/**
|
||||
* @brief is this node an operation?
|
||||
* This is true when the instance is of the subclass NodeOperation.
|
||||
|
@@ -28,7 +28,7 @@
|
||||
#include "COM_SocketConnection.h"
|
||||
#include "COM_defines.h"
|
||||
|
||||
NodeOperation::NodeOperation()
|
||||
NodeOperation::NodeOperation() : NodeBase()
|
||||
{
|
||||
this->m_resolutionInputSocketIndex = 0;
|
||||
this->m_complex = false;
|
||||
|
@@ -49,6 +49,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
|
||||
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));
|
||||
@@ -58,12 +59,14 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
|
||||
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);
|
||||
@@ -79,6 +82,7 @@ void BlurNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
|
||||
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);
|
||||
|
@@ -61,6 +61,7 @@ void BokehBlurNode::convertToOperations(ExecutionSystem *graph, CompositorContex
|
||||
this->getInputSocket(3)->relinkConnections(operation->getInputSocket(2), 3, graph);
|
||||
operation->setSize(((bNodeSocketValueFloat *)this->getInputSocket(2)->getbNodeSocket()->default_value)->value);
|
||||
operation->setQuality(context->getQuality());
|
||||
operation->setbNode(this->getbNode());
|
||||
graph->addOperation(operation);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket());
|
||||
// }
|
||||
|
@@ -46,6 +46,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
|
||||
NodeDefocus *data = (NodeDefocus *)node->storage;
|
||||
|
||||
NodeOperation *radiusOperation;
|
||||
OutputSocket * depthOperation;
|
||||
if (data->no_zbuf) {
|
||||
MathMultiplyOperation *multiply = new MathMultiplyOperation();
|
||||
SetValueOperation *multiplier = new SetValueOperation();
|
||||
@@ -63,6 +64,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
|
||||
graph->addOperation(maxRadius);
|
||||
graph->addOperation(minimize);
|
||||
radiusOperation = minimize;
|
||||
depthOperation = minimize->getOutputSocket(0);
|
||||
}
|
||||
else {
|
||||
ConvertDepthToRadiusOperation *converter = new ConvertDepthToRadiusOperation();
|
||||
@@ -72,6 +74,7 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
|
||||
this->getInputSocket(1)->relinkConnections(converter->getInputSocket(0), 1, graph);
|
||||
graph->addOperation(converter);
|
||||
radiusOperation = converter;
|
||||
depthOperation = converter->getInputSocket(0)->getConnection()->getFromSocket();
|
||||
}
|
||||
|
||||
BokehImageOperation *bokeh = new BokehImageOperation();
|
||||
@@ -90,6 +93,14 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
|
||||
bokeh->deleteDataOnFinish();
|
||||
graph->addOperation(bokeh);
|
||||
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
InverseSearchRadiusOperation *search = new InverseSearchRadiusOperation();
|
||||
addLink(graph, radiusOperation->getOutputSocket(0), search->getInputSocket(0));
|
||||
addLink(graph, depthOperation, search->getInputSocket(1));
|
||||
search->setMaxBlur(data->maxblur);
|
||||
search->setThreshold(data->bthresh);
|
||||
graph->addOperation(search);
|
||||
#endif
|
||||
VariableSizeBokehBlurOperation *operation = new VariableSizeBokehBlurOperation();
|
||||
if (data->preview) {
|
||||
operation->setQuality(COM_QUALITY_LOW);
|
||||
@@ -97,10 +108,14 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
|
||||
operation->setQuality(context->getQuality());
|
||||
}
|
||||
operation->setMaxBlur(data->maxblur);
|
||||
operation->setbNode(node);
|
||||
operation->setThreshold(data->bthresh);
|
||||
addLink(graph, bokeh->getOutputSocket(), operation->getInputSocket(1));
|
||||
addLink(graph, radiusOperation->getOutputSocket(), operation->getInputSocket(2));
|
||||
addLink(graph, radiusOperation->getInputSocket(0)->getConnection()->getFromSocket(), operation->getInputSocket(3));
|
||||
addLink(graph, depthOperation, operation->getInputSocket(3));
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
addLink(graph, search->getOutputSocket(), operation->getInputSocket(4));
|
||||
#endif
|
||||
if (data->gamco) {
|
||||
GammaCorrectOperation *correct = new GammaCorrectOperation();
|
||||
GammaUncorrectOperation *inverse = new GammaUncorrectOperation();
|
||||
@@ -115,6 +130,5 @@ void DefocusNode::convertToOperations(ExecutionSystem *graph, CompositorContext
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
|
||||
this->getOutputSocket()->relinkConnections(operation->getOutputSocket());
|
||||
}
|
||||
|
||||
graph->addOperation(operation);
|
||||
}
|
||||
|
@@ -40,6 +40,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
bNode *editorNode = this->getbNode();
|
||||
if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE_THRESH) {
|
||||
DilateErodeThresholdOperation *operation = new DilateErodeThresholdOperation();
|
||||
operation->setbNode(editorNode);
|
||||
operation->setDistance(editorNode->custom2);
|
||||
operation->setInset(editorNode->custom3);
|
||||
|
||||
@@ -59,6 +60,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
else if (editorNode->custom1 == CMP_NODE_DILATEERODE_DISTANCE) {
|
||||
if (editorNode->custom2 > 0) {
|
||||
DilateDistanceOperation *operation = new DilateDistanceOperation();
|
||||
operation->setbNode(editorNode);
|
||||
operation->setDistance(editorNode->custom2);
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
@@ -66,6 +68,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
}
|
||||
else {
|
||||
ErodeDistanceOperation *operation = new ErodeDistanceOperation();
|
||||
operation->setbNode(editorNode);
|
||||
operation->setDistance(-editorNode->custom2);
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
@@ -90,12 +93,14 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
}
|
||||
|
||||
GaussianAlphaXBlurOperation *operationx = new GaussianAlphaXBlurOperation();
|
||||
operationx->setbNode(editorNode);
|
||||
operationx->setData(data);
|
||||
operationx->setQuality(quality);
|
||||
this->getInputSocket(0)->relinkConnections(operationx->getInputSocket(0), 0, graph);
|
||||
// this->getInputSocket(1)->relinkConnections(operationx->getInputSocket(1), 1, graph); // no size input yet
|
||||
graph->addOperation(operationx);
|
||||
GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation();
|
||||
operationy->setbNode(editorNode);
|
||||
operationy->setData(data);
|
||||
operationy->setQuality(quality);
|
||||
this->getOutputSocket(0)->relinkConnections(operationy->getOutputSocket());
|
||||
@@ -127,6 +132,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
else {
|
||||
if (editorNode->custom2 > 0) {
|
||||
DilateStepOperation *operation = new DilateStepOperation();
|
||||
operation->setbNode(editorNode);
|
||||
operation->setIterations(editorNode->custom2);
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
@@ -134,6 +140,7 @@ void DilateErodeNode::convertToOperations(ExecutionSystem *graph, CompositorCont
|
||||
}
|
||||
else {
|
||||
ErodeStepOperation *operation = new ErodeStepOperation();
|
||||
operation->setbNode(editorNode);
|
||||
operation->setIterations(-editorNode->custom2);
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
|
@@ -36,6 +36,7 @@ void DoubleEdgeMaskNode::convertToOperations(ExecutionSystem *system, Compositor
|
||||
bNode *bnode = this->getbNode();
|
||||
|
||||
operation = new DoubleEdgeMaskOperation();
|
||||
operation->setbNode(bnode);
|
||||
operation->setAdjecentOnly(bnode->custom1);
|
||||
operation->setKeepInside(bnode->custom2);
|
||||
|
||||
|
@@ -73,7 +73,7 @@ void FilterNode::convertToOperations(ExecutionSystem *graph, CompositorContext *
|
||||
operation->set3x3Filter(0, 0, 0, 0, 1, 0, 0, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
operation->setbNode(this->getbNode());
|
||||
inputImageSocket->relinkConnections(operation->getInputSocket(0), 1, graph);
|
||||
inputSocket->relinkConnections(operation->getInputSocket(1), 0, graph);
|
||||
outputSocket->relinkConnections(operation->getOutputSocket());
|
||||
|
@@ -63,6 +63,8 @@ void GlareNode::convertToOperations(ExecutionSystem *system, CompositorContext *
|
||||
SetValueOperation *mixvalueoperation = new SetValueOperation();
|
||||
MixGlareOperation *mixoperation = new MixGlareOperation();
|
||||
mixoperation->getInputSocket(2)->setResizeMode(COM_SC_FIT);
|
||||
thresholdOperation->setbNode(node);
|
||||
glareoperation->setbNode(node);
|
||||
|
||||
this->getInputSocket(0)->relinkConnections(thresholdOperation->getInputSocket(0), 0, system);
|
||||
addLink(system, thresholdOperation->getOutputSocket(), glareoperation->getInputSocket(0));
|
||||
|
@@ -74,9 +74,11 @@ OutputSocket *KeyingNode::setupPreBlur(ExecutionSystem *graph, InputSocket *inpu
|
||||
|
||||
blurXOperation->setSize(size);
|
||||
blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X);
|
||||
blurXOperation->setbNode(this->getbNode());
|
||||
|
||||
blurYOperation->setSize(size);
|
||||
blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y);
|
||||
blurYOperation->setbNode(this->getbNode());
|
||||
|
||||
addLink(graph, separateOperation->getOutputSocket(), blurXOperation->getInputSocket(0));
|
||||
addLink(graph, blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0));
|
||||
@@ -104,9 +106,11 @@ OutputSocket *KeyingNode::setupPostBlur(ExecutionSystem *graph, OutputSocket *po
|
||||
|
||||
blurXOperation->setSize(size);
|
||||
blurXOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_X);
|
||||
blurXOperation->setbNode(this->getbNode());
|
||||
|
||||
blurYOperation->setSize(size);
|
||||
blurYOperation->setAxis(KeyingBlurOperation::BLUR_AXIS_Y);
|
||||
blurYOperation->setbNode(this->getbNode());
|
||||
|
||||
addLink(graph, postBlurInput, blurXOperation->getInputSocket(0));
|
||||
addLink(graph, blurXOperation->getOutputSocket(), blurYOperation->getInputSocket(0));
|
||||
@@ -129,6 +133,7 @@ OutputSocket *KeyingNode::setupDilateErode(ExecutionSystem *graph, OutputSocket
|
||||
dilateErodeOperation = new ErodeDistanceOperation();
|
||||
dilateErodeOperation->setDistance(-distance);
|
||||
}
|
||||
dilateErodeOperation->setbNode(this->getbNode());
|
||||
|
||||
addLink(graph, dilateErodeInput, dilateErodeOperation->getInputSocket(0));
|
||||
|
||||
@@ -161,6 +166,7 @@ OutputSocket *KeyingNode::setupFeather(ExecutionSystem *graph, CompositorContext
|
||||
operationx->setSize(1.0f);
|
||||
operationx->setSubtract(distance < 0);
|
||||
operationx->setFalloff(falloff);
|
||||
operationx->setbNode(this->getbNode());
|
||||
graph->addOperation(operationx);
|
||||
|
||||
GaussianAlphaYBlurOperation *operationy = new GaussianAlphaYBlurOperation();
|
||||
@@ -169,6 +175,7 @@ OutputSocket *KeyingNode::setupFeather(ExecutionSystem *graph, CompositorContext
|
||||
operationy->setSize(1.0f);
|
||||
operationy->setSubtract(distance < 0);
|
||||
operationy->setFalloff(falloff);
|
||||
operationy->setbNode(this->getbNode());
|
||||
graph->addOperation(operationy);
|
||||
|
||||
addLink(graph, featherInput, operationx->getInputSocket(0));
|
||||
|
@@ -45,6 +45,7 @@ void KeyingScreenNode::convertToOperations(ExecutionSystem *graph, CompositorCon
|
||||
|
||||
// always connect the output image
|
||||
KeyingScreenOperation *operation = new KeyingScreenOperation();
|
||||
operation->setbNode(editorNode);
|
||||
|
||||
if (outputScreen->isConnected()) {
|
||||
outputScreen->relinkConnections(operation->getOutputSocket());
|
||||
|
@@ -37,7 +37,7 @@ void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorC
|
||||
NodeLensDist *data = (NodeLensDist *)editorNode->storage;
|
||||
if (data->proj) {
|
||||
ProjectorLensDistortionOperation *operation = new ProjectorLensDistortionOperation();
|
||||
|
||||
operation->setbNode(editorNode);
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, graph);
|
||||
this->getInputSocket(2)->relinkConnections(operation->getInputSocket(1), 2, graph);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
@@ -48,6 +48,7 @@ void LensDistortionNode::convertToOperations(ExecutionSystem *graph, CompositorC
|
||||
}
|
||||
else {
|
||||
ScreenLensDistortionOperation *operation = new ScreenLensDistortionOperation();
|
||||
operation->setbNode(editorNode);
|
||||
operation->setData(data);
|
||||
if (!(this->getInputSocket(1)->isConnected() || this->getInputSocket(2)->isConnected()))
|
||||
{
|
||||
|
@@ -45,7 +45,7 @@ void MaskNode::convertToOperations(ExecutionSystem *graph, CompositorContext *co
|
||||
|
||||
// always connect the output image
|
||||
MaskOperation *operation = new MaskOperation();
|
||||
|
||||
operation->setbNode(editorNode);
|
||||
operation->setMaskWidth(data->xsch * data->size / 100.0f);
|
||||
operation->setMaskHeight(data->ysch * data->size / 100.0f);
|
||||
|
||||
|
@@ -34,7 +34,7 @@ void TonemapNode::convertToOperations(ExecutionSystem *system, CompositorContext
|
||||
{
|
||||
NodeTonemap *data = (NodeTonemap *)this->getbNode()->storage;
|
||||
TonemapOperation *operation = data->type == 1 ? new PhotoreceptorTonemapOperation() : new TonemapOperation();
|
||||
|
||||
operation->setbNode(this->getbNode());
|
||||
operation->setData(data);
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
|
||||
this->getOutputSocket(0)->relinkConnections(operation->getOutputSocket(0));
|
||||
|
@@ -34,6 +34,7 @@ void VectorBlurNode::convertToOperations(ExecutionSystem *system, CompositorCont
|
||||
bNode *node = this->getbNode();
|
||||
NodeBlurData *vectorBlurSettings = (NodeBlurData *)node->storage;
|
||||
VectorBlurOperation *operation = new VectorBlurOperation();
|
||||
operation->setbNode(node);
|
||||
operation->setVectorBlurSettings(vectorBlurSettings);
|
||||
operation->setQuality(context->getQuality());
|
||||
this->getInputSocket(0)->relinkConnections(operation->getInputSocket(0), 0, system);
|
||||
|
@@ -33,6 +33,9 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); // do not resize the bokeh image.
|
||||
this->addInputSocket(COM_DT_VALUE); // radius
|
||||
this->addInputSocket(COM_DT_VALUE); // depth
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
this->addInputSocket(COM_DT_COLOR, COM_SC_NO_RESIZE); // inverse search radius optimization structure.
|
||||
#endif
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
|
||||
@@ -42,6 +45,9 @@ VariableSizeBokehBlurOperation::VariableSizeBokehBlurOperation() : NodeOperation
|
||||
this->m_inputDepthProgram = NULL;
|
||||
this->m_maxBlur = 32.0f;
|
||||
this->m_threshold = 1.0f;
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
this->m_inputSearchProgram = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +57,9 @@ void VariableSizeBokehBlurOperation::initExecution()
|
||||
this->m_inputBokehProgram = getInputSocketReader(1);
|
||||
this->m_inputSizeProgram = getInputSocketReader(2);
|
||||
this->m_inputDepthProgram = getInputSocketReader(3);
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
this->m_inputSearchProgram = getInputSocketReader(4);
|
||||
#endif
|
||||
QualityStepHelper::initExecution(COM_QH_INCREASE);
|
||||
}
|
||||
|
||||
@@ -63,10 +72,19 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
|
||||
float multiplier_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
float color_accum[4] = {0.0f, 0.0f, 0.0f, 0.0f};
|
||||
|
||||
int miny = y - this->m_maxBlur;
|
||||
int maxy = y + this->m_maxBlur;
|
||||
int minx = x - this->m_maxBlur;
|
||||
int maxx = x + this->m_maxBlur;
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
float search[4];
|
||||
this->inputSearchProgram->read(search, x/InverseSearchRadiusOperation::DIVIDER, y/InverseSearchRadiusOperation::DIVIDER, inputBuffers, NULL);
|
||||
int minx = search[0];
|
||||
int miny = search[1];
|
||||
int maxx = search[2];
|
||||
int maxy = search[3];
|
||||
#else
|
||||
int minx = MAX2(x - this->m_maxBlur, 0.0f);
|
||||
int miny = MAX2(y - this->m_maxBlur, 0.0f);
|
||||
int maxx = MIN2(x + this->m_maxBlur, m_width);
|
||||
int maxy = MIN2(y + this->m_maxBlur, m_height);
|
||||
#endif
|
||||
{
|
||||
this->m_inputSizeProgram->read(tempSize, x, y, COM_PS_NEAREST, inputBuffers);
|
||||
this->m_inputDepthProgram->read(tempDepth, x, y, COM_PS_NEAREST, inputBuffers);
|
||||
@@ -80,9 +98,9 @@ void VariableSizeBokehBlurOperation::executePixel(float *color, int x, int y, Me
|
||||
for (int nx = minx; nx < maxx; nx += QualityStepHelper::getStep()) {
|
||||
if (nx >= 0 && nx < this->getWidth() && ny >= 0 && ny < getHeight()) {
|
||||
this->m_inputDepthProgram->read(tempDepth, nx, ny, COM_PS_NEAREST, inputBuffers);
|
||||
if (tempDepth[0] < centerDepth) {
|
||||
this->m_inputSizeProgram->read(tempSize, nx, ny, COM_PS_NEAREST, inputBuffers);
|
||||
float size = tempSize[0];
|
||||
if (tempDepth[0] < centerDepth) {
|
||||
if ((sizeCenter > this->m_threshold && size > this->m_threshold) || size <= this->m_threshold) {
|
||||
float dx = nx - x;
|
||||
float dy = ny - y;
|
||||
@@ -115,6 +133,10 @@ void VariableSizeBokehBlurOperation::deinitExecution()
|
||||
this->m_inputProgram = NULL;
|
||||
this->m_inputBokehProgram = NULL;
|
||||
this->m_inputSizeProgram = NULL;
|
||||
this->m_inputDepthProgram = NULL;
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
this->m_inputSearchProgram = NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
@@ -131,6 +153,7 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu
|
||||
bokehInput.ymax = 512;
|
||||
bokehInput.ymin = 0;
|
||||
|
||||
|
||||
NodeOperation *operation = getInputOperation(2);
|
||||
if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) {
|
||||
return true;
|
||||
@@ -143,9 +166,118 @@ bool VariableSizeBokehBlurOperation::determineDependingAreaOfInterest(rcti *inpu
|
||||
if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) {
|
||||
return true;
|
||||
}
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
rcti searchInput;
|
||||
searchInput.xmax = (input->xmax/InverseSearchRadiusOperation::DIVIDER)+1;
|
||||
searchInput.xmin = (input->xmin/InverseSearchRadiusOperation::DIVIDER)-1;
|
||||
searchInput.ymax = (input->ymax/InverseSearchRadiusOperation::DIVIDER)+1;
|
||||
searchInput.ymin = (input->ymin/InverseSearchRadiusOperation::DIVIDER)-1;
|
||||
operation = getInputOperation(4);
|
||||
if (operation->determineDependingAreaOfInterest(&searchInput, readOperation, output) ) {
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
operation = getInputOperation(0);
|
||||
if (operation->determineDependingAreaOfInterest(&newInput, readOperation, output) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
// InverseSearchRadiusOperation
|
||||
InverseSearchRadiusOperation::InverseSearchRadiusOperation() : NodeOperation()
|
||||
{
|
||||
this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // radius
|
||||
this->addInputSocket(COM_DT_VALUE, COM_SC_NO_RESIZE); // depth
|
||||
this->addOutputSocket(COM_DT_COLOR);
|
||||
this->setComplex(true);
|
||||
this->inputRadius = NULL;
|
||||
this->inputDepth = NULL;
|
||||
}
|
||||
|
||||
void InverseSearchRadiusOperation::initExecution()
|
||||
{
|
||||
this->inputRadius = this->getInputSocketReader(0);
|
||||
this->inputDepth = this->getInputSocketReader(1);
|
||||
}
|
||||
|
||||
void* InverseSearchRadiusOperation::initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers)
|
||||
{
|
||||
MemoryBuffer * data = new MemoryBuffer(NULL, rect);
|
||||
int x, y;
|
||||
float width = this->inputRadius->getWidth();
|
||||
float height = this->inputRadius->getHeight();
|
||||
|
||||
for (x = rect->xmin; x < rect->xmax ; x++) {
|
||||
for (y = rect->ymin; y < rect->ymax ; y++) {
|
||||
float[4] temp;
|
||||
int rx = x * DIVIDER;
|
||||
int ry = y * DIVIDER;
|
||||
this->inputRadius->read(temp, rx, ry, memoryBuffers, NULL);
|
||||
float centerRadius = temp[0];
|
||||
this->inputDepth->read(temp, rx, ry, memoryBuffers, NULL);
|
||||
float centerDepth = temp[0];
|
||||
t[0] = MAX2(rx - this->maxBlur, 0.0f);
|
||||
t[1] = MAX2(ry - this->maxBlur, 0.0f);
|
||||
t[2] = MIN2(rx + this->maxBlur, width);
|
||||
t[3] = MIN2(ry + this->maxBlur, height);
|
||||
int minx = t[0];
|
||||
int miny = t[1];
|
||||
int maxx = t[2];
|
||||
int maxy = t[3];
|
||||
int sminx = rx;
|
||||
int smaxx = rx;
|
||||
int sminy = ry;
|
||||
int smaxy = ry;
|
||||
for (int nx = minx ; nx < maxx ; nx ++) {
|
||||
for (int ny = miny ; ny < maxy ; ny ++) {
|
||||
this->inputRadius->read(temp, nx, ny, memoryBuffers, NULL);
|
||||
if (nx < rx && temp[0])
|
||||
|
||||
}
|
||||
}
|
||||
float t[4];
|
||||
data->writePixel(x, y, t);
|
||||
}
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
void InverseSearchRadiusOperation::executePixel(float *color, int x, int y, MemoryBuffer *inputBuffers[], void *data)
|
||||
{
|
||||
MemoryBuffer *buffer = (MemoryBuffer*)data;
|
||||
buffer->read(color, x, y);
|
||||
}
|
||||
|
||||
void InverseSearchRadiusOperation::deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data)
|
||||
{
|
||||
if (data) {
|
||||
MemoryBuffer* mb = (MemoryBuffer*)data;
|
||||
delete mb;
|
||||
}
|
||||
}
|
||||
|
||||
void InverseSearchRadiusOperation::deinitExecution()
|
||||
{
|
||||
this->inputRadius = NULL;
|
||||
this->inputDepth = NULL;
|
||||
}
|
||||
|
||||
void InverseSearchRadiusOperation::determineResolution(unsigned int resolution[], unsigned int preferredResolution[])
|
||||
{
|
||||
NodeOperation::determineResolution(resolution, preferredResolution);
|
||||
resolution[0] = resolution[0] / DIVIDER;
|
||||
resolution[1] = resolution[1] / DIVIDER;
|
||||
}
|
||||
|
||||
bool InverseSearchRadiusOperation::determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output)
|
||||
{
|
||||
rcti newRect;
|
||||
newRect.ymin = input->ymin*DIVIDER;
|
||||
newRect.ymax = input->ymax*DIVIDER;
|
||||
newRect.xmin = input->xmin*DIVIDER;
|
||||
newRect.xmax = input->xmax*DIVIDER;
|
||||
return NodeOperation::determineDependingAreaOfInterest(&newRect, readOperation, output);
|
||||
}
|
||||
#endif
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "COM_NodeOperation.h"
|
||||
#include "COM_QualityStepHelper.h"
|
||||
|
||||
|
||||
class VariableSizeBokehBlurOperation : public NodeOperation, public QualityStepHelper {
|
||||
private:
|
||||
int m_maxBlur;
|
||||
@@ -33,6 +34,9 @@ private:
|
||||
SocketReader *m_inputBokehProgram;
|
||||
SocketReader *m_inputSizeProgram;
|
||||
SocketReader *m_inputDepthProgram;
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
SocketReader *inputSearchProgram;
|
||||
#endif
|
||||
|
||||
public:
|
||||
VariableSizeBokehBlurOperation();
|
||||
@@ -60,4 +64,42 @@ public:
|
||||
|
||||
|
||||
};
|
||||
|
||||
#ifdef COM_DEFOCUS_SEARCH
|
||||
class InverseSearchRadiusOperation : public NodeOperation {
|
||||
private:
|
||||
int maxBlur;
|
||||
float threshold;
|
||||
SocketReader *inputDepth;
|
||||
SocketReader *inputRadius;
|
||||
public:
|
||||
static const int DIVIDER = 4;
|
||||
|
||||
InverseSearchRadiusOperation();
|
||||
|
||||
/**
|
||||
* the inner loop of this program
|
||||
*/
|
||||
void executePixel(float *color, int x, int y, MemoryBuffer * inputBuffers[], void *data);
|
||||
|
||||
/**
|
||||
* Initialize the execution
|
||||
*/
|
||||
void initExecution();
|
||||
void* initializeTileData(rcti *rect, MemoryBuffer **memoryBuffers);
|
||||
void deinitializeTileData(rcti *rect, MemoryBuffer **memoryBuffers, void *data);
|
||||
|
||||
/**
|
||||
* Deinitialize the execution
|
||||
*/
|
||||
void deinitExecution();
|
||||
|
||||
bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output);
|
||||
void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]);
|
||||
|
||||
void setMaxBlur(int maxRadius) { this->maxBlur = maxRadius; }
|
||||
|
||||
void setThreshold(float threshold) { this->threshold = threshold; }
|
||||
};
|
||||
#endif
|
||||
#endif
|
||||
|
@@ -63,6 +63,9 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
|
||||
MemoryBuffer *memoryBuffer = this->m_memoryProxy->getBuffer();
|
||||
float *buffer = memoryBuffer->getBuffer();
|
||||
if (this->m_input->isComplex()) {
|
||||
bNode* bnode = this->m_input->getbNode();
|
||||
if (bnode&& bnode->new_node) bnode->new_node->highlight++;
|
||||
|
||||
void *data = this->m_input->initializeTileData(rect, memoryBuffers);
|
||||
int x1 = rect->xmin;
|
||||
int y1 = rect->ymin;
|
||||
@@ -87,6 +90,7 @@ void WriteBufferOperation::executeRegion(rcti *rect, unsigned int tileNumber, Me
|
||||
this->m_input->deinitializeTileData(rect, memoryBuffers, data);
|
||||
data = NULL;
|
||||
}
|
||||
if (bnode&& bnode->new_node) bnode->new_node->highlight++;
|
||||
}
|
||||
else {
|
||||
int x1 = rect->xmin;
|
||||
@@ -139,6 +143,8 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice* device, rcti *rect,
|
||||
list<cl_mem> *clMemToCleanUp = new list<cl_mem>();
|
||||
clMemToCleanUp->push_back(clOutputBuffer);
|
||||
list<cl_kernel> *clKernelsToCleanUp = new list<cl_kernel>();
|
||||
bNode* bnode = this->m_input->getbNode();
|
||||
if (bnode&& bnode->new_node) bnode->new_node->highlight++;
|
||||
|
||||
this->m_input->executeOpenCL(device, outputBuffer, clOutputBuffer, inputMemoryBuffers, clMemToCleanUp, clKernelsToCleanUp);
|
||||
|
||||
@@ -157,6 +163,7 @@ void WriteBufferOperation::executeOpenCLRegion(OpenCLDevice* device, rcti *rect,
|
||||
|
||||
this->getMemoryProxy()->getBuffer()->copyContentFrom(outputBuffer);
|
||||
|
||||
if (bnode&& bnode->new_node) bnode->new_node->highlight++;
|
||||
// STEP 4
|
||||
|
||||
|
||||
|
@@ -724,6 +724,12 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
|
||||
if (node->flag & NODE_MUTED)
|
||||
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
|
||||
|
||||
if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) {
|
||||
if (node->highlight) {
|
||||
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
|
||||
node->highlight = 0;
|
||||
}
|
||||
}
|
||||
uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
|
||||
uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD);
|
||||
|
||||
@@ -862,7 +868,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
|
||||
node->block= NULL;
|
||||
}
|
||||
|
||||
static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *node)
|
||||
static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
bNodeSocket *sock;
|
||||
rctf *rct= &node->totr;
|
||||
@@ -879,6 +885,14 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b
|
||||
UI_ThemeColor(color_id);
|
||||
if (node->flag & NODE_MUTED)
|
||||
UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f);
|
||||
|
||||
if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) {
|
||||
if (node->highlight) {
|
||||
UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f);
|
||||
node->highlight = 0;
|
||||
}
|
||||
}
|
||||
|
||||
uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad);
|
||||
|
||||
/* outline active and selected emphasis */
|
||||
@@ -1005,7 +1019,7 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode)
|
||||
void node_draw_default(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node)
|
||||
{
|
||||
if (node->flag & NODE_HIDDEN)
|
||||
node_draw_hidden(C, ar, snode, node);
|
||||
node_draw_hidden(C, ar, snode, ntree, node);
|
||||
else
|
||||
node_draw_basis(C, ar, snode, ntree, node);
|
||||
}
|
||||
|
@@ -177,10 +177,11 @@ typedef struct bNode {
|
||||
char label[64]; /* custom user-defined label, MAX_NAME */
|
||||
short custom1, custom2; /* to be abused for buttons */
|
||||
float custom3, custom4;
|
||||
int highlight; /* 0 = not highlighted, 1-N = highlighted*/
|
||||
int pad;
|
||||
|
||||
short need_exec, exec; /* need_exec is set as UI execution event, exec is flag during exec */
|
||||
void *threaddata; /* optional extra storage for use in thread (read only then!) */
|
||||
|
||||
rctf totr; /* entire boundbox */
|
||||
rctf butr; /* optional buttons area */
|
||||
rctf prvr; /* optional preview area */
|
||||
|
@@ -880,6 +880,7 @@ typedef enum eSpaceNode_Flag {
|
||||
SNODE_USE_ALPHA = (1 << 3),
|
||||
SNODE_SHOW_ALPHA = (1 << 4),
|
||||
SNODE_AUTO_RENDER = (1 << 5),
|
||||
SNODE_SHOW_HIGHLIGHT = (1 << 6),
|
||||
} eSpaceNode_Flag;
|
||||
|
||||
/* snode->texfrom */
|
||||
|
@@ -2926,6 +2926,11 @@ static void rna_def_space_node(BlenderRNA *brna)
|
||||
RNA_def_property_enum_items(prop, backdrop_channels_items);
|
||||
RNA_def_property_ui_text(prop, "Draw Channels", "Channels of the image to draw");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
|
||||
|
||||
prop = RNA_def_property(srna, "show_highlight", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_SHOW_HIGHLIGHT);
|
||||
RNA_def_property_ui_text(prop, "Highlight", "Highlight nodes that are being calculated");
|
||||
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
|
||||
}
|
||||
|
||||
static void rna_def_space_logic(BlenderRNA *brna)
|
||||
|
@@ -118,7 +118,6 @@ static void update_node(bNodeTree *ntree, bNode *node)
|
||||
}
|
||||
}
|
||||
node->need_exec= 1;
|
||||
|
||||
/* individual node update call */
|
||||
if (node->typeinfo->updatefunc)
|
||||
node->typeinfo->updatefunc(ntree, node);
|
||||
@@ -192,6 +191,8 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
|
||||
|
||||
/* move over the compbufs and previews */
|
||||
for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
|
||||
lnode->new_node->new_node = lnode;
|
||||
lnode->highlight = 0;
|
||||
if ( (lnode->exec & NODE_READY) && !(lnode->exec & NODE_SKIPPED) ) {
|
||||
if (ntreeNodeExists(ntree, lnode->new_node)) {
|
||||
|
||||
@@ -200,6 +201,7 @@ static void local_sync(bNodeTree *localtree, bNodeTree *ntree)
|
||||
lnode->new_node->preview= lnode->preview;
|
||||
lnode->preview= NULL;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,6 +214,7 @@ static void local_merge(bNodeTree *localtree, bNodeTree *ntree)
|
||||
|
||||
/* move over the compbufs and previews */
|
||||
for (lnode= localtree->nodes.first; lnode; lnode= lnode->next) {
|
||||
lnode->highlight = 0;
|
||||
if (ntreeNodeExists(ntree, lnode->new_node)) {
|
||||
if (ELEM(lnode->type, CMP_NODE_VIEWER, CMP_NODE_SPLITVIEWER)) {
|
||||
if (lnode->id && (lnode->flag & NODE_DO_OUTPUT)) {
|
||||
|
Reference in New Issue
Block a user