[osg-submissions] osgconv: changes to handling of command line options
Robert Osfield
robert.osfield at gmail.com
Sun Aug 19 09:59:09 PDT 2007
Hi Max,
This is not an appropriate change as it'll eat command line entries
that might not be intended to be part of the option string. If you
want an option string with spaces in it simply use quotes around the
string.
Robert.
On 8/19/07, Max Langbein <m_langbe at informatik.uni-kl.de> wrote:
> hello,
> I have changed the handling of the command line options
> passed to the reader/writer (with -O)
>
> Until now, only one command line option
> with no spaces in it
> can be passed on to the reader/writer.
> (in fact, always the last option given with -O is passed on)
>
> With the change, all command line options given with -O
> are concatenated (with spaces) to a string passed on to the reader/writer.
>
> I needed this because I wanted to pass the options
> PRECISION 10 (note: two words separated with spaces)
> on to the .osg writer.
>
>
> Testing done:
>
> I compiled the new osgconv.cpp and executed
>
> osgconv -O PRECISION -O 10 bplan_from3ds.dxf
>
> (bplan_from3ds.dxf is a dxf file I wanted to have in a higher precision in
> the .osg file)
>
> The resulting file converted.osg
> could be loaded into osgviewer without errors;
>
> it had now 8 decimals per number instead of 6;
> (only 8 and not 10 because float doesn't have more precision)
>
>
> In the code, i made the following changes:
>
> I Replaced
>
> //----------------------------------------------------------
> std::string str;
> while (arguments.read("-O",str))
> {
> osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
> options->setOptionString(str);
> osgDB::Registry::instance()->setOptions(options);
> }
> //----------------------------------------------------------
>
> with:
>
> //----------------------------------------------------------
> std::string str,optstr="";
> while(arguments.read("-O",str))
> optstr+=" "+str;
>
> if(optstr!=""){
> osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
> options->setOptionString(optstr);
> osgDB::Registry::instance()->setOptions(options);
> }
> //----------------------------------------------------------
>
>
>
> Greetings,
> Max Langbein
> _______________________________________________
> osg-submissions mailing list
> osg-submissions at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>
>
More information about the osg-submissions
mailing list