diff options
Diffstat (limited to 'source/blender/compositor/intern/COM_OutputSocket.cpp')
-rw-r--r-- | source/blender/compositor/intern/COM_OutputSocket.cpp | 82 |
1 files changed, 16 insertions, 66 deletions
diff --git a/source/blender/compositor/intern/COM_OutputSocket.cpp b/source/blender/compositor/intern/COM_OutputSocket.cpp index 00d3518cd15..484254fe6de 100644 --- a/source/blender/compositor/intern/COM_OutputSocket.cpp +++ b/source/blender/compositor/intern/COM_OutputSocket.cpp @@ -25,63 +25,28 @@ #include "COM_SocketConnection.h" #include "COM_NodeOperation.h" -OutputSocket::OutputSocket(DataType datatype) :Socket(datatype) +OutputSocket::OutputSocket(DataType datatype) : Socket(datatype) { - this->inputSocketDataTypeDeterminatorIndex = -1; -} -OutputSocket::OutputSocket(DataType datatype, int inputSocketDataTypeDeterminatorIndex) :Socket(datatype) -{ - this->inputSocketDataTypeDeterminatorIndex = inputSocketDataTypeDeterminatorIndex; -} - -OutputSocket::OutputSocket(OutputSocket *from): Socket(from->getDataType()) -{ - this->inputSocketDataTypeDeterminatorIndex = from->getInputSocketDataTypeDeterminatorIndex(); + /* pass */ } int OutputSocket::isOutputSocket() const { return true; } -const int OutputSocket::isConnected() const { return this->connections.size()!=0; } +const int OutputSocket::isConnected() const { return this->connections.size() != 0; } void OutputSocket::determineResolution(unsigned int resolution[], unsigned int preferredResolution[]) { NodeBase *node = this->getNode(); if (node->isOperation()) { - NodeOperation *operation = (NodeOperation*)node; - operation->determineResolution(resolution, preferredResolution); - operation->setResolution(resolution); - } -} - -void OutputSocket::determineActualDataType() -{ - DataType actualDatatype = this->getNode()->determineActualDataType(this); - - /** @todo: set the channel info needs to be moved after integration with OCIO */ - this->channelinfo[0].setNumber(0); - this->channelinfo[1].setNumber(1); - this->channelinfo[2].setNumber(2); - this->channelinfo[3].setNumber(3); - switch (actualDatatype) { - case COM_DT_VALUE: - this->channelinfo[0].setType(COM_CT_Value); - break; - case COM_DT_VECTOR: - this->channelinfo[0].setType(COM_CT_X); - this->channelinfo[1].setType(COM_CT_Y); - this->channelinfo[2].setType(COM_CT_Z); - break; - case COM_DT_COLOR: - this->channelinfo[0].setType(COM_CT_ColorComponent); - this->channelinfo[1].setType(COM_CT_ColorComponent); - this->channelinfo[2].setType(COM_CT_ColorComponent); - this->channelinfo[3].setType(COM_CT_Alpha); - break; - default: - break; + NodeOperation *operation = (NodeOperation *)node; + if (operation->isResolutionSet()) { + resolution[0] = operation->getWidth(); + resolution[1] = operation->getHeight(); + } + else { + operation->determineResolution(resolution, preferredResolution); + operation->setResolution(resolution); + } } - - this->setActualDataType(actualDatatype); - this->fireActualDataType(); } void OutputSocket::addConnection(SocketConnection *connection) @@ -89,14 +54,6 @@ void OutputSocket::addConnection(SocketConnection *connection) this->connections.push_back(connection); } -void OutputSocket::fireActualDataType() -{ - unsigned int index; - for (index = 0 ; index < this->connections.size();index ++) { - SocketConnection *connection = this->connections[index]; - connection->getToSocket()->notifyActualInputType(this->getActualDataType()); - } -} void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single) { if (isConnected()) { @@ -104,17 +61,15 @@ void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single) SocketConnection *connection = this->connections[0]; connection->setFromSocket(relinkToSocket); relinkToSocket->addConnection(connection); -// relinkToSocket->setActualDataType(this->getActualDataType()); this->connections.erase(this->connections.begin()); } else { unsigned int index; - for (index = 0 ; index < this->connections.size();index ++) { + for (index = 0; index < this->connections.size(); index++) { SocketConnection *connection = this->connections[index]; connection->setFromSocket(relinkToSocket); relinkToSocket->addConnection(connection); } -// relinkToSocket->setActualDataType(this->getActualDataType()); this->connections.clear(); } } @@ -139,21 +94,16 @@ void OutputSocket::clearConnections() WriteBufferOperation *OutputSocket::findAttachedWriteBufferOperation() const { unsigned int index; - for (index = 0 ; index < this->connections.size();index++) { + for (index = 0; index < this->connections.size(); index++) { SocketConnection *connection = this->connections[index]; NodeBase *node = connection->getToNode(); if (node->isOperation()) { - NodeOperation *operation = (NodeOperation*)node; + NodeOperation *operation = (NodeOperation *)node; if (operation->isWriteBufferOperation()) { - return (WriteBufferOperation*)operation; + return (WriteBufferOperation *)operation; } } } return NULL; } -ChannelInfo *OutputSocket::getChannelInfo(const int channelnumber) -{ - return &this->channelinfo[channelnumber]; -} - |