From Sukender, "

DAE plugin was linking ORIGINAL images in the Collada file, using image->getName() as a path (even if images were modified in memory!). As the behaviour was not the one of other plugins (3DS, FBX, and such), I made the plugin relativise images filenames (as those plugins) and write the image which is in memory. However, in order to avoid removing features, I kept the previous behaviour but moved it in an option. Here are the options of the plugin I changed:
- daeForceTexture was unclear in this new context and removed in favor of two new options
- daeLinkOriginalTexturesNoForce: Writes reference to the original image if found, instead of writing the image in memory
- daeLinkOriginalTexturesForce: Writes reference to the original image even if not found, instead of writing the image in memory
Of course, if you specify no option, images are written as for other plugins.

Other thing I changed is the UTF8 support as I told you in a previous conversation. Now there is a simple option, "daeNamesUseCodepage", which makes all names except filenames (materials, animation, geometries...) be considered as encoded using current codepage. If so, they'll be converted to UTF8 when writing; else they are written directly. Of course, filenames follow OSG_USE_UTF8_FILENAME as usual.

I did "
This commit is contained in:
Robert Osfield
2011-01-21 13:40:28 +00:00
parent cc207c1112
commit 90508f282a
6 changed files with 132 additions and 34 deletions

View File

@@ -19,6 +19,7 @@
#include <dom/domConstants.h>
#include <sstream>
#include <osgDB/ConvertUTF>
namespace osgDAE {
@@ -95,7 +96,7 @@ std::string toString(const osg::Matrix& value)
}
daeWriter::daeWriter( DAE *dae_, const std::string &fileURI, bool _usePolygons, bool googleMode, TraversalMode tm, bool _writeExtras, bool earthTex, bool zUpAxis, bool forceTexture) : osg::NodeVisitor( tm ),
daeWriter::daeWriter( DAE *dae_, const std::string & fileURI, const std::string & directory, const std::string & srcDirectory, const osgDB::ReaderWriter::Options * options, bool _usePolygons, bool googleMode, TraversalMode tm, bool _writeExtras, bool earthTex, bool zUpAxis, bool linkOrignialTextures, bool forceTexture, bool namesUseCodepage) : osg::NodeVisitor( tm ),
dae(dae_),
_domLibraryAnimations(NULL),
writeExtras(_writeExtras),
@@ -104,8 +105,14 @@ daeWriter::daeWriter( DAE *dae_, const std::string &fileURI, bool _usePolygons,
m_GoogleMode(googleMode),
m_EarthTex(earthTex),
m_ZUpAxis(zUpAxis),
m_linkOrignialTextures(linkOrignialTextures),
m_ForceTexture(forceTexture),
m_CurrentRenderingHint(osg::StateSet::DEFAULT_BIN)
_namesUseCodepage(namesUseCodepage),
m_CurrentRenderingHint(osg::StateSet::DEFAULT_BIN),
_lastGeneratedImageFileName(0),
_directory(directory),
_srcDirectory(srcDirectory),
_options(options)
{
success = true;
@@ -198,8 +205,9 @@ void daeWriter::updateCurrentDaeNode()
}
}
std::string daeWriter::uniquify( const std::string &name )
std::string daeWriter::uniquify( const std::string &_name )
{
const std::string name( _namesUseCodepage ? osgDB::convertStringFromCurrentCodePageToUTF8(_name) : _name );
std::map< std::string, int >::iterator iter = uniqueNames.find( name );
if ( iter != uniqueNames.end() )
{