Merging r47874 through r47885 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jun 2012 11:22:24 +0000 (11:22 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 14 Jun 2012 11:22:24 +0000 (11:22 +0000)
31 files changed:
extern/recastnavigation/Recast/Include/RecastAssert.h
intern/raskter/raskter.c
source/blender/collada/ExportSettings.h
source/blender/collada/collada.cpp
source/blender/collada/collada.h
source/blender/collada/collada_utils.cpp
source/blender/collada/collada_utils.h
source/blender/compositor/COM_defines.h
source/blender/compositor/intern/COM_Converter.cpp
source/blender/compositor/intern/COM_ExecutionSystem.cpp
source/blender/compositor/intern/COM_ExecutionSystemHelper.cpp
source/blender/compositor/intern/COM_InputSocket.cpp
source/blender/compositor/intern/COM_InputSocket.h
source/blender/compositor/intern/COM_NodeBase.cpp
source/blender/compositor/intern/COM_NodeBase.h
source/blender/compositor/intern/COM_OutputSocket.cpp
source/blender/compositor/intern/COM_OutputSocket.h
source/blender/compositor/intern/COM_Socket.cpp
source/blender/compositor/intern/COM_Socket.h
source/blender/compositor/nodes/COM_MuteNode.cpp
source/blender/compositor/nodes/COM_OutputFileNode.cpp
source/blender/compositor/nodes/COM_SocketProxyNode.cpp
source/blender/compositor/nodes/COM_SwitchNode.cpp
source/blender/compositor/operations/COM_GlareFogGlowOperation.cpp
source/blender/compositor/operations/COM_SocketProxyOperation.cpp
source/blender/compositor/operations/COM_SocketProxyOperation.h
source/blender/makesrna/intern/rna_scene_api.c
source/blender/windowmanager/intern/wm_operators.c
source/gameengine/BlenderRoutines/KX_BlenderKeyboardDevice.h
source/gameengine/Rasterizer/RAS_2DFilterManager.h
source/gameengine/Rasterizer/RAS_MeshObject.h

index b58b8fcd286946a984cecf1da1f252a0d053dab7..45cb01fb595d39852e3ed2af0ad49a328c8bc46f 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifdef NDEBUG
 // From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
-#      define rcAssert(x) do { (void)sizeof(x); } while(__LINE__==-1,false)  
+#      define rcAssert(x) do { (void)sizeof(x); } while((void)(__LINE__ == -1), false)
 #else
 #      include <assert.h> 
 #      define rcAssert assert
index 0574d985d0c0af3bddf25754f990d11a3e186aa6..910cd4c6a3dc7ad2297cfe0d50cb14a34b8d87c6 100644 (file)
@@ -810,9 +810,9 @@ int PLX_antialias_buffer(float *buf, int buf_x, int buf_y) {
                buf[i] *= 0.5f;
        }
 #endif
-       buf_x = buf_x;
-       buf_y = buf_y;
-       buf[0] = buf[0];
+       (void)buf_x;
+       (void)buf_y;
+       (void)buf;
        return 1;
 #else
        /*XXX - TODO: THIS IS NOT FINAL CODE - IT DOES NOT WORK - DO NOT ENABLE IT */
index 97ea687385630df6d1d21b2343c5db456edd17a4..e856eefab9926954c0ef2cf7c9adad4436ac61c7 100644 (file)
@@ -39,6 +39,7 @@ struct ExportSettings
  bool include_armatures;
  bool include_children;
  bool use_object_instantiation;
+ bool sort_by_name;
  bool second_life;
  char *filepath;
  LinkNode *export_set;
index bc03bdc970c429347676f5ab8e1c76a8a53b81b9..9a4fd44b9e95b28789e67e99acea39417581bae2 100644 (file)
@@ -59,6 +59,7 @@ int collada_export(
     int include_children,
 
     int use_object_instantiation,
+       int sort_by_name,
     int second_life)
 {
        ExportSettings export_settings;
@@ -79,6 +80,7 @@ int collada_export(
        export_settings.include_children         = include_children != 0;
        export_settings.second_life              = second_life != 0;
        export_settings.use_object_instantiation = use_object_instantiation != 0;
+       export_settings.sort_by_name             = sort_by_name != 0;
        export_settings.filepath                 = (char *)filepath;
 
        int includeFilter = OB_REL_NONE;
@@ -88,6 +90,9 @@ int collada_export(
        eObjectSet objectSet = (export_settings.selected) ? OB_SET_SELECTED : OB_SET_ALL;
        export_settings.export_set = BKE_object_relational_superset(sce, objectSet, (eObRelationTypes)includeFilter);
 
+       if (export_settings.sort_by_name)
+               bc_bubble_sort_by_Object_name(export_settings.export_set);
+
        DocumentExporter exporter(&export_settings);
        exporter.exportCurrentScene(sce);
 
index da2179ca13534ac84cc52deca7ccfbbc4d105fd0..8daf2b65fe23da3a368f1ea1b6c4faafc90190b6 100644 (file)
@@ -47,6 +47,7 @@ extern "C" {
                int include_children,
 
                int use_object_instantiation,
+               int sort_by_name,
                int second_life);
 
 
index f481de994a34d3f520259016ac969e8e78231530..3d9aa8e542d6182d7b867ceca94717cf70808c52 100644 (file)
@@ -226,3 +226,31 @@ void bc_remove_mark(Object *ob)
 {
        ob->id.flag &= ~LIB_DOIT;
 }
+
+// Use bubble sort algorithm for sorting the export set
+void bc_bubble_sort_by_Object_name(LinkNode *export_set)
+{
+       int i, j; // loop indices
+       bool unsorted = true;
+
+       LinkNode *current;
+       int set_size = BLI_linklist_length(export_set);
+       for(i = 0; (i < set_size) && unsorted; i++) {
+               unsorted = false;
+               
+               for (current=export_set; current->next; current = current->next) {
+                       Object *a = (Object *)current->link;
+                       Object *b = (Object *)current->next->link;
+
+                       std::string str_a (a->id.name);
+                       std::string str_b (b->id.name);
+
+                       if (str_a.compare(str_b) > 0) {
+                               current->link       = b;
+                               current->next->link = a;
+                               unsorted = true;
+                       }
+                       
+               }
+       }
+}
\ No newline at end of file
index 71365ffb8d0d0345d05d9541f204116655d87e12..139a2cb93bd6ee1f2fe6165e2ca9aacce6677131 100644 (file)
@@ -71,4 +71,6 @@ extern void bc_remove_mark(Object *ob);
 extern char *bc_CustomData_get_layer_name(const CustomData *data, int type, int n);
 extern char *bc_CustomData_get_active_layer_name(const CustomData *data, int type);
 
+extern void bc_bubble_sort_by_Object_name(LinkNode *export_set);
+
 #endif
index d072b4ca727241b97adda144a7db1c9c56914371..d59388c92065d6f9bf3d1c0b4bac089e2acd80c7 100644 (file)
@@ -28,8 +28,6 @@
  * @ingroup Model
  */
 typedef enum DataType {
-       /** @brief Unknown data type (or not yet known) */
-       COM_DT_UNKNOWN = 0,
        /** @brief Value data type */
        COM_DT_VALUE   = 1,
        /** @brief Vector data type */
index 92eb0f0f92c82c8757f1dc26e93b628e68f88597..9731555039ced05af0f2a06837a234b83165f4d3 100644 (file)
@@ -370,8 +370,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();
index 9681996c74d04c616809141995fe9cd9583c7231..7ea97b3fa39835d8c5ed0160e43c7d6189e58c34 100644 (file)
@@ -212,7 +212,9 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
                writeOperation = new WriteBufferOperation();
                writeOperation->setbNodeTree(this->getContext().getbNodeTree());
                this->addOperation(writeOperation);
-               for (index = 0 ; index < outputsocket->getNumberOfConnections();index ++) {
+               ExecutionSystemHelper::addLink(this->getConnections(), outputsocket, writeOperation->getInputSocket(0));
+               writeOperation->readResolutionFromInputSocket();
+               for (index = 0 ; index < outputsocket->getNumberOfConnections()-1;index ++) {
                        SocketConnection * connection = outputsocket->getConnection(index);
                        ReadBufferOperation *readoperation = new ReadBufferOperation();
                        readoperation->setMemoryProxy(writeOperation->getMemoryProxy());
@@ -221,27 +223,21 @@ void ExecutionSystem::addReadWriteBufferOperations(NodeOperation *operation)
                        readoperation->readResolutionFromWriteBuffer();
                        this->addOperation(readoperation);
                }
-               ExecutionSystemHelper::addLink(this->getConnections(), outputsocket, writeOperation->getInputSocket(0));
-               writeOperation->readResolutionFromInputSocket();
        }
 }
 
 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<NodeBase*>&)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<NodeBase*>&)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<NodeBase*> &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<ExecutionGroup*> *result, CompositorPriority priority) const
 {
        unsigned int index;
index d5ca2ec619a926e30038d7b468ec84e66e6bb909..2d889e269e0ce7f3d11046f1553118242cef8aa6 100644 (file)
@@ -218,7 +218,7 @@ void ExecutionSystemHelper::debugDump(ExecutionSystem *system)
                                        printf("|");
                                }
                                printf("<IN_%p>", 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("<OUT_%p>", 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");
index 4d96d0779017c4be801279be219e2518641ff999..c9705ad69fbf3c3073458b04781599cb46fd685a 100644 (file)
@@ -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()) {
index 6ac6ad09126f15b49ee0a55d9347f27a895b7e9a..c066b5d8303878e0ea7631d1a1b3c822554dda27 100644 (file)
@@ -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
index 17a623c9c817a744df8a260ede9945b575f54948..5ffe9bdd26a5e57ad90755fe03053d1cce1b27f6 100644 (file)
@@ -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();
-               }
-       }
-}
index 3917904afe3f9885c03b6c4562419ca53d6da0c0..5e3a4fa55318754a1f943197e057981f69ca9df5 100644 (file)
@@ -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
index 708b2d65d464f9622790748c149431834faa24a1..77bad3c006f50c98cdbf172adfdfed9f182f8855 100644 (file)
 
 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];
-}
-
index e008d65104685bb2a824b5b12e474a08ab42bb23..c073703c42321a7a302e6aa896183eb60d96746f 100644 (file)
@@ -43,15 +43,7 @@ class WriteBufferOperation;
 class OutputSocket : public Socket {
 private:
        vector<SocketConnection *> 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:
 
 };
index a5336ac120272a1b89471c7d8aeaa159f57897c0..af9ad1967a514eeaf422e3f2afd9f6da6388ec76 100644 (file)
@@ -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;
-}
index 0be21a6b1b81145fb4b70a727198d619a940fef3..7c5c2198a1666922c658352a25d8ba64234a10fc 100644 (file)
@@ -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; }
index 93e352cfedeaf18272e393b4d6d7d278d62d5b00..57b7871318bcd92b56cf58ab13caa404375f97b5 100644 (file)
@@ -72,9 +72,6 @@ void MuteNode::reconnect(ExecutionSystem * graph, OutputSocket * output)
                        operation = coloroperation;
                        break;
                }
-                       /* quiet warnings */
-               case COM_DT_UNKNOWN:
-                       break;
        }
 
        if (operation) {
index ca18ea5fbf75021b551b0d89c62a359ac6b1f539..e5deb595d7856f0d5e3feb907f595b690b18c80b 100644 (file)
@@ -77,7 +77,7 @@ void OutputFileNode::convertToOperations(ExecutionSystem *graph, CompositorConte
                                BLI_join_dirfile(path, FILE_MAX, storage->base_path, sockdata->path);
                                
                                OutputSingleLayerOperation *outputOperation = new OutputSingleLayerOperation(
-                                               context->getScene(), context->getbNodeTree(), input->getActualDataType(), format, path);
+                                               context->getScene(), context->getbNodeTree(), input->getDataType(), format, path);
                                input->relinkConnections(outputOperation->getInputSocket(0));
                                graph->addOperation(outputOperation);
                                if (!previewAdded) {
index fbb25afe266107c1de0bb5603f208023c2a3f3b7..cdb844cad54d2fa45239631ad24d650a59689087 100644 (file)
@@ -49,14 +49,14 @@ void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorCont
        InputSocket * inputsocket = this->getInputSocket(0);
        if (outputsocket->isConnected()) {
                if (inputsocket->isConnected()) {
-                       SocketProxyOperation *operation = new SocketProxyOperation();
+                       SocketProxyOperation *operation = new SocketProxyOperation(this->getOutputSocket()->getDataType());
                        inputsocket->relinkConnections(operation->getInputSocket(0));
                        outputsocket->relinkConnections(operation->getOutputSocket(0));
                        graph->addOperation(operation);
                }
                else {
                        /* If input is not connected, add a constant value operation instead */
-                       switch (outputsocket->getActualDataType()) {
+                       switch (outputsocket->getDataType()) {
                        case COM_DT_VALUE:
                        {
                                SetValueOperation *operation = new SetValueOperation();
@@ -84,9 +84,6 @@ void SocketProxyNode::convertToOperations(ExecutionSystem *graph, CompositorCont
                                graph->addOperation(operation);
                                break;
                        }
-                               /* quiet warnings */
-                       case COM_DT_UNKNOWN:
-                               break;
                        }
                }
        }
index 58c60a96de8ed78fc32e89a6d952cc600017523b..bb1a9c119f8c2035bc01d4b9064fb4a72a9ce012 100644 (file)
@@ -31,7 +31,7 @@ SwitchNode::SwitchNode(bNode *editorNode): Node(editorNode)
 
 void SwitchNode::convertToOperations(ExecutionSystem *graph, CompositorContext * context)
 {
-       SocketProxyOperation * operation = new SocketProxyOperation();
+       SocketProxyOperation * operation = new SocketProxyOperation(COM_DT_COLOR);
        int switchFrame = this->getbNode()->custom1;
 
        if (!switchFrame) {
index aa847c2d10d526a07a075ae057c6874dbafdfea5..a91445be4b5b49a2e665231e6ef4aa38f8e49364 100644 (file)
 typedef float fREAL;
 
 // returns next highest power of 2 of x, as well it's log2 in L2
-static unsigned int nextPow2(unsigned int x, unsigned intL2)
+static unsigned int nextPow2(unsigned int x, unsigned int *L2)
 {
-       unsigned int pw, x_notpow2 = x & (x-1);
+       unsigned int pw, x_notpow2 = x & (x - 1);
        *L2 = 0;
-       while (x>>=1) ++(*L2);
+       while (x >>= 1) ++(*L2);
        pw = 1 << (*L2);
-       if (x_notpow2) { (*L2)++;  pw<<=1; }
+       if (x_notpow2) { (*L2)++;  pw <<= 1; }
        return pw;
 }
 
@@ -46,11 +46,11 @@ static unsigned int nextPow2(unsigned int x, unsigned int* L2)
 // use: r = revbin_upd(r, h) where h = N>>1
 static unsigned int revbin_upd(unsigned int r, unsigned int h)
 {
-       while (!((r^=h)&h)) h >>= 1;
+       while (!((r ^= h) & h)) h >>= 1;
        return r;
 }
 //------------------------------------------------------------------------------
-static void FHT(fREALdata, unsigned int M, unsigned int inverse)
+static void FHT(fREAL *data, unsigned int M, unsigned int inverse)
 {
        double tt, fc, dc, fs, ds, a = M_PI;
        fREAL t1, t2;
@@ -58,9 +58,9 @@ static void FHT(fREAL* data, unsigned int M, unsigned int inverse)
 
        int i, j = 0;
        unsigned int Nh = len >> 1;
-       for (i=1;i<(len-1);++i) {
+       for (i = 1; i < (len - 1); ++i) {
                j = revbin_upd(j, Nh);
-               if (j>i) {
+               if (j > i) {
                        t1 = data[i];
                        data[i] = data[j];
                        data[j] = t1;
@@ -68,40 +68,40 @@ static void FHT(fREAL* data, unsigned int M, unsigned int inverse)
        }
 
        do {
-               fREALdata_n = &data[n];
+               fREAL *data_n = &data[n];
 
                istep = n << 1;
-               for (k=0; k<len; k+=istep) {
+               for (k = 0; k < len; k += istep) {
                        t1 = data_n[k];
                        data_n[k] = data[k] - t1;
                        data[k] += t1;
                }
 
                n2 = n >> 1;
-               if (n>2) {
+               if (n > 2) {
                        fc = dc = cos(a);
-                       fs = ds = sqrt(1.0 - fc*fc); //sin(a);
-                       bd = n-2;
-                       for (bl=1; bl<n2; bl++) {
-                               fREALdata_nbd = &data_n[bd];
-                               fREALdata_bd = &data[bd];
-                               for (k=bl; k<len; k+=istep) {
-                                       t1 = fc*data_n[k] + fs*data_nbd[k];
-                                       t2 = fs*data_n[k] - fc*data_nbd[k];
+                       fs = ds = sqrt(1.0 - fc * fc); //sin(a);
+                       bd = n - 2;
+                       for (bl = 1; bl < n2; bl++) {
+                               fREAL *data_nbd = &data_n[bd];
+                               fREAL *data_bd = &data[bd];
+                               for (k = bl; k < len; k += istep) {
+                                       t1 = fc * data_n[k] + fs * data_nbd[k];
+                                       t2 = fs * data_n[k] - fc * data_nbd[k];
                                        data_n[k] = data[k] - t1;
                                        data_nbd[k] = data_bd[k] - t2;
                                        data[k] += t1;
                                        data_bd[k] += t2;
                                }
-                               tt = fc*dc - fs*ds;
-                               fs = fs*dc + fc*ds;
+                               tt = fc * dc - fs * ds;
+                               fs = fs * dc + fc * ds;
                                fc = tt;
                                bd -= 2;
                        }
                }
 
-               if (n>1) {
-                       for (k=n2; k<len; k+=istep) {
+               if (n > 1) {
+                       for (k = n2; k < len; k += istep) {
                                t1 = data_n[k];
                                data_n[k] = data[k] - t1;
                                data[k] += t1;
@@ -110,20 +110,20 @@ static void FHT(fREAL* data, unsigned int M, unsigned int inverse)
 
                n = istep;
                a *= 0.5;
-       } while (n<len);
+       } while (n < len);
 
        if (inverse) {
                fREAL sc = (fREAL)1 / (fREAL)len;
-               for (k=0; k<len; ++k)
+               for (k = 0; k < len; ++k)
                        data[k] *= sc;
        }
 }
 //------------------------------------------------------------------------------
 /* 2D Fast Hartley Transform, Mx/My -> log2 of width/height,
-       nzp -> the row where zero pad data starts,
-       inverse -> see above */
+    nzp -> the row where zero pad data starts,
+    inverse -> see above */
 static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
-               unsigned int nzp, unsigned int inverse)
+                  unsigned int nzp, unsigned int inverse)
 {
        unsigned int i, j, Nx, Ny, maxy;
        fREAL t;
@@ -133,25 +133,25 @@ static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
 
        // rows (forward transform skips 0 pad data)
        maxy = inverse ? Ny : nzp;
-       for (j=0; j<maxy; ++j)
-               FHT(&data[Nx*j], Mx, inverse);
+       for (j = 0; j < maxy; ++j)
+               FHT(&data[Nx * j], Mx, inverse);
 
        // transpose data
-       if (Nx==Ny) {  // square
-               for (j=0; j<Ny; ++j)
-                       for (i=j+1; i<Nx; ++i) {
+       if (Nx == Ny) {  // square
+               for (j = 0; j < Ny; ++j)
+                       for (i = j + 1; i < Nx; ++i) {
                                unsigned int op = i + (j << Mx), np = j + (i << My);
-                               t=data[op], data[op]=data[np], data[np]=t;
+                               t = data[op], data[op] = data[np], data[np] = t;
                        }
        }
        else {  // rectangular
-               unsigned int k, Nym = Ny-1, stm = 1 << (Mx + My);
-               for (i=0; stm>0; i++) {
+               unsigned int k, Nym = Ny - 1, stm = 1 << (Mx + My);
+               for (i = 0; stm > 0; i++) {
                        #define PRED(k) (((k & Nym) << Mx) + (k >> My))
-                       for (j=PRED(i); j>i; j=PRED(j));
+                       for (j = PRED(i); j > i; j = PRED(j)) ;
                        if (j < i) continue;
-                       for (k=i, j=PRED(i); j!=i; k=j, j=PRED(j), stm--) {
-                               t=data[j], data[j]=data[k], data[k]=t;
+                       for (k = i, j = PRED(i); j != i; k = j, j = PRED(j), stm--) {
+                               t = data[j], data[j] = data[k], data[k] = t;
                        }
                        #undef PRED
                        stm--;
@@ -162,21 +162,21 @@ static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
        i = Mx, Mx = My, My = i;
 
        // now columns == transposed rows
-       for (j=0; j<Ny; ++j)
-               FHT(&data[Nx*j], Mx, inverse);
+       for (j = 0; j < Ny; ++j)
+               FHT(&data[Nx * j], Mx, inverse);
 
        // finalize
-       for (j=0; j<=(Ny >> 1); j++) {
-               unsigned int jm = (Ny - j) & (Ny-1);
+       for (j = 0; j <= (Ny >> 1); j++) {
+               unsigned int jm = (Ny - j) & (Ny - 1);
                unsigned int ji = j << Mx;
                unsigned int jmi = jm << Mx;
-               for (i=0; i<=(Nx >> 1); i++) {
-                       unsigned int im = (Nx - i) & (Nx-1);
+               for (i = 0; i <= (Nx >> 1); i++) {
+                       unsigned int im = (Nx - i) & (Nx - 1);
                        fREAL A = data[ji + i];
                        fREAL B = data[jmi + i];
                        fREAL C = data[ji + im];
                        fREAL D = data[jmi + im];
-                       fREAL E = (fREAL)0.5*((A + D) - (B + C));
+                       fREAL E = (fREAL)0.5 * ((A + D) - (B + C));
                        data[ji + i] = A - E;
                        data[jmi + i] = B + E;
                        data[ji + im] = C + E;
@@ -189,62 +189,62 @@ static void FHT2D(fREAL *data, unsigned int Mx, unsigned int My,
 //------------------------------------------------------------------------------
 
 /* 2D convolution calc, d1 *= d2, M/N - > log2 of width/height */
-static void fht_convolve(fREAL* d1, fREAL* d2, unsigned int M, unsigned int N)
+static void fht_convolve(fREAL *d1, fREAL *d2, unsigned int M, unsigned int N)
 {
        fREAL a, b;
        unsigned int i, j, k, L, mj, mL;
        unsigned int m = 1 << M, n = 1 << N;
-       unsigned int m2 = 1 << (M-1), n2 = 1 << (N-1);
-       unsigned int mn2 = m << (N-1);
+       unsigned int m2 = 1 << (M - 1), n2 = 1 << (N - 1);
+       unsigned int mn2 = m << (N - 1);
 
        d1[0] *= d2[0];
        d1[mn2] *= d2[mn2];
        d1[m2] *= d2[m2];
        d1[m2 + mn2] *= d2[m2 + mn2];
-       for (i=1; i<m2; i++) {
+       for (i = 1; i < m2; i++) {
                k = m - i;
-               a = d1[i]*d2[i] - d1[k]*d2[k];
-               b = d1[k]*d2[i] + d1[i]*d2[k];
-               d1[i] = (b + a)*(fREAL)0.5;
-               d1[k] = (b - a)*(fREAL)0.5;
-               a = d1[i + mn2]*d2[i + mn2] - d1[k + mn2]*d2[k + mn2];
-               b = d1[k + mn2]*d2[i + mn2] + d1[i + mn2]*d2[k + mn2];
-               d1[i + mn2] = (b + a)*(fREAL)0.5;
-               d1[k + mn2] = (b - a)*(fREAL)0.5;
+               a = d1[i] * d2[i] - d1[k] * d2[k];
+               b = d1[k] * d2[i] + d1[i] * d2[k];
+               d1[i] = (b + a) * (fREAL)0.5;
+               d1[k] = (b - a) * (fREAL)0.5;
+               a = d1[i + mn2] * d2[i + mn2] - d1[k + mn2] * d2[k + mn2];
+               b = d1[k + mn2] * d2[i + mn2] + d1[i + mn2] * d2[k + mn2];
+               d1[i + mn2] = (b + a) * (fREAL)0.5;
+               d1[k + mn2] = (b - a) * (fREAL)0.5;
        }
-       for (j=1; j<n2; j++) {
+       for (j = 1; j < n2; j++) {
                L = n - j;
                mj = j << M;
                mL = L << M;
-               a = d1[mj]*d2[mj] - d1[mL]*d2[mL];
-               b = d1[mL]*d2[mj] + d1[mj]*d2[mL];
-               d1[mj] = (b + a)*(fREAL)0.5;
-               d1[mL] = (b - a)*(fREAL)0.5;
-               a = d1[m2 + mj]*d2[m2 + mj] - d1[m2 + mL]*d2[m2 + mL];
-               b = d1[m2 + mL]*d2[m2 + mj] + d1[m2 + mj]*d2[m2 + mL];
-               d1[m2 + mj] = (b + a)*(fREAL)0.5;
-               d1[m2 + mL] = (b - a)*(fREAL)0.5;
+               a = d1[mj] * d2[mj] - d1[mL] * d2[mL];
+               b = d1[mL] * d2[mj] + d1[mj] * d2[mL];
+               d1[mj] = (b + a) * (fREAL)0.5;
+               d1[mL] = (b - a) * (fREAL)0.5;
+               a = d1[m2 + mj] * d2[m2 + mj] - d1[m2 + mL] * d2[m2 + mL];
+               b = d1[m2 + mL] * d2[m2 + mj] + d1[m2 + mj] * d2[m2 + mL];
+               d1[m2 + mj] = (b + a) * (fREAL)0.5;
+               d1[m2 + mL] = (b - a) * (fREAL)0.5;
        }
-       for (i=1; i<m2; i++) {
+       for (i = 1; i < m2; i++) {
                k = m - i;
-               for (j=1; j<n2; j++) {
+               for (j = 1; j < n2; j++) {
                        L = n - j;
                        mj = j << M;
                        mL = L << M;
-                       a = d1[i + mj]*d2[i + mj] - d1[k + mL]*d2[k + mL];
-                       b = d1[k + mL]*d2[i + mj] + d1[i + mj]*d2[k + mL];
-                       d1[i + mj] = (b + a)*(fREAL)0.5;
-                       d1[k + mL] = (b - a)*(fREAL)0.5;
-                       a = d1[i + mL]*d2[i + mL] - d1[k + mj]*d2[k + mj];
-                       b = d1[k + mj]*d2[i + mL] + d1[i + mL]*d2[k + mj];
-                       d1[i + mL] = (b + a)*(fREAL)0.5;
-                       d1[k + mj] = (b - a)*(fREAL)0.5;
+                       a = d1[i + mj] * d2[i + mj] - d1[k + mL] * d2[k + mL];
+                       b = d1[k + mL] * d2[i + mj] + d1[i + mj] * d2[k + mL];
+                       d1[i + mj] = (b + a) * (fREAL)0.5;
+                       d1[k + mL] = (b - a) * (fREAL)0.5;
+                       a = d1[i + mL] * d2[i + mL] - d1[k + mj] * d2[k + mj];
+                       b = d1[k + mj] * d2[i + mL] + d1[i + mL] * d2[k + mj];
+                       d1[i + mL] = (b + a) * (fREAL)0.5;
+                       d1[k + mj] = (b - a) * (fREAL)0.5;
                }
        }
 }
 //------------------------------------------------------------------------------
 
-void convolve(float* dst, MemoryBuffer* in1, MemoryBuffer* in2)
+void convolve(float *dst, MemoryBuffer *in1, MemoryBuffer *in2)
 {
        fREAL *data1, *data2, *fp;
        unsigned int w2, h2, hw, hh, log2_w, log2_h;
@@ -256,35 +256,35 @@ void convolve(float* dst, MemoryBuffer* in1, MemoryBuffer* in2)
        const unsigned int kernelHeight = in2->getHeight();
        const unsigned int imageWidth = in1->getWidth();
        const unsigned int imageHeight = in1->getHeight();
-       float * kernelBuffer = in2->getBuffer();
-       float * imageBuffer = in1->getBuffer();
+       float *kernelBuffer = in2->getBuffer();
+       float *imageBuffer = in1->getBuffer();
 
-       MemoryBufferrdst = new MemoryBuffer(NULL, in1->getRect());
+       MemoryBuffer *rdst = new MemoryBuffer(NULL, in1->getRect());
 
        // convolution result width & height
-       w2 = 2*kernelWidth - 1;
-       h2 = 2*kernelHeight - 1;
+       w2 = 2 * kernelWidth - 1;
+       h2 = 2 * kernelHeight - 1;
        // FFT pow2 required size & log2
        w2 = nextPow2(w2, &log2_w);
        h2 = nextPow2(h2, &log2_h);
 
        // alloc space
-       data1 = (fREAL*)MEM_callocN(3*w2*h2*sizeof(fREAL), "convolve_fast FHT data1");
-       data2 = (fREAL*)MEM_callocN(w2*h2*sizeof(fREAL), "convolve_fast FHT data2");
+       data1 = (fREAL *)MEM_callocN(3 * w2 * h2 * sizeof(fREAL), "convolve_fast FHT data1");
+       data2 = (fREAL *)MEM_callocN(w2 * h2 * sizeof(fREAL), "convolve_fast FHT data2");
 
        // normalize convolutor
        wt[0] = wt[1] = wt[2] = 0.f;
-       for (y=0; y<kernelHeight; y++) {
-               colp = (fRGB*)&kernelBuffer[y*kernelWidth*COM_NUMBER_OF_CHANNELS];
-               for (x=0; x<kernelWidth; x++)
+       for (y = 0; y < kernelHeight; y++) {
+               colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUMBER_OF_CHANNELS];
+               for (x = 0; x < kernelWidth; x++)
                        fRGB_add(wt, colp[x]);
        }
-       if (wt[0] != 0.f) wt[0] = 1.f/wt[0];
-       if (wt[1] != 0.f) wt[1] = 1.f/wt[1];
-       if (wt[2] != 0.f) wt[2] = 1.f/wt[2];
-       for (y=0; y<kernelHeight; y++) {
-               colp = (fRGB*)&kernelBuffer[y*kernelWidth*COM_NUMBER_OF_CHANNELS];
-               for (x=0; x<kernelWidth; x++)
+       if (wt[0] != 0.f) wt[0] = 1.f / wt[0];
+       if (wt[1] != 0.f) wt[1] = 1.f / wt[1];
+       if (wt[2] != 0.f) wt[2] = 1.f / wt[2];
+       for (y = 0; y < kernelHeight; y++) {
+               colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUMBER_OF_CHANNELS];
+               for (x = 0; x < kernelWidth; x++)
                        fRGB_colormult(colp[x], wt);
        }
 
@@ -300,33 +300,33 @@ void convolve(float* dst, MemoryBuffer* in1, MemoryBuffer* in2)
        if (imageWidth % xbsz) nxb++;
        nyb = imageHeight / ybsz;
        if (imageHeight % ybsz) nyb++;
-       for (ybl=0; ybl<nyb; ybl++) {
-               for (xbl=0; xbl<nxb; xbl++) {
+       for (ybl = 0; ybl < nyb; ybl++) {
+               for (xbl = 0; xbl < nxb; xbl++) {
 
                        // each channel one by one
-                       for (ch=0; ch<3; ch++) {
-                               fREAL* data1ch = &data1[ch*w2*h2];
+                       for (ch = 0; ch < 3; ch++) {
+                               fREAL *data1ch = &data1[ch * w2 * h2];
 
                                // only need to calc fht data from in2 once, can re-use for every block
                                if (!in2done) {
                                        // in2, channel ch -> data1
-                                       for (y=0; y<kernelHeight; y++) {
-                                               fp = &data1ch[y*w2];
-                                               colp = (fRGB*)&kernelBuffer[y*kernelWidth*COM_NUMBER_OF_CHANNELS];
-                                               for (x=0; x<kernelWidth; x++)
+                                       for (y = 0; y < kernelHeight; y++) {
+                                               fp = &data1ch[y * w2];
+                                               colp = (fRGB *)&kernelBuffer[y * kernelWidth * COM_NUMBER_OF_CHANNELS];
+                                               for (x = 0; x < kernelWidth; x++)
                                                        fp[x] = colp[x][ch];
                                        }
                                }
 
                                // in1, channel ch -> data2
-                               memset(data2, 0, w2*h2*sizeof(fREAL));
-                               for (y=0; y<ybsz; y++) {
-                                       int yy = ybl*ybsz + y;
+                               memset(data2, 0, w2 * h2 * sizeof(fREAL));
+                               for (y = 0; y < ybsz; y++) {
+                                       int yy = ybl * ybsz + y;
                                        if (yy >= imageHeight) continue;
-                                       fp = &data2[y*w2];
-                                       colp = (fRGB*)&imageBuffer[yy*imageWidth*COM_NUMBER_OF_CHANNELS];
-                                       for (x=0; x<xbsz; x++) {
-                                               int xx = xbl*xbsz + x;
+                                       fp = &data2[y * w2];
+                                       colp = (fRGB *)&imageBuffer[yy * imageWidth * COM_NUMBER_OF_CHANNELS];
+                                       for (x = 0; x < xbsz; x++) {
+                                               int xx = xbl * xbsz + x;
                                                if (xx >= imageWidth) continue;
                                                fp[x] = colp[xx][ch];
                                        }
@@ -334,8 +334,8 @@ void convolve(float* dst, MemoryBuffer* in1, MemoryBuffer* in2)
 
                                // forward FHT
                                // zero pad data start is different for each == height+1
-                               if (!in2done) FHT2D(data1ch, log2_w, log2_h, kernelHeight+1, 0);
-                               FHT2D(data2, log2_w, log2_h, kernelHeight+1, 0);
+                               if (!in2done) FHT2D(data1ch, log2_w, log2_h, kernelHeight + 1, 0);
+                               FHT2D(data2, log2_w, log2_h, kernelHeight + 1, 0);
 
                                // FHT2D transposed data, row/col now swapped
                                // convolve & inverse FHT
@@ -344,13 +344,13 @@ void convolve(float* dst, MemoryBuffer* in1, MemoryBuffer* in2)
                                // data again transposed, so in order again
 
                                // overlap-add result
-                               for (y=0; y<(int)h2; y++) {
-                                       const int yy = ybl*ybsz + y - hh;
+                               for (y = 0; y < (int)h2; y++) {
+                                       const int yy = ybl * ybsz + y - hh;
                                        if ((yy < 0) || (yy >= imageHeight)) continue;
-                                       fp = &data2[y*w2];
-                                       colp = (fRGB*)&rdst->getBuffer()[yy*imageWidth*COM_NUMBER_OF_CHANNELS];
-                                       for (x=0; x<(int)w2; x++) {
-                                               const int xx = xbl*xbsz + x - hw;
+                                       fp = &data2[y * w2];
+                                       colp = (fRGB *)&rdst->getBuffer()[yy * imageWidth * COM_NUMBER_OF_CHANNELS];
+                                       for (x = 0; x < (int)w2; x++) {
+                                               const int xx = xbl * xbsz + x - hw;
                                                if ((xx < 0) || (xx >= imageWidth)) continue;
                                                colp[xx][ch] += fp[x];
                                        }
@@ -363,7 +363,7 @@ void convolve(float* dst, MemoryBuffer* in1, MemoryBuffer* in2)
 
        MEM_freeN(data2);
        MEM_freeN(data1);
-       memcpy(dst, rdst->getBuffer(), sizeof(float)*imageWidth*imageHeight*COM_NUMBER_OF_CHANNELS);
+       memcpy(dst, rdst->getBuffer(), sizeof(float) * imageWidth * imageHeight * COM_NUMBER_OF_CHANNELS);
        delete(rdst);
 }
 
@@ -382,19 +382,19 @@ void GlareFogGlowOperation::generateGlare(float *data, MemoryBuffer *inputTile,
        BLI_init_rcti(&kernelRect, 0, sz, 0, sz);
        ckrn = new MemoryBuffer(NULL, &kernelRect);
 
-       scale = 0.25f*sqrtf((float)sz*sz);
+       scale = 0.25f * sqrtf((float)(sz * sz));
 
-       for (y=0; y<sz; ++y) {
-               v = 2.f*(y / (float)sz) - 1.f;
-               for (x=0; x<sz; ++x) {
-                       u = 2.f*(x / (float)sz) - 1.f;
-                       r = (u*u + v*v)*scale;
-                       d = -sqrtf(sqrtf(sqrtf(r)))*9.f;
-                       fcol[0] = expf(d*cs_r), fcol[1] = expf(d*cs_g), fcol[2] = expf(d*cs_b);
+       for (y = 0; y < sz; ++y) {
+               v = 2.f * (y / (float)sz) - 1.0f;
+               for (x = 0; x < sz; ++x) {
+                       u = 2.f * (x / (float)sz) - 1.0f;
+                       r = (u * u + v * v) * scale;
+                       d = -sqrtf(sqrtf(sqrtf(r))) * 9.0f;
+                       fcol[0] = expf(d * cs_r), fcol[1] = expf(d * cs_g), fcol[2] = expf(d * cs_b);
                        // linear window good enough here, visual result counts, not scientific analysis
                        //w = (1.f-fabs(u))*(1.f-fabs(v));
                        // actually, Hanning window is ok, cos^2 for some reason is slower
-                       w = (0.5f + 0.5f*cos((double)u*M_PI))*(0.5f + 0.5f*cos((double)v*M_PI));
+                       w = (0.5f + 0.5f * cos((double)u * M_PI)) * (0.5f + 0.5f * cos((double)v * M_PI));
                        fRGB_mult(fcol, w);
                        ckrn->writePixel(x, y, fcol);
                }
index 51b16506dd909aade07b38e1f3c5cc7451f763e4..5f86d6bd7c7f9313cb27148aad1b075075f106ae 100644 (file)
 
 #include "COM_SocketProxyOperation.h"
 
-SocketProxyOperation::SocketProxyOperation() : NodeOperation()
+SocketProxyOperation::SocketProxyOperation(DataType type) : NodeOperation()
 {
-       this->addInputSocket(COM_DT_COLOR/*|COM_DT_VECTOR|COM_DT_VALUE*/);
-       this->addOutputSocket(COM_DT_COLOR);
+       this->addInputSocket(type);
+       this->addOutputSocket(type);
        this->inputOperation = NULL;
 }
 
index 701a5a8f69304abf4c7769831bf46d87cbfb8e2e..5dc8f3d6f8f8960cf01b9bb062ff894cf736d8c1 100644 (file)
@@ -29,7 +29,7 @@ class SocketProxyOperation : public NodeOperation {
 private:
        SocketReader *inputOperation;
 public:
-       SocketProxyOperation();
+       SocketProxyOperation(DataType type);
        void executePixel(float *color, float x, float y, PixelSampler sampler, MemoryBuffer * inputBuffers[]);
        
        void initExecution();
index 76fe5a656b690e95153c7d81b5b72619d30c0252..76366efe0d100bffae098a6cb4f6027548c02f93 100644 (file)
@@ -93,11 +93,12 @@ static void rna_Scene_collada_export(
     int include_armatures,
     int include_children,
     int use_object_instantiation,
+       int sort_by_name,
     int second_life)
 {
        collada_export(scene, filepath, selected, apply_modifiers, 
                       include_armatures, include_children,
-                      use_object_instantiation, second_life);
+                      use_object_instantiation, sort_by_name, second_life);
 }
 
 #endif
@@ -130,6 +131,7 @@ void RNA_api_scene(StructRNA *srna)
        parm = RNA_def_boolean(func, "include_armatures", 0, "Include Armatures", "Include armature(s) used by the exported objects");
        parm = RNA_def_boolean(func, "include_children", 0, "Include Children", "Include all children even if not selected");
        parm = RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instantiation", "Instantiate multiple Objects from same Data");
+       parm = RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name", "Sort exported data by Object name");
        parm = RNA_def_boolean(func, "second_life", 0, "Export for Second Life", "Compatibility mode for Second Life");
        RNA_def_function_ui_description(func, "Export to collada file");
 #endif
index e16a7befdd56b04acf76ef875b94a08d1f0888d2..b4bec014b9cfffac05a0b9d3ea4ad11842446e54 100644 (file)
@@ -2167,6 +2167,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
        int apply_modifiers;
        int include_children;
        int use_object_instantiation;
+       int sort_by_name;
        
        if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
                BKE_report(op->reports, RPT_ERROR, "No filename given");
@@ -2182,6 +2183,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
        include_armatures        = RNA_boolean_get(op->ptr, "include_armatures");
        include_children         = RNA_boolean_get(op->ptr, "include_children");
        use_object_instantiation = RNA_boolean_get(op->ptr, "use_object_instantiation");
+       sort_by_name             = RNA_boolean_get(op->ptr, "sort_by_name");
        second_life              = RNA_boolean_get(op->ptr, "second_life");
 
        /* get editmode results */
@@ -2195,6 +2197,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
                include_armatures,
                include_children,
                use_object_instantiation,
+                       sort_by_name,
                second_life)) {
                return OPERATOR_FINISHED;
        }
@@ -2232,6 +2235,9 @@ static void WM_OT_collada_export(wmOperatorType *ot)
        RNA_def_boolean(ot->srna, "use_object_instantiation", 1, "Use Object Instantiation",
                        "Instantiate multiple Objects from same Data");
 
+       RNA_def_boolean(ot->srna, "sort_by_name", 0, "Sort by Object name",
+                       "Sort exported data by Object name");
+
        RNA_def_boolean(ot->srna, "second_life", 0, "Export for Second Life",
                        "Compatibility mode for Second Life");
 }
index 84991b9a9ad573dd33243bcde6737621d92f82c8..43296fc97605ad59b88cde3b72d4864d01c1f5a0 100644 (file)
@@ -51,7 +51,7 @@ public:
        virtual void    NextFrame();
        virtual void    HookEscape();
 private:
-       short           m_exit_key;
+       /* short                m_exit_key; */ /* UNUSED */
 
 
 #ifdef WITH_CXX_GUARDEDALLOC
index d3b23deab52cb55dbec0bc174a0e156c6e2429d1..c9af48fe51645ec19ddb848038069035f5c4abdd 100644 (file)
@@ -57,14 +57,14 @@ private:
  
        float                   canvascoord[4];
        float                   textureoffsets[18];
-       float                   view[4];
+       /* float                        view[4]; */ /* UNUSED */
        /* texname[0] contains render to texture, texname[1] contains depth texture,  texname[2] contains luminance texture*/
        unsigned int    texname[3]; 
        int                             texturewidth;
        int                             textureheight;
        int                             canvaswidth;
        int                             canvasheight;
-       int                             numberoffilters;
+       /* int                          numberoffilters; */ /* UNUSED */
        /* bit 0: enable/disable depth texture
         * bit 1: enable/disable luminance texture*/
        short                   texflag[MAX_RENDER_PASS];
index b3e84c4656b0876fe9c86369407139cff424af32..ffe2964c058fafa3355a514cfc30fa507d448240 100644 (file)
@@ -57,7 +57,7 @@ class RAS_Deformer;
 class RAS_MeshObject
 {
 private:
-       unsigned int                            m_debugcolor;
+       /* unsigned int                         m_debugcolor; */ /* UNUSED */
 
        bool                                            m_bModified;
        bool                                            m_bMeshModified;