-
Notifications
You must be signed in to change notification settings - Fork 3
/
__init__.py
107 lines (89 loc) · 3.65 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
# Copyright (C) 2023 Spencer Magnusson
# Created by Spencer Magnusson
# 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/>.
if 'bpy' in locals():
import importlib
import os
import sys
import types
def reload_package(package):
assert (hasattr(package, '__package__'))
fn = package.__file__
fn_dir = os.path.dirname(fn) + os.sep
module_visit = {fn}
del fn
def reload_recursive_ex(module):
module_iter = (
module_child
for module_child in vars(module).values()
if isinstance(module_child, types.ModuleType)
)
for module_child in module_iter:
fn_child = getattr(module_child, '__file__', None)
if (fn_child is not None) and fn_child.startswith(fn_dir) and fn_child not in module_visit:
# print('Reloading:', fn_child, 'from', module)
module_visit.add(fn_child)
reload_recursive_ex(module_child)
importlib.reload(module)
return reload_recursive_ex(package)
reload_package(sys.modules[__name__])
import bpy
from . import save_load, model, operators, panels, preferences
bl_info = {
'name': 'BLint',
'author': 'Spencer Magnusson',
'version': (1, 4, 0),
'blender': (3, 6, 0),
'description': 'Custom project linting',
'location': 'Scene',
'support': 'COMMUNITY',
'category_icon': 'Scene',
'doc_url': 'https://semagnum.github.io/blint/',
'tracker_url': 'https://github.com/semagnum/blint/issues',
}
properties = [
('lint_rule_active', bpy.props.IntProperty(default=0)),
('lint_issue_active', bpy.props.IntProperty(default=0)),
('lint_issues', bpy.props.CollectionProperty(type=model.LintIssue)),
('blint_form_issue_active', bpy.props.IntProperty(default=0)),
('blint_form_issues', bpy.props.CollectionProperty(type=model.LintIssue)),
('edit_form_collapsed', bpy.props.BoolProperty(name='Edit Selected Rule', default=True)),
('run_form_collapsed', bpy.props.BoolProperty(name='Run on File or Folder', default=True)),
('blint_running_progress', bpy.props.FloatProperty(default=-1.0, subtype='PERCENTAGE')),
('blint_run_path', bpy.props.StringProperty(
name='File or Folder Path',
description='.blend file to evaluate. When folder is selected, '
'BLint selects all .blend files in folder and subfolders.',
subtype='FILE_PATH')
),
('blint_run_fix', bpy.props.BoolProperty(
name='Fix Issues Found',
description='Runs fixes on selected .blend files',
default=False)
),
]
def register():
window_manager = bpy.types.WindowManager
model.register()
preferences.register()
operators.register()
panels.register()
for name, prop in properties:
setattr(window_manager, name, prop)
def unregister():
panels.unregister()
operators.unregister()
preferences.unregister()
model.unregister()
if __name__ == '__main__':
register()