-
Notifications
You must be signed in to change notification settings - Fork 234
/
__init__.py
executable file
·133 lines (109 loc) · 4.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# ***** BEGIN GPL LICENSE BLOCK *****
#
# 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 2
# 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/>
# and write to the Free Software Foundation, Inc., 51 Franklin Street,
# Fifth Floor, Boston, MA 02110-1301, USA..
#
# The Original Code is Copyright (C) 2013-2014 by Gorodetskiy Nikita ###
# All rights reserved.
#
# Contact: sverchok-b3d@ya.ru ###
# Information: http://nikitron.cc.ua/sverchok_en.html ###
#
# The Original Code is: all of this file.
#
# Contributor(s):
# Nedovizin Alexander (aka Cfyzzz)
# Gorodetskiy Nikita (aka Nikitron)
# Linus Yng (aka Ly29)
# Agustin Jimenez (aka AgustinJB)
# Dealga McArdle (aka zeffii)
# Konstantin Vorobiew (aka Kosvor)
# Ilya Portnov (aka portnov)
# Eleanor Howick (aka elfnor)
# Walter Perdan (aka kalwalt)
# Marius Giurgi (aka DolphinDream)
# Victor Doval (aka vicdoval)
# Alex (aka Satabol)
#
# ***** END GPL LICENSE BLOCK *****
#
# -*- coding: utf-8 -*-
bl_info = {
"name": "Sverchok",
"author": "sverchok-b3d@ya.ru various authors see https://github.com/nortikin/sverchok/graphs/contributors",
"version": (1, 2, 0),
"blender": (3, 5, 0),
"location": "Node Editor",
"category": "Node",
"description": "Parametric node-based geometry programming",
"warning": "",
"wiki_url": "https://nortikin.github.io/sverchok/docs/main.html",
"tracker_url": "http://www.blenderartists.org/forum/showthread.php?272679"
}
VERSION = 'v1.3.0-alpha' # looks like the only way to have custom format for the version
reload_event = "import_sverchok" in locals() # reloading does not clear previous module names
# pylint: disable=E0602
# pylint: disable=C0413
# pylint: disable=C0412
def profiling_startup(file_name):
"""Start blender with `blender -- --sv-profile` to create two
files with profiling of Sverchok startup. "imp_stats" file keeps stats of
importing modules and "reg_stats" keeps stats of add-on registration."""
def decorator(func):
from functools import wraps
@wraps(func)
def wrap():
import cProfile
import pstats
profile = cProfile.Profile()
profile.enable()
res = func()
profile.disable()
stats = pstats.Stats(profile)
stats.dump_stats(file_name)
return res
import sys
return wrap if "--sv-profile" in sys.argv else func
return decorator
@profiling_startup("imp_stats")
def import_sverchok():
import sys
# make sverchok the root module name, (if sverchok dir not named exactly "sverchok")
if __name__ != "sverchok":
sys.modules["sverchok"] = sys.modules[__name__]
import sverchok.core as core
imported_modules_ = core.init_architecture()
if "nodes" not in globals(): # magic
raise core.interupted_activation_detected()
if not reload_event:
node_modules_ = core.import_nodes()
else:
node_modules_ = core.handle_reload_event(imported_modules_)
return imported_modules_, node_modules_, core
imported_modules, node_modules, core = import_sverchok()
@profiling_startup("reg_stats")
def register():
from sverchok.utils import ascii_print
core.sv_register_modules(imported_modules)
core.enable_logging()
core.sv_register_modules(core.imported_utils_modules())
core.sv_register_modules(node_modules)
ascii_print.show_welcome()
def unregister():
core.sv_unregister_modules(imported_modules)
core.sv_unregister_modules(core.imported_utils_modules())
core.sv_unregister_modules(node_modules)
core.disable_logging()
# EOF