Untitled

mail@pastecode.io avatar
unknown
python
a month ago
373 B
6
Indexable
Never
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