-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prefs.py
48 lines (38 loc) · 1.26 KB
/
prefs.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
# SPDX-License-Identifier: GPL-2.0-or-later
import bpy
from bpy.types import AddonPreferences
from bpy.props import StringProperty, BoolProperty
from .bl_class_registry import BlClassRegistry
from .panels import (
ISN_PT_mainPanel,
ISN_PT_commentsPanel,
)
@BlClassRegistry()
class ISNPreferences(AddonPreferences):
bl_idname = __package__
def _panel_category_update(self, context):
panels = [
ISN_PT_mainPanel,
ISN_PT_commentsPanel,
]
for panel in panels:
has_panel = hasattr(bpy.types, panel.bl_idname)
if has_panel:
try:
bpy.utils.unregister_class(panel)
except:
pass
panel.bl_category = self.panel_category
bpy.utils.register_class(panel)
panel_category: StringProperty(
name="Panel Category",
description="Category to show \"Syncsketch Feedback\" panel",
default="Animation",
update=_panel_category_update,
)
def draw(self, context):
layout = self.layout
row = layout.row()
col = row.column()
col.label(text="Set the category to show the \"Syncsketch Feedback\" panel:")
col.prop(self, "panel_category")