Changeset View
Changeset View
Standalone View
Standalone View
source/blender/compositor/nodes/COM_SetAlphaNode.cpp
| Show All 12 Lines | |||||
| * along with this program; if not, write to the Free Software Foundation, | * along with this program; if not, write to the Free Software Foundation, | ||||
| * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||||
| * | * | ||||
| * Copyright 2011, Blender Foundation. | * Copyright 2011, Blender Foundation. | ||||
| */ | */ | ||||
| #include "COM_SetAlphaNode.h" | #include "COM_SetAlphaNode.h" | ||||
| #include "COM_ExecutionSystem.h" | #include "COM_ExecutionSystem.h" | ||||
| #include "COM_SetAlphaOperation.h" | #include "COM_SetAlphaMultiplyOperation.h" | ||||
| #include "COM_SetAlphaReplaceOperation.h" | |||||
| void SetAlphaNode::convertToOperations(NodeConverter &converter, | void SetAlphaNode::convertToOperations(NodeConverter &converter, | ||||
| const CompositorContext & /*context*/) const | const CompositorContext & /*context*/) const | ||||
| { | { | ||||
| SetAlphaOperation *operation = new SetAlphaOperation(); | const bNode *editorNode = this->getbNode(); | ||||
| const NodeSetAlpha *storage = static_cast<const NodeSetAlpha *>(editorNode->storage); | |||||
| NodeOperation *operation = nullptr; | |||||
| switch (storage->mode) { | |||||
| case CMP_NODE_SETALPHA_MODE_MULTIPLY: | |||||
| operation = new SetAlphaMultiplyOperation(); | |||||
| break; | |||||
| case CMP_NODE_SETALPHA_MODE_REPLACE: | |||||
| operation = new SetAlphaReplaceOperation(); | |||||
| break; | |||||
| } | |||||
| if (!this->getInputSocket(0)->isLinked() && this->getInputSocket(1)->isLinked()) { | if (!this->getInputSocket(0)->isLinked() && this->getInputSocket(1)->isLinked()) { | ||||
| operation->setResolutionInputSocketIndex(1); | operation->setResolutionInputSocketIndex(1); | ||||
| } | } | ||||
| converter.addOperation(operation); | converter.addOperation(operation); | ||||
| converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); | converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0)); | ||||
| converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); | converter.mapInputSocket(getInputSocket(1), operation->getInputSocket(1)); | ||||
| converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); | converter.mapOutputSocket(getOutputSocket(0), operation->getOutputSocket()); | ||||
| } | } | ||||