CybranM

Hide all children of selected items

Sep 4th, 2021
645
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. import bpy
  2.  
  3. def recursiveSelect(parent):
  4.     for child in parent.children:
  5.        
  6.         child.select_set(True)
  7.  
  8.         if child.children:
  9.             recursiveSelect(child)
  10.  
  11. initialSelection = bpy.context.selected_objects
  12.  
  13. for obj in initialSelection:
  14.     recursiveSelect(obj)
  15.  
  16. for obj in bpy.context.selected_objects:
  17.     obj.hide_set(True)
Advertisement
Add Comment
Please, Sign In to add comment