I’ve been looking for ways to remove objects from all scenes at once but haven’t found any so I’ve written a small add-on that takes care of the job. The script can be installed like any other add-on. Once activated it adds a panel (containing one button) to the toolshelf; pressing the button will remove all selected objects from all scenes.
Ideally I’d like the button to appear in the Object Tools panel instead of in its own panel. Also it would be neat to assign a shortcut (for example alt-x or shift-x) to the function; any hints regarding those improvements will be appreciated.
import bpy
bl_info = {
"name": "Delete From All Scenes",
"description": "This will delete an object from all scenes rather than just from the current one.",
"author": "Abel",
"version": (0,1),
"blender": (2, 5, 9),
"api": 40791,
"location": "Object Tools > Delete From All Scenes panel > Delete from all scenes",
"warning": "", # used for warning icon and text in addons panel
"category": "Object"}
## interface ##
class DeleteFromAllScenesPanel(bpy.types.Panel) :
bl_space_type = "VIEW_3D"
bl_region_type = "TOOLS"
bl_context = "objectmode"
bl_label = "Delete From All Scenes"
def draw(self, context) :
TheCol = self.layout.column(align = True)
TheCol.operator("object.delete_from_all_scenes", text = "Delete From All Scenes")
# end interface class
## operator ##
class DeleteFromAllScenes(bpy.types.Operator):
bl_idname = "object.delete_from_all_scenes"
bl_label = "Delete Object From All Scenes"
bl_options = {"UNDO"}
## actual function ##
def invoke(self, context, event):
for i in range (0,len(bpy.context.selected_objects)):
current_object = bpy.context.selected_objects[0]
# unlink object from all scenes
for sce in bpy.data.scenes:
try: sce.objects.unlink(current_object)
except: pass
return {"FINISHED"}
# end invoke
# end operator class
def register():
bpy.utils.register_class(DeleteFromAllScenes)
bpy.utils.register_class(DeleteFromAllScenesPanel)
def unregister():
bpy.utils.register_class(DeleteFromAllScenes)
bpy.utils.register_class(DeleteFromAllScenesPanel)
download link: http://www.everholt.org/abel/delete_from_all_scenes.py