API Question a question about oapiLoadMeshGlobal

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,883
Reaction score
2,135
Points
203
Location
between the planets
There's something I'm not quite sure about... What happens if I call oapiLoadMeshGlobal for a mesh that was already loaded globally? I'll have different vessels using the same templates, but I' won't know which ones they are beforehand.

Should I check if GetMeshTemplate() returns NULL for every mesh before loading oapiLoadMeshGlobal, or does the function check if the mesh was already created and in this case just returns a handle to the template?
 

Face

Well-known member
Orbiter Contributor
Addon Developer
Beta Tester
Joined
Mar 18, 2008
Messages
4,403
Reaction score
581
Points
153
Location
Vienna
or does the function check if the mesh was already created and in this case just returns a handle to the template?

According to /Orbitersdk/doc/API_Reference.pdf, p. 114, this should indeed be the case:

Documentation said:
When called for the first time for any given file name, the mesh is loaded from file and stored as a system
resource. Every further request for the same mesh directly returns a handle to the stored mesh without
additional file I/O.
 

jedidia

shoemaker without legs
Addon Developer
Joined
Mar 19, 2008
Messages
10,883
Reaction score
2,135
Points
203
Location
between the planets
Oops, somehow that line escaped me. Should read more careful in the future. Thanks!
 
Top