Notifications
Clear all

[Closed] CustomAttributes and instanced objects

Hi,

I’m trying to do a script where I have to put custom attributes onto objects. Problem is: these objects can also be instances but the custom attributes should not get instanced!

Can someone help me, please?

10 Replies

Then you should references, not instances

edit: see posting below

Hi,
you can control that with the “BaseObject:<bool>” argument in the “custattributes.add” command.

 E.g.
custattributes.add $ TestDataCaDef BaseObject:false
 ...will add the Custom attribute only to the selection without affecting its instances. "BaseObject:true" would add an 'instanced' custom attrbute to the selection and all its instances. Changing the value of that CA, would change the value for all instances as well.

Okay, thank you!
I tried that before but then the following doesn’t work anymore:


  paramWire.connect obj.seedPlanter[#disturb_rad] newSphere.baseObject[#radius] "disturb_rad"
  

(obj is the object with custom attribute “disturb_rad” in attributes set “seedPlanter”)


  seed_attributes = attributes "seedPlanter"
  (
  	parameters main
  	(
  	disturb_rad type:#float default:0
  	disturb_bbox type:#node
  	)
  )
  
  

What do I do wrong? :o/

No clue about that, sorry. I have no experience with param wiring…

 eek

Can you show us the warning you get?

The objects did not seem to be wired anymore… but I think I found the bug at another part of my script… sorry! I added the customAttribute over and over again to the object, even if it had it…
Generating a ClassID for the attributes helped me getting rid of this.

Thanks for your help!

48design,
did you figure it out? I’m trying to do a similar thing using a custom attribute “distance” to drive “rectangle width” parameter at the base of my modifier stack. I want the base geometry to be instanced but the attribute to be unique. I’m trying to build a sytem like the one shown here> http://designreform.net/2008/02/21/circle-pattern-wire-parameters/ only I’d like the flexability to have instanced panels to control the whole system rather than copies as shown in the tutorials. By your question, it sounds like you were trying to create an instanced array and then apply the custom attribute with a maxscript after. Is that correct? Any help you can give me would be greatly appreciated.

Hi guapador,

I made it like this:


thing_attrib = attributes "attribThing" attribID:#(0x12345678, 0x12345678)
(
	parameters main
	(
	rad type:#float default:0
	bbox type:#node
	use type:#boolean default:true
	)
)

The attribID is generated by typing genClassID() into the Listener.


custAttributes.add obj thing_attrib BaseObject:false

After that the attribute is unique and is not put onto the object more than once.


newSphere = Sphere radius:20 segs:8
paramWire.connect obj.attribThing[#rad] newSphere.baseObject[#radius] "rad"

I hope that helps! Would be nice to see your script in action after you finished it.

Page 1 / 2