[SOLVED] Import modified .obj, while program still runs.

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
crazy1k
Posts: 7
Joined: Sat Dec 19, 2015 1:13 pm

[SOLVED] Import modified .obj, while program still runs.

Post by crazy1k »

Importing .obj like so:

Code: Select all

scene::ISceneNode * Import_1 = smgr->addMeshSceneNode(smgr->getMesh("d:\\1_test.obj"));
Another nodes in scene - camera and one light.
Then i wrote another button that removes this mesh:

Code: Select all

Import_1->remove();
Works well so far. Viewport showing that scene is empty (I mean no geometry). While programm is still running I modify this "1_test.obj" and then import it again with different var:

Code: Select all

scene::ISceneNode * Import_2_modified = smgr->addMeshSceneNode(smgr->getMesh("d:\\1_test.obj"));
And viewport showing unmodified model. Any ideas anyone?
Tried to:

Code: Select all

smgr->clear()
then resetting scene lights and cameras. Then importing this modified .obj, but result is still the same - viewport shows start model, not modified one.
Maybe I`m not deleting something properly? Or it`s a bug?
Last edited by crazy1k on Sat Dec 19, 2015 2:48 pm, edited 1 time in total.
JLouisB
Posts: 67
Joined: Tue Jul 24, 2012 12:36 pm
Location: France

Re: Import modified .obj, while program still runs.

Post by JLouisB »

It's probably because your mesh is still in the mesh cache.
If you add something like :

Code: Select all

smgr->getMeshCache()->clear();
before your second load it should works (if you have more than one mesh you shouldn't clear the cache but use a loop to find the specific mesh)
crazy1k
Posts: 7
Joined: Sat Dec 19, 2015 1:13 pm

Re: Import modified .obj, while program still runs.

Post by crazy1k »

WORKS! Thanks a lot! I use only one mesh node, so I think there won`t be any issues with this anymore. Thanks again!
Post Reply