[bb] Make EntityAlpha etc. work with animated Meshes by jfk EO-11110 [ 1+ years ago ]

Started by BlitzBot, June 29, 2017, 00:28:39

Previous topic - Next topic

BlitzBot

Title : Make EntityAlpha etc. work with animated Meshes
Author : jfk EO-11110
Posted : 1+ years ago

Description : Ever wondered why EntityAlpha don't works with animated Meshes that have multiple children meshes, or EntityPickmode and so on? The reason why is: you need to execute those Commands on all Children, as well as on the children of the children. To make this a simple task you can use a collection of recursively working Functions, I give you two examples, it should then be easy for you to create a working recursive version for every Entity Manipulation command you need.

Code :
Code (blitzbasic) Select
usage:

EntityAnimColor(mesh,red,green,blue)
or
EntityAnimAlpha(mesh,alpha#)




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

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


Comments : none...