Zach,

Are you running on windows.

On windows I get

 
<init_from>../../../../../textures/rm_big_tree1.rgba</init_from>

The code that puts the file name in looks like this at the moment

std::string imgstr = "/" + osgDB::convertFileNameToUnixStyle(
osgDB::findDataFile( osgimg->getFileName() ) );
#ifdef WIN32
daeURI uri( _strlwr( (char *)imgstr.c_str() ) );
#else
daeURI uri( imgstr.c_str() );
#endif
uri.validate();
imgif->setValue( uri.getURI() );
//imgif->setValue( imgstr.c_str() );
//imgif->getValue().validate();
#ifdef WIN32
std::string docUriString = doc->getDocumentURI()->getFilepath();
docUriString += doc->getDocumentURI()->getFile();
daeURI docUri( _strlwr( (char *)docUriString.c_str() ) );
imgif->getValue().makeRelativeTo( &docUri );
#else
imgif->getValue().makeRelativeTo( doc->getDocumentURI() ); 
#endif

The line that puts the leading / on the file name was in the original code
and causes the call to uri.validate not to normalise the path. However it
looks like the call to makeRelative to also now treats this as an absolute
path.

If I remove the leading / then uri.Validate normalises the path, but this
means that the leading part of the path is now mixed case! This means that
makeRelativeTo which does not know we are running on windows does not
correctly normalise the path. Catch 22.

I am afraid that looking back it seems all my test files had absolute
windows paths in them (c:/xxx/yyy etc) which work properly.

By the way, if I hand fix the file then only one side of the tree shows.
That looks like another problem.

Roger




_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to