''' Create a python code for blender that add a new cube everytime the default one is deleted. ''' import bpy def create_cube(scene): bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, location=(0, 0, 0)) def delete_handler(scene): if bpy.context.selected_objects and bpy.context.selected_objects[0].name == "Cube": bpy.app.handlers.scene_update_pre.remove(delete_handler) create_cube(scene) bpy.app.handlers.scene_update_pre.append(delete_handler)