Re: [Plib-users] STATES
Brought to you by:
sjbaker
From: Steve B. <sjb...@ai...> - 2004-07-16 09:20:16
|
Manuel Pecero Rodr=EDguez wrote: > Ok, but I need to change the state (I need an state selector for this=20 > object) and if I make it with an ssgEntity * I cannot do it becouse wit= h=20 > the ssgEntity class you cannot acces to the ssgLeaf states without a=20 > casting. isn=B4t it? Ah! OK - I see the cause of your confusion. The ssgLoad function(s) don't generate a single leaf node - they generate= an entire sub-tree of branch nodes with numerous leaf nodes under them. In order to change the states of ALL of those leaf nodes you have to do one of two things. EITHER: 1) After you load the model, traverse the tree structure by testing each node to see whether it's a leaf or a branch (use 'isAKindOf()) If it's a leaf, change it's state. If it's a branch use getNumKids()= and getKid(n) to find all of it's child nodes - and call the tree tra= verser recursively for each of them. 2) You can use a callback function (it's provided in the ssgLoaderOptions= ) that calls your code as the model is being loaded in order that you c= an allocate your own ssgSimpleState nodes instead of the loader doing it= for you. Which of these things to do depends on the context and what other things you may need to change in the model that was loaded. ---------------------------- Steve Baker ------------------------- HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://www.sjbaker.org Projects : http://plib.sf.net http://tuxaqfh.sf.net http://tuxkart.sf.net http://prettypoly.sf.net -----BEGIN GEEK CODE BLOCK----- GCS d-- s:+ a+ C++++$ UL+++$ P--- L++++$ E--- W+++ N o+ K? w--- !O M- V-- PS++ PE- Y-- PGP-- t+ 5 X R+++ tv b++ DI++ D G+ e++ h--(-) r+++ y++++= -----END GEEK CODE BLOCK----- |