Persist attribute values

   2093   3   1
User Avatar
Member
2 posts
Joined: Nov. 2014
Offline
Hello,

I am new to Houdini and not grasping how attributes work.

First I created “Add” node to create a point.

Then I have created attributes in “Attribute Create” node called @posx and @frameno (@frameno value is $FF).

I then created a “Point Wrangle” node with the following vex code:

if(@frameno < 100){
@posx = @frameno;
}


The @posx attribute indeed increments, but once @frameno gets past 100, the value returns to zero. What is the method to have these attributes retain their values?

Thank you,
Caesar
User Avatar
Member
387 posts
Joined: Nov. 2008
Offline
@posx is not defined outside the if statement, that mean it's initialized to default value that is usually zero (or random value in some programming language).

use:
float max = 100;
@posx = max-1;
if(@Frame < max){
@posx = @Frame;
}
User Avatar
Member
483 posts
Joined: Dec. 2006
Offline
Maybe a solution, too :-?

Please have a look here, too:

http://vimeo.com/6803463 [vimeo.com]
http://vimeo.com/6803615 [vimeo.com]
http://vimeo.com/6803939 [vimeo.com]

and then
http://vimeo.com/15923855 [vimeo.com]

Attachments:
if_in_expression.hip (31.5 KB)
if_in_expression.jpg (208.7 KB)
if_in_expression-detail-attribute.hip (58.5 KB)

English is not my native language, sorry in advance for any misunderstanding :-)
User Avatar
Member
143 posts
Joined: March 2014
Offline
Thank you gentlemen - I will give it a try when I get home.

~Caesar
  • Quick Links