Selecting all objects with the desired modifier in Blender

To select all objects in Blender with the desired modifier appended using the Blender Python API, we need to loop through all the objects in the scene, check for the presence of the desired modifier and set the object selection flag to True.

Select objects with a modifier by its name

Loop through all the objects in the scene:

If the object meets our condition – it is a mesh, at least one modifier is appended to it, and the desired modifier name is present in the list of modifiers (for example, for the Subdivision Surface modifier):

And select the object:

Full code:

The same in a single line:

Select objects with a modifier by its type

The name of the modifier can be changed by the user, so it is not always correct to use it in search. Instead of a modifier name, it’s better to use its type.

The modifier’s type can be found from its “type” property.

The same code for selecting all objects with the Subdivision Surface modifier but by its type will look like the following:

And the same in a single line:

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Inline Feedbacks
View all comments