-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathui.py
More file actions
105 lines (87 loc) · 3.27 KB
/
ui.py
File metadata and controls
105 lines (87 loc) · 3.27 KB
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
# SPDX-License-Identifier: GPL-3.0-or-later
import bpy
from bpy.types import Panel
from bpy.types import Context
from .utils import is_any_pose_bone_selected
from .bl_logger import logger
class VIEW3D_PT_convert_rotation_mode(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "Animation"
bl_label = "Convert Rotation Mode"
def draw(self, context: Context) -> None:
"""Draw main panel"""
layout = self.layout
scene = context.scene
CRM_Properties = scene.CRM_Properties
col = layout.column(align=True)
col.label(text="Target Rotation Mode")
col.prop(CRM_Properties, "targetRmode", text="")
if not is_any_pose_bone_selected():
col = layout.column(align=True)
col.label(text="Please select a bone!", icon="ERROR")
col = layout.column(align=True)
col.operator("crm.convert_rotation_mode", text="Convert!")
col.prop(CRM_Properties, "jumpInitFrame")
col.prop(CRM_Properties, "preserveLocks")
col.prop(CRM_Properties, "preserveSelection")
class VIEW3D_PT_Rmodes_recommendations(Panel):
bl_space_type = 'VIEW_3D'
bl_region_type = 'UI'
bl_category = "Animation"
bl_parent_id = "VIEW3D_PT_convert_rotation_mode"
bl_label = "Rotation Modes Cheat Sheet"
bl_options = {'DEFAULT_CLOSED'}
def draw(self, context: Context) -> None:
"""Draw recommendations panel"""
layout = self.layout
grid = layout.grid_flow(columns=2, align=True, even_columns=True)
grid.label(text="# Bone/Body Part")
grid.label(text="COG")
grid.label(text="Hip")
grid.label(text="Leg")
grid.label(text="Shoulders")
grid.label(text="Arm Upper")
grid.label(text="Arm Lower")
grid.label(text="Wrist")
grid.label(text="Fingers")
grid.label(text="Spine Base")
grid.label(text="Spine Mid")
grid.label(text="Chest")
grid.label(text="Neck")
grid.label(text="Head")
grid.label(text="# Rotation Mode")
grid.label(text="ZXY")
grid.label(text="YZX")
grid.label(text="ZXY")
grid.label(text="YZX")
grid.label(text="YXZ")
grid.label(text="ZYX (or YZX)")
grid.label(text="ZYX (or YZX)")
grid.label(text="YZX")
grid.label(text="ZXY")
grid.label(text="YZX")
grid.label(text="ZXY")
grid.label(text="YXZ")
grid.label(text="YXZ")
panels = [
VIEW3D_PT_convert_rotation_mode,
VIEW3D_PT_Rmodes_recommendations,
]
def update_panel(self, context: Context) -> None:
"""Update tab in which to place the panel"""
try:
# Ensure 'panels' is defined or imported
# from .ui import panels # Import panels from the appropriate module
for panel in panels:
if "bl_rna" in panel.__dict__:
bpy.utils.unregister_class(panel)
for panel in panels:
addon = context.preferences.addons[__package__]
panel.bl_category = addon.preferences.category
bpy.utils.register_class(panel)
except Exception as e:
message = "Updating Panel locations has failed"
logger.error(
"\n[{}]\n{}\n\nError:\n{}".format(__package__, message, e)
)