If i have a cube A and sphere B. I apply boolean modifier (difference) to A and use B as cutter. So B is 'linked' to A via boolean modifier but B is not a child of A.
When A is selected , is there a method to select all of its cutters ?
If i have a cube A and sphere B. I apply boolean modifier (difference) to A and use B as cutter. So B is 'linked' to A via boolean modifier but B is not a child of A.
When A is selected , is there a method to select all of its cutters ?
Here's a script that adds an operator to do that in the "Select" menu.
I added 3 checkboxes to specifiy if you want to include hidden (eye icon), disabled (monitor icon) or unselectable objects, since by default they can't be selected if they are in either of these states.
The operator selects everything by default, hidden, selectable or not.
import bpy
class SelectBooleansOperator(bpy.types.Operator):
bl_label = "Select Linked Booleans"
bl_idname = "object.select_linked_booleans"
bl_options = {'REGISTER', 'UNDO'}
extend: bpy.props.BoolProperty(
name="Extend",
default=False,
)
select_hidden: bpy.props.BoolProperty(
name="Select Hidden",
default=True,
)
select_disabled: bpy.props.BoolProperty(
name="Select Disabled",
default=True,
)
select_unselectable: bpy.props.BoolProperty(
name="Select Unselectable",
default=True,
)
@classmethod
def poll(cls, context):
return context.active_object and context.active_object.type == 'MESH'
def execute(self, context):
layout = self.layout
mods = context.active_object.modifiers
for mod in mods:
if mod.type != 'BOOLEAN':
continue
obj = mod.object
# Logic from https://blenderartists.org/t/blender-2-8-python-hide-unhide-objects/1141228/2
if (not obj.hide_viewport and not obj.visible_get()) and self.select_hidden:
# Hidden with the eye icon
obj.hide_set(False)
if obj.hide_viewport:
obj.hide_viewport = False # Toggle to test visibility
if obj.visible_get() and self.select_disabled:
# Hidden with the monitor icon
obj.hide_viewport = False
elif self.select_disabled and self.select_hidden:
# Hidden both ways
obj.hide_viewport = False
obj.hide_set(False)
else:
obj.hide_viewport = True # Toggle back
if obj.hide_select and self.select_unselectable:
obj.hide_select = False
mod.object.select_set(True)
context.active_object.select_set(self.extend)
return {'FINISHED'}
def draw_item(self, context):
self.layout.operator(SelectBooleansOperator.bl_idname)
def register():
bpy.utils.register_class(SelectBooleansOperator)
bpy.types.VIEW3D_MT_select_object.append(draw_item)
def unregister():
bpy.utils.unregister_class(SelectBooleansOperator)
bpy.types.VIEW3D_MT_select_object.remove(draw_item)
if __name__ == "__main__":
register()
How to use :
Note that you would have to re-run the script every time you close and open Blender. If you want it to be persistent, make it into an add-on.
You can also add a shortcut to the operator by right clicking it in the menu.