PDA

View Full Version : PYTHON: How to find some object in Outlinear


zasid
02-25-2011, 05:11 PM
Hi,

I have simple/newbie python question :

I have like 3 or maybe 100 objects (spheres,cubes,cones).Is there a way I can query outlinear to find sphere10 for me and do something with it lets say move it in transformX or just rename it simply. I know how to do the last bit but I don't know the first bit.

All I just need to know is how to query the outlinear if something is in there or not.what function I should be using for that.

Thanksalot.

zasid

NaughtyNathan
02-25-2011, 06:23 PM
why do you need to query the outliner? you can just ask if an object exists using the objExists command:
if mc.objExists('sphere10'):
## do something...
but the objExists command doesn't work so well with namespaces so I tend to use the ls command instead, something like:
allSpheres = mc.ls('sphere*', r=1, l=1)
if allSpheres:
## found all my sphere objects.. so do something...
is this any help?
:nathaN

zasid
02-26-2011, 07:39 PM
sorry I think I asked it in a wrong way. but yes this is something that would solve my query. as I all I wanted to know that if an geometry node (such as spehere,box,or anything with a particular name exists in my scene or not.) thanks alot !

CGTalk Moderation
02-26-2011, 07:39 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.