1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
19 # Copyright 2011, Ryan Inch
22 from bpy
.types
import AddonPreferences
23 from bpy
.props
import (
30 from . import qcd_init
32 def update_disable_objects_hotkeys_status(self
, context
):
33 if self
.enable_disable_objects_override
:
34 cm_init
.register_disable_objects_hotkeys()
37 cm_init
.unregister_disable_objects_hotkeys()
39 def update_qcd_status(self
, context
):
41 qcd_init
.register_qcd()
43 if self
.enable_qcd_view_hotkeys
:
44 qcd_init
.register_qcd_view_hotkeys()
46 if self
.enable_qcd_view_edit_mode_hotkeys
:
47 qcd_init
.register_qcd_view_edit_mode_hotkeys()
50 qcd_init
.unregister_qcd()
52 def update_qcd_view_hotkeys_status(self
, context
):
53 if self
.enable_qcd_view_hotkeys
:
54 qcd_init
.register_qcd_view_hotkeys()
56 qcd_init
.unregister_qcd_view_hotkeys()
58 def update_qcd_view_edit_mode_hotkeys_status(self
, context
):
59 if self
.enable_qcd_view_edit_mode_hotkeys
:
60 qcd_init
.register_qcd_view_edit_mode_hotkeys()
62 qcd_init
.unregister_qcd_view_edit_mode_hotkeys()
64 def get_tool_text(self
):
65 if self
.tool_text_override
:
66 return self
["tool_text_color"]
68 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.text
69 self
["tool_text_color"] = color
.r
, color
.g
, color
.b
70 return self
["tool_text_color"]
72 def set_tool_text(self
, values
):
73 self
["tool_text_color"] = values
[0], values
[1], values
[2]
76 def get_tool_text_sel(self
):
77 if self
.tool_text_sel_override
:
78 return self
["tool_text_sel_color"]
80 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.text_sel
81 self
["tool_text_sel_color"] = color
.r
, color
.g
, color
.b
82 return self
["tool_text_sel_color"]
84 def set_tool_text_sel(self
, values
):
85 self
["tool_text_sel_color"] = values
[0], values
[1], values
[2]
88 def get_tool_inner(self
):
89 if self
.tool_inner_override
:
90 return self
["tool_inner_color"]
92 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.inner
93 self
["tool_inner_color"] = color
[0], color
[1], color
[2], color
[3]
94 return self
["tool_inner_color"]
96 def set_tool_inner(self
, values
):
97 self
["tool_inner_color"] = values
[0], values
[1], values
[2], values
[3]
100 def get_tool_inner_sel(self
):
101 if self
.tool_inner_sel_override
:
102 return self
["tool_inner_sel_color"]
104 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.inner_sel
105 self
["tool_inner_sel_color"] = color
[0], color
[1], color
[2], color
[3]
106 return self
["tool_inner_sel_color"]
108 def set_tool_inner_sel(self
, values
):
109 self
["tool_inner_sel_color"] = values
[0], values
[1], values
[2], values
[3]
112 def get_tool_outline(self
):
113 if self
.tool_outline_override
:
114 return self
["tool_outline_color"]
116 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.outline
117 self
["tool_outline_color"] = color
.r
, color
.g
, color
.b
118 return self
["tool_outline_color"]
120 def set_tool_outline(self
, values
):
121 self
["tool_outline_color"] = values
[0], values
[1], values
[2]
124 def get_menu_back_text(self
):
125 if self
.menu_back_text_override
:
126 return self
["menu_back_text_color"]
128 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.text
129 self
["menu_back_text_color"] = color
.r
, color
.g
, color
.b
130 return self
["menu_back_text_color"]
132 def set_menu_back_text(self
, values
):
133 self
["menu_back_text_color"] = values
[0], values
[1], values
[2]
136 def get_menu_back_inner(self
):
137 if self
.menu_back_inner_override
:
138 return self
["menu_back_inner_color"]
140 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.inner
141 self
["menu_back_inner_color"] = color
[0], color
[1], color
[2], color
[3]
142 return self
["menu_back_inner_color"]
144 def set_menu_back_inner(self
, values
):
145 self
["menu_back_inner_color"] = values
[0], values
[1], values
[2], values
[3]
148 def get_menu_back_outline(self
):
149 if self
.menu_back_outline_override
:
150 return self
["menu_back_outline_color"]
152 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.outline
153 self
["menu_back_outline_color"] = color
.r
, color
.g
, color
.b
154 return self
["menu_back_outline_color"]
156 def set_menu_back_outline(self
, values
):
157 self
["menu_back_outline_color"] = values
[0], values
[1], values
[2]
160 def get_tooltip_text(self
):
161 if self
.tooltip_text_override
:
162 return self
["tooltip_text_color"]
164 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.text
165 self
["tooltip_text_color"] = color
.r
, color
.g
, color
.b
166 return self
["tooltip_text_color"]
168 def set_tooltip_text(self
, values
):
169 self
["tooltip_text_color"] = values
[0], values
[1], values
[2]
172 def get_tooltip_inner(self
):
173 if self
.tooltip_inner_override
:
174 return self
["tooltip_inner_color"]
176 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.inner
177 self
["tooltip_inner_color"] = color
[0], color
[1], color
[2], color
[3]
178 return self
["tooltip_inner_color"]
180 def set_tooltip_inner(self
, values
):
181 self
["tooltip_inner_color"] = values
[0], values
[1], values
[2], values
[3]
184 def get_tooltip_outline(self
):
185 if self
.tooltip_outline_override
:
186 return self
["tooltip_outline_color"]
188 color
= bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.outline
189 self
["tooltip_outline_color"] = color
.r
, color
.g
, color
.b
190 return self
["tooltip_outline_color"]
192 def set_tooltip_outline(self
, values
):
193 self
["tooltip_outline_color"] = values
[0], values
[1], values
[2]
196 class CMPreferences(AddonPreferences
):
197 bl_idname
= __package__
199 # ENABLE DISABLE OBJECTS OVERRIDE
200 enable_disable_objects_override
: BoolProperty(
201 name
="Disable objects instead of Hiding",
203 "Replace the object hiding hotkeys with object disabling hotkeys and add them to the Object->Show/Hide menu.\n"
204 "Disabling objects prevents them from being automatically shown again when collections are unexcluded"
207 update
=update_disable_objects_hotkeys_status
,
211 enable_qcd
: BoolProperty(
213 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 View header widget",
215 update
=update_qcd_status
,
218 enable_qcd_view_hotkeys
: BoolProperty(
220 description
="Enable/Disable the numerical hotkeys to view QCD slots",
222 update
=update_qcd_view_hotkeys_status
,
225 enable_qcd_view_edit_mode_hotkeys
: BoolProperty(
226 name
="QCD Edit Mode Hotkeys",
227 description
="Enable/Disable the numerical hotkeys to view QCD slots in Edit Mode",
229 update
=update_qcd_view_edit_mode_hotkeys_status
,
234 tool_text_override
: BoolProperty(
236 description
="Override Theme Text Color",
240 tool_text_sel_override
: BoolProperty(
242 description
="Override Theme Text Selection Color",
246 tool_inner_override
: BoolProperty(
248 description
="Override Theme Inner Color",
252 tool_inner_sel_override
: BoolProperty(
254 description
="Override Theme Inner Selection Color",
258 tool_outline_override
: BoolProperty(
260 description
="Override Theme Outline Color",
264 menu_back_text_override
: BoolProperty(
266 description
="Override Theme Text Color",
270 menu_back_inner_override
: BoolProperty(
272 description
="Override Theme Inner Color",
276 menu_back_outline_override
: BoolProperty(
278 description
="Override Theme Outline Color",
282 tooltip_text_override
: BoolProperty(
284 description
="Override Theme Text Color",
288 tooltip_inner_override
: BoolProperty(
290 description
="Override Theme Inner Color",
294 tooltip_outline_override
: BoolProperty(
296 description
="Override Theme Outline Color",
302 qcd_ogl_widget_tool_text
: FloatVectorProperty(
304 description
="QCD Move Widget Tool Text Color",
305 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.text
,
306 subtype
='COLOR_GAMMA',
313 qcd_ogl_widget_tool_text_sel
: FloatVectorProperty(
315 description
="QCD Move Widget Tool Text Selection Color",
316 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.text_sel
,
317 subtype
='COLOR_GAMMA',
320 get
=get_tool_text_sel
,
321 set=set_tool_text_sel
,
324 qcd_ogl_widget_tool_inner
: FloatVectorProperty(
326 description
="QCD Move Widget Tool Inner Color",
327 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.inner
,
328 subtype
='COLOR_GAMMA',
336 qcd_ogl_widget_tool_inner_sel
: FloatVectorProperty(
338 description
="QCD Move Widget Tool Inner Selection Color",
339 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.inner_sel
,
340 subtype
='COLOR_GAMMA',
344 get
=get_tool_inner_sel
,
345 set=set_tool_inner_sel
,
348 qcd_ogl_widget_tool_outline
: FloatVectorProperty(
350 description
="QCD Move Widget Tool Outline Color",
351 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tool
.outline
,
352 subtype
='COLOR_GAMMA',
355 get
=get_tool_outline
,
356 set=set_tool_outline
,
359 qcd_ogl_widget_menu_back_text
: FloatVectorProperty(
361 description
="QCD Move Widget Menu Back Text Color",
362 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.text
,
363 subtype
='COLOR_GAMMA',
366 get
=get_menu_back_text
,
367 set=set_menu_back_text
,
370 qcd_ogl_widget_menu_back_inner
: FloatVectorProperty(
372 description
="QCD Move Widget Menu Back Inner Color",
373 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.inner
,
374 subtype
='COLOR_GAMMA',
378 get
=get_menu_back_inner
,
379 set=set_menu_back_inner
,
382 qcd_ogl_widget_menu_back_outline
: FloatVectorProperty(
384 description
="QCD Move Widget Menu Back Outline Color",
385 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_menu_back
.outline
,
386 subtype
='COLOR_GAMMA',
389 get
=get_menu_back_outline
,
390 set=set_menu_back_outline
,
393 qcd_ogl_widget_tooltip_text
: FloatVectorProperty(
395 description
="QCD Move Widget Tooltip Text Color",
396 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.text
,
397 subtype
='COLOR_GAMMA',
400 get
=get_tooltip_text
,
401 set=set_tooltip_text
,
404 qcd_ogl_widget_tooltip_inner
: FloatVectorProperty(
406 description
="QCD Move Widget Tooltip Inner Color",
407 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.inner
,
408 subtype
='COLOR_GAMMA',
412 get
=get_tooltip_inner
,
413 set=set_tooltip_inner
,
416 qcd_ogl_widget_tooltip_outline
: FloatVectorProperty(
418 description
="QCD Move Widget Tooltip Outline Color",
419 default
=bpy
.context
.preferences
.themes
[0].user_interface
.wcol_tooltip
.outline
,
420 subtype
='COLOR_GAMMA',
423 get
=get_tooltip_outline
,
424 set=set_tooltip_outline
,
427 # NON ACTIVE ICON ALPHA
428 qcd_ogl_selected_icon_alpha
: FloatProperty(
429 name
="Selected Icon Alpha",
430 description
="Set the 'Selected' icon's alpha value",
436 qcd_ogl_objects_icon_alpha
: FloatProperty(
437 name
="Objects Icon Alpha",
438 description
="Set the 'Objects' icon's alpha value",
444 def draw(self
, context
):
448 box
.row().prop(self
, "enable_disable_objects_override")
449 box
.row().prop(self
, "enable_qcd")
451 if not self
.enable_qcd
:
454 box
.row().prop(self
, "enable_qcd_view_hotkeys")
455 box
.row().prop(self
, "enable_qcd_view_edit_mode_hotkeys")
457 box
.row().label(text
="QCD Move Widget")
461 tool_box
.row().label(text
="Tool Theme Overrides:")
463 overrides
= tool_box
.split(align
=True)
466 col
= overrides
.column()
467 col
.alignment
= 'RIGHT'
470 override
= col
.row(align
=True)
471 override
.alignment
= 'RIGHT'
472 checkbox
= override
.row(align
=True)
473 checkbox
.alignment
= 'RIGHT'
474 checkbox
.label(text
="Text")
475 checkbox
.prop(self
, "tool_text_override", text
="")
476 color_picker
= override
.row(align
=True)
477 color_picker
.alignment
= 'RIGHT'
478 color_picker
.enabled
= self
.tool_text_override
479 color_picker
.prop(self
, "qcd_ogl_widget_tool_text")
482 override
= col
.row(align
=True)
483 override
.alignment
= 'RIGHT'
484 checkbox
= override
.row(align
=True)
485 checkbox
.alignment
= 'RIGHT'
486 checkbox
.label(text
="Selection")
487 checkbox
.prop(self
, "tool_text_sel_override", text
="")
488 color_picker
= override
.row(align
=True)
489 color_picker
.alignment
= 'RIGHT'
490 color_picker
.enabled
= self
.tool_text_sel_override
491 color_picker
.prop(self
, "qcd_ogl_widget_tool_text_sel")
494 col
= overrides
.column()
495 col
.alignment
= 'RIGHT'
498 override
= col
.row(align
=True)
499 override
.alignment
= 'RIGHT'
500 checkbox
= override
.row(align
=True)
501 checkbox
.alignment
= 'RIGHT'
502 checkbox
.label(text
="Inner")
503 checkbox
.prop(self
, "tool_inner_override", text
="")
504 color_picker
= override
.row(align
=True)
505 color_picker
.alignment
= 'RIGHT'
506 color_picker
.enabled
= self
.tool_inner_override
507 color_picker
.prop(self
, "qcd_ogl_widget_tool_inner")
510 override
= col
.row(align
=True)
511 override
.alignment
= 'RIGHT'
512 checkbox
= override
.row(align
=True)
513 checkbox
.alignment
= 'RIGHT'
514 checkbox
.label(text
="Selection")
515 checkbox
.prop(self
, "tool_inner_sel_override", text
="")
516 color_picker
= override
.row(align
=True)
517 color_picker
.alignment
= 'RIGHT'
518 color_picker
.enabled
= self
.tool_inner_sel_override
519 color_picker
.prop(self
, "qcd_ogl_widget_tool_inner_sel")
522 override
= col
.row(align
=True)
523 override
.alignment
= 'RIGHT'
524 checkbox
= override
.row(align
=True)
525 checkbox
.alignment
= 'RIGHT'
526 checkbox
.label(text
="Outline")
527 checkbox
.prop(self
, "tool_outline_override", text
="")
528 color_picker
= override
.row(align
=True)
529 color_picker
.alignment
= 'RIGHT'
530 color_picker
.enabled
= self
.tool_outline_override
531 color_picker
.prop(self
, "qcd_ogl_widget_tool_outline")
534 tool_box
.row().label(text
="Icon Alpha:")
535 icon_fade_row
= tool_box
.row()
536 icon_fade_row
.alignment
= 'EXPAND'
537 icon_fade_row
.prop(self
, "qcd_ogl_selected_icon_alpha", text
="Selected")
538 icon_fade_row
.prop(self
, "qcd_ogl_objects_icon_alpha", text
="Objects")
541 # MENU BACK OVERRIDES
542 menu_back_box
= box
.box()
543 menu_back_box
.row().label(text
="Menu Back Theme Overrides:")
545 overrides
= menu_back_box
.split(align
=True)
548 col
= overrides
.column()
549 col
.alignment
= 'RIGHT'
552 override
= col
.row(align
=True)
553 override
.alignment
= 'RIGHT'
554 checkbox
= override
.row(align
=True)
555 checkbox
.alignment
= 'RIGHT'
556 checkbox
.label(text
="Text")
557 checkbox
.prop(self
, "menu_back_text_override", text
="")
558 color_picker
= override
.row(align
=True)
559 color_picker
.alignment
= 'RIGHT'
560 color_picker
.enabled
= self
.menu_back_text_override
561 color_picker
.prop(self
, "qcd_ogl_widget_menu_back_text")
564 col
= overrides
.column()
565 col
.alignment
= 'RIGHT'
568 override
= col
.row(align
=True)
569 override
.alignment
= 'RIGHT'
570 checkbox
= override
.row(align
=True)
571 checkbox
.alignment
= 'RIGHT'
572 checkbox
.label(text
="Inner")
573 checkbox
.prop(self
, "menu_back_inner_override", text
="")
574 color_picker
= override
.row(align
=True)
575 color_picker
.alignment
= 'RIGHT'
576 color_picker
.enabled
= self
.menu_back_inner_override
577 color_picker
.prop(self
, "qcd_ogl_widget_menu_back_inner")
580 override
= col
.row(align
=True)
581 override
.alignment
= 'RIGHT'
582 checkbox
= override
.row(align
=True)
583 checkbox
.alignment
= 'RIGHT'
584 checkbox
.label(text
="Outline")
585 checkbox
.prop(self
, "menu_back_outline_override", text
="")
586 color_picker
= override
.row(align
=True)
587 color_picker
.alignment
= 'RIGHT'
588 color_picker
.enabled
= self
.menu_back_outline_override
589 color_picker
.prop(self
, "qcd_ogl_widget_menu_back_outline")
593 tooltip_box
= box
.box()
594 tooltip_box
.row().label(text
="Tooltip Theme Overrides:")
596 overrides
= tooltip_box
.split(align
=True)
599 col
= overrides
.column()
600 col
.alignment
= 'RIGHT'
603 override
= col
.row(align
=True)
604 override
.alignment
= 'RIGHT'
605 checkbox
= override
.row(align
=True)
606 checkbox
.alignment
= 'RIGHT'
607 checkbox
.label(text
="Text")
608 checkbox
.prop(self
, "tooltip_text_override", text
="")
609 color_picker
= override
.row(align
=True)
610 color_picker
.alignment
= 'RIGHT'
611 color_picker
.enabled
= self
.tooltip_text_override
612 color_picker
.prop(self
, "qcd_ogl_widget_tooltip_text")
615 col
= overrides
.column()
616 col
.alignment
= 'RIGHT'
619 override
= col
.row(align
=True)
620 override
.alignment
= 'RIGHT'
621 checkbox
= override
.row(align
=True)
622 checkbox
.alignment
= 'RIGHT'
623 checkbox
.label(text
="Inner")
624 checkbox
.prop(self
, "tooltip_inner_override", text
="")
625 color_picker
= override
.row(align
=True)
626 color_picker
.alignment
= 'RIGHT'
627 color_picker
.enabled
= self
.tooltip_inner_override
628 color_picker
.prop(self
, "qcd_ogl_widget_tooltip_inner")
631 override
= col
.row(align
=True)
632 override
.alignment
= 'RIGHT'
633 checkbox
= override
.row(align
=True)
634 checkbox
.alignment
= 'RIGHT'
635 checkbox
.label(text
="Outline")
636 checkbox
.prop(self
, "tooltip_outline_override", text
="")
637 color_picker
= override
.row(align
=True)
638 color_picker
.alignment
= 'RIGHT'
639 color_picker
.enabled
= self
.tooltip_outline_override
640 color_picker
.prop(self
, "qcd_ogl_widget_tooltip_outline")