Created
April 21, 2020 12:38
-
-
Save openroomxyz/c60fb3168ce81f894bab6b57bad036f4 to your computer and use it in GitHub Desktop.
Blender Python : Does object with name exist?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
def does_object_with_name_exist(name): | |
if name in bpy.data.objects: | |
return True | |
return False | |
if not does_object_with_name_exist("Generated"): | |
bpy.ops.mesh.primitive_cube_add(location=(0, 0, 0)) | |
bpy.context.object.name = "Generated" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment