Index: OpenSceneGraph/trunk/src/osgPlugins/3ds/ReaderWriter3DS.cpp
===================================================================
--- OpenSceneGraph/trunk/src/osgPlugins/3ds/ReaderWriter3DS.cpp (revision 11194)
+++ OpenSceneGraph/trunk/src/osgPlugins/3ds/ReaderWriter3DS.cpp (revision 11203)
@@ -95,13 +95,16 @@
 }
 
-void copyLib3dsVec3ToOsgVec3(osg::Vec3f osgVec, const float vertices[3]) {
+void copyLib3dsVec3ToOsgVec3(osg::Vec3f osgVec, const float vertices[3])
+{
     return osgVec.set(vertices[0], vertices[1], vertices[2]);
 }
 
-osg::Vec3f copyLib3dsVec3ToOsgVec3(const float vertices[3]) {
+osg::Vec3f copyLib3dsVec3ToOsgVec3(const float vertices[3])
+{
     return osg::Vec3f(vertices[0], vertices[1], vertices[2]);
 }
 
-osg::Quat copyLib3dsQuatToOsgQuat(const float quat[4]) {
+osg::Quat copyLib3dsQuatToOsgQuat(const float quat[4])
+{
     return osg::Quat(quat[0], quat[1], quat[2], quat[3]);
 }
@@ -226,20 +229,20 @@
 
 #if 0
-    osg::notify(osg::NOTICE)<<"3DS reader sizes:"<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsBool)="<<sizeof(Lib3dsBool)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsByte)="<<sizeof(Lib3dsByte)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsWord)="<<sizeof(Lib3dsWord)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsDword)="<<sizeof(Lib3dsDword)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsIntb)="<<sizeof(Lib3dsIntb)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsIntw)="<<sizeof(Lib3dsIntw)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsIntd)="<<sizeof(Lib3dsIntd)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsFloat)="<<sizeof(Lib3dsFloat)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsDouble)="<<sizeof(Lib3dsDouble)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsVector)="<<sizeof(Lib3dsVector)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsTexel)="<<sizeof(Lib3dsTexel)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsQuat)="<<sizeof(Lib3dsQuat)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsMatrix)="<<sizeof(Lib3dsMatrix)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsRgb)="<<sizeof(Lib3dsRgb)<<std::endl;
-    osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsRgba)="<<sizeof(Lib3dsRgba)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"3DS reader sizes:"<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsBool)="<<sizeof(Lib3dsBool)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsByte)="<<sizeof(Lib3dsByte)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsWord)="<<sizeof(Lib3dsWord)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsDword)="<<sizeof(Lib3dsDword)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsIntb)="<<sizeof(Lib3dsIntb)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsIntw)="<<sizeof(Lib3dsIntw)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsIntd)="<<sizeof(Lib3dsIntd)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsFloat)="<<sizeof(Lib3dsFloat)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsDouble)="<<sizeof(Lib3dsDouble)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsVector)="<<sizeof(Lib3dsVector)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsTexel)="<<sizeof(Lib3dsTexel)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsQuat)="<<sizeof(Lib3dsQuat)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsMatrix)="<<sizeof(Lib3dsMatrix)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsRgb)="<<sizeof(Lib3dsRgb)<<std::endl;
+    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsRgba)="<<sizeof(Lib3dsRgba)<<std::endl;
 #endif
 
@@ -254,5 +257,6 @@
     restoreMatrixTransformsNoMeshes(false)
 {
-    if (options) {
+    if (options)
+    {
         std::istringstream iss(options->getOptionString());
         std::string opt; 
@@ -273,5 +277,6 @@
     These print methods for 3ds hacking
 */
-void pad(int level) {
+void pad(int level)
+{
     for(int i=0;i<level;i++) std::cout<<"  ";
 }
@@ -281,5 +286,6 @@
 void print(Lib3dsNode *node, int level);
 
-void print(Lib3dsMatrix matrix,int level) {
+void print(Lib3dsMatrix matrix,int level)
+{
     pad(level); cout << matrix[0][0] <<" "<< matrix[0][1] <<" "<< matrix[0][2] <<" "<< matrix[0][3] << endl;
     pad(level); cout << matrix[1][0] <<" "<< matrix[1][1] <<" "<< matrix[1][2] <<" "<< matrix[1][3] << endl;
@@ -287,23 +293,33 @@
     pad(level); cout << matrix[3][0] <<" "<< matrix[3][1] <<" "<< matrix[3][2] <<" "<< matrix[3][3] << endl;
 }
-void print(Lib3dsMesh *mesh,int level) {
-    if (mesh) {
+void print(Lib3dsMesh *mesh,int level)
+{
+    if (mesh)
+    {
         pad(level); cout << "mesh name " << mesh->name  << endl;
         print(mesh->matrix,level);
-    } else {
+    }
+    else
+    {
         pad(level); cout << "no mesh " << endl;
     }
 }
-void print(Lib3dsUserData *user,int level) {
-    if (user) {
+void print(Lib3dsUserData *user,int level)
+{
+    if (user)
+    {
         pad(level); cout << "user data" << endl;
         //print(user->mesh,level+1);
-    } else {
+    }
+    else
+    {
         pad(level); cout << "no user data" << endl;
     }
 }
 
-void print(Lib3dsMeshInstanceNode *object,int level) {
-    if (object) {
+void print(Lib3dsMeshInstanceNode *object,int level)
+{
+    if (object)
+    {
         pad(level); cout << "objectdata instance [" << object->instance_name << "]" << endl;
         pad(level); cout << "pivot     " << object->pivot[0] <<" "<< object->pivot[1] <<" "<< object->pivot[2] << endl;
@@ -311,10 +327,13 @@
         pad(level); cout << "scl       " << object->scl[0] <<" "<< object->scl[1] <<" "<< object->scl[2] << endl;
         pad(level); cout << "rot       " << object->rot[0] <<" "<< object->rot[1] <<" "<< object->rot[2] <<" "<< object->rot[3] << endl;
-    } else {
+    }
+    else
+    {
         pad(level); cout << "no object data" << endl;
     }
 }
 
-void print(Lib3dsNode *node, int level) {
+void print(Lib3dsNode *node, int level)
+{
 
     pad(level); cout << "node name [" << node->name << "]" << endl;
@@ -324,8 +343,11 @@
     print(node->matrix,level+1);
 
-    if (node->type == LIB3DS_NODE_MESH_INSTANCE) {
+    if (node->type == LIB3DS_NODE_MESH_INSTANCE)
+    {
         pad(level); cout << "mesh instance data:" << endl;
         print(reinterpret_cast<Lib3dsMeshInstanceNode *>(node),level+1);
-    } else {
+    }
+    else
+    {
         pad(level); cout << "node is not a mesh instance (not handled)" << endl;
     }
@@ -333,5 +355,6 @@
     print(&node->user_ptr,level);
 
-    for(Lib3dsNode *child=node->childs; child; child=child->next) {
+    for(Lib3dsNode *child=node->childs; child; child=child->next)
+    {
         print(child,level+1);
     }
@@ -387,5 +410,6 @@
 // Creates a Geode and Geometry (as parent,child) and adds the Geode to 'parent' parameter iff 'parent' is non-NULL
 // Returns ptr to the Geode
-osg::Node* ReaderWriter3DS::ReaderObject::processMesh(StateSetMap& drawStateMap,osg::Group* parent,Lib3dsMesh* mesh, const osg::Matrix * matrix) {
+osg::Node* ReaderWriter3DS::ReaderObject::processMesh(StateSetMap& drawStateMap,osg::Group* parent,Lib3dsMesh* mesh, const osg::Matrix * matrix)
+{
     typedef std::vector<FaceList> MaterialFaceMap;
     MaterialFaceMap materialFaceMap;
@@ -395,14 +419,17 @@
     for (unsigned int i=0; i<mesh->nfaces; ++i)
     {
-        if (mesh->faces[i].material>=0) {
+        if (mesh->faces[i].material>=0)
+        {
             materialFaceMap[mesh->faces[i].material].push_back(i);
         }
         else
+        {
             defaultMaterialFaceList.push_back(i);
+        }
     }
     if (materialFaceMap.empty() && defaultMaterialFaceList.empty())
     {
-        osg::notify(osg::NOTICE)<<"Warning : no triangles assigned to mesh '"<<mesh->name<<"'"<< std::endl;
-        //osg::notify(osg::INFO) << "No material assigned to mesh '" << mesh->name << "'" << std::endl;
+        OSG_NOTIFY(osg::NOTICE)<<"Warning : no triangles assigned to mesh '"<<mesh->name<<"'"<< std::endl;
+        //OSG_NOTIFY(osg::INFO) << "No material assigned to mesh '" << mesh->name << "'" << std::endl;
         return NULL;
     }
@@ -473,6 +500,8 @@
 
     osg::Matrix meshMat;
-    if (mesh) {
-         if (!noMatrixTransforms) {
+    if (mesh)
+    {
+         if (!noMatrixTransforms)
+         {
             // There can be a transform directly on a mesh instance (= as if a osg::MatrixTransform and a osg::Geode were merged together) in object->pos/rot/scl
             if (!pivoted) {
@@ -493,19 +522,25 @@
 
     bool isOsgNodeMatrixIdentity = false;
-    if (osgNodeMatrix.isIdentity() || (checkForEspilonIdentityMatrices && isIdentityEquivalent(osgNodeMatrix, MATRIX_EPSILON))) {
+    if (osgNodeMatrix.isIdentity() || (checkForEspilonIdentityMatrices && isIdentityEquivalent(osgNodeMatrix, MATRIX_EPSILON)))
+    {
         isOsgNodeMatrixIdentity = true;
     }
 
 
-    //if (node->childs != NULL || pivoted || (!isOsgNodeMatrixIdentity && !noMatrixTransforms)) {
-    if (node->childs != NULL || (!isOsgNodeMatrixIdentity && !noMatrixTransforms)) {
-        if (isOsgNodeMatrixIdentity || noMatrixTransforms) {
+    //if (node->childs != NULL || pivoted || (!isOsgNodeMatrixIdentity && !noMatrixTransforms))
+    if (node->childs != NULL || (!isOsgNodeMatrixIdentity && !noMatrixTransforms))
+    {
+        if (isOsgNodeMatrixIdentity || noMatrixTransforms)
+        {
             group = new osg::Group;
-        } else {
+        }
+        else
+        {
             group = new osg::MatrixTransform(osgNodeMatrix);
         }
     }
 
-    if (group) {
+    if (group)
+    {
         if (strcmp(node->name, "$$$DUMMY") == 0) 
         {
@@ -517,24 +552,32 @@
 
         // Handle all children of this node for hierarchical assemblies
-        for (Lib3dsNode *p=node->childs; p!=NULL; p=p->next) {
+        for (Lib3dsNode *p=node->childs; p!=NULL; p=p->next)
+        {
             group->addChild(processNode(drawStateMap,f,p));
         }
-    } else {
+    }
+    else
+    {
         assert(node->childs == NULL);        // Else we must have a group to put childs into
     }
 
     // Handle mesh
-    if (mesh) {
+    if (mesh)
+    {
         osg::Matrix * meshAppliedMatPtr = NULL;
-        if (!meshMat.isIdentity() && !(checkForEspilonIdentityMatrices && isIdentityEquivalent(meshMat, MATRIX_EPSILON))) {
+        if (!meshMat.isIdentity() && !(checkForEspilonIdentityMatrices && isIdentityEquivalent(meshMat, MATRIX_EPSILON)))
+        {
             meshAppliedMatPtr = &meshMat;
         }
 
-        if(group) {
+        if (group)
+        {
             // add our geometry to group (where our children already are)
             // creates geometry under modifier node
             processMesh(drawStateMap,group,mesh,meshAppliedMatPtr);
             return group;
-        } else {
+        }
+        else
+        {
             // didnt use group for children
             // return a ptr directly to the Geode for this mesh
@@ -542,5 +585,7 @@
         }
 
-    } else {
+    }
+    else
+    {
         // no mesh for this node - probably a camera or something of that persuasion
         //cout << "no mesh for object " << node->name << endl;
@@ -550,5 +595,6 @@
 
 
-static long filei_seek_func(void *self, long offset, Lib3dsIoSeek origin) {
+static long filei_seek_func(void *self, long offset, Lib3dsIoSeek origin)
+{
     std::istream *f = reinterpret_cast<std::istream*>(self);
     ios_base::seekdir o = ios_base::beg;
@@ -560,5 +606,6 @@
 }
 
-static long fileo_seek_func(void *self, long offset, Lib3dsIoSeek origin) {
+static long fileo_seek_func(void *self, long offset, Lib3dsIoSeek origin)
+{
     std::ostream *f = reinterpret_cast<std::ostream*>(self);
     ios_base::seekdir o = ios_base::beg;
@@ -570,10 +617,12 @@
 }
 
-static long filei_tell_func(void *self) {
+static long filei_tell_func(void *self)
+{
     std::istream *f = reinterpret_cast<std::istream*>(self);
     return f->tellg();
 }
 
-static long fileo_tell_func(void *self) {
+static long fileo_tell_func(void *self)
+{
     std::ostream *f = reinterpret_cast<std::ostream*>(self);
     return f->tellp();
@@ -581,5 +630,6 @@
 
 
-static size_t filei_read_func(void *self, void *buffer, size_t size) {
+static size_t filei_read_func(void *self, void *buffer, size_t size)
+{
     std::istream *f = reinterpret_cast<std::istream*>(self);
     f->read(reinterpret_cast<char*>(buffer), size);
@@ -587,5 +637,6 @@
 }
 
-static size_t fileo_write_func(void *self, const void *buffer, size_t size) {
+static size_t fileo_write_func(void *self, const void *buffer, size_t size)
+{
     std::ostream *f = reinterpret_cast<std::ostream*>(self);
     f->write(static_cast<const char*>(buffer), size);
@@ -601,5 +652,5 @@
     else if (level == LIB3DS_LOG_INFO) l = osg::INFO;
     else if (level == LIB3DS_LOG_DEBUG) l = osg::DEBUG_INFO;
-    osg::notify(l) << msg << std::endl;
+    OSG_NOTIFY(l) << msg << std::endl;
 }
 
@@ -700,9 +751,10 @@
         int level=0;
         std::cout << "NODE TRAVERSAL of 3ds file "<<f->name<<std::endl;
-        for(Lib3dsNode *node=f->nodes; node; node=node->next) {
+        for(Lib3dsNode *node=f->nodes; node; node=node->next)
+        {
             print(node,level+1);
         }
         std::cout << "MESH TRAVERSAL of 3ds file "<<f->name<<std::endl;
-        for (int imesh=0; imesh<f->nmeshes; ++imesh) {
+        for (int imesh=0; imesh<f->nmeshes; ++imesh){
             print(f->meshes[imesh],level+1);
         }
@@ -716,6 +768,7 @@
     // MIKEC: have found 3ds files with NO node structure - only meshes, for this case we fall back to the old traverse-by-meshes code
     // Loading and re-exporting these files from 3DS produces a file with correct node structure, so perhaps these are not 100% conformant?
-    if (f->nodes == NULL) {
-        osg::notify(osg::WARN)<<"Warning: in 3ds loader: file has no nodes, traversing by meshes instead"<< std::endl;
+    if (f->nodes == NULL)
+    {
+        OSG_NOTIFY(osg::WARN)<<"Warning: in 3ds loader: file has no nodes, traversing by meshes instead"<< std::endl;
         traverse_nodes=true;
     }
@@ -723,17 +776,24 @@
     osg::Node* group = NULL;
 
-    if (traverse_nodes) { // old method
+    if (traverse_nodes) // old method
+    {
         group = new osg::Group();
-        for (int imesh=0; imesh<f->nmeshes; ++imesh) {
+        for (int imesh=0; imesh<f->nmeshes; ++imesh)
+        {
             reader.processMesh(drawStateMap,group->asGroup(),f->meshes[imesh],NULL);
         }
-    } else { // new method
+    }
+    else
+    { // new method
         Lib3dsNode *node=f->nodes;
         if (!node->next)
+        {
             group = reader.processNode(drawStateMap,f,node);
+        }
         else
         {
             group = new osg::Group();
-            for(; node; node=node->next) {
+            for(; node; node=node->next)
+            {
                 group->asGroup()->addChild(reader.processNode(drawStateMap,f,node));
             }
@@ -744,5 +804,5 @@
     if (osg::getNotifyLevel()>=osg::INFO)
     {
-        osg::notify(osg::NOTICE) << "Final OSG node structure looks like this:"<< endl;
+        OSG_NOTIFY(osg::NOTICE) << "Final OSG node structure looks like this:"<< endl;
         PrintVisitor pv(osg::notify(osg::NOTICE));
         group->accept(pv);
@@ -903,5 +963,5 @@
     if (texture && *(texture->name))
     {
-        osg::notify(osg::INFO)<<"texture->name="<<texture->name<<", _directory="<<_directory<<std::endl;
+        OSG_NOTIFY(osg::INFO)<<"texture->name="<<texture->name<<", _directory="<<_directory<<std::endl;
 
         std::string fileName = osgDB::findFileInDirectory(texture->name,_directory,osgDB::CASE_INSENSITIVE);
@@ -910,5 +970,5 @@
             // file not found in .3ds file's directory, so we'll look in the datafile path list.
             fileName = osgDB::findDataFile(texture->name,options, osgDB::CASE_INSENSITIVE);
-            osg::notify(osg::INFO)<<"texture->name="<<texture->name<<", _directory="<<_directory<<std::endl;
+            OSG_NOTIFY(osg::INFO)<<"texture->name="<<texture->name<<", _directory="<<_directory<<std::endl;
         }
 
@@ -919,28 +979,31 @@
                 // if 3DS file is loaded from http, just attempt to load texture from same location.
                 fileName = _directory + "/" + texture->name;
-            } else {
-                osg::notify(osg::WARN) << "texture '"<<texture->name<<"' not found"<< std::endl;
+            }
+            else
+            {
+                OSG_NOTIFY(osg::WARN) << "texture '"<<texture->name<<"' not found"<< std::endl;
                 return NULL;
             }
         }
 
-        if (label) osg::notify(osg::DEBUG_INFO) << label;
-        else osg::notify(osg::DEBUG_INFO) << "texture name";
-        osg::notify(osg::DEBUG_INFO) << " '"<<texture->name<<"'"<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    texture flag        "<<texture->flags<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_DECALE       "<<((texture->flags)&LIB3DS_TEXTURE_DECALE)<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_MIRROR       "<<((texture->flags)&LIB3DS_TEXTURE_MIRROR)<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_NEGATE       "<<((texture->flags)&LIB3DS_TEXTURE_NEGATE)<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_NO_TILE      "<<((texture->flags)&LIB3DS_TEXTURE_NO_TILE)<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_SUMMED_AREA  "<<((texture->flags)&LIB3DS_TEXTURE_SUMMED_AREA)<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_ALPHA_SOURCE "<<((texture->flags)&LIB3DS_TEXTURE_ALPHA_SOURCE)<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_TINT         "<<((texture->flags)&LIB3DS_TEXTURE_TINT)<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_IGNORE_ALPHA "<<((texture->flags)&LIB3DS_TEXTURE_IGNORE_ALPHA)<< std::endl;
-        osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_RGB_TINT     "<<((texture->flags)&LIB3DS_TEXTURE_RGB_TINT)<< std::endl;
+        if (label) { OSG_NOTIFY(osg::DEBUG_INFO) << label; }
+        else { OSG_NOTIFY(osg::DEBUG_INFO) << "texture name"; }
+
+        OSG_NOTIFY(osg::DEBUG_INFO) << " '"<<texture->name<<"'"<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    texture flag        "<<texture->flags<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_DECALE       "<<((texture->flags)&LIB3DS_TEXTURE_DECALE)<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_MIRROR       "<<((texture->flags)&LIB3DS_TEXTURE_MIRROR)<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_NEGATE       "<<((texture->flags)&LIB3DS_TEXTURE_NEGATE)<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_NO_TILE      "<<((texture->flags)&LIB3DS_TEXTURE_NO_TILE)<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_SUMMED_AREA  "<<((texture->flags)&LIB3DS_TEXTURE_SUMMED_AREA)<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_ALPHA_SOURCE "<<((texture->flags)&LIB3DS_TEXTURE_ALPHA_SOURCE)<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_TINT         "<<((texture->flags)&LIB3DS_TEXTURE_TINT)<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_IGNORE_ALPHA "<<((texture->flags)&LIB3DS_TEXTURE_IGNORE_ALPHA)<< std::endl;
+        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_RGB_TINT     "<<((texture->flags)&LIB3DS_TEXTURE_RGB_TINT)<< std::endl;
 
         osg::ref_ptr<osg::Image> osg_image = osgDB::readRefImageFile(fileName.c_str(), options); //Absolute Path
         if (!osg_image.valid())
         {
-            osg::notify(osg::NOTICE) << "Warning: Cannot create texture "<<texture->name<< std::endl;
+            OSG_NOTIFY(osg::NOTICE) << "Warning: Cannot create texture "<<texture->name<< std::endl;
             return NULL;
         }
@@ -1071,5 +1134,6 @@
 
 
-osgDB::ReaderWriter::WriteResult ReaderWriter3DS::writeNode(const osg::Node& node,const std::string& fileName,const Options* options) const {
+osgDB::ReaderWriter::WriteResult ReaderWriter3DS::writeNode(const osg::Node& node,const std::string& fileName,const Options* options) const
+{
     std::string ext = osgDB::getLowerCaseFileExtension(fileName);
     if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED;
@@ -1084,14 +1148,8 @@
     if (!file3ds) return WriteResult(WriteResult::ERROR_IN_WRITING_FILE);
 
-    try {
-        osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
-        local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName));
-
-        if (!createFileObject(node, file3ds, fileName, local_opt)) ok = false;
-        if (ok && !lib3ds_file_save(file3ds, fileName.c_str())) ok = false;
-    } catch (...) {
-        lib3ds_file_free(file3ds);
-        throw;
-    }
+    osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
+    local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName));
+    if (!createFileObject(node, file3ds, fileName, local_opt)) ok = false;
+    if (ok && !lib3ds_file_save(file3ds, fileName.c_str())) ok = false;
     lib3ds_file_free(file3ds);
 
@@ -1101,8 +1159,10 @@
 
 
-osgDB::ReaderWriter::WriteResult ReaderWriter3DS::writeNode(const osg::Node& node,std::ostream& fout,const Options* options) const {
-    //osg::notify(osg::WARN) << "!!WARNING!! 3DS write support is incomplete" << std::endl;
+osgDB::ReaderWriter::WriteResult ReaderWriter3DS::writeNode(const osg::Node& node,std::ostream& fout,const Options* options) const
+{
+    //OSG_NOTIFY(osg::WARN) << "!!WARNING!! 3DS write support is incomplete" << std::endl;
     std::string optFileName;
-    if (options) {
+    if (options)
+    {
         optFileName = options->getPluginStringData("STREAM_FILENAME");
     }
@@ -1111,5 +1171,6 @@
 }
 
-osgDB::ReaderWriter::WriteResult ReaderWriter3DS::doWriteNode(const osg::Node& node,std::ostream& fout, const Options* options, const std::string & fileNamelib3ds) const {
+osgDB::ReaderWriter::WriteResult ReaderWriter3DS::doWriteNode(const osg::Node& node,std::ostream& fout, const Options* options, const std::string & fileNamelib3ds) const
+{
     osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options;
     local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileNamelib3ds));
@@ -1127,12 +1188,6 @@
 
     bool ok = true;
-    try {
-        if (!createFileObject(node, file3ds, fileNamelib3ds, local_opt.get())) ok = false;
-        if (ok && !lib3ds_file_write(file3ds, &io)) ok = false;
-        
-    } catch (...) {
-        lib3ds_file_free(file3ds);
-        throw;
-    }
+    if (!createFileObject(node, file3ds, fileNamelib3ds, local_opt.get())) ok = false;
+    if (ok && !lib3ds_file_write(file3ds, &io)) ok = false;
     lib3ds_file_free(file3ds);
 
@@ -1141,11 +1196,11 @@
 }
 
-bool ReaderWriter3DS::createFileObject(const osg::Node& node, Lib3dsFile * file3ds,const std::string& fileName, const osgDB::ReaderWriter::Options* options) const {
+bool ReaderWriter3DS::createFileObject(const osg::Node& node, Lib3dsFile * file3ds,const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
+{
     WriterNodeVisitor w(file3ds, fileName, options, osgDB::getFilePath(node.getName()));
     const_cast<osg::Node &>(node).accept(w);                // Ugly const_cast<> for visitor...
-    if (!w.suceedLastApply())
-        return false;
+    if (!w.succeeded()) return false;
     w.writeMaterials();
-    return true;    //w.good();
-}
-
+    return w.succeeded();
+}
+
