Skinify: fix shape generation
[blender-addons.git] / materials_utils / preferences.py
blobfdbb499342a73ece71dfb6b4f37402ea2b54490d
1 # SPDX-License-Identifier: GPL-2.0-or-later
3 import bpy
5 from bpy.types import (
6 AddonPreferences,
7 PropertyGroup,
9 from bpy.props import (
10 StringProperty,
11 BoolProperty,
12 EnumProperty,
13 IntProperty,
14 FloatProperty
16 from math import radians
18 from .enum_values import *
20 # Addon Preferences
21 class VIEW3D_MT_materialutilities_preferences(AddonPreferences):
22 bl_idname = __package__
24 new_material_name: StringProperty(
25 name = "New Material name",
26 description = "What Base name pattern to use for a new created Material\n"
27 "It is appended by an automatic numeric pattern depending\n"
28 "on the number of Scene's materials containing the Base",
29 default = "Unnamed Material",
31 override_type: EnumProperty(
32 name = 'Assignment method',
33 description = '',
34 items = mu_override_type_enums
36 fake_user: EnumProperty(
37 name = "Set Fake User",
38 description = "Default option for the Set Fake User (Turn fake user on or off)",
39 items = mu_fake_user_set_enums,
40 default = 'TOGGLE'
42 fake_user_affect: EnumProperty(
43 name = "Affect",
44 description = "Which materials of objects to affect",
45 items = mu_fake_user_affect_enums,
46 default = 'UNUSED'
48 link_to: EnumProperty(
49 name = "Change Material Link To",
50 description = "Default option for the Change Material Link operator",
51 items = mu_link_to_enums,
52 default = 'OBJECT'
54 link_to_affect: EnumProperty(
55 name = "Affect",
56 description = "Which materials of objects to affect by default with Change Material Link",
57 items = mu_link_affect_enums,
58 default = 'SELECTED'
60 search_show_limit: IntProperty(
61 name = "Show 'Search' Limit",
62 description = "How many materials should there be before the 'Search' option is shown "
63 "in the Assign Material and Select By Material menus\n"
64 "Set it to 0 to always show 'Search'",
65 min = 0,
66 default = 0
69 set_smooth_affect: EnumProperty(
70 name = "Set Auto Smooth Affect",
71 description = "Which objects to affect",
72 items = mu_affect_enums,
73 default = 'SELECTED'
75 auto_smooth_angle: FloatProperty(
76 name = "Auto Smooth Angle",
77 description = "Maximum angle between face normals that will be considered as smooth",
78 subtype = 'ANGLE',
79 min = 0,
80 max = radians(180),
81 default = radians(35)
84 def draw(self, context):
85 layout = self.layout
86 layout.use_property_split = True
88 box = layout.box()
89 box.label(text = "Defaults")
91 a = box.box()
92 a.label(text = "Assign Material")
93 a.prop(self, "new_material_name", icon = "MATERIAL")
94 a.prop(self, "override_type", expand = False)
96 b = box.box()
97 b.label(text = "Set Fake User")
98 b.row().prop(self, "fake_user", expand = False)
99 b.row().prop(self, "fake_user_affect", expand = False)
101 c = box.box()
102 c.label(text = "Set Link To")
103 c.row().prop(self, "link_to", expand = False)
104 c.row().prop(self, "link_to_affect", expand = False)
106 d = box.box()
107 d.label(text = "Set Auto Smooth")
108 d.row().prop(self, "auto_smooth_angle", expand = False)
109 d.row().prop(self, "set_smooth_affect", expand = False)
111 box = layout.box()
112 box.label(text = "Miscellaneous")
114 #col = box.column()
115 #row = col.split(factor = 0.5)
116 box.prop(self, "search_show_limit", expand = False)
119 def materialutilities_get_preferences(context):
120 return context.preferences.addons[__package__].preferences