Jump to content

Setting array attribute element via attribute wrangle


90okm

Recommended Posts

Hi ! trying to work with vex snippets and faced the problem !

I've created an integer array attribute on primitives and want to fill it with some values in attrib wrangle

but i always get the error message of "Ambiguous call to array index operator ''. Candidates are: 'float vector4[int]', 'float vector2[int]', 'float vector[int]'" 

 

being declared within wrangle node the construction like this

i[]@arr = {};
@arr[0]=@primnum-21;

works fine

 

aarr_created.png

error.png

wrangle_error.hip

Edited by 90okm
Link to comment
Share on other sites

Might be wrong, but if the attribute exists then it's just a statement what type of attribute you are trying to access, otherwise it has to guess what type of attribute is and it seems that it's not very good at it :)

It's not a bad practice to state the type of the attribute every time you want to work with it.

Link to comment
Share on other sites

Here the list of known attributes which does not require type specified. As stated, all others will be assumed as floats. But you need to write type only once, later you may omit type:

v@test = {1, 1, 1};  // Type need to be specified once.
@test = 0;           // Still a vector assigment, will be set as {0, 0, 0}.

You also can declare attributes by writing full type name, in that case value will be used as default:

vector @test = {1, 2, 3};
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...