Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # An easier way to create an object variable.
- # By inputting the object's name, you can create
- # a variable for it. This can either be a "direct"
- # string or an "indirect" string.
- # For example:
- # cube = objVar("Cube")
- # cube = objVar(listObjs()[0])
- # Assuming the 0 in the second example points to
- # the string "Cube" in your list, they will both
- # have the same result.
- def objVar(listObjSpec):
- for each in range(0,len(bpy.data.objects)):
- if bpy.data.objects[each].name == listObjSpec:
- print("Variable created!")
- return bpy.data.objects[each]
- if listObjSpec not in listObjs():
- print("This failed so hard, what are you trying to do?")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement