#CHECK IF AN OBJECT EXISTS
def Exist(input):
if Application.Dictionary.GetObject ( input, False ) != None:
return True
else:
return False
#TESTS
if Exist("sphere"):
print "The object 'sphere' exists in the scene"
if not Exist("cone"):
print "The object 'cone' doesn't exist in the scene"
Useful trips and tricks, a bit of starting tutorials and lots of little Python scripts for Softimage and, maybe in the future, other 2D and 3D applications
Monday, March 21, 2011
SOFTIMAGE: Starting with IF EXIST
Hi all. We'd like to start this blog with a simple script to check if the given object exists or not. The function returns "True" or "False" depending if it can or can't find the object, so you can check very easily with an IF if what you want is in the scene. VEEEEEEEERY useful, and "A MUST" to have at the top of your scripts.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment