Advertisement
Guest User

Untitled

a guest
Jul 25th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.76 KB | None | 0 0
  1. class customshape_edge(bpy.types.Operator):
  2.     bl_idname = _common.get_ops_idname('pose', 'customshape_edge')
  3.     bl_label = "棒"
  4.     bl_options = {'REGISTER', 'UNDO'}
  5.    
  6.     @classmethod
  7.     def poll(cls, context):
  8.         try:
  9.             if not len(context.selected_pose_bones): return False
  10.         except: return False
  11.         return True
  12.    
  13.     def execute(self, context):
  14.         arm = context.active_object.data
  15.        
  16.         for pose_bone in context.selected_pose_bones:
  17.             name = context.active_object.name + ":" + pose_bone.name + ":CustomShape"
  18.             me = context.blend_data.meshes.new(name)
  19.             ob = context.blend_data.objects.new(name, me)
  20.             me.from_pydata([(0, 0, 0), (0, 1, 0)], [(0, 1)], [])
  21.             pose_bone.custom_shape = ob
  22.            
  23.             arm.bones[pose_bone.name].show_wire = True
  24.        
  25.         return {'FINISHED'}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement