Jump to content

how to hold attribute value / prevent change [SOLVED]


Recommended Posts

Hello,

I'm looking for the best way to prevent an attribute from changing once it has reached a certain value.

I'll have other benefits from this, but for now it's to control the "active" state of some points via an animated object.
I'm setting a group of point with a bounding sphere grouping, then I wrangle i@active = 1 for that group.

but, obviously, when a point is back out of the sphere, it's out of the group and gets a @active = 0 again.

I'm wondering if it's doable in VEX (if active becomes 1 then never change again) or if there's other tricks to do that.

here is a simple hip file where I move the points up when they are in group1, so for this exemple, I would like the point to never come back down if they get moved.

Thank you!

 

I've seen a way to do that in a particle tutorial, where the colours get changed and is then prevent from changing back when outside a box, but I just can't remember, and can't get my hand on that video again : /

OD-F_keepattrib.hipnc

Edited by 6ril
Link to comment
Share on other sites

fantastic ! bravo !

1480187 thanks to you.

 

out of curiosity, if there a way in VEX to prevent future change of an attribute? (if "attrib" becomes 1 then never change again)

 

Link to comment
Share on other sites

Sure, a simple if statement checking for value of 1 will work. You need to get previous geometry as an input, which involves usage of sop solver or for loop. Without it you will cook completely new geometry with fresh attribute. It is not impossible for pure VEX, but not efficient. You could cache animated geometry on disk, and then loop through files to get attribute values, and accumulate them the way you like:

// Point wrangle.

for (int i = 1; i < 35; i++)
{
    string file = sprintf("$HIP/geo/geo%02d.bgeosc", i);
    int active = point(file, "active", @ptnum);
    i@active = max(i@active, active);
}

 

accumulate_group_weird.zip

  • Like 1
Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...