Operating System: :Win XP SP3:
Hello, again more newbie questions.
I have my map editor which load assets (zip files) from users, you can expect all bad things: Duplicated/missing particles/meshes/materials invalid scripts, etc.
When something goes wrong i'd like to log/display the error and maybe load a default mesh/object and allow the program to continue running.
I tried a simple try/catch around some code that will cause crash and the catch is never being executed, how I do handle errors in Ogre?
Code at CreateScene()
Code: Select all
try
{
printf("let's crash this!... \r\n");
SceneNode *BrownSN = mSceneMgr->getRootSceneNode()->createChildSceneNode("BrownSN");
Entity *HeadA = mSceneMgr->createEntity("Head2", "Head2.mesh");
BrownSN->attachObject(HeadA);
Entity *HeadB = mSceneMgr->createEntity("Head2", "Head2.mesh"); //this will crash it
BrownSN->attachObject(HeadB);
}
catch (Exception& e)
{
printf("Crashed as expected\r\n");
fprintf(stderr, "An exception has occurred: %s\n",e.getFullDescription().c_str());
system("pause");
}
Code: Select all
let's crash this!...
Mesh: Loading Head2.mesh.
Skeleton: Loading Head2-Armature2.skeleton
Texture: headTex1.jpg: Loading 1 faces(PF_R8G8B8,512x512x1) with hardware gener
ated mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
Texture: teethTex.jpg: Loading 1 faces(PF_R8G8B8,128x128x1) with hardware gener
ated mipmaps from Image. Internal format is PF_X8R8G8B8,128x128x1.
Texture: eyeTex.jpg: Loading 1 faces(PF_R8G8B8,512x512x1) with hardware generat
ed mipmaps from Image. Internal format is PF_X8R8G8B8,512x512x1.
WARNING: the mesh 'Head2.mesh' includes vertices with more than 4 bone assignmen
ts. The lowest weighted assignments beyond this limit have been removed, so your
animation may look slightly different. To eliminate this, reduce the number of
bone assignments per vertex on your mesh to 4.
terminate called after throwing an instance of 'Ogre::ItemIdentityException'
what(): OGRE EXCEPTION(4:ItemIdentityException): An object of type 'Entity' w
ith name 'Head2' already exists. in SceneManager::createMovableObject at ../../.
./../../OgreMain/src/OgreSceneManager.cpp (line 6484)
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Process returned 3 (0x3) execution time : 9.906 s
Press any key to continue.
Another different question, how do I make Ogre override/ignore duplicated particle scripts rather than throwing an exception and closing when I load a resource group?
Any tutorial with good practices for error handling in Ogre?
Edit: Forgot to create a child node, yet the error persist.