Global Variables and ICE

Discussions about SOFTIMAGEs© Interactive Creative Environment©
Post Reply
User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada
Contact:

Global Variables and ICE

Post by claudevervoort » 04 Feb 2010, 03:27

Hi all!

I would like to do a little counter to avoid doing geometry queries (as in give me all the points in the cloud, filter on the condition and get the final array size), so basically increment some counter when a particle is in a given state, and decrement it whenever it dies or goes to another state.

Is there a way to do that? I did create a new parameter on an object in the scene (using anim>create>parameter) and was planning of doing for each particle that meets the condition a simple: get data (obj.counter) -> add ( 1 ) -> set data(obj.counter) -> if ( condition on particle ) -> ICE Tree.

Well it seems I cannot do the connection between the setData and the IF. The IF context is a given point on the cloud, and it seems that the set data scope requires to be the Object (which I imagine means run once per simulation step?). Is it due to the fact that setters on global object are forbidden due the parallel processing (as to prevent race condition?) or is it just me missing something :)

Any help appreciated while I keep digging...

Thanks!

Claude

grahamef
Posts: 281
Joined: 23 Jun 2009, 21:01

Re: Global Variables and ICE

Post by grahamef » 04 Feb 2010, 20:33

The context is basically just the owner of the data: the object itself, or its points, etc. For example, if there's one value for the whole object then you can't set a new value per point which is why you can't plug those nodes together. On the other hand, if the context was per point then you'd have a different value of counter for each particle, which is clearly not what you want either.

However in this case it should be quite simple. Simply get cloudname.stateid (that's not a geo query BTW), filter by the state you want, then use Get Set Size (in the Statistics category) and use its Filtered Size output. Don't forget to do this after all the particles that are going to die or change state this frame have already done so, otherwise the total will not be accurate.

User avatar
claudevervoort
Posts: 89
Joined: 16 Oct 2009, 02:56
Location: Montréal, QC, Canada
Contact:

Re: Global Variables and ICE

Post by claudevervoort » 04 Feb 2010, 23:28

You just cleared up a fundamental point that was blocking my proper understanding of ICE. Thanks a ton!!!

Claude

Post Reply

Who is online

Users browsing this forum: No registered users and 49 guests