Page 1 of 1

changing file system with open file dialog ?

Posted: Mon Jun 15, 2009 2:01 pm
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.

Posted: Mon Jun 15, 2009 2:19 pm
by Sylence
You have to remove the scene nodes that you created before creating new ones.
You can do this with ISceneNode::remove().

Posted: Mon Jun 15, 2009 4:18 pm
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.

Posted: Mon Jun 15, 2009 8:40 pm
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...

Posted: Mon Jun 15, 2009 9:18 pm
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.