Rigify: store advanced options in armature instead of window manager.
[blender-addons.git] / materials_utils / preferences.py
blob7fdbd9ff5d3097d11780aa29220fb6858626cf01
1 import bpy
3 from bpy.types import (
4 AddonPreferences,
5 PropertyGroup,
7 from bpy.props import (
8 StringProperty,
9 BoolProperty,
10 EnumProperty,
11 IntProperty,
12 FloatProperty
14 from math import radians
16 from .enum_values import *
18 # Addon Preferences
19 class VIEW3D_MT_materialutilities_preferences(AddonPreferences):
20 bl_idname = __package__
22 new_material_name: StringProperty(
23 name = "New Material name",
24 description = "What Base name pattern to use for a new created Material\n"
25 "It is appended by an automatic numeric pattern depending\n"
26 "on the number of Scene's materials containing the Base",
27 default = "Unnamed Material",
29 override_type: EnumProperty(
30 name = 'Assignment method',
31 description = '',
32 items = mu_override_type_enums
34 fake_user: EnumProperty(
35 name = "Set Fake User",
36 description = "Default option for the Set Fake User (Turn fake user on or off)",
37 items = mu_fake_user_set_enums,
38 default = 'TOGGLE'
40 fake_user_affect: EnumProperty(
41 name = "Affect",
42 description = "Which materials of objects to affect",
43 items = mu_fake_user_affect_enums,
44 default = 'UNUSED'
46 link_to: EnumProperty(
47 name = "Change Material Link To",
48 description = "Default option for the Change Material Link operator",
49 items = mu_link_to_enums,
50 default = 'OBJECT'
52 link_to_affect: EnumProperty(
53 name = "Affect",
54 description = "Which materials of objects to affect by default with Change Material Link",
55 items = mu_link_affect_enums,
56 default = 'SELECTED'
58 search_show_limit: IntProperty(
59 name = "Show 'Search' Limit",
60 description = "How many materials should there be before the 'Search' option is shown "
61 "in the Assign Material and Select By Material menus\n"
62 "Set it to 0 to always show 'Search'",
63 min = 0,
64 default = 0
67 set_smooth_affect: EnumProperty(
68 name = "Set Auto Smooth Affect",
69 description = "Which objects to affect",
70 items = mu_affect_enums,
71 default = 'SELECTED'
73 auto_smooth_angle: FloatProperty(
74 name = "Auto Smooth Angle",
75 description = "Maximum angle between face normals that will be considered as smooth",
76 subtype = 'ANGLE',
77 min = 0,
78 max = radians(180),
79 default = radians(35)
82 def draw(self, context):
83 layout = self.layout
84 layout.use_property_split = True
86 box = layout.box()
87 box.label(text = "Defaults")
89 a = box.box()
90 a.label(text = "Assign Material")
91 a.prop(self, "new_material_name", icon = "MATERIAL")
92 a.prop(self, "override_type", expand = False)
94 b = box.box()
95 b.label(text = "Set Fake User")
96 b.row().prop(self, "fake_user", expand = False)
97 b.row().prop(self, "fake_user_affect", expand = False)
99 c = box.box()
100 c.label(text = "Set Link To")
101 c.row().prop(self, "link_to", expand = False)
102 c.row().prop(self, "link_to_affect", expand = False)
104 d = box.box()
105 d.label(text = "Set Auto Smooth")
106 d.row().prop(self, "auto_smooth_angle", expand = False)
107 d.row().prop(self, "set_smooth_affect", expand = False)
109 box = layout.box()
110 box.label(text = "Miscellaneous")
112 #col = box.column()
113 #row = col.split(factor = 0.5)
114 box.prop(self, "search_show_limit", expand = False)
117 def materialutilities_get_preferences(context):
118 return context.preferences.addons[__package__].preferences