Skip to content

Instantly share code, notes, and snippets.

@iCyP
Created March 15, 2014 06:54
Show Gist options
  • Save iCyP/9562767 to your computer and use it in GitHub Desktop.
Save iCyP/9562767 to your computer and use it in GitHub Desktop.
bl_info = {
"name": " Select children",
"author": "icyp",
"version": (0, 1),
"blender": (2, 69, 0),
"location": "View3D",
"description": "select Children",
"warning": "",
"wiki_url": "",
"tracker_url": "",
"category": "3D VIEW"
}
import bpy
from bpy.types import Operator
def select_children_recursion(obj):
if obj.children :
for child in obj.children:
child.select = True
select_children_recursion(child)
def select_children(self, context):
for obj in context.selected_objects:
select_children_recursion(obj)
class OBJECT_OT_select_children(Operator):
bl_idname = "obj.select_child"
bl_label = "select Children"
bl_options = {'REGISTER', 'UNDO'}
def execute(self, context):
select_children(self, context)
return {'FINISHED'}
class select_children_button(bpy.types.Panel):
bl_label = 'Select children'
bl_space_type = 'VIEW_3D'
bl_region_type = 'TOOLS'
bl_context = ''
def draw(self, context):
col = self.layout.column(align=True)
col.operator(OBJECT_OT_select_children.bl_idname)
# Registration
def register():
bpy.utils.register_class(OBJECT_OT_select_children)
bpy.utils.register_class(select_children_button)
def unregister():
bpy.utils.unregister_class(OBJECT_OT_select_children)
bpy.utils.unregister_class(select_children_button)
if __name__ == "__main__":
register()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment