Feature Request: Apply Modifier without byp.ops
I have a very time intensive script that operates 1000's of boolean Unions.
bpy.ops.object.modifier_apply(modifier='bool 1')
bpy.ops commands have several flaws when scripting, notably slow downs based on # of objects, and incompatibility with threading.
"new_wall.modifier_apply(modifier='bool 1')" type command added would be greatly appreciated.
If curious, I'm making a highly detailed random building/city/world generator, and the booleans adds random windows to the walls.
I apologize if this is the wrong location to post... navigation of blender websites are exceptionally obtuse.
4 Comments
That would be nice, besides perfomance reasons also don't like operators because of the selection management.
I'm pretty sure bpy.data.meshes.new_from_object() does this if you give it the evaluated depsgraph (which I think comes from bpy.context.scene).
* @Josephbburg * I have no idea what you're saying.
From my understanding all the bpy. commands performs scene refresh. Is this not the case? And your link is broken.
* @fibulator777 * I've fixed the link. And no, that's not the case. "Scene refresh" as you call it is a depsgraph update, which is an expensive operation so it doesn't happen in most of the bpy functions. I was wrong, it comes from the viewlayer, not the scene:
Here's the way to use it:
Alternately, you can use
bpy.ops.object.convert(target='MESH', keep_original=False)as a single bpy.ops call, instead of doing it for each modifier.I'm sure there are other ways of doing it, too, but these are the two I have now.