How to store an array in a Digital Asset?

   2297   2   0
User Avatar
Member
899 posts
Joined: Feb. 2016
Offline
I need to store
[1, 2, 3, 4]
in my digital asset.
So far I'm storing the values in a string parameter ‘1 2 3 4’, but this is very unpractical as I need to do string-int conversion and vice versa every time I need to retrieve or update the array.

Ideally, I should be able to save the array as integer array attribute, but it's not possible with Digital Assets to modify the geometry inside them.

The almost perfect solution is node.cachedUserData(), but I need to save the array across Houdini sessions.
Node.userData() instead let you save only strings (do you know why it won't let you save python objects like the cache version?)

Any suggestion?
User Avatar
Member
203 posts
Joined: July 2015
Offline
IIRC there is a data type parameter you can store stuff like this on. I think the stroke sop makes use of this, too (?).
Manuel Köster - Senior Technical Artist @Remedy Entertainment

https://www.remedygames.com/ [www.remedygames.com]
http://shadesoforange.de/ [shadesoforange.de]
https://twitter.com/ShadesOfOrange_ [twitter.com]
User Avatar
Member
899 posts
Joined: Feb. 2016
Offline
it looks like you can store only geometry in a ‘Data’ param.
Then I don't understand why there is even a ‘Geometry Data’ parm :/


A workaround would be to store in the data parm a dummy geometry with an array attrib. But it's not as flexible, because I would be limited to 1D arrays. Wouldn't be able to store dictionaries or 2d arrays, for example
Edited by Andr - Oct. 3, 2019 07:07:02

Attachments:
dataparm.JPG (172.9 KB)

  • Quick Links