Created
April 26, 2023 17:11
-
-
Save n1ckfg/7a07538b29b67609d8049d185df54bce to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# https://blenderartists.org/t/how-to-select-bone-child-objects-in-one-click/660780/16 | |
bl_info = { | |
"name": "Select Siblings", | |
"author": "Stanislav Blinov", | |
"version": (1, 0, 0), | |
"blender": (3, 0, 0), | |
"description": "Select siblings in object mode (respecting distinct bone parents)", | |
"category": "Object", | |
} | |
import bpy | |
class OBJECT_OT_select_siblings_deep(bpy.types.Operator): | |
bl_idname = "object.select_siblings_deep" | |
bl_label = "Select Siblings (Deep)" | |
bl_options = {'REGISTER', 'UNDO'} | |
extend = bpy.props.BoolProperty( | |
name="Extend", | |
description="Extend selection instead of deselecting everything first", | |
default=False) | |
@classmethod | |
def poll(cls, context): | |
return context.mode == 'OBJECT' and context.object | |
def execute(self, context): | |
ao = bpy.context.selected_objects[0] | |
for o in bpy.context.selectable_objects: | |
if o.parent == ao.parent: | |
if (o.parent_type != 'BONE') or (o.parent_bone == ao.parent_bone): | |
o.select_set(True) | |
return {'FINISHED'} | |
def register(): | |
bpy.utils.register_class(OBJECT_OT_select_siblings_deep) | |
def unregister(): | |
bpy.utils.unregister_class(OBJECT_OT_select_siblings_deep) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment