Revision: 8564
http://playerstage.svn.sourceforge.net/playerstage/?rev=8564&view=rev
Author: hsujohnhsu
Date: 2010-03-05 04:00:15 +0000 (Fri, 05 Mar 2010)
Log Message:
-----------
search for texture file next to the collada file.
Modified Paths:
--------------
code/gazebo/trunk/server/AssimpLoader.cc
Modified: code/gazebo/trunk/server/AssimpLoader.cc
===================================================================
--- code/gazebo/trunk/server/AssimpLoader.cc 2010-03-05 03:47:26 UTC (rev
8563)
+++ code/gazebo/trunk/server/AssimpLoader.cc 2010-03-05 04:00:15 UTC (rev
8564)
@@ -3,6 +3,7 @@
#include "Mesh.hh"
#include "Material.hh"
#include "AssimpLoader.hh"
+#include <sys/stat.h>
using namespace gazebo;
@@ -55,7 +56,19 @@
aiTextureMapping mapping;
unsigned int uvIndex;
amat->GetTexture(aiTextureType_DIFFUSE,0, &texName, &mapping,
&uvIndex);
- mat->SetTextureImage(texName.data);
+
+ // attempt to find fully qualified filename for texture image
+ // in the same place as the collada file
+ // pathname of the collada dae file
+ std::string dae_pathname = filename.rfind("/")==std::string::npos ?
+ std::string("") : filename.substr(0,filename.rfind("/")+1);
+ // fully qualified texture filename
+ std::string texture_fqfn = dae_pathname + texName.data;
+ struct stat st;
+ if (stat(texture_fqfn.c_str(), &st) == 0)
+ mat->SetTextureImage(texture_fqfn); // use fqfn if it exists
+ else
+ mat->SetTextureImage(texName.data); // use defaut filename, rely on
ogre path
}
else if (propKey == "?mat.name")
{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit