-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
58 lines (38 loc) · 1.11 KB
/
__init__.py
File metadata and controls
58 lines (38 loc) · 1.11 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
import bpy
bl_info = {
"name": "Model Validator",
"description": "",
"author": "Game Dev (Vamps)",
"version": (0, 4, 0),
"blender": (2, 83, 0),
"location": "View3D => Header => Overlays",
"wiki_url": "",
"category": "Object"}
modules = (
"preferences",
"properties",
"ui"
)
for mod in modules:
exec(f"from . import {mod}")
def cleanse_modules():
"""search for persistent modules of the plugin in blender python sys.modules and remove them"""
import sys
all_modules = sys.modules
all_modules = dict(
sorted(all_modules.items(), key=lambda x: x[0])) # sort them
for k in all_modules.keys():
if k.startswith(__name__):
del sys.modules[k]
return None
def register():
for mod in modules:
exec(f"{mod}.register()")
bpy.types.Object.mesh_check_statistics = bpy.props.BoolProperty(
name="Toggle Visibility",
default=False)
def unregister():
del bpy.types.Object.mesh_check_statistics
for mod in reversed(modules):
exec(f"{mod}.unregister()")
cleanse_modules()