changing file system with open file dialog ?

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
vorschau
Posts: 10
Joined: Thu Mar 03, 2005 3:00 pm
Location: vienna

changing file system with open file dialog ?

Post by vorschau »

i would like to create a meshviewer, witch loads .pk3 files with the addFileOpenDialog and loads the meshes within, but when i change the file system it does not reload the meshes, so the old are still displayed.

..jes i´m not a pro

anny code snipples to learn would help.
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

You have to remove the scene nodes that you created before creating new ones.
You can do this with ISceneNode::remove().
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

The mesh is still in the meshcache so if you reload it with the same name you have to remove the old one first explicitly.
You can access the cache like: sceneManager->getMeshCache ().
And there you have several ways to remove it. Best check the docs to find the functions for that.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
vorschau
Posts: 10
Joined: Thu Mar 03, 2005 3:00 pm
Location: vienna

Post by vorschau »

using irrlicht 1.2

tried the following

Code: Select all

// solid-oberflächen
scene::IAnimatedMeshSceneNode* mesh = 0;

if(mesh)
mesh->remove();
	mesh = 0;
scene::IAnimatedMesh* solid = 0;

smgr->getMeshCache();
scene::IMeshCache*cache = 0;
cache->removeMesh(solid);

solid = smgr->getMesh("solid.3ds");
scene::ITriangleSelector* selectormesh = 0;

if(solid)
{
		mesh = smgr->addAnimatedMeshSceneNode(solid);
		mesh->setMaterialType(video::EMT_SOLID);
		mesh->setMaterialFlag(video::EMF_LIGHTING, false);
// erkennung für collision
		selectormesh = smgr->createTriangleSelector(solid->getMesh(0), mesh);
		mesh->setTriangleSelector(selectormesh);
		metaselector->addTriangleSelector(selectormesh);


}
but something is wrong

please help...
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

Code: Select all

scene::IMeshCache*cache = 0;
cache->removeMesh(solid); 
You should first learn at least the basics of c++ before using irrlicht.
You are accessing an invalid pointer. You have to initialize it using ISceneManager::getMeshCache()

And for the future: "Something is wrong" is not an acceptable error description. Not if you want us to help you.

Oh and btw:
The current Irrlicht version is 1.5 and 1.6 is on its way.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
Post Reply