Changeset View
Changeset View
Standalone View
Standalone View
object_boolean_tools.py
| Context not available. | |||||
| for ob in bpy.context.scene.objects: | for ob in bpy.context.scene.objects: | ||||
| if isCanvas(ob): | if isCanvas(ob): | ||||
| for mod in ob.modifiers: | for mod in ob.modifiers: | ||||
| if ("BTool_" in mod.name): | if "BTool_" in mod.name: | ||||
| if (obj.name in mod.name): | if obj.name in mod.name: | ||||
| return ob | return ob | ||||
| Context not available. | |||||
| # Remove it from the Canvas | # Remove it from the Canvas | ||||
| for mod in actObj.modifiers: | for mod in actObj.modifiers: | ||||
| if ("BTool_" in mod.name): | if "BTool_" in mod.name: | ||||
| if (_thisObj_name in mod.name): | if _thisObj_name in mod.name: | ||||
| actObj.modifiers.remove(mod) | actObj.modifiers.remove(mod) | ||||
| if Prop == "THIS": | if Prop == "THIS": | ||||
| Context not available. | |||||
| Canvas = FindCanvas(actObj) | Canvas = FindCanvas(actObj) | ||||
| if Canvas: | if Canvas: | ||||
| for mod in Canvas.modifiers: | for mod in Canvas.modifiers: | ||||
| if ("BTool_" in mod.name): | if "BTool_" in mod.name: | ||||
| if (actObj.name in mod.name): | if actObj.name in mod.name: | ||||
| Canvas.modifiers.remove(mod) | Canvas.modifiers.remove(mod) | ||||
| cyclesVis = actObj.cycles_visibility | cyclesVis = actObj.cycles_visibility | ||||
| actObj.draw_type = "TEXTURED" | actObj.draw_type = "TEXTURED" | ||||
| Context not available. | |||||
| if Prop == "CANVAS": | if Prop == "CANVAS": | ||||
| for mod in actObj.modifiers: | for mod in actObj.modifiers: | ||||
| if ("BTool_" in mod.name): | if "BTool_" in mod.name: | ||||
| RemoveThis(mod.object.name) | RemoveThis(mod.object.name) | ||||
| Context not available. | |||||
| def EnableBrush(context, objList, canvas): | def EnableBrush(context, objList, canvas): | ||||
| for obj in objList: | for obj in objList: | ||||
| for mod in canvas.modifiers: | for mod in canvas.modifiers: | ||||
| if ("BTool_" in mod.name and mod.object.name == obj): | if "BTool_" in mod.name and mod.object.name == obj: | ||||
| if (mod.show_viewport): | if mod.show_viewport: | ||||
| mod.show_viewport = False | mod.show_viewport = False | ||||
| mod.show_render = False | mod.show_render = False | ||||
| else: | else: | ||||
| Context not available. | |||||
| if obj != bpy.context.active_object: | if obj != bpy.context.active_object: | ||||
| if isCanvas(obj): | if isCanvas(obj): | ||||
| for mod in obj.modifiers: | for mod in obj.modifiers: | ||||
| if ("BTool_" in mod.name): | if "BTool_" in mod.name: | ||||
| if mod.object == bpy.context.active_object: | if mod.object == bpy.context.active_object: | ||||
| canvas = obj | canvas = obj | ||||
| for mod in canvas.modifiers: | for mod in canvas.modifiers: | ||||
| if ("BTool_" in mod.name): | if "BTool_" in mod.name: | ||||
| if mod.object == bpy.context.active_object: | if mod.object == bpy.context.active_object: | ||||
| if set == "None": | if set == "None": | ||||
| if (mod.show_viewport): | if mod.show_viewport: | ||||
| mod.show_viewport = False | mod.show_viewport = False | ||||
| mod.show_render = False | mod.show_render = False | ||||
| else: | else: | ||||
| mod.show_viewport = True | mod.show_viewport = True | ||||
| mod.show_render = True | mod.show_render = True | ||||
| else: | else: | ||||
| if (set == "True"): | if set == "True": | ||||
| mod.show_viewport = True | mod.show_viewport = True | ||||
| else: | else: | ||||
| mod.show_viewport = False | mod.show_viewport = False | ||||
| Context not available. | |||||
| for selObj in list: | for selObj in list: | ||||
| if isCanvas(selObj) and selObj == context.active_object: | if isCanvas(selObj) and selObj == context.active_object: | ||||
| for mod in selObj.modifiers: | for mod in selObj.modifiers: | ||||
| if ("BTool_" in mod.name): | if "BTool_" in mod.name: | ||||
| objDeleteList.append(mod.object) | objDeleteList.append(mod.object) | ||||
| try: | try: | ||||
| bpy.ops.object.modifier_apply(modifier=mod.name) | bpy.ops.object.modifier_apply(modifier=mod.name) | ||||
| Context not available. | |||||
| for obj in context.scene.objects: | for obj in context.scene.objects: | ||||
| if isCanvas(obj): | if isCanvas(obj): | ||||
| for mod in obj.modifiers: | for mod in obj.modifiers: | ||||
| if ("BTool_" + brush.name in mod.name): | if "BTool_" + brush.name in mod.name: | ||||
| """ | """ | ||||
| # EXPERIMENTAL | # EXPERIMENTAL | ||||
| if isMakeVertexGroup(): | if isMakeVertexGroup(): | ||||
| Context not available. | |||||
| if isCanvas(_obj): | if isCanvas(_obj): | ||||
| BTRoot = False | BTRoot = False | ||||
| for mod in _obj.modifiers: | for mod in _obj.modifiers: | ||||
| if ("BTool_" in mod.name): | if "BTool_" in mod.name: | ||||
| BTRoot = True | BTRoot = True | ||||
| if mod.object is None: | if mod.object is None: | ||||
| _obj.modifiers.remove(mod) | _obj.modifiers.remove(mod) | ||||
| Context not available. | |||||
| def execute(self, context): | def execute(self, context): | ||||
| for ob in bpy.context.scene.objects: | for ob in bpy.context.scene.objects: | ||||
| if (ob.name == self.obj): | if ob.name == self.obj: | ||||
| bpy.ops.object.select_all(action='TOGGLE') | bpy.ops.object.select_all(action='TOGGLE') | ||||
| bpy.ops.object.select_all(action='DESELECT') | bpy.ops.object.select_all(action='DESELECT') | ||||
| bpy.context.scene.objects.active = ob | bpy.context.scene.objects.active = ob | ||||
| Context not available. | |||||
| return context.active_object is not None | return context.active_object is not None | ||||
| def execute(self, context): | def execute(self, context): | ||||
| if (self.direction == "UP"): | if self.direction == "UP": | ||||
| bpy.ops.object.modifier_move_up(modifier=self.modif) | bpy.ops.object.modifier_move_up(modifier=self.modif) | ||||
| if (self.direction == "DOWN"): | if self.direction == "DOWN": | ||||
| bpy.ops.object.modifier_move_down(modifier=self.modif) | bpy.ops.object.modifier_move_down(modifier=self.modif) | ||||
| return {'FINISHED'} | return {'FINISHED'} | ||||
| Context not available. | |||||
| layout.operator(BTool_Slice.bl_idname, icon="ROTATECENTER") | layout.operator(BTool_Slice.bl_idname, icon="ROTATECENTER") | ||||
| layout.separator() | layout.separator() | ||||
| if (isCanvas(context.active_object)): | if isCanvas(context.active_object): | ||||
| layout.separator() | layout.separator() | ||||
| layout.operator(BTool_AllBrushToMesh.bl_idname, icon="MOD_LATTICE", text="Apply All") | layout.operator(BTool_AllBrushToMesh.bl_idname, icon="MOD_LATTICE", text="Apply All") | ||||
| Rem = layout.operator(BTool_Remove.bl_idname, icon="CANCEL", text="Remove All") | Rem = layout.operator(BTool_Remove.bl_idname, icon="CANCEL", text="Remove All") | ||||
| Rem.thisObj = "" | Rem.thisObj = "" | ||||
| Rem.Prop = "CANVAS" | Rem.Prop = "CANVAS" | ||||
| if (isBrush(context.active_object)): | if isBrush(context.active_object): | ||||
| layout.separator() | layout.separator() | ||||
| layout.operator(BTool_BrushToMesh.bl_idname, icon="MOD_LATTICE", text="Apply Brush") | layout.operator(BTool_BrushToMesh.bl_idname, icon="MOD_LATTICE", text="Apply Brush") | ||||
| Rem = layout.operator(BTool_Remove.bl_idname, icon="CANCEL", text="Remove Brush") | Rem = layout.operator(BTool_Remove.bl_idname, icon="CANCEL", text="Remove Brush") | ||||
| Context not available. | |||||
| result = False | result = False | ||||
| actObj = bpy.context.active_object | actObj = bpy.context.active_object | ||||
| if (isCanvas(actObj) or isBrush(actObj) or isPolyBrush(actObj)): | if isCanvas(actObj) or isBrush(actObj) or isPolyBrush(actObj): | ||||
| result = True | result = True | ||||
| return result | return result | ||||
| Context not available. | |||||
| # BRUSH ------------------------------------------------------ | # BRUSH ------------------------------------------------------ | ||||
| if isBrush(actObj): | if isBrush(actObj): | ||||
| if (actObj["BoolToolBrush"] == "UNION"): | if actObj["BoolToolBrush"] == "UNION": | ||||
| icon = "ROTATECOLLECTION" | icon = "ROTATECOLLECTION" | ||||
| if (actObj["BoolToolBrush"] == "DIFFERENCE"): | if actObj["BoolToolBrush"] == "DIFFERENCE": | ||||
| icon = "ROTATECENTER" | icon = "ROTATECENTER" | ||||
| if (actObj["BoolToolBrush"] == "INTERSECT"): | if actObj["BoolToolBrush"] == "INTERSECT": | ||||
| icon = "ROTACTIVE" | icon = "ROTACTIVE" | ||||
| if (actObj["BoolToolBrush"] == "SLICE"): | if actObj["BoolToolBrush"] == "SLICE": | ||||
| icon = "ROTATECENTER" | icon = "ROTATECENTER" | ||||
| row = layout.row(True) | row = layout.row(True) | ||||
| Context not available. | |||||
| container = self.layout.box() | container = self.layout.box() | ||||
| row = container.row(True) | row = container.row(True) | ||||
| icon = "" | icon = "" | ||||
| if ("BTool_" in mod.name): | if "BTool_" in mod.name: | ||||
| if (mod.operation == "UNION"): | if mod.operation == "UNION": | ||||
| icon = "ROTATECOLLECTION" | icon = "ROTATECOLLECTION" | ||||
| if (mod.operation == "DIFFERENCE"): | if mod.operation == "DIFFERENCE": | ||||
| icon = "ROTATECENTER" | icon = "ROTATECENTER" | ||||
| if (mod.operation == "INTERSECT"): | if mod.operation == "INTERSECT": | ||||
| icon = "ROTACTIVE" | icon = "ROTACTIVE" | ||||
| if (mod.operation == "SLICE"): | if mod.operation == "SLICE": | ||||
| icon = "ROTATECENTER" | icon = "ROTATECENTER" | ||||
| objSelect = row.operator("btool.find_brush", text=mod.object.name, icon=icon, emboss=False) | objSelect = row.operator("btool.find_brush", text=mod.object.name, icon=icon, emboss=False) | ||||
| objSelect.obj = mod.object.name | objSelect.obj = mod.object.name | ||||
| EnableIcon = "RESTRICT_VIEW_ON" | EnableIcon = "RESTRICT_VIEW_ON" | ||||
| if (mod.show_viewport): | if mod.show_viewport: | ||||
| EnableIcon = "RESTRICT_VIEW_OFF" | EnableIcon = "RESTRICT_VIEW_OFF" | ||||
| Enable = row.operator(BTool_EnableBrush.bl_idname, icon=EnableIcon, emboss=False) | Enable = row.operator(BTool_EnableBrush.bl_idname, icon=EnableIcon, emboss=False) | ||||
| Enable.thisObj = mod.object.name | Enable.thisObj = mod.object.name | ||||
| Context not available. | |||||