Welcome to mirror list, hosted at ThFree Co, Russian Federation.

preferences.py « materials_utils - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fdbb499342a73ece71dfb6b4f37402ea2b54490d (plain)
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# SPDX-License-Identifier: GPL-2.0-or-later

import bpy

from bpy.types import (
    AddonPreferences,
    PropertyGroup,
    )
from bpy.props import (
    StringProperty,
    BoolProperty,
    EnumProperty,
    IntProperty,
    FloatProperty
    )
from math import radians

from .enum_values import *

# Addon Preferences
class VIEW3D_MT_materialutilities_preferences(AddonPreferences):
    bl_idname = __package__

    new_material_name: StringProperty(
            name = "New Material name",
            description = "What Base name pattern to use for a new created Material\n"
                          "It is appended by an automatic numeric pattern depending\n"
                          "on the number of Scene's materials containing the Base",
            default = "Unnamed Material",
            )
    override_type: EnumProperty(
            name = 'Assignment method',
            description = '',
            items = mu_override_type_enums
            )
    fake_user: EnumProperty(
            name = "Set Fake User",
            description = "Default option for the Set Fake User (Turn fake user on or off)",
            items = mu_fake_user_set_enums,
            default = 'TOGGLE'
            )
    fake_user_affect: EnumProperty(
            name = "Affect",
            description = "Which materials of objects to affect",
            items = mu_fake_user_affect_enums,
            default = 'UNUSED'
            )
    link_to: EnumProperty(
            name = "Change Material Link To",
            description = "Default option for the Change Material Link operator",
            items = mu_link_to_enums,
            default = 'OBJECT'
            )
    link_to_affect: EnumProperty(
            name = "Affect",
            description = "Which materials of objects to affect by default with Change Material Link",
            items = mu_link_affect_enums,
            default = 'SELECTED'
            )
    search_show_limit: IntProperty(
            name = "Show 'Search' Limit",
            description = "How many materials should there be before the 'Search' option is shown "
                          "in the Assign Material and Select By Material menus\n"
                          "Set it to 0 to always show 'Search'",
            min = 0,
            default = 0
            )

    set_smooth_affect: EnumProperty(
            name = "Set Auto Smooth Affect",
            description = "Which objects to affect",
            items = mu_affect_enums,
            default = 'SELECTED'
            )
    auto_smooth_angle: FloatProperty(
            name = "Auto Smooth Angle",
            description = "Maximum angle between face normals that will be considered as smooth",
            subtype = 'ANGLE',
            min = 0,
            max = radians(180),
            default = radians(35)
            )

    def draw(self, context):
        layout = self.layout
        layout.use_property_split = True

        box = layout.box()
        box.label(text = "Defaults")

        a = box.box()
        a.label(text = "Assign Material")
        a.prop(self, "new_material_name", icon = "MATERIAL")
        a.prop(self, "override_type", expand = False)

        b = box.box()
        b.label(text = "Set Fake User")
        b.row().prop(self, "fake_user", expand = False)
        b.row().prop(self, "fake_user_affect", expand = False)

        c = box.box()
        c.label(text = "Set Link To")
        c.row().prop(self, "link_to", expand = False)
        c.row().prop(self, "link_to_affect", expand = False)

        d = box.box()
        d.label(text = "Set Auto Smooth")
        d.row().prop(self, "auto_smooth_angle", expand = False)
        d.row().prop(self, "set_smooth_affect", expand = False)

        box = layout.box()
        box.label(text = "Miscellaneous")

        #col = box.column()
        #row = col.split(factor = 0.5)
        box.prop(self, "search_show_limit", expand = False)


def materialutilities_get_preferences(context):
    return context.preferences.addons[__package__].preferences