forked from BenjaminSauder/uv_highlight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
99 lines (76 loc) · 2.27 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
98
99
bl_info = {
"name": "Highlight UV",
"category": "3D View",
"author": "Benjamin Sauder",
"description": "Show uv selections in the scene view",
"version": (0, 2),
"location": "ImageEditor > Tool Shelf",
"blender": (2, 80, 0),
}
if "bpy" in locals():
import importlib
importlib.reload(main)
importlib.reload(render)
importlib.reload(operators)
importlib.reload(props)
importlib.reload(ui)
importlib.reload(prefs)
else:
from . import (
main,
render,
operators,
props,
ui,
prefs,
)
import bpy
from bpy.app.handlers import persistent
# stuff which needs to be registred in blender
classes = [
props.UVHighlightProperties,
operators.UpdateOperator,
operators.HeartBeatOperator,
operators.UVToSelection,
operators.SelectionToUV,
operators.PinIslands,
operators.UnwrapSelectedFaces,
ui.IMAGE_PT_view_UV_HIGHLIGHT,
#ui.IMAGE_PT_tools_UV_HIGHLIGHT,
prefs.UVHIGHLIGHT_PREFS,
]
@persistent
def pre_load_handler(dummy):
if prefs.debug:
print("pre load")
bpy.app.handlers.scene_update_post.remove(main.handle_scene_update)
render.disable()
operators.MOUSE_UPDATE = False
@persistent
def post_load_handler(dummy):
if prefs.debug:
print("post load")
bpy.app.handlers.scene_update_post.append(main.handle_scene_update)
render.enable()
def register():
if prefs.debug:
print("register")
for c in classes:
bpy.utils.register_class(c)
bpy.types.Scene.uv_highlight = bpy.props.PointerProperty(type=props.UVHighlightProperties)
bpy.app.handlers.load_pre.append(pre_load_handler)
bpy.app.handlers.load_post.append(post_load_handler)
bpy.app.handlers.scene_update_post.append(main.handle_scene_update)
operators.MOUSE_UPDATE = False
main.INIT = False
render.enable()
def unregister():
if prefs.debug:
print("unregister")
bpy.app.handlers.scene_update_post.remove(main.handle_scene_update)
render.disable()
operators.MOUSE_UPDATE = False
main.INIT = False
del bpy.types.Scene.uv_highlight
for c in classes:
bpy.utils.unregister_class(c)