Notifications
Clear all

[Closed] Multiple custom attributes on multiple objects?

I’ve just started working with custom attributes, and I have a question.

Right now, I have a custom attribute that is instanced across several objects. Now I want to add an additional button to one of the objects. I COULD make a completely new CA, duplicate everything from the original into it, and simply add the new button that I want. But it seems like there should be a more efficient way to do it (especially since the new button uses one of the same parameters that has already been defined).

What is the best way to handle this?

3 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

your goal is not clear for me. If you have a CA that is general for all objects and only one object needs a specific parameter (ui element, etc.) just add new CA to this object.

Here is what you looking for!


delete $Box*

Def = attributes "test"
(
)
boxes = for i in 1 to 2 collect (Box width:10 height:10 length:10 pos:[i*15,0,0])
for b in boxes do 
	( custAttributes.add b newDef )
	
newDef = attributes "test"
(
	rollout defRoll "defRoll"
	(
	button btnTest "test"
	)
)
oldDef = custAttributes.getDef boxes[1] 1
custAttributes.redefine oldDef newDef.source

I didn’t read well yout post, sorry!
Looks like you answered your own question…
you have to delete the instanced CA and create a new one.
you get custAttributes.getDef to get back your attributes definition
but you will have to make the change by yourself