add color swatch attribute

111 views
Skip to first unread message

kevco...@gmail.com

unread,
Oct 17, 2014, 1:50:42 PM10/17/14
to python_in...@googlegroups.com
Okay, So i'm just trying to add a color swatch attribute to a locator. why does this not work? it's basically taken from the pymel docs

import pymel.core as pm

null = pm.spaceLocator()
null.addAttr( longName='Color', usedAsColor=True attributeType='float3' )


Thanks
Kev

Colas Fiszman

unread,
Oct 17, 2014, 6:33:27 PM10/17/14
to python_in...@googlegroups.com
Hi Kev,
You also need to add the child attribute.

import pymel.core as pm

null = pm.spaceLocator()
null.addAttr('rainbow', usedAsColor=True, attributeType='float3' )
null.addAttr('red', attributeType='float', parent='rainbow' )
null.addAttr('green', attributeType='float', parent='rainbow' )
null.addAttr('blue', attributeType='float', parent='rainbow' )

Greets,
Colas



--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/6ebf6dcc-0e03-479b-b018-ce46dd249788%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

kevco...@gmail.com

unread,
Oct 17, 2014, 9:24:02 PM10/17/14
to python_in...@googlegroups.com
ah-HA. Thank you!

Kev

Reply all
Reply to author
Forward
0 new messages