Am 03.06.2016 um 11:30 schrieb Ralf Habacker:
> Am 02.06.2016 um 13:01 schrieb Robert Osfield:
>> One would simply use a osg::clone(options) to generate the options
>> object to store in the cache, this would insulate the cache from being
>> invalidated by changes to the original Options object passed in,
> Got it, thanks :-)
>
> I added initial support to class ObjectCache, see
> https://github.com/rhabacker/osg/commit/e3539ea0185a4013514850c3577180aaa38c895d
>
> While trying to test the implementation with osgviewer it turns out that
> it is not possible to setup a testcase using command line.
>
> I used
>
> osgviewer -O convertToFeed test-file1.flt -O convertToKilometers
> test-file2.flt
>
> and got always empty options. 
>
>
> Adding test1.flt with options '' to ObjectCache 0x15fadb0
>
> A quick check shows that in Registry::readCommandLine()  all -O options
> are read and saved in one Options instance in Registry::_options.
>
> void Registry::readCommandLine(osg::ArgumentParser& arguments)
>
> ...
>     while(arguments.read("-O",value))
>     {
>         setOptions(new Options(value));
>     }
>
> So I thought there may be a change to get options using one file:
>
> osgviewer -O convertToFeed test-file1.flt
>
>
> but still got
>
> adding test1.flt with options '' to ObjectCache 0x12b9db0
>
> Any idea what's going wrong and how to fix ?
Beside the that the mentioned command line should be

osgviewer -O convertToFeed test.flt

to match to debug output 


and an incomplete patch from my side, which is fixed in 
https://github.com/rhabacker/osg/commit/33aca40d00b8de692bc5858a15f8a53833c7d85c


it looks that there are conflicts in osgviewer command line handling relating 
to the object cache.


On command line the object cache is enabled with --enable-object-cache, which 
is handled in osgviewer.cpp:89 ff [2]

    // Enable caching?
    while (arguments.read("--enable-object-cache"))
    {
        if (osgDB::Registry::instance()->getOptions()==0) 
osgDB::Registry::instance()->setOptions(new osgDB::Options());
        
osgDB::Registry::instance()->getOptions()->setObjectCacheHint(osgDB::Options::CACHE_ALL);
    }


Adding -O <options> to command line in frot of a filename is handled in 

void Registry::readCommandLine(osg::ArgumentParser& arguments)

...
    while(arguments.read("-O",value))
    {
        setOptions(new Options(value));
    }

The problem here is that the newly created option overwrites CACHE_ALL setting 
from [2].

Second this code only adds the latest -O option and overwrites the previous 
one, which breaks command line using multiple -O options like 

osgviewer -O <options1> file1 -O <option2> <file2>

The appended sequence diagram shows the related calls. 

Do you have any advice how to fix this issue(s) ? 

Cheers
Ralf  


_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to