Thanks for the reply.

My issue was getting the gradient control to appear in the attribute editor 
though - like it appears in the "Profile Curve" section in the attribute 
editor for the polySplitRing object.

Has anyone managed to do this? In the gradientControl docs it mentions a 
mel script AEaddRampControl, but I couldn't seem to get it to work.

On Thursday, 6 December 2012 10:58:11 UTC-8, Justin Israel wrote:
>
> There is a link 
> here<http://www.creativecrash.com/forums/mel/topics/gradientcontrol-example> 
> that 
> goes into the details of how gradientControl apparently needs some specfic 
> arrangements of properties.
> Here is a python equivalent based on the MEL example of the graph:
>
> objName = cmds.polySphere()[0]
> attrib = "graph"
> objAttrib = '.'.join([objName, attrib])
>
> cmds.addAttr(objName, longName=attrib, 
>                 attributeType="compound", multi=True, 
>                 numberOfChildren=3)
> cmds.addAttr(objName, shortName='%sX' % attrib, 
>                 attributeType='float', parent=attrib)
> cmds.addAttr(objName, shortName='%sY' % attrib, 
>                 attributeType='float', parent=attrib)
> cmds.addAttr(objName, shortName='%sInterp' % attrib, 
>                 attributeType='enum', enumName="Linear:Spline", 
>                 parent=attrib)
>
> # Now create your own window with a gradientControl
> cmds.window(title='Gradient Control For Attribute')
> cmds.columnLayout()
> # this needs to come after the columnLayout (the maya python example has 
> an error)
> cmds.gradientControl(at=objAttrib)
> cmds.showWindow()
>
> What this gets you is a "table" looking attribute on your node, but in 
> your window you have the graph control. The part about the AE templates is 
> for your custom node, to tell it how to represent it's attributes in the 
> Attribute Editor.
>
>
>
> On Wednesday, December 5, 2012 12:47:09 PM UTC-8, Henry van der Beek wrote:
>>
>> Hi,
>>
>>
>> I want to create a gradient attribute on an existing node. I've seen code 
>> how to do this in MPxNode in a plugin, I'm wondering if it's possible to do 
>> this dynamically.
>>
>>
>> This code is in the docs:
>>
>> import maya.cmds as cmds
>>
>> cmds.window( title='Gradient Control For Attribute' )
>>
>> objName = cmds.createNode('polySplitRing')
>>
>> cmds.columnLayout()
>>
>> cmds.gradientControl( at='%s.profileCurve' % objName )
>>
>> cmds.showWindow()
>>
>>
>> I'm not sure how to actually create the attribute (profileCurve in this 
>> example) which gets controlled by the gradient control.
>>
>>
>> Thanks,
>>
>>
>> Henry
>>
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to