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

carver_preferences.py « object_carver - git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 873a814d530f2365c80da5b39f6e10f8ab0c3739 (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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# SPDX-License-Identifier: GPL-2.0-or-later

import bpy
from bpy.props import (
    BoolProperty,
    IntProperty,
    PointerProperty,
    StringProperty,
)

class CarverPrefs(bpy.types.AddonPreferences):
    bl_idname = __name__

    Enable_Tab_01: BoolProperty(
        name="Info",
        description="Some general information and settings about the add-on",
        default=False
    )
    Enable_Tab_02: BoolProperty(
        name="Hotkeys",
        description="List of the shortcuts used during carving",
        default=False
    )
    bpy.types.Scene.Key_Create: StringProperty(
        name="Object creation",
        description="Object creation",
        maxlen=1,
        default="C"
    )
    bpy.types.Scene.Key_Update: StringProperty(
        name="Auto Bevel Update",
        description="Auto Bevel Update",
        maxlen=1,
        default="A",
    )
    bpy.types.Scene.Key_Bool: StringProperty(
        name="Boolean type",
        description="Boolean operation type",
        maxlen=1,
        default="T",
    )
    bpy.types.Scene.Key_Brush: StringProperty(
            name="Brush Mode",
            description="Brush Mode",
            maxlen=1,
            default="B",
    )
    bpy.types.Scene.Key_Help: StringProperty(
        name="Help display",
        description="Help display",
        maxlen=1,
        default="H",
    )
    bpy.types.Scene.Key_Instant: StringProperty(
        name="Instantiate",
        description="Instantiate object",
        maxlen=1,
        default="I",
    )
    bpy.types.Scene.Key_Close: StringProperty(
        name="Close polygonal shape",
        description="Close polygonal shape",
        maxlen=1,
        default="X",
    )
    bpy.types.Scene.Key_Apply: StringProperty(
        name="Apply operation",
        description="Apply operation",
        maxlen=1,
        default="Q",
    )
    bpy.types.Scene.Key_Scale: StringProperty(
        name="Scale object",
        description="Scale object",
        maxlen=1,
        default="S",
    )
    bpy.types.Scene.Key_Gapy: StringProperty(
        name="Gap rows",
        description="Scale gap between columns",
        maxlen=1,
        default="J",
    )
    bpy.types.Scene.Key_Gapx: StringProperty(
        name="Gap columns",
        description="Scale gap between columns",
        maxlen=1,
        default="U",
    )
    bpy.types.Scene.Key_Depth: StringProperty(
        name="Depth",
        description="Cursor depth or solidify pattern",
        maxlen=1,
        default="D",
    )
    bpy.types.Scene.Key_BrushDepth: StringProperty(
        name="Brush Depth",
        description="Brush depth",
        maxlen=1,
        default="C",
    )
    bpy.types.Scene.Key_Subadd: StringProperty(
        name="Add subdivision",
        description="Add subdivision",
        maxlen=1,
        default="X",
    )
    bpy.types.Scene.Key_Subrem: StringProperty(
        name="Remove subdivision",
        description="Remove subdivision",
        maxlen=1,
        default="W",
    )
    bpy.types.Scene.Key_Randrot: StringProperty(
        name="Random rotation",
        description="Random rotation",
        maxlen=1,
        default="R",
    )
    bpy.types.Scene.ProfilePrefix: StringProperty(
        name="Profile prefix",
        description="Prefix to look for profiles with",
        default="Carver_Profile-"
    )

    def draw(self, context):
        scene = context.scene
        layout = self.layout
        print("DRAW !")

        icon_1 = "TRIA_RIGHT" if not self.Enable_Tab_01 else "TRIA_DOWN"
        box = layout.box()

        box.prop(self, "Enable_Tab_01", text="Info and Settings", emboss=False, icon=icon_1)
        if self.Enable_Tab_01:
            box.label(text="Carver Operator:", icon="LAYER_ACTIVE")
            box.label(text="Select a Mesh Object and press [CTRL]+[SHIFT]+[X] to carve",
                         icon="LAYER_USED")
            box.label(text="To finish carving press [ESC] or [RIGHT CLICK]",
                         icon="LAYER_USED")
            box.prop(scene, "ProfilePrefix", text="Profile prefix")

        icon_2 = "TRIA_RIGHT" if not self.Enable_Tab_02 else "TRIA_DOWN"
        box = layout.box()
        box.prop(self, "Enable_Tab_02", text="Keys", emboss=False, icon=icon_2)
        if self.Enable_Tab_02:
            split = box.split(align=True)
            box = split.box()
            col = box.column(align=True)
            col.label(text="Object Creation:")
            col.prop(scene, "Key_Create", text="")
            col.label(text="Auto bevel update:")
            col.prop(scene, "Key_Update", text="")
            col.label(text="Boolean operation type:")
            col.prop(scene, "Key_Bool", text="")
            col.label(text="Brush Depth:")
            col.prop(scene, "Key_BrushDepth", text="")

            box = split.box()
            col = box.column(align=True)
            col.label(text="Brush Mode:")
            col.prop(scene, "Key_Brush", text="")
            col.label(text="Help display:")
            col.prop(scene, "Key_Help", text="")
            col.label(text="Instantiate object:")
            col.prop(scene, "Key_Instant", text="")
            col.label(text="Random rotation:")
            col.prop(scene, "Key_Randrot", text="")

            box = split.box()
            col = box.column(align=True)
            col.label(text="Close polygonal shape:")
            col.prop(scene, "Key_Close", text="")
            col.label(text="Apply operation:")
            col.prop(scene, "Key_Apply", text="")
            col.label(text="Scale object:")
            col.prop(scene, "Key_Scale", text="")
            col.label(text="Subdiv add:")
            col.prop(scene, "Key_Subadd", text="")

            box = split.box()
            col = box.column(align=True)
            col.label(text="Gap rows:")
            col.prop(scene, "Key_Gapy", text="")
            col.label(text="Gap columns:")
            col.prop(scene, "Key_Gapx", text="")
            col.label(text="Depth / Solidify:")
            col.prop(scene, "Key_Depth", text="")
            col.label(text="Subdiv Remove:")
            col.prop(scene, "Key_Subrem", text="")

def register():
    bpy.utils.register_class(CarverPrefs)

def unregister():
    bpy.utils.unregister_class(CarverPrefs)