Accessing the name of a "Child"
Blitz3D Forums/Blitz3D Programming/Accessing the name of a "Child"| 
 | ||
| Is there any way to find the name of "child" in a model using BlitzBasic code (rather than looking it up in the modeling program)? I can get a handle using GetChild(parent entity, index#) or FindChild ( entity,child_name$ ) But I can't get a name. The problem seems to be that a "child" is not considered to be an entity. Can you rename a child? Or is all the naming confined to the modeling program? 
;--------------------
;EXAMPLE CODE
plane=LoadAnimMesh("ship.3ds", pivot)  
NameEntity(plane, "ship")                      
While Not KeyDown( 1 )
{
current_child_handle = GetChild(plane,count) 
current_child_name$ = EntityName (current_child_handle)
...  ;; ERROR HERE
This code returns an error "Entity does not exist." Obviously because a child is not an entity. | 
| 
 | ||
| You aren't setting the 'count' variable to anything so it's 0 by default so this is expected.  It should be at least 1. You may also want to check there are children by making sure countchildren( plane ) > 0 Stevie | 
| 
 | ||
| Yeah, that's better.  Thanks Stevie! | 
| 
 | ||
| Function PrintChildren(Entity,estr$="") Print estr$+EntityName$(Entity) For t=1 To CountChildren(Entity) PrintChildren(GetChild(Entity,t),estr$+EntityName$(Entity)+"->") Next End Function |