Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class customshape_edge(bpy.types.Operator):
- bl_idname = _common.get_ops_idname('pose', 'customshape_edge')
- bl_label = "棒"
- bl_options = {'REGISTER', 'UNDO'}
- @classmethod
- def poll(cls, context):
- try:
- if not len(context.selected_pose_bones): return False
- except: return False
- return True
- def execute(self, context):
- arm = context.active_object.data
- for pose_bone in context.selected_pose_bones:
- name = context.active_object.name + ":" + pose_bone.name + ":CustomShape"
- me = context.blend_data.meshes.new(name)
- ob = context.blend_data.objects.new(name, me)
- me.from_pydata([(0, 0, 0), (0, 1, 0)], [(0, 1)], [])
- pose_bone.custom_shape = ob
- arm.bones[pose_bone.name].show_wire = True
- return {'FINISHED'}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement