Re: [Maya-Python] list connected imageplane shape node

571 views
Skip to first unread message

Justin Israel

unread,
Oct 22, 2012, 3:33:42 PM10/22/12
to python_in...@googlegroups.com
Do you want to be able to get the imagePlane that is connected to a given camera? 

camShape = cmds.listRelatives('camera1', type='camera', fullPath=True)[0]
ip = cmds.listConnections(camShape, type="imagePlane")[0]
cmds.getAttr(ip + ".imageName")

If not, what are you passing as "dagNode"?



On Fri, Oct 19, 2012 at 10:38 AM, San Luthra <sky...@gmail.com> wrote:
I am trying to get the imageplane shape node  so that its attribute "imageName" can be read

so far I have this
    def connectedImgPlanes(self,dagNode):
        print "dagNode ",dagNode ,type(dagNode)
        lc=""
        try:
            lc=cmds.listRelatives(cmds.listRelatives(dagNode)[0])[0]
        except TypeError:
               return ""
        print lc
        atribVal=cmds.getAttr(lc+".imageName")
        return atribVal

the above code works fine if their is only one camera connected to imageplane , but I have more than one camera's imageplane set i get error saying " More than one object matches name: imagePlane1"

I guess this is not the right way to traverse and get the ip shape node please help me out....

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

Jesse Capper

unread,
Oct 22, 2012, 4:55:53 PM10/22/12
to python_in...@googlegroups.com
As an aside, image planes aren't DAG nodes and thus don't have shapes/transforms associated with them. When you select an image plane in the viewport you're actually selecting that image plane's camera.

John Patrick

unread,
Oct 22, 2012, 11:09:40 PM10/22/12
to python_in...@googlegroups.com
Actually in Maya 2013 they have been changed to DAG nodes, just to throw a fun little curveball at ya...




--
John Patrick
404-242-2675
jspa...@gmail.com
http://www.canyourigit.com

san

unread,
Oct 23, 2012, 12:51:50 AM10/23/12
to python_in...@googlegroups.com
well in dagnodes I am passing in a shape node(working in maya 2013).... though you have my answer already if we just pass camera name like front or back...thanks s tonn. 


PS: hey did u talked about __methods__ in the second DVD of python @ CMIvfx coz in first u mentioned you will tlak about them but till the end I didnt hear anything about those !!!

san

unread,
Oct 23, 2012, 12:53:08 AM10/23/12
to python_in...@googlegroups.com
Yea I am on maya 2013 so never bothered about variable name

Justin Israel

unread,
Oct 23, 2012, 11:24:02 AM10/23/12
to python_in...@googlegroups.com
Re: PS
Ya in the first dvd I only show you usage of existing methods (@15min) on the string object. But to teach writing methods would require teaching classes which was too advanced for that 1st intro video.
I get into writing classes and methods right away in the 2nd DVD.

Jesse Capper

unread,
Oct 23, 2012, 2:18:34 PM10/23/12
to python_in...@googlegroups.com
Interesting, I didn't realize that; still on 2012.
Reply all
Reply to author
Forward
0 new messages