-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
53 lines (42 loc) · 2.11 KB
/
Copy path__init__.py
File metadata and controls
53 lines (42 loc) · 2.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
bl_info = {
"name": "GreasePress",
"author": "Atlas / OpenAI",
"version": (2, 0, 2),
"blender": (5, 0, 1),
"location": "View3D > Sidebar > GreasePress",
"description": "Page-based Grease Pencil layout with booklet and brochure PDF imposition",
"category": "Grease Pencil",
}
import bpy
from bpy.props import PointerProperty
from bpy.app.handlers import persistent
from . import properties, operators_document, operators_pages, operators_content, operators_textflow, operators_story, operators_styles, operators_master, operators_preflight, operators_imposition, operators_sheets, operators_export, guides, panels
MODULES = (properties, guides, operators_document, operators_pages, operators_content, operators_textflow, operators_story, operators_styles, operators_master, operators_preflight, operators_imposition, operators_sheets, operators_export, panels)
@persistent
def _normalize_images_after_load(_dummy=None):
# During add-on registration Blender may expose _RestrictData, where
# bpy.data.objects is unavailable. Run the migration only after the file
# is fully accessible.
try:
operators_content.normalize_all_image_uvs()
operators_styles.ensure_all_style_collections()
except (AttributeError, RuntimeError):
pass
def _normalize_images_timer():
_normalize_images_after_load()
return None
def register():
for module in MODULES:
module.register()
bpy.types.Scene.editorial_gp = PointerProperty(type=properties.EDITORIALGP_PG_settings)
if _normalize_images_after_load not in bpy.app.handlers.load_post:
bpy.app.handlers.load_post.append(_normalize_images_after_load)
# A zero-delay timer runs after registration, once bpy.data is unrestricted.
bpy.app.timers.register(_normalize_images_timer, first_interval=0.0)
def unregister():
if _normalize_images_after_load in bpy.app.handlers.load_post:
bpy.app.handlers.load_post.remove(_normalize_images_after_load)
if hasattr(bpy.types.Scene, "editorial_gp"):
del bpy.types.Scene.editorial_gp
for module in reversed(MODULES):
module.unregister()