Thanks a lot Justin it really helps.

I don t need it right now but for sure would be nice to seee how you handle the 
case where some object exist and some don't.

For now, let  see if am able to convert that to mel.


Thanks a lot again


Carlos


________________________________
From: Justin Israel <[email protected]>
Sent: December 3, 2015 9:55 PM
To: Python Programming for Autodesk Maya
Cc: [email protected]
Subject: Re: [Maya-Python] Test if multiple object exist

Hi,

Is your goal to just find out if any of the given objects exist? or all of the 
objects exist? To you want be able to handle the case where some exist and some 
dont?

The `ls` command can handle being given a list of names and returning those 
that exist:

if cmds.ls<http://cmds.ls>(["foo", "bar", "baz"]):
    print "at least one exists"


Or if you want to ensure all objects exist:

names = ["foo", "bar", "baz"]
found = cmds.ls<http://cmds.ls>(names)
if len(found) == len(names):
    print "all objects exist"


Justin


On Fri, Dec 4, 2015 at 1:28 PM 
<[email protected]<mailto:[email protected]>> wrote:
Hi all,

Am new to maya swiching from XSI and am learning mel and python for now.
Am trying to check if multiple object are in the scene but it seems that when I 
use "objExists" I can only test if one object exist....
Can anyone help me on this.
The code would go in my mind something like this


if ( `objExists Object1, Object2, ...` )
{

print "All object exist";

} else {

print "Your missing some objects";

}


Thanks in advance!

--
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]<mailto:python_inside_maya%[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/e54bc6c2-7fea-47ee-a3ce-a9e35bb8f568%40googlegroups.com.
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/BY2PR11MB0552CAD7BC2BFAAB0BFACAA6DB0C0%40BY2PR11MB0552.namprd11.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to