From d492a9ffa93f2fcffeae2b6f883d8835c0eeec8a Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Sun, 30 Jun 2013 13:35:00 +0000 Subject: [PATCH] Fix for * [#35922] RGB Input Node doesn't work properly --- .../blender/compositor/nodes/COM_MixNode.cpp | 10 -------- .../operations/COM_MixBaseOperation.cpp | 24 +++++++++++++++++++ .../operations/COM_MixBaseOperation.h | 3 +++ 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/source/blender/compositor/nodes/COM_MixNode.cpp b/source/blender/compositor/nodes/COM_MixNode.cpp index 3e8f1fb0f74..ab4e464327d 100644 --- a/source/blender/compositor/nodes/COM_MixNode.cpp +++ b/source/blender/compositor/nodes/COM_MixNode.cpp @@ -124,16 +124,6 @@ void MixNode::convertToOperations(ExecutionSystem *graph, CompositorContext *con convertProg->setUseValueAlphaMultiply(useAlphaPremultiply); convertProg->setUseClamp(useClamp); - if (color1Socket->isConnected()) { - convertProg->setResolutionInputSocketIndex(1); - } - else { - if (color2Socket->isConnected()) - convertProg->setResolutionInputSocketIndex(2); - else - convertProg->setResolutionInputSocketIndex(0); - } - valueSocket->relinkConnections(convertProg->getInputSocket(0), 0, graph); color1Socket->relinkConnections(convertProg->getInputSocket(1), 1, graph); color2Socket->relinkConnections(convertProg->getInputSocket(2), 2, graph); diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.cpp b/source/blender/compositor/operations/COM_MixBaseOperation.cpp index 438fb84ebb7..5b455338bb0 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.cpp +++ b/source/blender/compositor/operations/COM_MixBaseOperation.cpp @@ -63,6 +63,30 @@ void MixBaseOperation::executePixel(float output[4], float x, float y, PixelSamp output[3] = inputColor1[3]; } +void MixBaseOperation::determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) +{ + InputSocket *socket; + unsigned int tempPreferredResolution[2] = {0, 0}; + unsigned int tempResolution[2]; + + socket = this->getInputSocket(1); + socket->determineResolution(tempResolution, tempPreferredResolution); + if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) { + this->setResolutionInputSocketIndex(1); + } + else { + socket = this->getInputSocket(2); + socket->determineResolution(tempResolution, tempPreferredResolution); + if ((tempResolution[0] != 0) && (tempResolution[1] != 0)) { + this->setResolutionInputSocketIndex(2); + } + else { + this->setResolutionInputSocketIndex(0); + } + } + NodeOperation::determineResolution(resolution, preferredResolution); +} + void MixBaseOperation::deinitExecution() { this->m_inputValueOperation = NULL; diff --git a/source/blender/compositor/operations/COM_MixBaseOperation.h b/source/blender/compositor/operations/COM_MixBaseOperation.h index 75ca1c3f6c6..3c0c0778190 100644 --- a/source/blender/compositor/operations/COM_MixBaseOperation.h +++ b/source/blender/compositor/operations/COM_MixBaseOperation.h @@ -70,6 +70,9 @@ public: * Deinitialize the execution */ void deinitExecution(); + + void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]); + void setUseValueAlphaMultiply(const bool value) { this->m_valueAlphaMultiply = value; } bool useValueAlphaMultiply() { return this->m_valueAlphaMultiply; }