-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreferences.py
78 lines (66 loc) · 2.81 KB
/
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
import bpy
from bpy.props import StringProperty, EnumProperty, IntProperty
from bpy.types import AddonPreferences
class LLT_AddonPreferences(AddonPreferences):
bl_idname = __package__
def update_panel(self, context):
from .panel import refresh_panel
refresh_panel()
panel_name: StringProperty(name="Panel Name", default="LH", update=update_panel)
node_search_depth: IntProperty(name="Node search depth",
description="If the setting is too high or the materials in the scene are too complex, stuttering may occur",
default=10, max=50, min=3)
light_list_filter_type: EnumProperty(
name="List Filter Type",
default="ALL",
translation_context="light_helper_zh_CN",
items=[
("ALL", "All", "Display lights and objects that can emit light", "SCENE_DATA", 0),
("LIGHT", "Light", "Only show the lights", "OUTLINER_DATA_LIGHT", 1),
("EMISSION", "Emission Material", "Only luminous material are displayed", "MATERIAL", 2),
]
)
def get_link(self):
key = f"{self.light_list_filter_type}_link"
if key in self:
return self[key]
else:
return 0
def set_link(self, value):
key = f"{self.light_list_filter_type}_link"
self[key] = value
light_link_filter_type: EnumProperty(
name="Link Filter Type",
default="ALL",
translation_context="light_helper_zh_CN",
items=[
("ALL", "All", "Show all"),
("NOT_LINK", "General", "Only non-light links are displayed"),
("LINK", "Linking", "Only light links are displayed"),
],
get=get_link,
set=set_link,
)
moving_view_type: EnumProperty(
name="Moving View Type",
default="NONE",
items=[
("NONE", "None", "Only Select, Do not move the view", "RESTRICT_SELECT_OFF", 0),
("MAINTAINING_ZOOM", "Maintaining Zoom", "Direct switching of view position,no animation", "VIEWZOOM", 1),
("ANIMATION", "Animation", "Animation switching, no fixed zoom", "ANIM", 2),
]
)
def draw(self, context):
layout = self.layout
column = layout.column(align=True)
if bpy.app.version < (4, 3, 0):
column.label(text="Version lower than 4.3.0, only the CYCLE renderer can set light exclusion")
column.prop(self, "panel_name")
column.prop(self, "node_search_depth")
column.prop(self, "light_list_filter_type")
column.prop(self, "light_link_filter_type", text_ctxt="light_helper_zh_CN")
column.prop(self, "moving_view_type")
def register():
bpy.utils.register_class(LLT_AddonPreferences)
def unregister():
bpy.utils.unregister_class(LLT_AddonPreferences)