Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2013
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # An easier way to create an object variable.
  2. # By inputting the object's name, you can create
  3. # a variable for it. This can either be a "direct"
  4. # string or an "indirect" string.
  5. # For example:
  6. # cube = objVar("Cube")
  7. # cube = objVar(listObjs()[0])
  8. # Assuming the 0 in the second example points to
  9. # the string "Cube" in your list, they will both
  10. # have the same result.
  11.  
  12. def objVar(listObjSpec):
  13.  for each in range(0,len(bpy.data.objects)):
  14.   if bpy.data.objects[each].name == listObjSpec:
  15.    print("Variable created!")
  16.    return bpy.data.objects[each]
  17.  if listObjSpec not in listObjs():
  18.   print("This failed so hard, what are you trying to do?")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement