Jump to content

if in list (vex)


gerardocastellanos

Recommended Posts

I stored different index (integer number) in my primitives, and I want to create an array detail attribute with all my different index.

sometimes my geometry could has 4 different index, for example (3,6,7,2), but in another case it could has 6 or 8 different numbers.

my idea is store in a detail attribute that list of numbers (index)

 

I create an primitive wrangle with this:


 

int indexList[] = detailattrib(0, "indexList",0,1);

if (!find(indexList, @index)){
push(indexList, (int)@index);

setdetailattrib(0, "indexList", indexList);
}

 

but it does not work as I expect.

what I am doing wrong?

 

thanks

Edited by gerardocastellanos
Link to comment
Share on other sites

as I mentioned if returned index by find() is negative it's not found

your test simply tests if it's 0, which is actually still a valid index

 

so you want to do :

if (find(indexList, @index) < 0)
Edited by anim
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...