Wednesday, 12 December 2012

More MetaData goodness

I've just been adding to the MetaClass addAttr() call such that it now supports 2 important new features:
Firstly I've wrapped it so you can pass in any of the standard cmds.addAttr keywords which means you can set min, max values etc whilst adding, something that's been requested a few times now.
I've also added double3/float3 support to the call so in one go you can do this:

self.addAttr(attr='attrName',type='double3',value=((subAttr1,subAttr2,subAttr3),(value1,value2,value3)),hidden=False, min=0,max=10)

Which will add a new compound double3 attribute 'attrName' with chuild attributes subAttr1 2,3, set their values to value1,2,3. It'll also push the min and max to these subAttrs and set the whole lot keyable and exposed to the channel box :)

Still thinking if there's maybe a neater way to pass the value data but we'll see. It's all pretty well documented in the code anyway.



1 comment:

  1. Ok, so maybe there's a better way, just modified it so that you only need to pass in attr, I then add X,Y,Z to that and create the child attrs from that instead. Means that value is just that, (1.0,2.2,3.3) a tuple to set, if none is passed the values are left at default.