Loading another scene with earlier one.. [SOLVED]


14-07-2009 12:44:25


I am trying to do 3D-editor with Mogre and now I have little problem..

When I load scene first in InitMogre-function (normal start-up sequence), everything works fine; all resources have been loaded and scene looks exactly like it should be. When I want to add another scene in new childSceneNode under same RootSceneNode, I lose all resources with FileSystem-type. I try to add lost resource location, but it is no use, I still get the first assertion failed exception and then FileNotFoundException.

code for adding another scene:
this->openSceneDialog->DefaultExt = "scene";
this->openSceneDialog->FileName = "*.scene";
this->openSceneDialog->Filter = "Scene-files|*.scene";
if (openSceneDialog->ShowDialog() == System::Windows::Forms::DialogResult::OK)


code for loading meshes in scene, works fine for first scene, crashes in second
else if (name == "entity")
String^ entName = Cnode->Attributes["name"]->Value;
partFile_ = Cnode->Attributes["meshFile"]->Value;
// list for checking resources
StringVectorPtr^ list = Mogre::ResourceGroupManager::Singleton->ListResourceNames(ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

if(list->Count == 0){
//filesystems were lost somewhere, try to add them again
root_->AddResourceLocation(directory_->FullName, "FileSystem", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true);
//resources can be seen again in this list
StringVectorPtr^ list2 = Mogre::ResourceGroupManager::Singleton->ListResourceNames(ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
// crashes here
Entity^ ent = mgr_->CreateEntity(entName, partFile_);

assertion fail is following:
Assertion failed! Program: file: d:\cubicalminds\mogreworld\mogre...\ogrefi...tem.cpp
Line: 199
Expression: ret==0 && "Problem getting file size"

Ogre.log gives following exception. First three meshes are in first scene, Sphere01.mesh is in second one.

14:29:26: Mesh: Loading Z.mesh.
14:29:26: Mesh: Loading Y.mesh.
14:29:26: Mesh: Loading X.mesh.
14:29:33: Added resource location 'c:\MetviroII\Material3D' of type 'FileSystem' to resource group 'General' with recursive option
14:29:33: Initialising resource group General
14:29:33: Mesh: Loading Sphere01.mesh.
14:32:58: OGRE EXCEPTION(6:FileNotFoundException): Cannot open file: Sphere01.mesh in FileSystemArchive::open at d:\cubicalminds\mogreworld\mogre\ogrenew\ogremain\src\ogrefilesystem.cpp (line 211)
14:33:08: Unregistering ResourceManager for type BspLevel

I believe that this is probably something very simple, but I am at my wits end with this one. If someone could help me, I would be very grateful..


16-07-2009 05:04:34

this->openSceneDialog->RestoreDirectory = true;
if (openSceneDialog->ShowDialog() == System::Windows::Forms::DialogResult::OK)

Otherwise the OpenFileDialog changes the current directory.


16-07-2009 06:21:13

Thank you! It worked! :D