Hi Terry,

Thanks, I've committed the c_str() fix. I did not commit your other change
however. The export materials option is actually referring to 3ds Max
materials (i.e. osg::StateSet), not osg::Material objects. So your change
would break the expected behavior of that option. If you need textures and
other stateset related attributes exported, then you should leave the
export materials option enabled. I realize the name of this option is quite
misleading. It should probably be made more clear in the export dialog.

Cheers,
Farshid


On Mon, Jan 21, 2013 at 2:37 PM, Terry Welsh <[email protected]> wrote:

> I can't remember, is it okay to make OSGExp submissions here?
>
> Right now osg::Textures and texcoords can only be exported if an
> osg::Material is also exported. This changes separates them so
> textures can be exported without materials. I submitted something
> similar a long time ago as revision 151. It looks like it was reverted
> in revision 152, but the commit comment makes it unclear if it was
> reverted intentionally or unintentionally. I still think this is a
> useful modification.
>
> I also added a 2 .c_str() without which I couldn't compile. I'm using
> Visual Studio 2008 Express Edition and 3ds Max 8.
>
>
> Index: OSGExp.cpp
> ===================================================================
> --- OSGExp.cpp  (revision 275)
> +++ OSGExp.cpp  (working copy)
> @@ -584,13 +584,11 @@
>
>                 // Add the nodes material to out material list
>                 // Null entries are ignored when added...
> -               if(_options->getExportMaterials()){
> -                       BOOL mtlAdded = _mtlList->addMtl(node->GetMtl(),
> t);
> -                       if(mtlAdded){
> -                               // Update material exporting progress bar.
> -                               _nCurMtl++;
> -
> _ip->ProgressUpdate((int)((float)_nCurMtl/_nTotalMtlCount*100.0f));
> -                       }
> +               BOOL mtlAdded = _mtlList->addMtl(node->GetMtl(), t);
> +               if(mtlAdded){
> +                       // Update material exporting progress bar.
> +                       _nCurMtl++;
> +
> _ip->ProgressUpdate((int)((float)_nCurMtl/_nTotalMtlCount*100.0f));
>                 }
>         }
>
> Index: MtlKeeper.cpp
> ===================================================================
> --- MtlKeeper.cpp       (revision 275)
> +++ MtlKeeper.cpp       (working copy)
> @@ -639,7 +639,8 @@
>                 // Make the OSG material.
>                 osg::ref_ptr<osg::Material> osgMtl =
> createMaterial(stdMtl, t);
>                 // Set the material to the stateset.
> -               stateset->setAttribute(osgMtl.get());
> +               if(options->getExportMaterials())
> +                       stateset->setAttribute(osgMtl.get());
>                 // Set blend function if material is transparent.
>                 if (stdMtl->GetOpacity(t)!= 1.0f)
>                         Util::addAlphaBlendFunc(stateset);
> @@ -1626,8 +1627,8 @@
>
>         // If original file is specified, then make exact copy of file
>         if( !originalFile.empty() ) {
> -               M_STD_FISTREAM src(originalFile, M_STD_FISTREAM::in |
> M_STD_FISTREAM::binary);
> -               M_STD_FOSTREAM dst(filename, M_STD_FOSTREAM::out |
> M_STD_FOSTREAM::binary);
> +               M_STD_FISTREAM src(originalFile.c_str(),
> M_STD_FISTREAM::in |
> M_STD_FISTREAM::binary);
> +               M_STD_FOSTREAM dst(filename.c_str(), M_STD_FOSTREAM::out |
> M_STD_FOSTREAM::binary);
>                 if(src && dst) {
>                         dst << src.rdbuf();
>                         return BMMRES_SUCCESS;
> _______________________________________________
> osg-submissions mailing list
> [email protected]
>
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to