-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
65 lines (47 loc) · 1.65 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
bl_info = {
"name": "Rig Remover",
"author": "alisahanyalcin",
"version": (1, 0),
"blender": (3, 4, 1),
"location": "Scene Properties > Rig Remover > Remover Button",
"description": "Remove rig from your model",
"warning": "",
"doc_url": "https://github.com/alisahanyalcin/Blender-Rig-Remover",
"category": "Rig Remover",
}
import bpy
def main(context):
bpy.ops.object.posemode_toggle()
opsObj = bpy.ops.pose
opsObj.select_all(action="SELECT")
bpy.ops.pose.user_transforms_clear()
bpy.ops.object.posemode_toggle()
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)
bpy.ops.object.select_by_type(type='ARMATURE')
bpy.ops.object.delete(use_global=False, confirm=False)
class Remover(bpy.types.Operator):
bl_idname = "object.remover"
bl_label = "Rig Remover"
def execute(self, context):
main(context)
return {'FINISHED'}
class DrawPanel(bpy.types.Panel):
bl_label = "Rig Remover"
bl_idname = "Rig_Remover_Panel"
bl_space_type = 'PROPERTIES'
bl_region_type = 'WINDOW'
bl_context = "scene"
def draw(self, context):
layout = self.layout
btnRow = layout.row()
btnRow.scale_y = 1.0
btnRow.operator("object.remover", text="Remove", icon='ARMATURE_DATA')
def register():
bpy.utils.register_class(Remover)
bpy.utils.register_class(DrawPanel)
def unregister():
bpy.utils.unregister_class(Remover)
bpy.utils.unregister_class(DrawPanel)
if __name__ == "__main__":
register()