Skip to content

Instantly share code, notes, and snippets.

@openroomxyz
Created April 21, 2020 12:38
Show Gist options
  • Save openroomxyz/c60fb3168ce81f894bab6b57bad036f4 to your computer and use it in GitHub Desktop.
Save openroomxyz/c60fb3168ce81f894bab6b57bad036f4 to your computer and use it in GitHub Desktop.
Blender Python : Does object with name exist?
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