LapisSea

Untitled

May 16th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.51 KB | None | 0 0
  1. def getArmature(ctx: Context):
  2.    
  3.     def get(obj: Object):
  4.         if obj is None:
  5.             return None
  6.        
  7.         if obj.type == "ARMATURE":
  8.             return obj
  9.        
  10.         for e in obj.modifiers:
  11.             if isinstance(e, ArmatureModifier) and e.object is not None:
  12.                 return e.object
  13.        
  14.         return get(obj.parent)
  15.    
  16.     for obj in ctx.selected_objects:
  17.         a=get(obj.parent)
  18.         if a is not None:
  19.             return a
  20.    
  21.     return None
Add Comment
Please, Sign In to add comment