2
$\begingroup$

Let's say I have LEGO model in Blender containing 1000 bricks (objects) and every single one has its own modifiers - is there a way how to apply all of them (well, I mean those objects that are selected) at once, so that I would not need to go manually all of those 1000 objects one by one?

Possibly rather in a form of simple addon instead of script so one could just click a single button everytime he needs?

$\endgroup$
1
  • $\begingroup$ There isn't an addon specifically for this (while you could save the script as your own one for faster running). As far as I know, Ctrl+A > Visual Geometry to Mesh applies all modifiers but hidden ones on selected objects $\endgroup$
    – Mr Zak
    Oct 29, 2020 at 19:51

1 Answer 1

6
$\begingroup$

Nearly this answer.

For all modifiers you can run this script that will apply them all:

import bpy

for ob in bpy.context.selected_objects:
    bpy.context.view_layer.objects.active = ob
    for name in [m.name for m in ob.modifiers]:
        bpy.ops.object.modifier_apply( modifier = name )

To run the script:

open a text editor, create a new text, paste the code above, select the wanted objects, and use the button indicated in the picture below:

enter image description here

If you want to apply modifier that are visible in viewport only, use this:

import bpy

for ob in bpy.context.selected_objects:
    bpy.context.view_layer.objects.active = ob
    for name in [m.name for m in ob.modifiers]:
        modifier = ob.modifiers[name]
        if modifier.show_viewport:
            bpy.ops.object.modifier_apply( modifier = name )
$\endgroup$
10
  • $\begingroup$ Sorry to ask but how to run a script in Blender, please? $\endgroup$
    – qraqatit
    Oct 29, 2020 at 19:11
  • $\begingroup$ Edited for some explaination. If not clear ask here $\endgroup$
    – lemon
    Oct 29, 2020 at 19:16
  • $\begingroup$ great - it works, but I would like to apply only ALLOWED modifiers, not all of them one object can have (you know those, that are there, but are inactive), maybe even remove those that are inactive (if possible)? $\endgroup$
    – qraqatit
    Oct 29, 2020 at 19:24
  • $\begingroup$ Inactive in viewport, render, both? $\endgroup$
    – lemon
    Oct 29, 2020 at 19:34
  • $\begingroup$ I do not render in Blender, I am using Blender just as export tool to FBX for UE4, so probably viewport only? :-) Also I am thinking about making it into extremely simlpe addon, like single button, so I would just click it without going thru text Editor, Open Script, press Apply with every other model I would have - is it possible? $\endgroup$
    – qraqatit
    Oct 29, 2020 at 19:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .