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