1 # SPDX-FileCopyrightText: 2011 Ryan Inch
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 from bpy
.types
import AddonPreferences
7 from bpy
.props
import (
14 from . import qcd_init
16 def update_disable_objects_hotkeys_status(self
, context
):
17 if self
.enable_disable_objects_override
:
18 cm_init
.register_disable_objects_hotkeys()
21 cm_init
.unregister_disable_objects_hotkeys()
23 def update_qcd_status(self
, context
):
25 qcd_init
.register_qcd()
28 qcd_init
.unregister_qcd()
30 def update_qcd_view_hotkeys_status(self
, context
):
31 if self
.enable_qcd_view_hotkeys
:
32 qcd_init
.register_qcd_view_hotkeys()
34 qcd_init
.unregister_qcd_view_hotkeys()
36 def update_qcd_view_edit_mode_hotkeys_status(self
, context
):
37 if self
.enable_qcd_view_edit_mode_hotkeys
:
38 qcd_init
.register_qcd_view_edit_mode_hotkeys()
40 qcd_init
.unregister_qcd_view_edit_mode_hotkeys()
42 def update_qcd_3dview_header_widget_status(self
, context
):
43 if self
.enable_qcd_3dview_header_widget
:
44 qcd_init
.register_qcd_3dview_header_widget()
46 qcd_init
.unregister_qcd_3dview_header_widget()
48 def get_tool_text(self
):
49 if self
.tool_text_override
:
50 return self
["tool_text_color"]
52 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.text
53 self
["tool_text_color"] = color
[0], color
[1], color
[2]
54 return self
["tool_text_color"]
56 def set_tool_text(self
, values
):
57 self
["tool_text_color"] = values
[0], values
[1], values
[2]
60 def get_tool_text_sel(self
):
61 if self
.tool_text_sel_override
:
62 return self
["tool_text_sel_color"]
64 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.text_sel
65 self
["tool_text_sel_color"] = color
[0], color
[1], color
[2]
66 return self
["tool_text_sel_color"]
68 def set_tool_text_sel(self
, values
):
69 self
["tool_text_sel_color"] = values
[0], values
[1], values
[2]
72 def get_tool_inner(self
):
73 if self
.tool_inner_override
:
74 return self
["tool_inner_color"]
76 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.inner
77 self
["tool_inner_color"] = color
[0], color
[1], color
[2], color
[3]
78 return self
["tool_inner_color"]
80 def set_tool_inner(self
, values
):
81 self
["tool_inner_color"] = values
[0], values
[1], values
[2], values
[3]
84 def get_tool_inner_sel(self
):
85 if self
.tool_inner_sel_override
:
86 return self
["tool_inner_sel_color"]
88 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.inner_sel
89 self
["tool_inner_sel_color"] = color
[0], color
[1], color
[2], color
[3]
90 return self
["tool_inner_sel_color"]
92 def set_tool_inner_sel(self
, values
):
93 self
["tool_inner_sel_color"] = values
[0], values
[1], values
[2], values
[3]
96 def get_tool_outline(self
):
97 if self
.tool_outline_override
:
98 return self
["tool_outline_color"]
100 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.outline
101 self
["tool_outline_color"] = color
[0], color
[1], color
[2], color
[3]
102 return self
["tool_outline_color"]
104 def set_tool_outline(self
, values
):
105 self
["tool_outline_color"] = values
[0], values
[1], values
[2], values
[3]
108 def get_menu_back_text(self
):
109 if self
.menu_back_text_override
:
110 return self
["menu_back_text_color"]
112 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.text
113 self
["menu_back_text_color"] = color
[0], color
[1], color
[2]
114 return self
["menu_back_text_color"]
116 def set_menu_back_text(self
, values
):
117 self
["menu_back_text_color"] = values
[0], values
[1], values
[2]
120 def get_menu_back_inner(self
):
121 if self
.menu_back_inner_override
:
122 return self
["menu_back_inner_color"]
124 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.inner
125 self
["menu_back_inner_color"] = color
[0], color
[1], color
[2], color
[3]
126 return self
["menu_back_inner_color"]
128 def set_menu_back_inner(self
, values
):
129 self
["menu_back_inner_color"] = values
[0], values
[1], values
[2], values
[3]
132 def get_menu_back_outline(self
):
133 if self
.menu_back_outline_override
:
134 return self
["menu_back_outline_color"]
136 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.outline
137 self
["menu_back_outline_color"] = color
[0], color
[1], color
[2], color
[3]
138 return self
["menu_back_outline_color"]
140 def set_menu_back_outline(self
, values
):
141 self
["menu_back_outline_color"] = values
[0], values
[1], values
[2], values
[3]
144 def get_tooltip_text(self
):
145 if self
.tooltip_text_override
:
146 return self
["tooltip_text_color"]
148 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.text
149 self
["tooltip_text_color"] = color
[0], color
[1], color
[2]
150 return self
["tooltip_text_color"]
152 def set_tooltip_text(self
, values
):
153 self
["tooltip_text_color"] = values
[0], values
[1], values
[2]
156 def get_tooltip_inner(self
):
157 if self
.tooltip_inner_override
:
158 return self
["tooltip_inner_color"]
160 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.inner
161 self
["tooltip_inner_color"] = color
[0], color
[1], color
[2], color
[3]
162 return self
["tooltip_inner_color"]
164 def set_tooltip_inner(self
, values
):
165 self
["tooltip_inner_color"] = values
[0], values
[1], values
[2], values
[3]
168 def get_tooltip_outline(self
):
169 if self
.tooltip_outline_override
:
170 return self
["tooltip_outline_color"]
172 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.outline
173 self
["tooltip_outline_color"] = color
[0], color
[1], color
[2], color
[3]
174 return self
["tooltip_outline_color"]
176 def set_tooltip_outline(self
, values
):
177 self
["tooltip_outline_color"] = values
[0], values
[1], values
[2], values
[3]
180 class CMPreferences(AddonPreferences
):
181 bl_idname
= __package__
183 # ENABLE DISABLE OBJECTS OVERRIDE
184 enable_disable_objects_override
: BoolProperty(
185 name
="Disable objects instead of Hiding",
187 "Replace the object hiding hotkeys with object disabling hotkeys and add them to the Object->Show/Hide menu.\n"
188 "Disabling objects prevents them from being automatically shown again when collections are unexcluded"
191 update
=update_disable_objects_hotkeys_status
,
195 enable_qcd
: BoolProperty(
197 description
="Enable/Disable QCD System.\nThe Quick Content Display system allows you to specify collections as QCD \"slots\" up to a maximum of 20. You can then interact with them through numerical hotkeys, a popup move widget, and a 3D Viewport header widget",
199 update
=update_qcd_status
,
202 enable_qcd_view_hotkeys
: BoolProperty(
204 description
="Enable/Disable the numerical hotkeys to view QCD slots",
206 update
=update_qcd_view_hotkeys_status
,
209 enable_qcd_view_edit_mode_hotkeys
: BoolProperty(
210 name
="QCD Edit Mode Hotkeys",
211 description
="Enable/Disable the numerical hotkeys to view QCD slots in Edit Mode",
213 update
=update_qcd_view_edit_mode_hotkeys_status
,
216 enable_qcd_3dview_header_widget
: BoolProperty(
217 name
="QCD 3D Viewport Header Widget",
218 description
="Enable/Disable the 3D Viewport header widget. This widget graphically represents the 20 QCD slots and allows you to interact with them through the GUI",
220 update
=update_qcd_3dview_header_widget_status
,
225 tool_text_override
: BoolProperty(
227 description
="Override Theme Text Color",
231 tool_text_sel_override
: BoolProperty(
233 description
="Override Theme Text Selection Color",
237 tool_inner_override
: BoolProperty(
239 description
="Override Theme Inner Color",
243 tool_inner_sel_override
: BoolProperty(
245 description
="Override Theme Inner Selection Color",
249 tool_outline_override
: BoolProperty(
251 description
="Override Theme Outline Color",
255 menu_back_text_override
: BoolProperty(
257 description
="Override Theme Text Color",
261 menu_back_inner_override
: BoolProperty(
263 description
="Override Theme Inner Color",
267 menu_back_outline_override
: BoolProperty(
269 description
="Override Theme Outline Color",
273 tooltip_text_override
: BoolProperty(
275 description
="Override Theme Text Color",
279 tooltip_inner_override
: BoolProperty(
281 description
="Override Theme Inner Color",
285 tooltip_outline_override
: BoolProperty(
287 description
="Override Theme Outline Color",
293 qcd_ogl_widget_tool_text
: FloatVectorProperty(
295 description
="QCD Move Widget Tool Text Color",
296 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.text
,
297 subtype
='COLOR_GAMMA',
304 qcd_ogl_widget_tool_text_sel
: FloatVectorProperty(
306 description
="QCD Move Widget Tool Text Selection Color",
307 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.text_sel
,
308 subtype
='COLOR_GAMMA',
311 get
=get_tool_text_sel
,
312 set=set_tool_text_sel
,
315 qcd_ogl_widget_tool_inner
: FloatVectorProperty(
317 description
="QCD Move Widget Tool Inner Color",
318 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.inner
,
319 subtype
='COLOR_GAMMA',
327 qcd_ogl_widget_tool_inner_sel
: FloatVectorProperty(
329 description
="QCD Move Widget Tool Inner Selection Color",
330 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.inner_sel
,
331 subtype
='COLOR_GAMMA',
335 get
=get_tool_inner_sel
,
336 set=set_tool_inner_sel
,
339 qcd_ogl_widget_tool_outline
: FloatVectorProperty(
341 description
="QCD Move Widget Tool Outline Color",
342 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.outline
,
343 subtype
='COLOR_GAMMA',
347 get
=get_tool_outline
,
348 set=set_tool_outline
,
351 qcd_ogl_widget_menu_back_text
: FloatVectorProperty(
353 description
="QCD Move Widget Menu Back Text Color",
354 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.text
,
355 subtype
='COLOR_GAMMA',
358 get
=get_menu_back_text
,
359 set=set_menu_back_text
,
362 qcd_ogl_widget_menu_back_inner
: FloatVectorProperty(
364 description
="QCD Move Widget Menu Back Inner Color",
365 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.inner
,
366 subtype
='COLOR_GAMMA',
370 get
=get_menu_back_inner
,
371 set=set_menu_back_inner
,
374 qcd_ogl_widget_menu_back_outline
: FloatVectorProperty(
376 description
="QCD Move Widget Menu Back Outline Color",
377 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.outline
,
378 subtype
='COLOR_GAMMA',
382 get
=get_menu_back_outline
,
383 set=set_menu_back_outline
,
386 qcd_ogl_widget_tooltip_text
: FloatVectorProperty(
388 description
="QCD Move Widget Tooltip Text Color",
389 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.text
,
390 subtype
='COLOR_GAMMA',
393 get
=get_tooltip_text
,
394 set=set_tooltip_text
,
397 qcd_ogl_widget_tooltip_inner
: FloatVectorProperty(
399 description
="QCD Move Widget Tooltip Inner Color",
400 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.inner
,
401 subtype
='COLOR_GAMMA',
405 get
=get_tooltip_inner
,
406 set=set_tooltip_inner
,
409 qcd_ogl_widget_tooltip_outline
: FloatVectorProperty(
411 description
="QCD Move Widget Tooltip Outline Color",
412 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.outline
,
413 subtype
='COLOR_GAMMA',
417 get
=get_tooltip_outline
,
418 set=set_tooltip_outline
,
421 # NON ACTIVE ICON ALPHA
422 qcd_ogl_selected_icon_alpha
: FloatProperty(
423 name
="Selected Icon Alpha",
424 description
="Set the 'Selected' icon's alpha value",
430 qcd_ogl_objects_icon_alpha
: FloatProperty(
431 name
="Objects Icon Alpha",
432 description
="Set the 'Objects' icon's alpha value",
438 def draw(self
, context
):
442 box
.row().prop(self
, "enable_disable_objects_override")
443 box
.row().prop(self
, "enable_qcd")
445 if not self
.enable_qcd
:
448 box
.row().prop(self
, "enable_qcd_view_hotkeys")
449 box
.row().prop(self
, "enable_qcd_view_edit_mode_hotkeys")
450 box
.row().prop(self
, "enable_qcd_3dview_header_widget")
452 box
.row().label(text
="QCD Move Widget")
456 tool_box
.row().label(text
="Tool Theme Overrides:")
458 overrides
= tool_box
.split(align
=True)
461 col
= overrides
.column()
462 col
.alignment
= 'RIGHT'
465 override
= col
.row(align
=True)
466 override
.alignment
= 'RIGHT'
467 checkbox
= override
.row(align
=True)
468 checkbox
.alignment
= 'RIGHT'
469 checkbox
.label(text
="Text")
470 checkbox
.prop(self
, "tool_text_override", text
="")
471 color_picker
= override
.row(align
=True)
472 color_picker
.alignment
= 'RIGHT'
473 color_picker
.enabled
= self
.tool_text_override
474 color_picker
.prop(self
, "qcd_ogl_widget_tool_text")
477 override
= col
.row(align
=True)
478 override
.alignment
= 'RIGHT'
479 checkbox
= override
.row(align
=True)
480 checkbox
.alignment
= 'RIGHT'
481 checkbox
.label(text
="Selection")
482 checkbox
.prop(self
, "tool_text_sel_override", text
="")
483 color_picker
= override
.row(align
=True)
484 color_picker
.alignment
= 'RIGHT'
485 color_picker
.enabled
= self
.tool_text_sel_override
486 color_picker
.prop(self
, "qcd_ogl_widget_tool_text_sel")
489 col
= overrides
.column()
490 col
.alignment
= 'RIGHT'
493 override
= col
.row(align
=True)
494 override
.alignment
= 'RIGHT'
495 checkbox
= override
.row(align
=True)
496 checkbox
.alignment
= 'RIGHT'
497 checkbox
.label(text
="Inner")
498 checkbox
.prop(self
, "tool_inner_override", text
="")
499 color_picker
= override
.row(align
=True)
500 color_picker
.alignment
= 'RIGHT'
501 color_picker
.enabled
= self
.tool_inner_override
502 color_picker
.prop(self
, "qcd_ogl_widget_tool_inner")
505 override
= col
.row(align
=True)
506 override
.alignment
= 'RIGHT'
507 checkbox
= override
.row(align
=True)
508 checkbox
.alignment
= 'RIGHT'
509 checkbox
.label(text
="Selection")
510 checkbox
.prop(self
, "tool_inner_sel_override", text
="")
511 color_picker
= override
.row(align
=True)
512 color_picker
.alignment
= 'RIGHT'
513 color_picker
.enabled
= self
.tool_inner_sel_override
514 color_picker
.prop(self
, "qcd_ogl_widget_tool_inner_sel")
517 override
= col
.row(align
=True)
518 override
.alignment
= 'RIGHT'
519 checkbox
= override
.row(align
=True)
520 checkbox
.alignment
= 'RIGHT'
521 checkbox
.label(text
="Outline")
522 checkbox
.prop(self
, "tool_outline_override", text
="")
523 color_picker
= override
.row(align
=True)
524 color_picker
.alignment
= 'RIGHT'
525 color_picker
.enabled
= self
.tool_outline_override
526 color_picker
.prop(self
, "qcd_ogl_widget_tool_outline")
529 tool_box
.row().label(text
="Icon Alpha:")
530 icon_fade_row
= tool_box
.row()
531 icon_fade_row
.alignment
= 'EXPAND'
532 icon_fade_row
.prop(self
, "qcd_ogl_selected_icon_alpha", text
="Selected")
533 icon_fade_row
.prop(self
, "qcd_ogl_objects_icon_alpha", text
="Objects")
536 # MENU BACK OVERRIDES
537 menu_back_box
= box
.box()
538 menu_back_box
.row().label(text
="Menu Back Theme Overrides:")
540 overrides
= menu_back_box
.split(align
=True)
543 col
= overrides
.column()
544 col
.alignment
= 'RIGHT'
547 override
= col
.row(align
=True)
548 override
.alignment
= 'RIGHT'
549 checkbox
= override
.row(align
=True)
550 checkbox
.alignment
= 'RIGHT'
551 checkbox
.label(text
="Text")
552 checkbox
.prop(self
, "menu_back_text_override", text
="")
553 color_picker
= override
.row(align
=True)
554 color_picker
.alignment
= 'RIGHT'
555 color_picker
.enabled
= self
.menu_back_text_override
556 color_picker
.prop(self
, "qcd_ogl_widget_menu_back_text")
559 col
= overrides
.column()
560 col
.alignment
= 'RIGHT'
563 override
= col
.row(align
=True)
564 override
.alignment
= 'RIGHT'
565 checkbox
= override
.row(align
=True)
566 checkbox
.alignment
= 'RIGHT'
567 checkbox
.label(text
="Inner")
568 checkbox
.prop(self
, "menu_back_inner_override", text
="")
569 color_picker
= override
.row(align
=True)
570 color_picker
.alignment
= 'RIGHT'
571 color_picker
.enabled
= self
.menu_back_inner_override
572 color_picker
.prop(self
, "qcd_ogl_widget_menu_back_inner")
575 override
= col
.row(align
=True)
576 override
.alignment
= 'RIGHT'
577 checkbox
= override
.row(align
=True)
578 checkbox
.alignment
= 'RIGHT'
579 checkbox
.label(text
="Outline")
580 checkbox
.prop(self
, "menu_back_outline_override", text
="")
581 color_picker
= override
.row(align
=True)
582 color_picker
.alignment
= 'RIGHT'
583 color_picker
.enabled
= self
.menu_back_outline_override
584 color_picker
.prop(self
, "qcd_ogl_widget_menu_back_outline")
588 tooltip_box
= box
.box()
589 tooltip_box
.row().label(text
="Tooltip Theme Overrides:")
591 overrides
= tooltip_box
.split(align
=True)
594 col
= overrides
.column()
595 col
.alignment
= 'RIGHT'
598 override
= col
.row(align
=True)
599 override
.alignment
= 'RIGHT'
600 checkbox
= override
.row(align
=True)
601 checkbox
.alignment
= 'RIGHT'
602 checkbox
.label(text
="Text")
603 checkbox
.prop(self
, "tooltip_text_override", text
="")
604 color_picker
= override
.row(align
=True)
605 color_picker
.alignment
= 'RIGHT'
606 color_picker
.enabled
= self
.tooltip_text_override
607 color_picker
.prop(self
, "qcd_ogl_widget_tooltip_text")
610 col
= overrides
.column()
611 col
.alignment
= 'RIGHT'
614 override
= col
.row(align
=True)
615 override
.alignment
= 'RIGHT'
616 checkbox
= override
.row(align
=True)
617 checkbox
.alignment
= 'RIGHT'
618 checkbox
.label(text
="Inner")
619 checkbox
.prop(self
, "tooltip_inner_override", text
="")
620 color_picker
= override
.row(align
=True)
621 color_picker
.alignment
= 'RIGHT'
622 color_picker
.enabled
= self
.tooltip_inner_override
623 color_picker
.prop(self
, "qcd_ogl_widget_tooltip_inner")
626 override
= col
.row(align
=True)
627 override
.alignment
= 'RIGHT'
628 checkbox
= override
.row(align
=True)
629 checkbox
.alignment
= 'RIGHT'
630 checkbox
.label(text
="Outline")
631 checkbox
.prop(self
, "tooltip_outline_override", text
="")
632 color_picker
= override
.row(align
=True)
633 color_picker
.alignment
= 'RIGHT'
634 color_picker
.enabled
= self
.tooltip_outline_override
635 color_picker
.prop(self
, "qcd_ogl_widget_tooltip_outline")