Code archives/3D Graphics - Mesh/GetSecMesh(mesh,parent)

This code has been declared by its author to be Public Domain code.

Download source code

GetSecMesh(mesh,parent) by Fuller2007
A very simple and easy way to load a mesh and retrieve the child mesh's handle just by inputting its name.
Very useful if you want to make positioning blocks, such as invisible "event" triggers from within your modelling software.
Function LoadSecMesh(file$,parent=0)
	
	mesh=LoadAnimMesh(file$,parent)
	If mesh=0 Then RuntimeError "Mesh "+file$+" does not exist"
	
	Return mesh
	
End Function 

Function GetEntFromName(mesh,name$)
	
	For x=1 To CountChildren(mesh)
		If EntityName$(GetChild(mesh,x))=name$
			Return GetChild(mesh,x)
		EndIf
	Next 
	
End Function

Comments

Stevie G2007
There is already a command to do this ...

http://www.blitzbasic.com/b3ddocs/command.php?name=FindChild&ref=3d_a-z

Your function also does not search recursively so will not find children of children etc...

Stevie


Code Archives Forum