-
Notifications
You must be signed in to change notification settings - Fork 70
/
fc_preferences.py
126 lines (97 loc) · 3.78 KB
/
fc_preferences.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
import bpy
from bpy.props import *
from bpy.types import AddonPreferences
def get_preferences():
return bpy.context.preferences.addons[__package__].preferences
class FC_AddonPreferences(AddonPreferences):
bl_idname = __package__
keyboard_section : BoolProperty(
name="Keyboard Shortcuts",
description="Keyboard Shortcuts",
default=True
)
color_font_section : BoolProperty(
name="Colors & Fonts",
description="Colors & Fonts",
default=False
)
operator_section : BoolProperty(
name="Operator settings",
description="Operator settings",
default=False
)
osd_text_color : FloatVectorProperty(
name="OSD text color",
description="Color for On Screen Display text",
default=(0.0, 0.5, 1.0, 1.0),
min=0.0,
max=1.0,
size=4,
subtype='COLOR'
)
osd_label_color : FloatVectorProperty(
name="OSD label color",
description="Color for On Screen Display labels",
default=(1.0, 1.5, 1.0, 1.0),
min=0.0,
max=1.0,
size=4,
subtype='COLOR'
)
osd_font_size : IntProperty(
name="OSD font size",
description="Font size of On Screen Display",
default=16,
min=10,
max=24
)
osd_offset_x : IntProperty(
name="OSD Offset X",
description="Offset X-axis On Screen Display",
default=60,
min=0
)
sym_dir_items = [ ("Selected to opposite", "Selected to opposite", "", 0),
("To Selected", "To Selected", "", 1)
]
symmetrize_direction : EnumProperty(items=sym_dir_items,
name="Symmetrize direction",
default="Selected to opposite")
def draw(self, context):
wm = bpy.context.window_manager
layout = self.layout
# Keyboard shortcuts section
layout.prop(self, "keyboard_section", icon='DISCLOSURE_TRI_DOWN' if self.keyboard_section else 'DISCLOSURE_TRI_RIGHT')
if self.keyboard_section:
km_items = wm.keyconfigs.user.keymaps['3D View'].keymap_items
km_item = km_items['object.fc_primitve_mode_op']
row = self.layout.row()
row.label(text=km_item.name)
row.prop(km_item, 'type', text='', full_event=True)
km_item = km_items['object.fc_boolean_mode_op']
row = self.layout.row()
row.label(text=km_item.name)
row.prop(km_item, 'type', text='', full_event=True)
km_mnu_item = km_items['wm.call_menu_pie']
row = self.layout.row()
row.label(text=km_mnu_item.name)
row.prop(km_mnu_item, 'type', text='', full_event=True)
# OSD section
layout.prop(self, "color_font_section", icon='DISCLOSURE_TRI_DOWN' if self.keyboard_section else 'DISCLOSURE_TRI_RIGHT')
if self.color_font_section:
row = self.layout.row()
row.prop(self, "osd_label_color")
row = self.layout.row()
row.prop(self, "osd_text_color")
row = self.layout.row()
row.label(text="OSD font size")
row.prop(self, "osd_font_size", text='')
row = self.layout.row()
row.label(text="OSD Offset X")
row.prop(self, "osd_offset_x", text='')
# Operator settings section
layout.prop(self, "operator_section", icon='DISCLOSURE_TRI_DOWN' if self.operator_section else 'DISCLOSURE_TRI_RIGHT')
if self.operator_section:
row = self.layout.row()
row.label(text="Symmetrize direction")
row.prop(self, "symmetrize_direction", text='')