Untitled

 avatar
unknown
python
a year ago
373 B
6
Indexable
import bpy

# Get a list of all objects in the scene
all_objects = bpy.context.scene.objects

# Get a list of selected objects
selected_objects = [obj for obj in all_objects if obj.select_get()]]

# Go through all objects and remove those that are not selected
for obj in all_objects:
    If obj not in selected_objects:
        bpy.data.objects.remove(obj, do_unlink=True)
Leave a Comment