diff options
Diffstat (limited to 'source/blender/compositor')
5 files changed, 43 insertions, 9 deletions
diff --git a/source/blender/compositor/nodes/COM_CompositorNode.cpp b/source/blender/compositor/nodes/COM_CompositorNode.cpp index a78f96adfc6..81fb37cc238 100644 --- a/source/blender/compositor/nodes/COM_CompositorNode.cpp +++ b/source/blender/compositor/nodes/COM_CompositorNode.cpp @@ -32,6 +32,8 @@ CompositorNode::CompositorNode(bNode *editorNode) : Node(editorNode) void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { bNode *editorNode = this->getbNode(); + bool is_active = (editorNode->flag & NODE_DO_OUTPUT_RECALC) || + context->isRendering(); InputSocket *imageSocket = this->getInputSocket(0); InputSocket *alphaSocket = this->getInputSocket(1); @@ -42,10 +44,12 @@ void CompositorNode::convertToOperations(ExecutionSystem *graph, CompositorConte compositorOperation->setRenderData(context->getRenderData()); compositorOperation->setbNodeTree(context->getbNodeTree()); compositorOperation->setIgnoreAlpha(editorNode->custom2 & CMP_NODE_OUTPUT_IGNORE_ALPHA); + compositorOperation->setActive(is_active); imageSocket->relinkConnections(compositorOperation->getInputSocket(0), 0, graph); alphaSocket->relinkConnections(compositorOperation->getInputSocket(1)); depthSocket->relinkConnections(compositorOperation->getInputSocket(2)); graph->addOperation(compositorOperation); - addPreviewOperation(graph, context, compositorOperation->getInputSocket(0)); -} + if (is_active) + addPreviewOperation(graph, context, compositorOperation->getInputSocket(0)); +} diff --git a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp index 37b888becca..0293f4926db 100644 --- a/source/blender/compositor/nodes/COM_SplitViewerNode.cpp +++ b/source/blender/compositor/nodes/COM_SplitViewerNode.cpp @@ -33,6 +33,11 @@ SplitViewerNode::SplitViewerNode(bNode *editorNode) : Node(editorNode) void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { + bNode *editorNode = this->getbNode(); + bool is_active = ((editorNode->flag & NODE_DO_OUTPUT_RECALC) && + (editorNode->flag & NODE_DO_OUTPUT) && this->isInActiveGroup()) || + context->isRendering(); + InputSocket *image1Socket = this->getInputSocket(0); InputSocket *image2Socket = this->getInputSocket(1); Image *image = (Image *)this->getbNode()->id; @@ -41,7 +46,7 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont SplitViewerOperation *splitViewerOperation = new SplitViewerOperation(); splitViewerOperation->setImage(image); splitViewerOperation->setImageUser(imageUser); - splitViewerOperation->setActive((this->getbNode()->flag & NODE_DO_OUTPUT) && this->isInActiveGroup()); + splitViewerOperation->setActive(is_active); splitViewerOperation->setSplitPercentage(this->getbNode()->custom1); splitViewerOperation->setViewSettings(context->getViewSettings()); @@ -56,7 +61,10 @@ void SplitViewerNode::convertToOperations(ExecutionSystem *graph, CompositorCont splitViewerOperation->setXSplit(!this->getbNode()->custom2); image1Socket->relinkConnections(splitViewerOperation->getInputSocket(0), 0, graph); image2Socket->relinkConnections(splitViewerOperation->getInputSocket(1), 1, graph); - addPreviewOperation(graph, context, splitViewerOperation->getInputSocket(0)); + + if (is_active) + addPreviewOperation(graph, context, splitViewerOperation->getInputSocket(0)); + graph->addOperation(splitViewerOperation); } } diff --git a/source/blender/compositor/nodes/COM_ViewerNode.cpp b/source/blender/compositor/nodes/COM_ViewerNode.cpp index 8f9e58fee13..2eb4c3a23ad 100644 --- a/source/blender/compositor/nodes/COM_ViewerNode.cpp +++ b/source/blender/compositor/nodes/COM_ViewerNode.cpp @@ -33,17 +33,21 @@ ViewerNode::ViewerNode(bNode *editorNode) : Node(editorNode) void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext *context) { + bNode *editorNode = this->getbNode(); + bool is_active = ((editorNode->flag & NODE_DO_OUTPUT_RECALC) && + (editorNode->flag & NODE_DO_OUTPUT) && this->isInActiveGroup()) || + context->isRendering(); + InputSocket *imageSocket = this->getInputSocket(0); InputSocket *alphaSocket = this->getInputSocket(1); InputSocket *depthSocket = this->getInputSocket(2); Image *image = (Image *)this->getbNode()->id; ImageUser *imageUser = (ImageUser *) this->getbNode()->storage; - bNode *editorNode = this->getbNode(); ViewerOperation *viewerOperation = new ViewerOperation(); viewerOperation->setbNodeTree(context->getbNodeTree()); viewerOperation->setImage(image); viewerOperation->setImageUser(imageUser); - viewerOperation->setActive((editorNode->flag & NODE_DO_OUTPUT) && this->isInActiveGroup()); + viewerOperation->setActive(is_active); viewerOperation->setChunkOrder((OrderOfChunks)editorNode->custom1); viewerOperation->setCenterX(editorNode->custom3); viewerOperation->setCenterY(editorNode->custom4); @@ -63,5 +67,7 @@ void ViewerNode::convertToOperations(ExecutionSystem *graph, CompositorContext * alphaSocket->relinkConnections(viewerOperation->getInputSocket(1)); depthSocket->relinkConnections(viewerOperation->getInputSocket(2)); graph->addOperation(viewerOperation); - addPreviewOperation(graph, context, viewerOperation->getInputSocket(0)); + + if (is_active) + addPreviewOperation(graph, context, viewerOperation->getInputSocket(0)); } diff --git a/source/blender/compositor/operations/COM_CompositorOperation.cpp b/source/blender/compositor/operations/COM_CompositorOperation.cpp index 43f491ad2d9..81e86efed42 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.cpp +++ b/source/blender/compositor/operations/COM_CompositorOperation.cpp @@ -50,12 +50,16 @@ CompositorOperation::CompositorOperation() : NodeOperation() this->m_depthInput = NULL; this->m_ignoreAlpha = false; + this->m_active = false; this->m_sceneName[0] = '\0'; } void CompositorOperation::initExecution() { + if (!this->m_active) + return; + // When initializing the tree during initial load the width and height can be zero. this->m_imageInput = getInputSocketReader(0); this->m_alphaInput = getInputSocketReader(1); @@ -70,6 +74,9 @@ void CompositorOperation::initExecution() void CompositorOperation::deinitExecution() { + if (!this->m_active) + return; + if (!isBreaked()) { Render *re = RE_GetRender(this->m_sceneName); RenderResult *rr = RE_AcquireResultWrite(re); diff --git a/source/blender/compositor/operations/COM_CompositorOperation.h b/source/blender/compositor/operations/COM_CompositorOperation.h index 27d29664610..d33e89ed742 100644 --- a/source/blender/compositor/operations/COM_CompositorOperation.h +++ b/source/blender/compositor/operations/COM_CompositorOperation.h @@ -66,19 +66,28 @@ private: */ SocketReader *m_depthInput; - /* Ignore any alpha input */ + /** + * @brief Ignore any alpha input + */ bool m_ignoreAlpha; + /** + * @brief operation is active for calculating final compo result + */ + bool m_active; public: CompositorOperation(); + const bool isActiveCompositorOutput() const { return this->m_active; } void executeRegion(rcti *rect, unsigned int tileNumber); void setSceneName(const char *sceneName) { BLI_strncpy(this->m_sceneName, sceneName, sizeof(this->m_sceneName)); } void setRenderData(const RenderData *rd) { this->m_rd = rd; } - bool isOutputOperation(bool rendering) const { return true; } + bool isOutputOperation(bool rendering) const { return this->isActiveCompositorOutput(); } void initExecution(); void deinitExecution(); const CompositorPriority getRenderPriority() const { return COM_PRIORITY_MEDIUM; } void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); void setIgnoreAlpha(bool value) { this->m_ignoreAlpha = value; } + void setActive(bool active) { this->m_active = active; } }; #endif + |