From 8ebec02df6e58fe02bd33c236601a3209f9818cd Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Thu, 14 Jun 2012 09:41:41 +0000 Subject: Removed the actual data type concept as it was never used. --- source/blender/compositor/intern/COM_Converter.cpp | 4 +- .../compositor/intern/COM_ExecutionSystem.cpp | 26 +------- .../intern/COM_ExecutionSystemHelper.cpp | 15 +---- .../blender/compositor/intern/COM_InputSocket.cpp | 78 +--------------------- source/blender/compositor/intern/COM_InputSocket.h | 15 ----- source/blender/compositor/intern/COM_NodeBase.cpp | 52 --------------- source/blender/compositor/intern/COM_NodeBase.h | 28 -------- .../blender/compositor/intern/COM_OutputSocket.cpp | 57 ---------------- .../blender/compositor/intern/COM_OutputSocket.h | 24 +------ source/blender/compositor/intern/COM_Socket.cpp | 7 -- source/blender/compositor/intern/COM_Socket.h | 22 +----- 11 files changed, 10 insertions(+), 318 deletions(-) (limited to 'source/blender/compositor/intern') diff --git a/source/blender/compositor/intern/COM_Converter.cpp b/source/blender/compositor/intern/COM_Converter.cpp index dc6409e7b86..f4bb89969ff 100644 --- a/source/blender/compositor/intern/COM_Converter.cpp +++ b/source/blender/compositor/intern/COM_Converter.cpp @@ -362,8 +362,8 @@ void Converter::convertDataType(SocketConnection *connection, ExecutionSystem *s { OutputSocket *outputSocket = connection->getFromSocket(); InputSocket *inputSocket = connection->getToSocket(); - DataType fromDatatype = outputSocket->getActualDataType(); - DataType toDatatype = inputSocket->getActualDataType(); + DataType fromDatatype = outputSocket->getDataType(); + DataType toDatatype = inputSocket->getDataType(); NodeOperation * converter = NULL; if (fromDatatype == COM_DT_VALUE && toDatatype == COM_DT_COLOR) { converter = new ConvertValueToColourProg(); diff --git a/source/blender/compositor/intern/COM_ExecutionSystem.cpp b/source/blender/compositor/intern/COM_ExecutionSystem.cpp index 9681996c74d..b84e9d0d3f7 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystem.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystem.cpp @@ -229,19 +229,15 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation) void ExecutionSystem::convertToOperations() { unsigned int index; - // first determine data types of the nodes, this can be used by the node to convert to a different operation system - this->determineActualSocketDataTypes((vector&)this->nodes); for (index = 0; index < this->nodes.size(); index++) { Node *node = (Node*)this->nodes[index]; node->convertToOperations(this, &this->context); } - // update the socket types of the operations. this will be used to add conversion operations in the system - this->determineActualSocketDataTypes((vector&)this->operations); for (index = 0 ; index < this->connections.size(); index ++) { SocketConnection *connection = this->connections[index]; if (connection->isValid()) { - if (connection->getFromSocket()->getActualDataType() != connection->getToSocket()->getActualDataType()) { + if (connection->getFromSocket()->getDataType() != connection->getToSocket()->getDataType()) { Converter::convertDataType(connection, this); } } @@ -307,26 +303,6 @@ void ExecutionSystem::addSocketConnection(SocketConnection *connection) } -void ExecutionSystem::determineActualSocketDataTypes(vector &nodes) -{ - unsigned int index; - /* first do all input nodes */ - for (index = 0; index < nodes.size(); index++) { - NodeBase *node = nodes[index]; - if (node->isInputNode()) { - node->determineActualSocketDataTypes(); - } - } - - /* then all other nodes */ - for (index = 0; index < nodes.size(); index++) { - NodeBase *node = nodes[index]; - if (!node->isInputNode()) { - node->determineActualSocketDataTypes(); - } - } -} - void ExecutionSystem::findOutputExecutionGroup(vector *result, CompositorPriority priority) const { unsigned int index; diff --git a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp index d5ca2ec619a..2d889e269e0 100644 --- a/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp +++ b/source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp @@ -218,7 +218,7 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system) printf("|"); } printf("", socket); - switch (socket->getActualDataType()) { + switch (socket->getDataType()) { case COM_DT_VALUE: printf("Value"); break; @@ -228,9 +228,6 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system) case COM_DT_COLOR: printf("Color"); break; - case COM_DT_UNKNOWN: - printf("Unknown"); - break; } } printf("}"); @@ -270,7 +267,7 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system) printf("|"); } printf("", socket); - switch (socket->getActualDataType()) { + switch (socket->getDataType()) { case COM_DT_VALUE: printf("Value"); break; @@ -280,9 +277,6 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system) case COM_DT_COLOR: printf("Color"); break; - case COM_DT_UNKNOWN: - printf("Unknown"); - break; } } printf("}"); @@ -317,7 +311,7 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system) printf(" [color=red]"); } else { - switch (connection->getFromSocket()->getActualDataType()) { + switch (connection->getFromSocket()->getDataType()) { case COM_DT_VALUE: printf(" [color=grey]"); break; @@ -327,9 +321,6 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system) case COM_DT_COLOR: printf(" [color=orange]"); break; - case COM_DT_UNKNOWN: - printf(" [color=black]"); - break; } } printf("\r\n"); diff --git a/source/blender/compositor/intern/COM_InputSocket.cpp b/source/blender/compositor/intern/COM_InputSocket.cpp index 4d96d077901..c9705ad69fb 100644 --- a/source/blender/compositor/intern/COM_InputSocket.cpp +++ b/source/blender/compositor/intern/COM_InputSocket.cpp @@ -64,68 +64,6 @@ void InputSocket::determineResolution(unsigned int resolution[],unsigned int pre } } -DataType InputSocket::convertToSupportedDataType(DataType datatype) -{ - int supportedDataTypes = getDataType(); - if (supportedDataTypes&datatype) { - return datatype; - } - bool candoValue = supportedDataTypes&COM_DT_VALUE; - bool candoVector = supportedDataTypes&COM_DT_VECTOR; - bool candoColor = supportedDataTypes&COM_DT_COLOR; - - if (datatype == COM_DT_VALUE) { - if (candoColor) { - return COM_DT_COLOR; - } - else if (candoVector) { - return COM_DT_VECTOR; - } - } - else if (datatype == COM_DT_VECTOR) { - if (candoColor) { - return COM_DT_COLOR; - } - else if (candoValue) { - return COM_DT_VALUE; - } - } - else if (datatype == COM_DT_COLOR) { - if (candoVector) { - return COM_DT_VECTOR; - } - else if (candoValue) { - return COM_DT_VALUE; - } - } - return this->getDataType(); -} - -void InputSocket::determineActualDataType() -{ - /// @note: this method is only called for inputsocket that are not connected. - /// @note: passes COM_DT_COLOR, the convertToSupportedDataType converts this to a capable DataType - this->setActualDataType(this->convertToSupportedDataType(COM_DT_COLOR)); - #if 0 // XXX TODO check for proxy node and use output data type? - if (this->getGroupOutputSocket()) { - if (!this->isInsideOfGroupNode()) { - this->getGroupOutputSocket()->determineActualDataType(); - } - } - #endif -} - -void InputSocket::notifyActualInputType(DataType datatype) -{ - DataType supportedDataType = convertToSupportedDataType(datatype); - this->setActualDataType(supportedDataType); - this->fireActualDataTypeSet(); -} - -void InputSocket::fireActualDataTypeSet() -{ - this->getNode()->notifyActualDataTypeSet(this, this->getActualDataType()); -} void InputSocket::relinkConnections(InputSocket *relinkToSocket) { if (!isConnected()) { @@ -141,8 +79,7 @@ void InputSocket::relinkConnectionsDuplicate(InputSocket *relinkToSocket, int ed { if (!this->isConnected()) { Node *node = (Node*)this->getNode(); - switch (this->getActualDataType()) { - case COM_DT_UNKNOWN: + switch (this->getDataType()) { case COM_DT_COLOR: node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex); break; @@ -171,8 +108,7 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket, int editorNode } else { Node *node = (Node*)this->getNode(); - switch (this->getActualDataType()) { - case COM_DT_UNKNOWN: + switch (this->getDataType()) { case COM_DT_COLOR: node->addSetColorOperation(graph, relinkToSocket, editorNodeInputSocketIndex); break; @@ -186,16 +122,6 @@ void InputSocket::relinkConnections(InputSocket *relinkToSocket, int editorNode } } -const ChannelInfo *InputSocket::getChannelInfo(const int channelnumber) -{ - if (this->isConnected() && this->connection->getFromSocket()) { - return this->connection->getFromSocket()->getChannelInfo(channelnumber); - } - else { - return NULL; - } -} - bool InputSocket::isStatic() { if (isConnected()) { diff --git a/source/blender/compositor/intern/COM_InputSocket.h b/source/blender/compositor/intern/COM_InputSocket.h index 6ac6ad09126..c066b5d8303 100644 --- a/source/blender/compositor/intern/COM_InputSocket.h +++ b/source/blender/compositor/intern/COM_InputSocket.h @@ -73,19 +73,6 @@ private: InputSocketResizeMode resizeMode; - /** - * @brief convert a data type to a by the socket supported data type. - * - * @param datatype the datatype that needs to be checked - * @section data-conversion - */ - DataType convertToSupportedDataType(DataType datatype); - - /** - * @brief called when the ActualDataType is set. notifies other parties - */ - void fireActualDataTypeSet(); - public: InputSocket(DataType datatype); InputSocket(DataType datatype, InputSocketResizeMode resizeMode); @@ -104,8 +91,6 @@ public: */ void determineResolution(unsigned int resolution[], unsigned int preferredResolution[]); - void determineActualDataType(); - /** * @brief Notifies the Input of the data type (via a SocketConnection) * @param datatype the datatype to evaluate diff --git a/source/blender/compositor/intern/COM_NodeBase.cpp b/source/blender/compositor/intern/COM_NodeBase.cpp index 17a623c9c81..5ffe9bdd26a 100644 --- a/source/blender/compositor/intern/COM_NodeBase.cpp +++ b/source/blender/compositor/intern/COM_NodeBase.cpp @@ -89,55 +89,3 @@ InputSocket *NodeBase::getInputSocket(int index) { return this->inputsockets[index]; } - - -void NodeBase::determineActualSocketDataTypes() -{ - unsigned int index; - for (index = 0 ; index < this->outputsockets.size() ; index ++) { - OutputSocket *socket = this->outputsockets[index]; - if (socket->getActualDataType() ==COM_DT_UNKNOWN && socket->isConnected()) { - socket->determineActualDataType(); - } - } - for (index = 0 ; index < this->inputsockets.size() ; index ++) { - InputSocket *socket = this->inputsockets[index]; - if (socket->getActualDataType() ==COM_DT_UNKNOWN) { - socket->determineActualDataType(); - } - } -} - -DataType NodeBase::determineActualDataType(OutputSocket *outputsocket) -{ - const int inputIndex = outputsocket->getInputSocketDataTypeDeterminatorIndex(); - if (inputIndex != -1) { - return this->getInputSocket(inputIndex)->getActualDataType(); - } - else { - return outputsocket->getDataType(); - } -} - -void NodeBase::notifyActualDataTypeSet(InputSocket *socket, DataType actualType) -{ - unsigned int index; - int socketIndex = -1; - for (index = 0 ; index < this->inputsockets.size() ; index ++) { - if (this->inputsockets[index] == socket) { - socketIndex = (int)index; - break; - } - } - if (socketIndex == -1) return; - - for (index = 0 ; index < this->outputsockets.size() ; index ++) { - OutputSocket *socket = this->outputsockets[index]; - if (socket->isActualDataTypeDeterminedByInputSocket() && - socket->getInputSocketDataTypeDeterminatorIndex() == socketIndex) - { - socket->setActualDataType(actualType); - socket->fireActualDataType(); - } - } -} diff --git a/source/blender/compositor/intern/COM_NodeBase.h b/source/blender/compositor/intern/COM_NodeBase.h index 3917904afe3..5e3a4fa5531 100644 --- a/source/blender/compositor/intern/COM_NodeBase.h +++ b/source/blender/compositor/intern/COM_NodeBase.h @@ -73,24 +73,6 @@ public: */ virtual ~NodeBase(); - /** - * @brief determine the actual socket data types that will go through the system - */ - virtual void determineActualSocketDataTypes(); - - /** - * @brief determine the actual socket data types of a specific outputsocket - * - * @param outputsocket - * a reference to the actual outputsocket where the datatype must be determined from - * - * @return - * COM_DT_VALUE if it is a value (1 float buffer) - * COM_DT_COLOR if it is a value (4 float buffer) - * COM_DT_VECTOR if it is a value (3 float buffer) - */ - virtual DataType determineActualDataType(OutputSocket *outputsocket); - /** * @brief is this node an operation? * This is true when the instance is of the subclass NodeOperation. @@ -116,16 +98,6 @@ public: */ const unsigned int getNumberOfOutputSockets() const { return this->outputsockets.size(); } - /** - * after the data has been determined of an outputsocket that has a connection with an inputsocket this method is called on the - * node that contains the inputsocket. - * @param socket - * the reference of the inputsocket where connected data type is found - * @param actualType [COM_DT_VALUE, COM_DT_VECTOR, COM_DT_COLOR] - * the actual data type that is coming from the connected output socket - */ - virtual void notifyActualDataTypeSet(InputSocket *socket, const DataType actualType); - /** * get the reference to a certain outputsocket * @param index diff --git a/source/blender/compositor/intern/COM_OutputSocket.cpp b/source/blender/compositor/intern/COM_OutputSocket.cpp index 708b2d65d46..77bad3c006f 100644 --- a/source/blender/compositor/intern/COM_OutputSocket.cpp +++ b/source/blender/compositor/intern/COM_OutputSocket.cpp @@ -27,16 +27,6 @@ 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(); } int OutputSocket::isOutputSocket() const { return true; } @@ -57,51 +47,11 @@ void OutputSocket::determineResolution(unsigned int resolution[], unsigned int p } } -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; - } - - this->setActualDataType(actualDatatype); - this->fireActualDataType(); -} - 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()) { @@ -109,7 +59,6 @@ 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 { @@ -119,7 +68,6 @@ void OutputSocket::relinkConnections(OutputSocket *relinkToSocket, bool single) connection->setFromSocket(relinkToSocket); relinkToSocket->addConnection(connection); } -// relinkToSocket->setActualDataType(this->getActualDataType()); this->connections.clear(); } } @@ -157,8 +105,3 @@ WriteBufferOperation *OutputSocket::findAttachedWriteBufferOperation() const return NULL; } -ChannelInfo *OutputSocket::getChannelInfo(const int channelnumber) -{ - return &this->channelinfo[channelnumber]; -} - diff --git a/source/blender/compositor/intern/COM_OutputSocket.h b/source/blender/compositor/intern/COM_OutputSocket.h index e008d651046..c073703c423 100644 --- a/source/blender/compositor/intern/COM_OutputSocket.h +++ b/source/blender/compositor/intern/COM_OutputSocket.h @@ -43,15 +43,7 @@ class WriteBufferOperation; class OutputSocket : public Socket { private: vector connections; - - /** - * @brief index of the inputsocket that determines the datatype of this outputsocket - * -1 will not use any inputsocket to determine the datatype, but use the outputsocket - * default datatype. - */ - int inputSocketDataTypeDeterminatorIndex; - - ChannelInfo channelinfo[4]; + void removeFirstConnection(); public: OutputSocket(DataType datatype); @@ -72,18 +64,10 @@ public: /** * @brief determine the actual data type and channel info. */ - void determineActualDataType(); void relinkConnections(OutputSocket *relinkToSocket) { this->relinkConnections(relinkToSocket, false); }; void relinkConnections(OutputSocket *relinkToSocket, bool single); - bool isActualDataTypeDeterminedByInputSocket() { - return this->inputSocketDataTypeDeterminatorIndex > -1; - } const int getNumberOfConnections() { return connections.size(); } - /** - * @brief get the index of the inputsocket that determines the datatype of this outputsocket - */ - int getInputSocketDataTypeDeterminatorIndex() { return this->inputSocketDataTypeDeterminatorIndex; } void clearConnections(); /** @@ -93,12 +77,6 @@ public: WriteBufferOperation *findAttachedWriteBufferOperation() const; ChannelInfo *getChannelInfo(const int channelnumber); - /** - * @brief trigger determine actual data type to all connected sockets - * @note will only be triggered just after the actual data type is set. - */ - void fireActualDataType(); - private: }; diff --git a/source/blender/compositor/intern/COM_Socket.cpp b/source/blender/compositor/intern/COM_Socket.cpp index a5336ac1202..af9ad1967a5 100644 --- a/source/blender/compositor/intern/COM_Socket.cpp +++ b/source/blender/compositor/intern/COM_Socket.cpp @@ -27,7 +27,6 @@ Socket::Socket(DataType datatype) { this->datatype = datatype; - this->actualType = COM_DT_UNKNOWN; this->editorSocket = NULL; this->node = NULL; } @@ -42,9 +41,3 @@ int Socket::isOutputSocket() const { return false; } const int Socket::isConnected() const {return false;} void Socket::setNode(NodeBase *node) {this->node = node;} NodeBase *Socket::getNode() const {return this->node;} - -DataType Socket::getActualDataType() const {return this->actualType;} -void Socket::setActualDataType(DataType actualType) -{ - this->actualType = actualType; -} diff --git a/source/blender/compositor/intern/COM_Socket.h b/source/blender/compositor/intern/COM_Socket.h index 0be21a6b1b8..7c5c2198a16 100644 --- a/source/blender/compositor/intern/COM_Socket.h +++ b/source/blender/compositor/intern/COM_Socket.h @@ -57,12 +57,6 @@ private: */ DataType datatype; - /** - * the actual data type during execution. This can be different than the field datatype, based on the conversion rules of the node - * @section data-conversion - */ - DataType actualType; - bNodeSocket *editorSocket; public: Socket(DataType datatype); @@ -71,25 +65,11 @@ public: void setNode(NodeBase *node); NodeBase *getNode() const; - /** - * @brief get the actual data type - * - * @note The actual data type can differ from the data type this socket expects. - * @return actual DataType - */ - DataType getActualDataType() const; - - /** - * @brief set the actual data type - * @param actualType the new actual type - */ - void setActualDataType(DataType actualType); - + const virtual int isConnected() const; int isInputSocket() const; int isOutputSocket() const; virtual void determineResolution(int resolution[], unsigned int preferredResolution[]) {} - virtual void determineActualDataType() {} void setEditorSocket(bNodeSocket *editorSocket) { this->editorSocket = editorSocket; } bNodeSocket *getbNodeSocket() const { return this->editorSocket; } -- cgit v1.2.3