forked from johnzero7/XNALaraMesh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xps_panels.py
140 lines (111 loc) · 4.07 KB
/
xps_panels.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
import bpy
class _XpsPanels():
"""All XPS panel inherit from this."""
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = 'XPS'
bl_context = 'objectmode'
class XPSToolsObjectPanel(_XpsPanels, bpy.types.Panel):
bl_idname = 'XPS_PT_xps_tools_object'
bl_label = 'XPS Tools'
def draw(self, context):
layout = self.layout
col = layout.column()
col.label(text='Import:')
# c = col.column()
r = col.row(align=True)
r1c1 = r.column(align=True)
r1c1.operator("xps_tools.import_model", text='Model', icon='NONE')
r1c2 = r.column(align=True)
r1c2.operator('xps_tools.import_pose', text='Pose')
# col.separator()
col = layout.column()
col.label(text="Export:")
c = col.column()
r = c.row(align=True)
r2c1 = r.column(align=True)
r2c1.operator('xps_tools.export_model', text='Model')
r2c2 = r.column(align=True)
r2c2.operator('xps_tools.export_pose', text='Pose')
class XPSToolsBonesPanel(_XpsPanels, bpy.types.Panel):
bl_idname = 'XPS_PT_xps_tools_bones'
bl_label = 'XPS Bones'
@classmethod
def poll(cls, context):
return bool(
next(
(obj for obj in context.selected_objects if obj.type == 'ARMATURE'),
None))
def draw(self, context):
layout = self.layout
col = layout.column()
# col.separator()
col = layout.column()
col.label(text='Hide Bones:')
c = col.column(align=True)
r = c.row(align=True)
r.operator('xps_tools.bones_hide_by_name', text='Unused')
r.operator('xps_tools.bones_hide_by_vertex_group', text='Vertex Group')
r = c.row(align=True)
r.operator('xps_tools.bones_show_all', text='Show All')
# col.separator()
col = layout.column()
col.label(text='BoneDict:')
c = col.column(align=True)
r = c.row(align=True)
r.operator('xps_tools.bones_dictionary_generate', text='Generate BoneDict')
r = c.row(align=True)
r.operator('xps_tools.bones_dictionary_rename', text='Rename Bones')
r = c.row(align=True)
r.operator('xps_tools.bones_dictionary_restore_name', text='Restore Names')
# col.separator()
col = layout.column()
col.label(text='Rename Bones:')
c = col.column(align=True)
r = c.row(align=True)
r.operator('xps_tools.bones_rename_to_blender', text='XPS to Blender')
r = c.row(align=True)
r.operator('xps_tools.bones_rename_to_xps', text='Blender To XPS')
col = layout.column()
col.label(text='Connect Bones:')
c = col.column(align=True)
r = c.row(align=True)
r.operator(
'xps_tools.bones_connect',
text='Connect All').connectBones = True
r = c.row(align=True)
r.operator(
'xps_tools.bones_connect',
text='Disconnect All').connectBones = False
col.label(text='New Rest Pose:')
c = col.column(align=True)
r = c.row(align=True)
r.operator(
'xps_tools.new_rest_pose',
text='New Rest Pose')
class XPSToolsAnimPanel(_XpsPanels, bpy.types.Panel):
bl_idname = 'XPS_PT_xps_tools_anim'
bl_label = 'XPS Anim'
@classmethod
def poll(cls, context):
return bool(
next(
(obj for obj in context.selected_objects if obj.type == 'ARMATURE'),
None))
def draw(self, context):
layout = self.layout
col = layout.column()
# col.separator()
col = layout.column()
col.label(text='Import:')
c = col.column(align=True)
r = c.row(align=True)
r.operator(
'xps_tools.import_poses_to_keyframes',
text='Poses to Keyframes')
# col.separator()
col = layout.column()
col.label(text='Export:')
c = col.column(align=True)
r = c.row(align=True)
r.operator('xps_tools.export_frames_to_poses', text='Frames to Poses')