-
Notifications
You must be signed in to change notification settings - Fork 0
/
preferences.py
33 lines (23 loc) · 1013 Bytes
/
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
import bpy
from bpy.types import AddonPreferences, Context, UILayout
from bpy.props import BoolProperty
from typing import Optional, cast
from .registration import register_module_classes_factory
class AvatarBuilderAddonPreferences(AddonPreferences):
# bl_idname must match the addon name
bl_idname = __package__
object_ui_sync: BoolProperty(
name="Object UI Sync",
description="Sync display of settings on Objects to show only the active settings of the Scene",
default=True,
)
def draw(self, context: Context):
layout: UILayout = self.layout
layout.prop(self, 'object_ui_sync')
def object_ui_sync_enabled(context: Optional[Context] = None):
"""Get whether Object UI Sync is enabled"""
if context is None:
context = bpy.context
preferences = cast(AvatarBuilderAddonPreferences, context.preferences.addons[__package__].preferences)
return preferences.object_ui_sync
register_module_classes_factory(__name__, globals())