Created
January 7, 2016 20:29
-
-
Save zeffii/82cc80f054b137d363d3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
def execute(self, context): | |
target_obj = context.active_object | |
tool_objs = [o for o in context.selected_objects if o != target_obj] | |
BOOL = 'BOOLEAN' | |
# first add them. | |
for obj in tool_objs: | |
bool_mod = target_obj.modifiers.new(name='difference_' + obj.name, type=BOOL) | |
bool_mod.operation = 'DIFFERENCE' | |
bool_mod.object = obj | |
# then apply them individually. | |
for modifier in target_obj.modifiers: | |
bpy.ops.object.modifier_apply(modifier=modifier.name) | |
execute(None, bpy.context) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment