Notifications
Clear all

[Closed] Saving array of struct in the parameter block

Hi,

I have a struct containing two properties: value (int) and name (string).

Is there a way to store an array of this structure in the parameter block of a scripted plugin? If not, I would use two arrays (#intTab and #stringTab) and keep them synchronized. But maybe there is another aproach to save an array of own structures?

Thanks in advance,
MrSparkle

7 Replies

Any idea? Managing two arrays seems a little complicated for this task…

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

unfortunately there is no way to store a structure in the param block… if you can use an identifier instead of a string (node handler instead of node name, for example) you can combine the value and the id in point2. the point2 value can be stored in a tab of param block.

if you still need arrays try to use fixed size arrays. it’s much easier to manage them than arrays with variable size.

you could store an xml document as a string in a single #stringtab, Then you can cast the branch back to int when you parse the stored string. I use this to store arrays of arrays for character presets.

What I have going in my rig right now is using multiple instances of a custom attribute as the array. Unfortunately, I really want to change it, I’m pretty sure it’s horribly inefficient. I have to load each instance of the custom attribute as “unique”, so i have like 50 copies of the same custom attribute definition loaded. It works though.

I’ve wanted to try loading the data into big strings, but I was afraid that they might have 255 character limits for some reason. StringTabs don’t have a character limit?

 PEN

String tabs don’t have that limit a I also use XML and store it in stringtabs for this sort of problem.

Another solution is to have a custom Attribute definition that has each of the parameters that need to be stored together. For each group of parameters that you want to store you create the definition and add it to a nodeTransformMonitor and store that NTM in a maxObjectTab in the main parameter block.

Thanks for your replies. I think XML is the way to go, even if it’s not very pretty

Had any success with setdefdata?