Skip to content

Commit

Permalink
* fixed loading absolute paths
Browse files Browse the repository at this point in the history
  • Loading branch information
fiezi committed Dec 15, 2011
1 parent fb94362 commit cc3beae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
Binary file modified Moviesandbox.exe
Binary file not shown.
21 changes: 18 additions & 3 deletions classes/sceneData.cpp
Expand Up @@ -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;
}

Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion projects/emptyProject/blank.scene
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion 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" />
Expand Down

0 comments on commit cc3beae

Please sign in to comment.