Thanks for your reply Paul.
Did you mean getAliasList instead of getAliasAttr, right? With this option
I get a list with the aliases, but the names of the attributes are included
too:
import maya.OpenMaya as om
list = om.MSelectionList()
node = om.MObject()
list.add("blendShape1")
list.getDependNode(0, node)
dgNode = om.MFnDependencyNode(node)
aliasList = []
dgNode.getAliasList(aliasList)
# Result: [u'pSphere2', u'weight[0]', u'pSphere3', u'weight[1]'] #
I don't understand the MSelectionList combo, could you explain it please?
Thank you Paul.
On Wed, Aug 29, 2012 at 3:29 AM, Paul Molodowitch <[email protected]>wrote:
> If I recall correctly, I just had to do a getAliasAttr / MSelectionList
> combo, as I suggested. Not sure when you would want to use findAlias
> (since it seems unreliable)...
>
> - Paul
>
>
> On Mon, Aug 27, 2012 at 1:29 PM, Miguel González Viñé
> <[email protected]>wrote:
>
>> Did you solve this or anyone knows how to get the MPlug from the alias
>> name in a MFnDependencyNode?
>> Also I've tried with getAliasAttr but I don't know what to do with the
>> returned MObject.
>>
>> Thank you!
>>
>>
>> On Mon, Jan 24, 2011 at 4:14 AM, Paul Molodowitch <[email protected]>wrote:
>>
>>> Hey all - so, I have an alias which refers to an multi-compound
>>> attribute:
>>>
>>> import maya.cmds as cmds
>>>
>>> remap = cmds.createNode('remapValue')
>>>
>>> cmds.aliasAttr ('alfred', remap + '.value[0].value_Position')
>>>
>>> print cmds.aliasAttr(remap, q=1)
>>>
>>>
>>> So far so good. Now, using the api, and starting with just the alias
>>> name, I want to be able to get an MPlug for the plug it points to.
>>> Unfortunately, I haven't found a way to do this. The obvious way - using
>>> MFnDependencyNode.findAlias - only gives me a plug for the base attribute,
>>> not the specific index / child the alias actually refers to:
>>>
>>>
>>> import maya.OpenMaya as om
>>>
>>>
>>> sel = om.MSelectionList()
>>>
>>> sel.add(remap)
>>>
>>>
>>> obj = om.MObject()
>>>
>>> sel.getDependNode(0, obj)
>>>
>>> mfn = om.MFnDependencyNode(obj)
>>>
>>>
>>> attr = om.MObject()
>>>
>>> mfn.findAlias('alfred', attr)
>>>
>>> plug = om.MPlug(obj, attr)
>>>
>>>
>>> print plug.partialName(True, True, True, False, True, True)
>>>
>>>
>>>
>>> However, what we end up with is remapValue1.value, not
>>> remapValue1.value[0].value_Position
>>>
>>>
>>> Should I just be using getAliasList, and then feeding the text string
>>> into an MSelectionList? If so, what's the point of findAlias?
>>>
>>>
>>> - Paul
>>>
>>> --
>>> http://groups.google.com/group/python_inside_maya
>>>
>>
>> --
>> view archives: http://groups.google.com/group/python_inside_maya
>> change your subscription settings:
>> http://groups.google.com/group/python_inside_maya/subscribe
>>
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
>
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe