-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy path__init__.py
More file actions
100 lines (83 loc) · 3.56 KB
/
__init__.py
File metadata and controls
100 lines (83 loc) · 3.56 KB
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
# Copyright (C) 2026 Christopher Gearhart
# christopher@bricksbroughttolife.com
# http://bricksbroughttolife.com/
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
bl_info = {
"name" : "AssemblMe",
"author" : "Christopher Gearhart <christopher@bricksbroughttolife.com>",
"version" : (2, 0, 0),
"blender" : (5, 0, 0),
"description" : "Iterative object assembly animations made simple",
"location" : "View3D > Tools > AssemblMe",
"warning" : "",
"doc_url" : "https://www.blendermarket.com/products/assemblme",
"tracker_url" : "https://github.com/bblanimation/assemblme/issues",
"category" : "Animation",
}
# System imports
import os
import getpass
# Blender imports
import bpy
from bpy.props import *
from bpy.types import Scene, Keyframe
from bpy.utils import register_class, unregister_class
# Addon import
from .functions import app_handlers, general, property_callbacks, timers
from .lib.classes_to_register import classes
from .lib import property_groups
def register():
for cls in classes:
register_class(cls)
bpy.props.assemblme_module_name = __name__
bpy.props.assemblme_version = str(bl_info["version"])[1:-1]
bpy.props.assemblme_developer_mode = getpass.getuser().startswith("cgear") and True
bpy.props.assemblme_validated = True
Scene.anim_preset_to_delete = EnumProperty(
name="Preset to Delete",
description="Another list of stored AssemblMe presets",
items=general.get_preset_tuples,
)
Scene.assemblme = PointerProperty(type=property_groups.AssemblMeProperties)
# list properties
Scene.aglist = CollectionProperty(type=property_groups.AnimatedCollectionProperties)
Scene.aglist_index = IntProperty(default=-1, update=property_callbacks.ag_update)
# register app handlers
bpy.app.handlers.load_post.append(timers.register_assemblme_timers)
bpy.app.timers.register(timers.handle_selections)
bpy.app.handlers.load_post.append(app_handlers.convert_velocity_value)
# bpy.app.handlers.load_pre.append(app_handlers.validate_assemblme)
bpy.app.handlers.load_post.append(app_handlers.handle_upconversion)
def unregister():
# unregister app handlers
bpy.app.handlers.load_post.remove(app_handlers.handle_upconversion)
# bpy.app.handlers.load_pre.remove(app_handlers.validate_assemblme)
bpy.app.handlers.load_post.remove(app_handlers.convert_velocity_value)
if bpy.app.timers.is_registered(timers.handle_selections):
bpy.app.timers.unregister(timers.handle_selections)
bpy.app.handlers.load_post.remove(timers.register_assemblme_timers)
del Scene.aglist_index
del Scene.aglist
del Scene.assemblme
del Scene.anim_preset_to_delete
# del Scene.anim_preset
del bpy.props.assemblme_validated
del bpy.props.assemblme_developer_mode
del bpy.props.assemblme_version
del bpy.props.assemblme_module_name
for cls in reversed(classes):
unregister_class(cls)
if __name__ == "__main__":
register()