Jump to content

Writing/reading a detail array from a point VEX


Recommended Posts

Hello!

 

I`m trying to write to a detail attribute which is an array of ints. Here`s what I do:

 

I create the attribute using attribCreate and set an integer of size 10 named myArray and i get this in the spreadsheet:

 

post-13044-0-32917400-1428909408_thumb.j

 

Then in my VEX, I am only able to write to the first entry using the function below:

 

setdetailattrib(geoself(), 'myArray', 8, 'set');

 

I tried many syntaxes:

 

'myArray[2]', 'myArray2', '@myArray[2]' but nothing seems to work.

 

Also found this post which seems to explain how to do it in H14 using setattribtypeinfo() but we are stuck with H13 for now.

https://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&p=172640&sid=e43b886abc29f89722b567acb0e54efa

 

Any help is appreciated!

Thanks!

Link to comment
Share on other sites

Array attributes only got introduced in H14. What you're actually creating is a "tuple attribute" with many components that have to be the same for all geometry elements, whereas an "array attribute" is 1 component of a variable sized array that can differ between each geometry element. In VEX, when you set say a matrix4 value, that actually writes out to a tuple attribute of size 16 (= 4 * 4). I don't think you can use VEX to set attributes with arbitrary number of components. If you need 10, then the hacky way is to use a matrix4, or marshal into a string attribute.

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