EntiyAlpha/Color on AnimMesh

Blitz3D Forums/Blitz3D Programming/EntiyAlpha/Color on AnimMesh

gburgess(Posted 2004) [#1]
EntityAlpha and EntityColor don't seem to have any effect on a mesh loaded with LoadAnimMesh. When I just used LoadMesh, they work. The mesh is a b3d generated by lwconvert. Have others encountered this problem? Is there a workaround?


Gabriel(Posted 2004) [#2]
Try using FindChild() or GetChild() ( FindChild is easier ) to locate the pieces you want to use EntityAlpha and EntityColor with. When you use LoadAnimMesh, it uses a hierarchy with a pivot at the base, and I think you're EntityAlpha'ing and EntityColor'ing that pivot.


gburgess(Posted 2004) [#3]
Of course! Thank you!


gburgess(Posted 2004) [#4]
Okay, now CountChildren is only returning "1", so I can only get at the first model in the heirarchy. Maybe this is an oddity of how LWConvert does it's thing? The B3D is available at the link below, if anyone can enlighten me.

http://www.optibrain.co.uk/downloads/bot1_legs.B3D


Gabriel(Posted 2004) [#5]
That's why I suggested using FindChild, because then you don't have to recursively trundle through the hierarchy manually. If you really want/need to do it this way, JFK's entry in the code archives will show you the structure of your mesh :

http://www.blitzbasic.com/codearcs/codearcs.php?code=615


gburgess(Posted 2004) [#6]
*blink*

Okay, I'm gonna study that snippet more closely. Oh, wait, I get it. Of course. "Child" only works for one "level", it needs to be called for each part and so on and so on. Okay, I can dig it. As you say, recursive trundling ahoy.

Bloody hell, all I want to do is make it transparent when it's not selected in the editor.


jfk EO-11110(Posted 2004) [#7]
yes, you need to create your collection of recursively working Commands of things like EntityAlpha, EntityFX, EntityColor etc.

Example:

Function EntityAnimColor(m,r,g,b)
 If EntityClass$(m)="Mesh"
  EntityColor m,r,g,b
 Endif
 For i=1 to CountChildren(m)
  ww=GetChild(m,i)
  EntityAnimColor(ww,r,g,b)
 Next
End Function

or

Function EntityAnimAlpha(m,a#)
 If EntityClass$(m)="Mesh"
  EntityAlpha m,a#
 Endif
 For i=1 to CountChildren(m)
  ww=GetChild(m,i)
  EntityAnimAlpha(ww,a#)
 Next
End Function


(The EntityClass check is done because you cannot set Alpha on bones, and children may be bones sometimes)


gburgess(Posted 2004) [#8]
Wow, crikey. Okay, thanks guys. Guess I'd better get my groove on and write a few of these bad boys. Better figure out texturing, I guess that's not gonna be as straightforward either. I guess UU3D copes with it okay, so it'd just be a case of applying the same texture to a bunch of different parts.