Show
Ignore:
Timestamp:
03/11/10 17:53:35 (3 years ago)
Author:
robert
Message:

From Sukender, "I had some conflicts when updating but they seem resolved now. Attached files (four files) are against rev. 11200. Changelog:
- Replaced exceptions with assert() or OSG_NOTIFY
- Replaced osg::notify() with OSG_NOTIFY
- Changed braces and tabs to fit OSG coding convention
- Cleaned a few things in code (names, added deallocations upon error)"

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/3ds/ReaderWriter3DS.cpp

    r11194 r11203  
    9595} 
    9696 
    97 void copyLib3dsVec3ToOsgVec3(osg::Vec3f osgVec, const float vertices[3]) { 
     97void copyLib3dsVec3ToOsgVec3(osg::Vec3f osgVec, const float vertices[3]) 
     98{ 
    9899    return osgVec.set(vertices[0], vertices[1], vertices[2]); 
    99100} 
    100101 
    101 osg::Vec3f copyLib3dsVec3ToOsgVec3(const float vertices[3]) { 
     102osg::Vec3f copyLib3dsVec3ToOsgVec3(const float vertices[3]) 
     103{ 
    102104    return osg::Vec3f(vertices[0], vertices[1], vertices[2]); 
    103105} 
    104106 
    105 osg::Quat copyLib3dsQuatToOsgQuat(const float quat[4]) { 
     107osg::Quat copyLib3dsQuatToOsgQuat(const float quat[4]) 
     108{ 
    106109    return osg::Quat(quat[0], quat[1], quat[2], quat[3]); 
    107110} 
     
    226229 
    227230#if 0 
    228     osg::notify(osg::NOTICE)<<"3DS reader sizes:"<<std::endl; 
    229     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsBool)="<<sizeof(Lib3dsBool)<<std::endl; 
    230     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsByte)="<<sizeof(Lib3dsByte)<<std::endl; 
    231     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsWord)="<<sizeof(Lib3dsWord)<<std::endl; 
    232     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsDword)="<<sizeof(Lib3dsDword)<<std::endl; 
    233     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsIntb)="<<sizeof(Lib3dsIntb)<<std::endl; 
    234     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsIntw)="<<sizeof(Lib3dsIntw)<<std::endl; 
    235     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsIntd)="<<sizeof(Lib3dsIntd)<<std::endl; 
    236     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsFloat)="<<sizeof(Lib3dsFloat)<<std::endl; 
    237     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsDouble)="<<sizeof(Lib3dsDouble)<<std::endl; 
    238     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsVector)="<<sizeof(Lib3dsVector)<<std::endl; 
    239     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsTexel)="<<sizeof(Lib3dsTexel)<<std::endl; 
    240     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsQuat)="<<sizeof(Lib3dsQuat)<<std::endl; 
    241     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsMatrix)="<<sizeof(Lib3dsMatrix)<<std::endl; 
    242     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsRgb)="<<sizeof(Lib3dsRgb)<<std::endl; 
    243     osg::notify(osg::NOTICE)<<"  sizeof(Lib3dsRgba)="<<sizeof(Lib3dsRgba)<<std::endl; 
     231    OSG_NOTIFY(osg::NOTICE)<<"3DS reader sizes:"<<std::endl; 
     232    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsBool)="<<sizeof(Lib3dsBool)<<std::endl; 
     233    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsByte)="<<sizeof(Lib3dsByte)<<std::endl; 
     234    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsWord)="<<sizeof(Lib3dsWord)<<std::endl; 
     235    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsDword)="<<sizeof(Lib3dsDword)<<std::endl; 
     236    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsIntb)="<<sizeof(Lib3dsIntb)<<std::endl; 
     237    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsIntw)="<<sizeof(Lib3dsIntw)<<std::endl; 
     238    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsIntd)="<<sizeof(Lib3dsIntd)<<std::endl; 
     239    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsFloat)="<<sizeof(Lib3dsFloat)<<std::endl; 
     240    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsDouble)="<<sizeof(Lib3dsDouble)<<std::endl; 
     241    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsVector)="<<sizeof(Lib3dsVector)<<std::endl; 
     242    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsTexel)="<<sizeof(Lib3dsTexel)<<std::endl; 
     243    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsQuat)="<<sizeof(Lib3dsQuat)<<std::endl; 
     244    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsMatrix)="<<sizeof(Lib3dsMatrix)<<std::endl; 
     245    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsRgb)="<<sizeof(Lib3dsRgb)<<std::endl; 
     246    OSG_NOTIFY(osg::NOTICE)<<"  sizeof(Lib3dsRgba)="<<sizeof(Lib3dsRgba)<<std::endl; 
    244247#endif 
    245248 
     
    254257    restoreMatrixTransformsNoMeshes(false) 
    255258{ 
    256     if (options) { 
     259    if (options) 
     260    { 
    257261        std::istringstream iss(options->getOptionString()); 
    258262        std::string opt;  
     
    273277    These print methods for 3ds hacking 
    274278*/ 
    275 void pad(int level) { 
     279void pad(int level) 
     280{ 
    276281    for(int i=0;i<level;i++) std::cout<<"  "; 
    277282} 
     
    281286void print(Lib3dsNode *node, int level); 
    282287 
    283 void print(Lib3dsMatrix matrix,int level) { 
     288void print(Lib3dsMatrix matrix,int level) 
     289{ 
    284290    pad(level); cout << matrix[0][0] <<" "<< matrix[0][1] <<" "<< matrix[0][2] <<" "<< matrix[0][3] << endl; 
    285291    pad(level); cout << matrix[1][0] <<" "<< matrix[1][1] <<" "<< matrix[1][2] <<" "<< matrix[1][3] << endl; 
     
    287293    pad(level); cout << matrix[3][0] <<" "<< matrix[3][1] <<" "<< matrix[3][2] <<" "<< matrix[3][3] << endl; 
    288294} 
    289 void print(Lib3dsMesh *mesh,int level) { 
    290     if (mesh) { 
     295void print(Lib3dsMesh *mesh,int level) 
     296{ 
     297    if (mesh) 
     298    { 
    291299        pad(level); cout << "mesh name " << mesh->name  << endl; 
    292300        print(mesh->matrix,level); 
    293     } else { 
     301    } 
     302    else 
     303    { 
    294304        pad(level); cout << "no mesh " << endl; 
    295305    } 
    296306} 
    297 void print(Lib3dsUserData *user,int level) { 
    298     if (user) { 
     307void print(Lib3dsUserData *user,int level) 
     308{ 
     309    if (user) 
     310    { 
    299311        pad(level); cout << "user data" << endl; 
    300312        //print(user->mesh,level+1); 
    301     } else { 
     313    } 
     314    else 
     315    { 
    302316        pad(level); cout << "no user data" << endl; 
    303317    } 
    304318} 
    305319 
    306 void print(Lib3dsMeshInstanceNode *object,int level) { 
    307     if (object) { 
     320void print(Lib3dsMeshInstanceNode *object,int level) 
     321{ 
     322    if (object) 
     323    { 
    308324        pad(level); cout << "objectdata instance [" << object->instance_name << "]" << endl; 
    309325        pad(level); cout << "pivot     " << object->pivot[0] <<" "<< object->pivot[1] <<" "<< object->pivot[2] << endl; 
     
    311327        pad(level); cout << "scl       " << object->scl[0] <<" "<< object->scl[1] <<" "<< object->scl[2] << endl; 
    312328        pad(level); cout << "rot       " << object->rot[0] <<" "<< object->rot[1] <<" "<< object->rot[2] <<" "<< object->rot[3] << endl; 
    313     } else { 
     329    } 
     330    else 
     331    { 
    314332        pad(level); cout << "no object data" << endl; 
    315333    } 
    316334} 
    317335 
    318 void print(Lib3dsNode *node, int level) { 
     336void print(Lib3dsNode *node, int level) 
     337{ 
    319338 
    320339    pad(level); cout << "node name [" << node->name << "]" << endl; 
     
    324343    print(node->matrix,level+1); 
    325344 
    326     if (node->type == LIB3DS_NODE_MESH_INSTANCE) { 
     345    if (node->type == LIB3DS_NODE_MESH_INSTANCE) 
     346    { 
    327347        pad(level); cout << "mesh instance data:" << endl; 
    328348        print(reinterpret_cast<Lib3dsMeshInstanceNode *>(node),level+1); 
    329     } else { 
     349    } 
     350    else 
     351    { 
    330352        pad(level); cout << "node is not a mesh instance (not handled)" << endl; 
    331353    } 
     
    333355    print(&node->user_ptr,level); 
    334356 
    335     for(Lib3dsNode *child=node->childs; child; child=child->next) { 
     357    for(Lib3dsNode *child=node->childs; child; child=child->next) 
     358    { 
    336359        print(child,level+1); 
    337360    } 
     
    387410// Creates a Geode and Geometry (as parent,child) and adds the Geode to 'parent' parameter iff 'parent' is non-NULL 
    388411// Returns ptr to the Geode 
    389 osg::Node* ReaderWriter3DS::ReaderObject::processMesh(StateSetMap& drawStateMap,osg::Group* parent,Lib3dsMesh* mesh, const osg::Matrix * matrix) { 
     412osg::Node* ReaderWriter3DS::ReaderObject::processMesh(StateSetMap& drawStateMap,osg::Group* parent,Lib3dsMesh* mesh, const osg::Matrix * matrix) 
     413{ 
    390414    typedef std::vector<FaceList> MaterialFaceMap; 
    391415    MaterialFaceMap materialFaceMap; 
     
    395419    for (unsigned int i=0; i<mesh->nfaces; ++i) 
    396420    { 
    397         if (mesh->faces[i].material>=0) { 
     421        if (mesh->faces[i].material>=0) 
     422        { 
    398423            materialFaceMap[mesh->faces[i].material].push_back(i); 
    399424        } 
    400425        else 
     426        { 
    401427            defaultMaterialFaceList.push_back(i); 
     428        } 
    402429    } 
    403430    if (materialFaceMap.empty() && defaultMaterialFaceList.empty()) 
    404431    { 
    405         osg::notify(osg::NOTICE)<<"Warning : no triangles assigned to mesh '"<<mesh->name<<"'"<< std::endl; 
    406         //osg::notify(osg::INFO) << "No material assigned to mesh '" << mesh->name << "'" << std::endl; 
     432        OSG_NOTIFY(osg::NOTICE)<<"Warning : no triangles assigned to mesh '"<<mesh->name<<"'"<< std::endl; 
     433        //OSG_NOTIFY(osg::INFO) << "No material assigned to mesh '" << mesh->name << "'" << std::endl; 
    407434        return NULL; 
    408435    } 
     
    473500 
    474501    osg::Matrix meshMat; 
    475     if (mesh) { 
    476          if (!noMatrixTransforms) { 
     502    if (mesh) 
     503    { 
     504         if (!noMatrixTransforms) 
     505         { 
    477506            // 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 
    478507            if (!pivoted) { 
     
    493522 
    494523    bool isOsgNodeMatrixIdentity = false; 
    495     if (osgNodeMatrix.isIdentity() || (checkForEspilonIdentityMatrices && isIdentityEquivalent(osgNodeMatrix, MATRIX_EPSILON))) { 
     524    if (osgNodeMatrix.isIdentity() || (checkForEspilonIdentityMatrices && isIdentityEquivalent(osgNodeMatrix, MATRIX_EPSILON))) 
     525    { 
    496526        isOsgNodeMatrixIdentity = true; 
    497527    } 
    498528 
    499529 
    500     //if (node->childs != NULL || pivoted || (!isOsgNodeMatrixIdentity && !noMatrixTransforms)) { 
    501     if (node->childs != NULL || (!isOsgNodeMatrixIdentity && !noMatrixTransforms)) { 
    502         if (isOsgNodeMatrixIdentity || noMatrixTransforms) { 
     530    //if (node->childs != NULL || pivoted || (!isOsgNodeMatrixIdentity && !noMatrixTransforms)) 
     531    if (node->childs != NULL || (!isOsgNodeMatrixIdentity && !noMatrixTransforms)) 
     532    { 
     533        if (isOsgNodeMatrixIdentity || noMatrixTransforms) 
     534        { 
    503535            group = new osg::Group; 
    504         } else { 
     536        } 
     537        else 
     538        { 
    505539            group = new osg::MatrixTransform(osgNodeMatrix); 
    506540        } 
    507541    } 
    508542 
    509     if (group) { 
     543    if (group) 
     544    { 
    510545        if (strcmp(node->name, "$$$DUMMY") == 0)  
    511546        { 
     
    517552 
    518553        // Handle all children of this node for hierarchical assemblies 
    519         for (Lib3dsNode *p=node->childs; p!=NULL; p=p->next) { 
     554        for (Lib3dsNode *p=node->childs; p!=NULL; p=p->next) 
     555        { 
    520556            group->addChild(processNode(drawStateMap,f,p)); 
    521557        } 
    522     } else { 
     558    } 
     559    else 
     560    { 
    523561        assert(node->childs == NULL);        // Else we must have a group to put childs into 
    524562    } 
    525563 
    526564    // Handle mesh 
    527     if (mesh) { 
     565    if (mesh) 
     566    { 
    528567        osg::Matrix * meshAppliedMatPtr = NULL; 
    529         if (!meshMat.isIdentity() && !(checkForEspilonIdentityMatrices && isIdentityEquivalent(meshMat, MATRIX_EPSILON))) { 
     568        if (!meshMat.isIdentity() && !(checkForEspilonIdentityMatrices && isIdentityEquivalent(meshMat, MATRIX_EPSILON))) 
     569        { 
    530570            meshAppliedMatPtr = &meshMat; 
    531571        } 
    532572 
    533         if(group) { 
     573        if (group) 
     574        { 
    534575            // add our geometry to group (where our children already are) 
    535576            // creates geometry under modifier node 
    536577            processMesh(drawStateMap,group,mesh,meshAppliedMatPtr); 
    537578            return group; 
    538         } else { 
     579        } 
     580        else 
     581        { 
    539582            // didnt use group for children 
    540583            // return a ptr directly to the Geode for this mesh 
     
    542585        } 
    543586 
    544     } else { 
     587    } 
     588    else 
     589    { 
    545590        // no mesh for this node - probably a camera or something of that persuasion 
    546591        //cout << "no mesh for object " << node->name << endl; 
     
    550595 
    551596 
    552 static long filei_seek_func(void *self, long offset, Lib3dsIoSeek origin) { 
     597static long filei_seek_func(void *self, long offset, Lib3dsIoSeek origin) 
     598{ 
    553599    std::istream *f = reinterpret_cast<std::istream*>(self); 
    554600    ios_base::seekdir o = ios_base::beg; 
     
    560606} 
    561607 
    562 static long fileo_seek_func(void *self, long offset, Lib3dsIoSeek origin) { 
     608static long fileo_seek_func(void *self, long offset, Lib3dsIoSeek origin) 
     609{ 
    563610    std::ostream *f = reinterpret_cast<std::ostream*>(self); 
    564611    ios_base::seekdir o = ios_base::beg; 
     
    570617} 
    571618 
    572 static long filei_tell_func(void *self) { 
     619static long filei_tell_func(void *self) 
     620{ 
    573621    std::istream *f = reinterpret_cast<std::istream*>(self); 
    574622    return f->tellg(); 
    575623} 
    576624 
    577 static long fileo_tell_func(void *self) { 
     625static long fileo_tell_func(void *self) 
     626{ 
    578627    std::ostream *f = reinterpret_cast<std::ostream*>(self); 
    579628    return f->tellp(); 
     
    581630 
    582631 
    583 static size_t filei_read_func(void *self, void *buffer, size_t size) { 
     632static size_t filei_read_func(void *self, void *buffer, size_t size) 
     633{ 
    584634    std::istream *f = reinterpret_cast<std::istream*>(self); 
    585635    f->read(reinterpret_cast<char*>(buffer), size); 
     
    587637} 
    588638 
    589 static size_t fileo_write_func(void *self, const void *buffer, size_t size) { 
     639static size_t fileo_write_func(void *self, const void *buffer, size_t size) 
     640{ 
    590641    std::ostream *f = reinterpret_cast<std::ostream*>(self); 
    591642    f->write(static_cast<const char*>(buffer), size); 
     
    601652    else if (level == LIB3DS_LOG_INFO) l = osg::INFO; 
    602653    else if (level == LIB3DS_LOG_DEBUG) l = osg::DEBUG_INFO; 
    603     osg::notify(l) << msg << std::endl; 
     654    OSG_NOTIFY(l) << msg << std::endl; 
    604655} 
    605656 
     
    700751        int level=0; 
    701752        std::cout << "NODE TRAVERSAL of 3ds file "<<f->name<<std::endl; 
    702         for(Lib3dsNode *node=f->nodes; node; node=node->next) { 
     753        for(Lib3dsNode *node=f->nodes; node; node=node->next) 
     754        { 
    703755            print(node,level+1); 
    704756        } 
    705757        std::cout << "MESH TRAVERSAL of 3ds file "<<f->name<<std::endl; 
    706         for (int imesh=0; imesh<f->nmeshes; ++imesh) { 
     758        for (int imesh=0; imesh<f->nmeshes; ++imesh){ 
    707759            print(f->meshes[imesh],level+1); 
    708760        } 
     
    716768    // MIKEC: have found 3ds files with NO node structure - only meshes, for this case we fall back to the old traverse-by-meshes code 
    717769    // Loading and re-exporting these files from 3DS produces a file with correct node structure, so perhaps these are not 100% conformant? 
    718     if (f->nodes == NULL) { 
    719         osg::notify(osg::WARN)<<"Warning: in 3ds loader: file has no nodes, traversing by meshes instead"<< std::endl; 
     770    if (f->nodes == NULL) 
     771    { 
     772        OSG_NOTIFY(osg::WARN)<<"Warning: in 3ds loader: file has no nodes, traversing by meshes instead"<< std::endl; 
    720773        traverse_nodes=true; 
    721774    } 
     
    723776    osg::Node* group = NULL; 
    724777 
    725     if (traverse_nodes) { // old method 
     778    if (traverse_nodes) // old method 
     779    { 
    726780        group = new osg::Group(); 
    727         for (int imesh=0; imesh<f->nmeshes; ++imesh) { 
     781        for (int imesh=0; imesh<f->nmeshes; ++imesh) 
     782        { 
    728783            reader.processMesh(drawStateMap,group->asGroup(),f->meshes[imesh],NULL); 
    729784        } 
    730     } else { // new method 
     785    } 
     786    else 
     787    { // new method 
    731788        Lib3dsNode *node=f->nodes; 
    732789        if (!node->next) 
     790        { 
    733791            group = reader.processNode(drawStateMap,f,node); 
     792        } 
    734793        else 
    735794        { 
    736795            group = new osg::Group(); 
    737             for(; node; node=node->next) { 
     796            for(; node; node=node->next) 
     797            { 
    738798                group->asGroup()->addChild(reader.processNode(drawStateMap,f,node)); 
    739799            } 
     
    744804    if (osg::getNotifyLevel()>=osg::INFO) 
    745805    { 
    746         osg::notify(osg::NOTICE) << "Final OSG node structure looks like this:"<< endl; 
     806        OSG_NOTIFY(osg::NOTICE) << "Final OSG node structure looks like this:"<< endl; 
    747807        PrintVisitor pv(osg::notify(osg::NOTICE)); 
    748808        group->accept(pv); 
     
    903963    if (texture && *(texture->name)) 
    904964    { 
    905         osg::notify(osg::INFO)<<"texture->name="<<texture->name<<", _directory="<<_directory<<std::endl; 
     965        OSG_NOTIFY(osg::INFO)<<"texture->name="<<texture->name<<", _directory="<<_directory<<std::endl; 
    906966 
    907967        std::string fileName = osgDB::findFileInDirectory(texture->name,_directory,osgDB::CASE_INSENSITIVE); 
     
    910970            // file not found in .3ds file's directory, so we'll look in the datafile path list. 
    911971            fileName = osgDB::findDataFile(texture->name,options, osgDB::CASE_INSENSITIVE); 
    912             osg::notify(osg::INFO)<<"texture->name="<<texture->name<<", _directory="<<_directory<<std::endl; 
     972            OSG_NOTIFY(osg::INFO)<<"texture->name="<<texture->name<<", _directory="<<_directory<<std::endl; 
    913973        } 
    914974 
     
    919979                // if 3DS file is loaded from http, just attempt to load texture from same location. 
    920980                fileName = _directory + "/" + texture->name; 
    921             } else { 
    922                 osg::notify(osg::WARN) << "texture '"<<texture->name<<"' not found"<< std::endl; 
     981            } 
     982            else 
     983            { 
     984                OSG_NOTIFY(osg::WARN) << "texture '"<<texture->name<<"' not found"<< std::endl; 
    923985                return NULL; 
    924986            } 
    925987        } 
    926988 
    927         if (label) osg::notify(osg::DEBUG_INFO) << label; 
    928         else osg::notify(osg::DEBUG_INFO) << "texture name"; 
    929         osg::notify(osg::DEBUG_INFO) << " '"<<texture->name<<"'"<< std::endl; 
    930         osg::notify(osg::DEBUG_INFO) << "    texture flag        "<<texture->flags<< std::endl; 
    931         osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_DECALE       "<<((texture->flags)&LIB3DS_TEXTURE_DECALE)<< std::endl; 
    932         osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_MIRROR       "<<((texture->flags)&LIB3DS_TEXTURE_MIRROR)<< std::endl; 
    933         osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_NEGATE       "<<((texture->flags)&LIB3DS_TEXTURE_NEGATE)<< std::endl; 
    934         osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_NO_TILE      "<<((texture->flags)&LIB3DS_TEXTURE_NO_TILE)<< std::endl; 
    935         osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_SUMMED_AREA  "<<((texture->flags)&LIB3DS_TEXTURE_SUMMED_AREA)<< std::endl; 
    936         osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_ALPHA_SOURCE "<<((texture->flags)&LIB3DS_TEXTURE_ALPHA_SOURCE)<< std::endl; 
    937         osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_TINT         "<<((texture->flags)&LIB3DS_TEXTURE_TINT)<< std::endl; 
    938         osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_IGNORE_ALPHA "<<((texture->flags)&LIB3DS_TEXTURE_IGNORE_ALPHA)<< std::endl; 
    939         osg::notify(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_RGB_TINT     "<<((texture->flags)&LIB3DS_TEXTURE_RGB_TINT)<< std::endl; 
     989        if (label) { OSG_NOTIFY(osg::DEBUG_INFO) << label; } 
     990        else { OSG_NOTIFY(osg::DEBUG_INFO) << "texture name"; } 
     991 
     992        OSG_NOTIFY(osg::DEBUG_INFO) << " '"<<texture->name<<"'"<< std::endl; 
     993        OSG_NOTIFY(osg::DEBUG_INFO) << "    texture flag        "<<texture->flags<< std::endl; 
     994        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_DECALE       "<<((texture->flags)&LIB3DS_TEXTURE_DECALE)<< std::endl; 
     995        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_MIRROR       "<<((texture->flags)&LIB3DS_TEXTURE_MIRROR)<< std::endl; 
     996        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_NEGATE       "<<((texture->flags)&LIB3DS_TEXTURE_NEGATE)<< std::endl; 
     997        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_NO_TILE      "<<((texture->flags)&LIB3DS_TEXTURE_NO_TILE)<< std::endl; 
     998        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_SUMMED_AREA  "<<((texture->flags)&LIB3DS_TEXTURE_SUMMED_AREA)<< std::endl; 
     999        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_ALPHA_SOURCE "<<((texture->flags)&LIB3DS_TEXTURE_ALPHA_SOURCE)<< std::endl; 
     1000        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_TINT         "<<((texture->flags)&LIB3DS_TEXTURE_TINT)<< std::endl; 
     1001        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_IGNORE_ALPHA "<<((texture->flags)&LIB3DS_TEXTURE_IGNORE_ALPHA)<< std::endl; 
     1002        OSG_NOTIFY(osg::DEBUG_INFO) << "    LIB3DS_TEXTURE_RGB_TINT     "<<((texture->flags)&LIB3DS_TEXTURE_RGB_TINT)<< std::endl; 
    9401003 
    9411004        osg::ref_ptr<osg::Image> osg_image = osgDB::readRefImageFile(fileName.c_str(), options); //Absolute Path 
    9421005        if (!osg_image.valid()) 
    9431006        { 
    944             osg::notify(osg::NOTICE) << "Warning: Cannot create texture "<<texture->name<< std::endl; 
     1007            OSG_NOTIFY(osg::NOTICE) << "Warning: Cannot create texture "<<texture->name<< std::endl; 
    9451008            return NULL; 
    9461009        } 
     
    10711134 
    10721135 
    1073 osgDB::ReaderWriter::WriteResult ReaderWriter3DS::writeNode(const osg::Node& node,const std::string& fileName,const Options* options) const { 
     1136osgDB::ReaderWriter::WriteResult ReaderWriter3DS::writeNode(const osg::Node& node,const std::string& fileName,const Options* options) const 
     1137{ 
    10741138    std::string ext = osgDB::getLowerCaseFileExtension(fileName); 
    10751139    if (!acceptsExtension(ext)) return WriteResult::FILE_NOT_HANDLED; 
     
    10841148    if (!file3ds) return WriteResult(WriteResult::ERROR_IN_WRITING_FILE); 
    10851149 
    1086     try { 
    1087         osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 
    1088         local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 
    1089  
    1090         if (!createFileObject(node, file3ds, fileName, local_opt)) ok = false; 
    1091         if (ok && !lib3ds_file_save(file3ds, fileName.c_str())) ok = false; 
    1092     } catch (...) { 
    1093         lib3ds_file_free(file3ds); 
    1094         throw; 
    1095     } 
     1150    osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 
     1151    local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileName)); 
     1152    if (!createFileObject(node, file3ds, fileName, local_opt)) ok = false; 
     1153    if (ok && !lib3ds_file_save(file3ds, fileName.c_str())) ok = false; 
    10961154    lib3ds_file_free(file3ds); 
    10971155 
     
    11011159 
    11021160 
    1103 osgDB::ReaderWriter::WriteResult ReaderWriter3DS::writeNode(const osg::Node& node,std::ostream& fout,const Options* options) const { 
    1104     //osg::notify(osg::WARN) << "!!WARNING!! 3DS write support is incomplete" << std::endl; 
     1161osgDB::ReaderWriter::WriteResult ReaderWriter3DS::writeNode(const osg::Node& node,std::ostream& fout,const Options* options) const 
     1162{ 
     1163    //OSG_NOTIFY(osg::WARN) << "!!WARNING!! 3DS write support is incomplete" << std::endl; 
    11051164    std::string optFileName; 
    1106     if (options) { 
     1165    if (options) 
     1166    { 
    11071167        optFileName = options->getPluginStringData("STREAM_FILENAME"); 
    11081168    } 
     
    11111171} 
    11121172 
    1113 osgDB::ReaderWriter::WriteResult ReaderWriter3DS::doWriteNode(const osg::Node& node,std::ostream& fout, const Options* options, const std::string & fileNamelib3ds) const { 
     1173osgDB::ReaderWriter::WriteResult ReaderWriter3DS::doWriteNode(const osg::Node& node,std::ostream& fout, const Options* options, const std::string & fileNamelib3ds) const 
     1174{ 
    11141175    osg::ref_ptr<Options> local_opt = options ? static_cast<Options*>(options->clone(osg::CopyOp::SHALLOW_COPY)) : new Options; 
    11151176    local_opt->getDatabasePathList().push_front(osgDB::getFilePath(fileNamelib3ds)); 
     
    11271188 
    11281189    bool ok = true; 
    1129     try { 
    1130         if (!createFileObject(node, file3ds, fileNamelib3ds, local_opt.get())) ok = false; 
    1131         if (ok && !lib3ds_file_write(file3ds, &io)) ok = false; 
    1132          
    1133     } catch (...) { 
    1134         lib3ds_file_free(file3ds); 
    1135         throw; 
    1136     } 
     1190    if (!createFileObject(node, file3ds, fileNamelib3ds, local_opt.get())) ok = false; 
     1191    if (ok && !lib3ds_file_write(file3ds, &io)) ok = false; 
    11371192    lib3ds_file_free(file3ds); 
    11381193 
     
    11411196} 
    11421197 
    1143 bool ReaderWriter3DS::createFileObject(const osg::Node& node, Lib3dsFile * file3ds,const std::string& fileName, const osgDB::ReaderWriter::Options* options) const { 
     1198bool ReaderWriter3DS::createFileObject(const osg::Node& node, Lib3dsFile * file3ds,const std::string& fileName, const osgDB::ReaderWriter::Options* options) const 
     1199{ 
    11441200    WriterNodeVisitor w(file3ds, fileName, options, osgDB::getFilePath(node.getName())); 
    11451201    const_cast<osg::Node &>(node).accept(w);                // Ugly const_cast<> for visitor... 
    1146     if (!w.suceedLastApply()) 
    1147         return false; 
     1202    if (!w.succeeded()) return false; 
    11481203    w.writeMaterials(); 
    1149     return true;    //w.good(); 
    1150 } 
    1151  
     1204    return w.succeeded(); 
     1205} 
     1206