API Question Is there a way to remove a specific mesh from a vessel?

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,891
Reaction score
2,141
Points
203
Location
between the planets
I need to remove a specific mesh from a vessel, but the only thing I can find in the API in that direction is to remove all the meshes.

Am I overlooking something? or is the only way to remove a specific mesh to remove them all and re-add the rest again?

---------- Post added at 11:06 AM ---------- Previous post was at 10:51 AM ----------

Dang it, I seem to be blind. Now I found the method (DelMesh, obviously). Forgett this post ever existed!
 

francisdrake

Addon Developer
Addon Developer
Joined
Mar 23, 2008
Messages
1,100
Reaction score
943
Points
128
Website
francisdrakex.deviantart.com
Well, that's normally no problem. Remove all meshes with ClearMeshes(TRUE);
and add again those meshes you would like to show. This happens in the blink of an eye (timestep), so no flickering.

Alternatively you could preload all meshes and just vary the visibility with SetMeshVisibility. Then the unwanted mesh would still be loaded, but invisible.
 

Hlynkacg

Aspiring rocket scientist
Addon Developer
Tutorial Publisher
Donator
Joined
Dec 27, 2010
Messages
1,870
Reaction score
3
Points
0
Location
San Diego
is the delete mesh function not working for you?

example...
Code:
UINT mesh_descentstage = AddMesh (myfolder/descent.msh); // adds mesh to vessel

delMesh (mesh_descentstage) // removes that mesh

NOTE:
Adding and deleting meshes eats up a fair bit of memory for that time step, so if you are going to re-use the mesh it's better to just change it's visibility settings.
 

N_Molson

Addon Developer
Addon Developer
Donator
Joined
Mar 5, 2010
Messages
9,295
Reaction score
3,265
Points
203
Location
Toulouse
Adding and deleting meshes eats up a fair bit of memory for that time step, so if you are going to re-use the mesh it's better to just change it's visibility settings.

Definitively, loading a mesh during simulation (and its related textures/maps) can cause lags, especially on the low-end configurations. The heaviest the mesh/textures/maps, the worse, of course. So yes, it seems a good idea to apply the "invisibility trick", when re-used. :yes:
 
Top