Skip to content
Browse files

* fixed loading absolute paths

  • Loading branch information...
1 parent fb94362 commit cc3beae49ac341c1e20027db57693ca5606318ac @fiezi committed
View
BIN Moviesandbox.exe
Binary file not shown.
View
21 classes/sceneData.cpp
@@ -1369,7 +1369,14 @@ void SceneData::loadMeshes(std::string path, std::string fileName){
for ( ; element!=NULL ;element=element->NextSiblingElement("ColladaMesh")){
string meshID=element->Attribute("meshID");
string meshFileName=element->Attribute("meshFilename");
- colladaLoader->loadColladaMesh(path+meshFileName, meshID);
+ //try relative path first
+ bool worked = colladaLoader->loadColladaMesh(path+meshFileName, meshID);
+ if (!worked){
+ worked = colladaLoader->loadColladaMesh(meshFileName, meshID);
+ //then try absolute path
+ if (!worked)
+ cout <<"ERROR loading colladaMesh:" << meshFileName << endl;
+ }
cout << "loaded mesh " << meshID << " from path " << path+meshFileName << endl;
}
@@ -1380,8 +1387,16 @@ void SceneData::loadMeshes(std::string path, std::string fileName){
for ( ; element!=NULL ;element=element->NextSiblingElement("SpriteMesh")){
string meshID=element->Attribute("meshID");
string meshFileName=element->Attribute("meshFilename");
- spriteMeshLoader->loadSpriteMesh(path+meshFileName, meshID);
- cout << "loaded sprite mesh " << meshID << " from path " << path+meshFileName << endl;
+ //try relative path first
+ bool worked = spriteMeshLoader->loadSpriteMesh(path+meshFileName, meshID);
+ //the try absolute path
+ if (!worked){
+ worked = spriteMeshLoader->loadSpriteMesh(meshFileName, meshID);
+ if (!worked)
+ cout <<"ERROR loading spriteMesh:" << meshFileName << endl;
+ }
+ if (worked)
+ cout << "loaded sprite mesh " << meshID << " from path " << path+meshFileName << endl;
}
element=hRoot.FirstChild( "SpriteMeshXML" ).Element();
View
2 projects/emptyProject/blank.scene
@@ -122,7 +122,7 @@
<TEXTRANSLATION>vec3f 0.000000 0.000000 0.000000</TEXTRANSLATION>
<TEXTUREID>string NULL</TEXTUREID>
<TRANSFORMMATRIX>mat4f 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 0.000000 0.000000 0.000000 1.000000 0.000000 4.368554 0.205743 3.747671 1.000000</TRANSFORMMATRIX>
- <VBOMESHID>string untitled4</VBOMESHID>
+ <VBOMESHID>string chair</VBOMESHID>
</Actor>
<Actor name="SkeletalActor3">13SkeletalActor
<BASE>actor* -1</BASE>
View
2 projects/emptyProject/my.project
@@ -1,7 +1,7 @@
<?xml version="1.0" ?>
<Moviesandbox>
<untitled amount="5" />
- <StartScene name="blank.scene" />
+ <StartScene name="chair.scene" />
<SpriteMesh meshID="chair" meshFilename="C:/Moviesandbox/projects/emptyProject/chair.spriteMesh" />
<SpriteMesh meshID="untitled1" meshFilename="untitled/untitled1.spriteMesh" />
<SpriteMesh meshID="untitled4" meshFilename="untitled/untitled4.spriteMesh" />

0 comments on commit cc3beae

Please sign in to comment.
Something went wrong with that request. Please try again.