Removing a modifier from all selected objects using Blender Python API

Assigning and removing modifiers in Blender is done separately for each object. However, if we need to, for example, remove a modifier from many objects in a complex scene, removing them from each object individually will be long and inefficient. Using the Blender Python API, we can write a simple script that will remove modifiers from all selected objects in the scene.

First, we need to get the type of modifier that we want to remove from the objects.

For the currently active object in the scene, the type of its active modifier can be obtained as follows:

Or by its number in the list of modifiers (remember that the list order starts with zero):

Loop through all selected objects in the scene:

We can get a list of all modifiers for an object:

But, we only want to remove modifiers of one type, so add a filter to the list.

Now we can remove modifiers from the object based on the resulting list.

All together:

Note that since we are removing modifiers by type and list, not by order number as we could do, even if multiple modifiers of the same type are applied to one object, all of them will be removed.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Newest
Oldest Most Voted
Inline Feedbacks
View all comments