Got it:

skeletonDefinitionNode.poseType = enumAttr.create("poseType", "pt",
OpenMaya.MFnData.kNumeric)
enumAttr.addField('skinPose', 0)
enumAttr.addField('rigPose', 1)
skeletonDefinitionNode.poseData = typedAttr.create("poseListData",
"pld", OpenMaya.MFnData.kString)

:-)

On Oct 29, 6:10 pm, Sune <[email protected]> wrote:
> Hi there,
>
> I would like to add an enum attribute to a custom node I'm creating,
> but I'm really new to open maya. What I want is basicaly the usual
> enum drop down with a few named choices. I'm on Maya 2009 and I have
> access to pymel.
>
> I already have working code for adding a string (stolen and
> hacked :-) ):
>
> typedAttr = OpenMaya.MFnTypedAttribute()
> skeletonDefinitionNode.poseData = typedAttr.create("poseListData",
> "pld", OpenMaya.MFnData.kString)
> skeletonDefinitionNode.addAttribute(skeletonDefinitionNode.poseData)
>
> That would translate into something like this for enums I guess:
>
> enumAttr = OpenMaya.MFnEnumAttribute()
> skeletonDefinitionNode.poseType = enumAttr.create("poseType", "pt",
> OpenMaya.MFnData.kNumeric)
> skeletonDefinitionNode.addAttribute(skeletonDefinitionNode.poseType)
>
> This gives me the enum attribute on the node, but the "list" is
> obviously empty :-)
>
> Any help would be great!
> Sune
--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/python_inside_maya
-~----------~----~----~----~------~----~------~--~---

Reply via email to