Welcome!
On Sun, 24 May 2015 9:10 PM Janos Hunyadi <[email protected]> wrote:
> Works flawlessly! Thank you! :)
>
>
> On Sunday, May 24, 2015 at 6:39:17 AM UTC+2, Justin Israel wrote:
>
>> Does this work for you?
>>
>> # Via the APIimport maya.OpenMaya as api
>>
>> sel = api.MSelectionList()
>> sel.add( 'pPlaneShape1' )
>> obj = api.MDagPath()
>> sel.getDagPath(0, obj )
>>
>> dgNode = api.MFnDagNode(obj)
>> aliasList = dgNode.findPlug( "worldMesh" )
>> worldP = aliasList[0]print worldP.name()
>>
>> mfDgN = api.MFnDagNode(worldP.node())print mfDgN.fullPathName()
>>
>> destPlugs = api.MPlugArray()
>> worldP.connectedTo(destPlugs, False, True)
>> destPlug = destPlugs[0]
>> mfDgN.setObject(destPlug.node())print mfDgN.fullPathName()
>> # Via cmdsimport maya.cmds as
>> cmdscmds.ls(cmds.listConnections("pPlaneShape1.worldMesh[0]", sh=True),
>> l=True)
>>
>>
>>
>> On Sat, May 23, 2015 at 7:21 PM Janos Hunyadi <[email protected]> wrote:
>>
>>> Basically yes. I only need the first connected (logical index) one.
>>>
>>>
>>> On Friday, May 22, 2015 at 11:49:22 PM UTC+2, Justin Israel wrote:
>>>
>>>> Are you trying to determine the dagpath of all objects connected to the
>>>> worldMesh[0] output plug?
>>>>
>>>> On Sat, May 23, 2015 at 12:41 AM Janos Hunyadi <[email protected]>
>>>> wrote:
>>>>
>>>>>
>>>>>
>>>>> Hi guys!
>>>>>
>>>>> I'm trying to find a simple way to find a nodes *DagPath *connected
>>>>> from a mesh* ("worldMesh[0]") output plug.*
>>>>>
>>>>> This is a command so it won't be inside a compute.
>>>>>
>>>>> Here's some python prototype code (*not working*):
>>>>>
>>>>> import maya.OpenMaya as api
>>>>> sel = api.MSelectionList()
>>>>> sel.add( 'pPlaneShape1' )
>>>>> obj = api.MDagPath()
>>>>> sel.getDagPath(0, obj )
>>>>>
>>>>>
>>>>> dgNode = api.MFnDagNode(obj)
>>>>>
>>>>> aliasList = api.MPlug()
>>>>> aliasList = dgNode.findPlug( "worldMesh" )
>>>>>
>>>>> worldP = api.MPlug()
>>>>> worldP = aliasList[0]
>>>>>
>>>>> # The plug is found!
>>>>> print worldP.name()
>>>>>
>>>>>
>>>>> # Ok lets convert it to a dagpath!
>>>>> ob = api.MObject()
>>>>> ob = worldP.asMObject()
>>>>>
>>>>> mfDgN = api.MFnDagNode(worldP.node())
>>>>>
>>>>> pa = api.MDagPath()
>>>>>
>>>>> mfDgN.getPath(pa)
>>>>> print pa.fullPathName()
>>>>>
>>>>> # Nope!
>>>>>
>>>>>
>>>>> Any ideas? :D
>>>>>
>>>>> --
>>>>> 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 [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/python_inside_maya/85465a8e-2517-4fff-b891-24438d8c9522%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/python_inside_maya/85465a8e-2517-4fff-b891-24438d8c9522%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>> For more options, visit https://groups.google.com/d/optout.
>>>>>
>>>> --
>>> 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 [email protected].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/python_inside_maya/9a734e78-fadd-42fa-888c-b52be36929c4%40googlegroups.com
>>> <https://groups.google.com/d/msgid/python_inside_maya/9a734e78-fadd-42fa-888c-b52be36929c4%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/40969e04-455c-4bf4-a2c7-82c1e6862c31%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/40969e04-455c-4bf4-a2c7-82c1e6862c31%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1mpFpeyG21W3rk7uk%3Du9iQwq92YHwD5yH6e5yDZAn_qA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.