Jump to content

Accessing Primitive Attributes in VEX


Recommended Posts

Hi guys

I struggle with this simple thing:

I have a grid piped into an attribute wrangle running over primitives.

In the wrangle I have a single var, delete. I use a for loop to iterate over all primitives and set delete to 1 at random.

In a second for loop I delete the prim, if delete is 1.

At least that's the plan. It doesn't work, because I can't read out the delete value in the if statement.

Even if I just reassign delete to another var, I just get zeros.

 

Would be great if someone could help me out here.

 

var_problem01.jpg

Link to comment
Share on other sites

What exactly are you trying to do? When in primitive mode on the wrangle it already loops over all prims, so right now you are looping over all primitives for every primitive, twice. Also, I think it creates attributes the last thing it does - so you cannot access it until after that wrangle. I think it would work better if you instead made a variable instead of an attribute, but dont quote me on this.

If you just want to delete random primitives do it like this:

if(rand(@primnum) > 0.5)
    removeprim(0, @primnum, 1);

Link to comment
Share on other sites

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...