How can i select all objects by type using python scripting. I am trying to select all empties in my scene.
I tried using
bpy.ops.object.select_by_type(type='EMPTY') but thats doesn't work.
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
import bpy objects = bpy.context.scene.objects for obj in objects: obj.select = obj.type == "EMPTY"
import bpy objects = bpy.context.scene.objects for obj in objects: obj.select_set(obj.type == "EMPTY")
See this answer for more info.
item='EMPTY' bpy.ops.object.select_all(action='DESELECT') bpy.ops.object.select_by_type(type=item)
item can take any of the following values according to this documentation:
[‘MESH’, ‘CURVE’, ‘SURFACE’, ‘META’, ‘FONT’, ‘ARMATURE’, ‘LATTICE’, ‘EMPTY’, ‘CAMERA’, ‘LAMP’, ‘SPEAKER’]