I am writing an exporter plugin. Before exporting, the existing modifiers should be applied to the objects (like subdivision surface, etc.). However, modifiers like Armature should not get applied.
The old version of the plugin copies the whole scene, applies the modifiers to the objects, and then removes that scene. However, this already produced many issues, e.g. if there occurs an error the copied scene will stay, effectively duplicating all materials and objects.
I already had a look at the to_mesh function. However, that only provides the option to either apply all modifiers or none, which is not what I want.
Is there a different way to apply only a specific set of modifiers without having to copy the object/scene?