Notifications
Clear all

[Closed] Storing user structs in custom attributes

Is this possible?

For example, define a struct like this:


 someStruct
 (name,
 color,
 size
 )

and then a custom attribute definition:

animationCA = attributes "Animation"
version:1
attribID:#(0x3c4200c4, 0x1b322fb5)
(
	parameters main rollout:r_params
	(
		animSegs type:#maxObjectTab tabSizeVariable:true
	)

	rollout r_params "Animation"
	(

	)
)

Then attach the CA to a node.
Then make an instance of the above struct in the listener, by typing:

blah = someStruct name:"Foo" size:13

and then say

$.animSeg = #(blah)

This fails because the type that we are trying to put the blah into doesn't match.


 

is it possible to make a parameter block with a parameter of some type (I don’t know which would work… tried maxObject so far) that can hold this?

Seems like no, but I figured I’d ask.

2 Replies
 eek
 testCa = attributes testAttribs 
 
(
 
parameters testParams
 
(
 
)
 
struct testStruct
(
a,b,c
)
)
 
custattributes.add $.pos.controller testCa
 
$.pos.controller.testAttribs.teststruct

 

something like this?

But then does an instance of that struct get saved in the CA when the max file gets saved? Like, say you want to save an array of testStructs in your file…

Basically, I’m trying to get away from using persistent globals to store nested structs that I’ve built and the helpfile says in “how can I make it better” that CA’s are preferrable to PG’s… but this seems like a hole in them.

Does that make sense?

-b