How to find constrained parent of an object in mayapy standalone.

1,780 views
Skip to first unread message

Sudeepth Patinjarayil

unread,
Jun 13, 2012, 3:27:52 PM6/13/12
to python_in...@googlegroups.com
Hi,

i am not able to get parent of an object in maya python standalone (mayapy). i used "parent = maya.cmds.parentConstrain ([obj], q=True, tl=True)". when using in standalone i was not able to get the result. but if i paste the same code inside maya script editor i am getting the result. 

please give me some solution for this problem.

Thanks and regards,
Sudeepth Patinjarayil.

Justin Israel

unread,
Jun 13, 2012, 4:15:52 PM6/13/12
to python_in...@googlegroups.com
Does this not work properly for you?

$ mayapy

import maya.standalone
maya.standalone.initialize()
import maya.cmds as cmds
sphere1 = cmds.polySphere()
sphere2 = cmds.polySphere()
cmds.parentConstraint(sphere1, sphere2, maintainOffset=True)
# [u'pSphere2_parentConstraint1']
cmds.parentConstraint(sphere2, q=True, tl=True)
# [u'pSphere1']


What version of maya? Is there something different in your situation than my test?


Sudeepth Patinjarayil

unread,
Jun 14, 2012, 3:35:19 PM6/14/12
to python_in...@googlegroups.com
Hi Justin,

Thank you for your code. But i wrote the same code but i was not getting the result in mayapy. i am using maya 2011 hotfix 3. my script is for getting the parent node(if any) of the scene referenced camera and to get the position of the camera. i got the position but unable to find the parent. But if i paste the same code in maya script editor i am getting the result. i think you understand what i want. 

Thanks and Regards,
Sudeepth Patinjarayi.

Kurian O.S

unread,
Jun 14, 2012, 4:01:10 PM6/14/12
to python_in...@googlegroups.com
If you can show your code snippet then it will be easy for to debug. The issue can be solved using long names. 




--
--:: Kurian ::--

Justin Israel

unread,
Jun 14, 2012, 6:16:46 PM6/14/12
to python_in...@googlegroups.com
My previous test was in maya2012
I just tested it in Maya 2011P09 SP1. Same working results,

I am not sure why you are not getting the same as me. But as Kurian suggested, please post a small snippet that we can use to reproduce your problem.
Reply all
Reply to author
Forward
0 new messages