-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
97 lines (79 loc) · 2.15 KB
/
__init__.py
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
bl_info = {
"name": "Snowman",
"author": "Jam",
"blender": (2, 79, 0),
"location": "3D View > Toolbox",
"description": "Creation of snowmen",
"warning": "",
"category": "Mesh"}
if "bpy" in locals():
import importlib
importlib.reload(ui)
else:
import bpy
from bpy.props import (
StringProperty,
PointerProperty,
IntProperty,
BoolProperty,
FloatProperty
)
from bpy.types import (
AddonPreferences,
PropertyGroup,
)
from . import (
ui
)
from .operators import operators
def update_panel(self, context):
panel = ui.Snowman
if "bl_rna" in panel.__dict__:
bpy.utils.unregister_class(panel)
panel.bl_category = context.user_preferences.addons[__name__].preferences.category
bpy.utils.register_class(panel)
class preferences(AddonPreferences):
bl_idname = __name__
category = StringProperty(
name="Tab Category",
description="Choose a name for the category of the panel",
default="Snowman",
update=update_panel
)
def draw(self, context):
layout = self.layout
row = layout.row()
col = row.column()
col.label(text="Tab Category:")
col.prop(self, "category", text="")
class SnowSettings(PropertyGroup):
ball_amount = IntProperty(
description="Number of balls",
min=1, max=10,
default=3
)
nose_length = FloatProperty(
description="Nose length",
min=1, default=10
)
button_amount = IntProperty(
description="Number of buttons",
min=2, max=10,
default=3
)
classes = (
operators.CreateBody,
operators.CreateFace,
operators.CreateButtons,
operators.CreateHat,
SnowSettings,
preferences,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
update_panel(None, bpy.context)
bpy.types.Scene.snow = PointerProperty(type=SnowSettings)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)