maya-umbrella 0.4.1__py2.py3-none-any.whl → 0.6.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of maya-umbrella might be problematic. Click here for more details.
- maya_umbrella/__init__.py +6 -2
- maya_umbrella/__version__.py +1 -1
- maya_umbrella/cleaner.py +111 -0
- maya_umbrella/collector.py +411 -0
- maya_umbrella/constants.py +17 -0
- maya_umbrella/defender.py +161 -0
- maya_umbrella/filesystem.py +151 -26
- maya_umbrella/hooks/delete_turtle.py +3 -3
- maya_umbrella/hooks/delete_unknown_plugin_node.py +4 -3
- maya_umbrella/hooks/fix_model_panel.py +2 -2
- maya_umbrella/hooks/fix_on_model_change_3dc.py +3 -3
- maya_umbrella/i18n.py +76 -0
- maya_umbrella/locales/en_US.json +19 -0
- maya_umbrella/locales/zh_CN.json +19 -0
- maya_umbrella/maya_funs.py +136 -0
- maya_umbrella/scanner.py +101 -0
- maya_umbrella/signatures.py +10 -0
- maya_umbrella/vaccine.py +18 -203
- maya_umbrella/vaccines/vaccine1.py +3 -2
- maya_umbrella/vaccines/vaccine2.py +23 -31
- maya_umbrella/vaccines/vaccine3.py +38 -36
- {maya_umbrella-0.4.1.dist-info → maya_umbrella-0.6.0.dist-info}/METADATA +75 -6
- maya_umbrella-0.6.0.dist-info/RECORD +28 -0
- maya_umbrella/core.py +0 -117
- maya_umbrella-0.4.1.dist-info/RECORD +0 -20
- {maya_umbrella-0.4.1.dist-info → maya_umbrella-0.6.0.dist-info}/LICENSE +0 -0
- {maya_umbrella-0.4.1.dist-info → maya_umbrella-0.6.0.dist-info}/WHEEL +0 -0
|
@@ -1,34 +1,42 @@
|
|
|
1
1
|
# Import built-in modules
|
|
2
2
|
import glob
|
|
3
|
-
import os
|
|
4
|
-
import re
|
|
5
|
-
|
|
6
|
-
# Import third-party modules
|
|
7
|
-
import maya.cmds as cmds
|
|
3
|
+
import os
|
|
8
4
|
|
|
9
5
|
# Import local modules
|
|
10
|
-
from maya_umbrella.
|
|
11
|
-
from maya_umbrella.filesystem import
|
|
6
|
+
from maya_umbrella.constants import JOB_SCRIPTS_VIRUS_SIGNATURES
|
|
7
|
+
from maya_umbrella.filesystem import check_virus_by_signature
|
|
8
|
+
from maya_umbrella.filesystem import check_virus_file_by_signature
|
|
9
|
+
from maya_umbrella.maya_funs import cmds
|
|
10
|
+
from maya_umbrella.maya_funs import get_attr_value
|
|
11
|
+
from maya_umbrella.maya_funs import get_reference_file_by_node
|
|
12
|
+
from maya_umbrella.maya_funs import is_maya_standalone
|
|
12
13
|
from maya_umbrella.vaccine import AbstractVaccine
|
|
13
14
|
|
|
14
15
|
|
|
15
16
|
class Vaccine(AbstractVaccine):
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
"""A class for handling the virus2024429 virus."""
|
|
18
|
+
|
|
19
|
+
virus_name = "Virus2024429"
|
|
18
20
|
|
|
19
|
-
def
|
|
21
|
+
def collect_infected_nodes(self):
|
|
20
22
|
"""Collect all bad nodes related to the virus."""
|
|
21
23
|
for script_node in cmds.ls(type="script"):
|
|
22
|
-
if cmds.referenceQuery(script_node, isNodeReferenced=True):
|
|
23
|
-
continue
|
|
24
|
-
# check uifiguration
|
|
25
|
-
if cmds.objExists("{}.KGMScriptProtector".format(script_node)):
|
|
26
|
-
self.api.add_bad_node(script_node)
|
|
27
24
|
# check vaccine
|
|
28
25
|
if "_gene" in script_node:
|
|
29
|
-
self.
|
|
26
|
+
self.report_issue(script_node)
|
|
27
|
+
self.api.add_infected_node(script_node)
|
|
28
|
+
self.api.add_infected_reference_file(get_reference_file_by_node(script_node))
|
|
29
|
+
if "uifiguration" in script_node:
|
|
30
|
+
for attr_name in ("before", "notes"):
|
|
31
|
+
script_string = get_attr_value(script_node, attr_name)
|
|
32
|
+
if not script_string:
|
|
33
|
+
continue
|
|
34
|
+
if check_virus_by_signature(script_string, JOB_SCRIPTS_VIRUS_SIGNATURES):
|
|
35
|
+
self.report_issue(script_node)
|
|
36
|
+
self.api.add_infected_node(script_node)
|
|
37
|
+
self.api.add_infected_reference_file(get_reference_file_by_node(script_node))
|
|
30
38
|
|
|
31
|
-
def
|
|
39
|
+
def collect_infected_mel_files(self):
|
|
32
40
|
"""Collect all bad MEL files related to the virus."""
|
|
33
41
|
# check usersetup.mel
|
|
34
42
|
# C:/Users/hallong/Documents/maya/scripts/usersetup.mel
|
|
@@ -38,9 +46,9 @@ class Vaccine(AbstractVaccine):
|
|
|
38
46
|
os.path.join(self.api.user_script_path, "usersetup.mel"),
|
|
39
47
|
]:
|
|
40
48
|
if os.path.exists(usersetup_mel):
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
self.api.
|
|
49
|
+
if check_virus_file_by_signature(usersetup_mel):
|
|
50
|
+
self.report_issue(usersetup_mel)
|
|
51
|
+
self.api.add_infected_file(usersetup_mel)
|
|
44
52
|
|
|
45
53
|
def collect_script_jobs(self):
|
|
46
54
|
"""Collect all script jobs related to the virus."""
|
|
@@ -48,31 +56,25 @@ class Vaccine(AbstractVaccine):
|
|
|
48
56
|
"leukocyte",
|
|
49
57
|
"execute",
|
|
50
58
|
]
|
|
51
|
-
|
|
52
59
|
for script_job in cmds.scriptJob(listJobs=True):
|
|
53
60
|
for virus in virus_gene:
|
|
54
61
|
if virus in script_job:
|
|
55
|
-
self.api.
|
|
62
|
+
self.api.add_infected_script_job(script_job)
|
|
56
63
|
|
|
57
64
|
def fix_bad_hik_files(self):
|
|
58
65
|
"""Fix all bad HIK files related to the virus."""
|
|
59
66
|
pattern = os.path.join(self.api.maya_install_root, "resources/l10n/*/plug-ins/mayaHIK.pres.mel")
|
|
60
67
|
for hik_mel in glob.glob(pattern):
|
|
61
|
-
|
|
62
|
-
data = f.read()
|
|
63
|
-
try:
|
|
64
|
-
check = re.findall(self.hik_regex, data)
|
|
65
|
-
except TypeError:
|
|
66
|
-
check = []
|
|
67
|
-
if len(check) > 0:
|
|
68
|
+
if check_virus_file_by_signature(hik_mel):
|
|
68
69
|
self.report_issue(hik_mel)
|
|
69
|
-
|
|
70
|
-
f.write(re.sub(self.hik_regex, "", data))
|
|
71
|
-
self.logger.info("Remove virus code from %s", hik_mel)
|
|
70
|
+
self.api.add_infected_file(hik_mel)
|
|
72
71
|
|
|
73
72
|
def collect_issues(self):
|
|
74
73
|
"""Collect all issues related to the virus."""
|
|
75
|
-
self.api.
|
|
76
|
-
self.
|
|
77
|
-
self.
|
|
78
|
-
|
|
74
|
+
self.api.add_malicious_file(os.path.join(os.getenv("APPDATA"), "syssst"))
|
|
75
|
+
self.collect_infected_mel_files()
|
|
76
|
+
self.collect_infected_nodes()
|
|
77
|
+
# This only works for Maya Gui model.
|
|
78
|
+
if not is_maya_standalone():
|
|
79
|
+
self.collect_script_jobs()
|
|
80
|
+
self.api.add_additionally_fix_function(self.fix_bad_hik_files)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: maya_umbrella
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Check and fix maya virus.
|
|
5
5
|
Home-page: https://github.com/loonghao/maya_umbrella
|
|
6
6
|
License: MIT
|
|
@@ -28,8 +28,9 @@ Description-Content-Type: text/markdown
|
|
|
28
28
|
[](https://img.shields.io/pypi/pyversions/maya-umbrella)
|
|
29
29
|
[](https://github.com/wntrblm/nox)
|
|
30
30
|
[](https://pypi.org/project/maya-umbrella/)
|
|
31
|
-
[](https://pepy.tech/project/maya-umbrella)
|
|
31
|
+
[](https://pepy.tech/project/maya-umbrella)
|
|
32
|
+
[](https://pepy.tech/project/maya-umbrella)
|
|
33
|
+
[](https://pepy.tech/project/maya-umbrella)
|
|
33
34
|
[](https://pypi.org/project/maya-umbrella/)
|
|
34
35
|
[](https://pypi.org/project/maya-umbrella/)
|
|
35
36
|
[](https://github.com/loonghao/maya-umbrella/graphs/commit-activity)
|
|
@@ -42,13 +43,33 @@ Description-Content-Type: text/markdown
|
|
|
42
43
|
[](https://img.shields.io/badge/maya-2018-green)
|
|
43
44
|
|
|
44
45
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
45
|
-
[](#contributors-)
|
|
46
47
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
47
48
|
|
|
48
|
-
|
|
49
|
+
This tool is designed to provide a robust solution for identifying and resolving any potential viruses within Autodesk
|
|
50
|
+
Maya.
|
|
51
|
+
It ensures a secure and seamless user experience by proactively scanning for threats and effectively neutralizing them.
|
|
49
52
|
|
|
53
|
+
It can be provided as an API for seamless integration into your existing pipeline.
|
|
50
54
|
|
|
51
|
-
#
|
|
55
|
+
# 安装
|
|
56
|
+
maya_umbrella是以标准pipy包去发布的,所以我们可以通过pip install去安装
|
|
57
|
+
```shell
|
|
58
|
+
your/maya-root/mayapy -m pip install maya-umbrella
|
|
59
|
+
```
|
|
60
|
+
更新版本
|
|
61
|
+
```shell
|
|
62
|
+
your/maya-root/mayapy -m pip install maya-umbrella --upgrade
|
|
63
|
+
```
|
|
64
|
+
卸载
|
|
65
|
+
```shell
|
|
66
|
+
your/maya-root/mayapy -m pip uninstall maya-umbrella
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
# 开发环境设置
|
|
70
|
+
|
|
71
|
+
Set up the development environment using a virtual environment,
|
|
72
|
+
and it is recommended to use Python 3.8 or higher versions.
|
|
52
73
|
|
|
53
74
|
通过虚拟环境去设置开发环境, 推荐python-3.8以上的版本
|
|
54
75
|
|
|
@@ -88,6 +109,14 @@ manual_test_in_maya.start()
|
|
|
88
109
|
nox -s ruff_check
|
|
89
110
|
```
|
|
90
111
|
|
|
112
|
+
# 生成安装包
|
|
113
|
+
|
|
114
|
+
执行下面的命令可以在<repo>/.zip下面创建zip,参数 `--version` 当前工具的版本号
|
|
115
|
+
|
|
116
|
+
```shell
|
|
117
|
+
nox -s make-zip -- --version 0.5.0
|
|
118
|
+
```
|
|
119
|
+
|
|
91
120
|
# 环境变量
|
|
92
121
|
|
|
93
122
|
我们可以通过下列环境变量去修改maya_umbrella的一些设置,方便有pipeline的公司可以更好的集成
|
|
@@ -108,6 +137,45 @@ MAYA_UMBRELLA_LOG_NAME
|
|
|
108
137
|
|
|
109
138
|
```shell
|
|
110
139
|
MAYA_UMBRELLA_LOG_LEVEL
|
|
140
|
+
```
|
|
141
|
+
修改杀毒后文件的备份文件夹名称, 默认是`_virus`
|
|
142
|
+
比如:
|
|
143
|
+
你文件路径是 `c:/your/path/file.ma`
|
|
144
|
+
那么备份文件路径是 `c:/your/path/_maya_umbrella/file.ma`
|
|
145
|
+
```shell
|
|
146
|
+
MAYA_UMBRELLA_BACKUP_FOLDER_NAME
|
|
147
|
+
```
|
|
148
|
+
默认的显示语言,包含日志打印输出等,默认是根据你当前maya的界面语言来设置的,当然我们也可以通过下面的环境变量去设置
|
|
149
|
+
```shell
|
|
150
|
+
MAYA_UMBRELLA_LANG
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
忽略保存到备份文件夹,*请注意,如果你不清楚这个会导致的后果请不要轻易修改*,默认批量杀毒后会把源文件自动备份到当前文件的备份文件夹.
|
|
154
|
+
```shell
|
|
155
|
+
MAYA_UMBRELLA_IGNORE_BACKUP
|
|
156
|
+
```
|
|
157
|
+
如果忽略请设置为
|
|
158
|
+
```shell
|
|
159
|
+
SET MAYA_UMBRELLA_IGNORE_BACKUP=true
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
# API
|
|
163
|
+
获取当前场景没有被修复的病毒文件
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
from maya_umbrella import MayaVirusDefender
|
|
167
|
+
|
|
168
|
+
api = MayaVirusDefender()
|
|
169
|
+
print(api.get_unfixed_references())
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
批量修复文件
|
|
173
|
+
```python
|
|
174
|
+
from maya_umbrella import MayaVirusScanner
|
|
175
|
+
|
|
176
|
+
api = MayaVirusScanner()
|
|
177
|
+
print(api.scan_files_from_pattern("your/path/*.m[ab]"))
|
|
178
|
+
|
|
111
179
|
```
|
|
112
180
|
|
|
113
181
|
## Contributors ✨
|
|
@@ -124,6 +192,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
|
|
|
124
192
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/hotwinter0"><img src="https://avatars.githubusercontent.com/u/106237305?v=4?s=100" width="100px;" alt="hotwinter0"/><br /><sub><b>hotwinter0</b></sub></a><br /><a href="https://github.com/loonghao/maya_umbrella/commits?author=hotwinter0" title="Tests">⚠️</a> <a href="https://github.com/loonghao/maya_umbrella/commits?author=hotwinter0" title="Code">💻</a></td>
|
|
125
193
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/lingyunfx"><img src="https://avatars.githubusercontent.com/u/73666629?v=4?s=100" width="100px;" alt="lingyunfx"/><br /><sub><b>lingyunfx</b></sub></a><br /><a href="https://github.com/loonghao/maya_umbrella/commits?author=lingyunfx" title="Tests">⚠️</a></td>
|
|
126
194
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yjjjj"><img src="https://avatars.githubusercontent.com/u/12741735?v=4?s=100" width="100px;" alt="yjjjj"/><br /><sub><b>yjjjj</b></sub></a><br /><a href="https://github.com/loonghao/maya_umbrella/commits?author=yjjjj" title="Tests">⚠️</a> <a href="https://github.com/loonghao/maya_umbrella/commits?author=yjjjj" title="Code">💻</a></td>
|
|
195
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/uncleschen"><img src="https://avatars.githubusercontent.com/u/37014389?v=4?s=100" width="100px;" alt="Unclechen"/><br /><sub><b>Unclechen</b></sub></a><br /><a href="https://github.com/loonghao/maya_umbrella/commits?author=uncleschen" title="Tests">⚠️</a></td>
|
|
127
196
|
</tr>
|
|
128
197
|
</tbody>
|
|
129
198
|
</table>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
maya_umbrella/__init__.py,sha256=uHgbJ-AL3NOfDNB55_7a4_c-OAuP4X8eQ_Yi1udaA0I,401
|
|
2
|
+
maya_umbrella/__version__.py,sha256=cID1jLnC_vj48GgMN6Yb1FA3JsQ95zNmCHmRYE8TFhY,22
|
|
3
|
+
maya_umbrella/cleaner.py,sha256=5EC3w4qRkIsr9AIZneEV8ljhxaOw385Gj2C2KTrzyJg,5044
|
|
4
|
+
maya_umbrella/collector.py,sha256=rAFmvY8Isdle89ezn2-H36hSJd77iBvPBLRPzruCycA,13111
|
|
5
|
+
maya_umbrella/constants.py,sha256=2sl0dL0U82mwu-Msda9B8-USxr89Wu2yu6SYiuaaJZk,539
|
|
6
|
+
maya_umbrella/defender.py,sha256=K5EERl9bwd0IY_ilvnNYXYaQpIe-DUGep-buEb3qLV8,5601
|
|
7
|
+
maya_umbrella/filesystem.py,sha256=CY3MlOXi_fJ8NTITvgotyPiZHyzM4uZQTgMmOYD25T0,8333
|
|
8
|
+
maya_umbrella/hooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
maya_umbrella/hooks/delete_turtle.py,sha256=OPFRFH1iwonHvETndrP87MZQlJLhxpe564AJE3KyJY8,761
|
|
10
|
+
maya_umbrella/hooks/delete_unknown_plugin_node.py,sha256=xbJvihfjZBhF946ugVqj2IpY_VjOBZt_8KO5omDrJhw,1281
|
|
11
|
+
maya_umbrella/hooks/fix_model_panel.py,sha256=dLuMOz5uQ1nqAboNWMCx-Bi_gHM3FQNTlGxPG5wRYEs,556
|
|
12
|
+
maya_umbrella/hooks/fix_on_model_change_3dc.py,sha256=o4WEQPcHNzaTMXdNnHZWWNCYlHfLxcSFYXR4YW0ZLwk,484
|
|
13
|
+
maya_umbrella/i18n.py,sha256=NCC6isPdchv3yRBS2F4Cguu1bVyi0VoMMcI4YOIxBtU,2683
|
|
14
|
+
maya_umbrella/locales/en_US.json,sha256=LW2gPgO2YJIYR5UfcIBuxW_DS7rf4gkjeVuADqs1V5s,962
|
|
15
|
+
maya_umbrella/locales/zh_CN.json,sha256=UsuRN2yaxxc9LE-7NQkbMqrkjXjNhNegS0QRkQLSTiE,1006
|
|
16
|
+
maya_umbrella/log.py,sha256=IJweFEBTThL6_mW86jAAPKyWNvI79CrMifs5vO3t6ks,1338
|
|
17
|
+
maya_umbrella/maya_funs.py,sha256=WDvREjzLfEsPND0RU-2ErbWgsU6MsILqVBW219p8sZo,3394
|
|
18
|
+
maya_umbrella/scanner.py,sha256=zqo7_Znu1OLI7WrqPBgU1aAxlp19UKVI24s2E-xC6Z8,3710
|
|
19
|
+
maya_umbrella/signatures.py,sha256=RkEXChch7tdqA9Yq6YQ8AMnK2ra6ih0dfnpeZy5FkYs,354
|
|
20
|
+
maya_umbrella/vaccine.py,sha256=aBW6pdT4tD4OMBPZ-d3E4_n16Rylz-2gb7JWzMZVPK0,1022
|
|
21
|
+
maya_umbrella/vaccines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
+
maya_umbrella/vaccines/vaccine1.py,sha256=WLo1uJElTLSjVCf5CBtRNU4HKs63my5mkHiGqTfnNEE,489
|
|
23
|
+
maya_umbrella/vaccines/vaccine2.py,sha256=yvHpnrQ6Jts9_zCy8WRJcbxz0CVSRAPkn2vF552atQs,2123
|
|
24
|
+
maya_umbrella/vaccines/vaccine3.py,sha256=d89Ocj1AmsZt9YJjggjDJqAWXcckGLMl-6u8jXeAPjg,3493
|
|
25
|
+
maya_umbrella-0.6.0.dist-info/LICENSE,sha256=tJf0Pz8q_65AjEkm3872K1cl4jGil28vJO5Ko_LhUqc,1060
|
|
26
|
+
maya_umbrella-0.6.0.dist-info/METADATA,sha256=JYAKRBCSJIq-vbrfRfehI97VuZPzAyyTo9drpkgofI0,9178
|
|
27
|
+
maya_umbrella-0.6.0.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
|
|
28
|
+
maya_umbrella-0.6.0.dist-info/RECORD,,
|
maya_umbrella/core.py
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
# Import built-in modules
|
|
2
|
-
import logging
|
|
3
|
-
|
|
4
|
-
# Import third-party modules
|
|
5
|
-
import maya.api.OpenMaya as om
|
|
6
|
-
import maya.cmds as cmds
|
|
7
|
-
|
|
8
|
-
# Import local modules
|
|
9
|
-
from maya_umbrella.filesystem import get_hooks
|
|
10
|
-
from maya_umbrella.filesystem import get_vaccines
|
|
11
|
-
from maya_umbrella.filesystem import load_hook
|
|
12
|
-
from maya_umbrella.log import setup_logger
|
|
13
|
-
from maya_umbrella.vaccine import MayaVirusCleaner
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
class MayaVirusDefender(object):
|
|
17
|
-
callback_ids = []
|
|
18
|
-
remove_callbacks = []
|
|
19
|
-
_bad_files = []
|
|
20
|
-
_vaccines = []
|
|
21
|
-
callback_maps = {
|
|
22
|
-
"after_open": om.MSceneMessage.kAfterOpen,
|
|
23
|
-
"maya_initialized": om.MSceneMessage.kMayaInitialized,
|
|
24
|
-
"after_import": om.MSceneMessage.kAfterImport,
|
|
25
|
-
"after_import_reference": om.MSceneMessage.kAfterImportReference,
|
|
26
|
-
"after_load_reference": om.MSceneMessage.kAfterLoadReference,
|
|
27
|
-
"before_save": om.MSceneMessage.kBeforeSave,
|
|
28
|
-
"before_import": om.MSceneMessage.kBeforeImport,
|
|
29
|
-
"before_load_reference": om.MSceneMessage.kBeforeLoadReference,
|
|
30
|
-
"before_import_reference": om.MSceneMessage.kBeforeImportReference,
|
|
31
|
-
"maya_exiting": om.MSceneMessage.kMayaExiting,
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
def __init__(self, auto_fix=True):
|
|
35
|
-
"""Initialize the MayaVirusDefender.
|
|
36
|
-
|
|
37
|
-
Args:
|
|
38
|
-
auto_fix (bool): Whether to automatically fix issues.
|
|
39
|
-
"""
|
|
40
|
-
logger = logging.getLogger(__name__)
|
|
41
|
-
self.auto_fix = auto_fix
|
|
42
|
-
self.logger = setup_logger(logger)
|
|
43
|
-
self.virus_cleaner = MayaVirusCleaner(self.logger)
|
|
44
|
-
self.load_vaccines()
|
|
45
|
-
|
|
46
|
-
def load_vaccines(self):
|
|
47
|
-
"""Load all vaccines."""
|
|
48
|
-
for vaccine in get_vaccines():
|
|
49
|
-
vaccine_class = load_hook(vaccine).Vaccine
|
|
50
|
-
try:
|
|
51
|
-
self._vaccines.append(vaccine_class(api=self.virus_cleaner, logger=self.logger))
|
|
52
|
-
except Exception as e:
|
|
53
|
-
self.logger.error("Error loading vaccine: %s", e)
|
|
54
|
-
|
|
55
|
-
@property
|
|
56
|
-
def vaccines(self):
|
|
57
|
-
"""Get all loaded vaccines.
|
|
58
|
-
|
|
59
|
-
Returns:
|
|
60
|
-
list: A list of loaded vaccines.
|
|
61
|
-
"""
|
|
62
|
-
return self._vaccines
|
|
63
|
-
|
|
64
|
-
def run_hooks(self):
|
|
65
|
-
"""Run all hooks, only works in non-batch mode."""
|
|
66
|
-
if not cmds.about(batch=True):
|
|
67
|
-
for hook_file in get_hooks():
|
|
68
|
-
self.logger.debug("run_hook: %s", hook_file)
|
|
69
|
-
try:
|
|
70
|
-
load_hook(hook_file).hook(virus_cleaner=self.virus_cleaner)
|
|
71
|
-
except Exception as e:
|
|
72
|
-
self.logger.error("Error running hook: %s", e)
|
|
73
|
-
|
|
74
|
-
def collect(self):
|
|
75
|
-
"""Collect all issues related to the Maya virus."""
|
|
76
|
-
for vaccine in self.vaccines:
|
|
77
|
-
vaccine.collect_issues()
|
|
78
|
-
|
|
79
|
-
def fix(self):
|
|
80
|
-
"""Fix all issues related to the Maya virus."""
|
|
81
|
-
self.virus_cleaner.fix_all_issues()
|
|
82
|
-
|
|
83
|
-
def report(self):
|
|
84
|
-
"""Report all issues related to the Maya virus."""
|
|
85
|
-
self.virus_cleaner.reset_all_issues()
|
|
86
|
-
self.collect()
|
|
87
|
-
self.virus_cleaner.report_all_issues()
|
|
88
|
-
|
|
89
|
-
def setup(self):
|
|
90
|
-
"""Set up the MayaVirusDefender."""
|
|
91
|
-
self.virus_cleaner.setup_default_callbacks()
|
|
92
|
-
for name, callbacks in self.virus_cleaner.registered_callbacks.items():
|
|
93
|
-
maya_callback = self.callback_maps[name]
|
|
94
|
-
self.logger.debug("%s setup.", name)
|
|
95
|
-
for func in callbacks:
|
|
96
|
-
self.callback_ids.append(om.MSceneMessage.addCallback(maya_callback, func))
|
|
97
|
-
for name, callbacks in self.callback_maps.items():
|
|
98
|
-
self.logger.debug("setup callback %s.", name)
|
|
99
|
-
self.callback_ids.append(om.MSceneMessage.addCallback(callbacks, self._callback))
|
|
100
|
-
|
|
101
|
-
def _callback(self, *args, **kwargs):
|
|
102
|
-
"""Callback function for MayaVirusDefender.
|
|
103
|
-
|
|
104
|
-
Args:
|
|
105
|
-
*args: Variable length argument list.
|
|
106
|
-
**kwargs: Arbitrary keyword arguments.
|
|
107
|
-
"""
|
|
108
|
-
if self.auto_fix:
|
|
109
|
-
self.collect()
|
|
110
|
-
self.fix()
|
|
111
|
-
self.run_hooks()
|
|
112
|
-
else:
|
|
113
|
-
self.report()
|
|
114
|
-
|
|
115
|
-
def start(self):
|
|
116
|
-
"""Start the MayaVirusDefender."""
|
|
117
|
-
self._callback()
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
maya_umbrella/__init__.py,sha256=039hJesYFSc1aXypFRo1PVQvqowJJ9Q_bAdfcEQI2qk,106
|
|
2
|
-
maya_umbrella/__version__.py,sha256=pMtTmSUht-XtbR_7Doz6bsQqopJJd8rZ8I8zy2HwwoA,22
|
|
3
|
-
maya_umbrella/constants.py,sha256=SuD8OP8e0Kh3a9ohyS5_MXjo5pHNQ8MWEPtJ6puZfIU,130
|
|
4
|
-
maya_umbrella/core.py,sha256=kUaDyDPwD92e2D3GIRPRUMZ2MAnf7DlaGBbBl753NwY,4112
|
|
5
|
-
maya_umbrella/filesystem.py,sha256=EwOtPvl9UhjOu2YYW1hyIbmqsdcseu6ye0Bnuzf2khU,4125
|
|
6
|
-
maya_umbrella/hooks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
|
-
maya_umbrella/hooks/delete_turtle.py,sha256=G5zzMFn9L9lSydvFiscUIqSgLbHZlWUV0lfUtnhvQUw,734
|
|
8
|
-
maya_umbrella/hooks/delete_unknown_plugin_node.py,sha256=PxufrH9eqUP6Y28bseTWmCaO_0M4zeHzexIJpws9Q2U,1246
|
|
9
|
-
maya_umbrella/hooks/fix_model_panel.py,sha256=DLXPo_E9Q1C6a3Dpye4jWCSqfjZxG0iBduMhORV5vKo,546
|
|
10
|
-
maya_umbrella/hooks/fix_on_model_change_3dc.py,sha256=PPnU70Ed_TW9j5nkQnbQ2EEGVo5jm5T6gimzOQYbgCY,457
|
|
11
|
-
maya_umbrella/log.py,sha256=IJweFEBTThL6_mW86jAAPKyWNvI79CrMifs5vO3t6ks,1338
|
|
12
|
-
maya_umbrella/vaccine.py,sha256=W6JhnA7j4rjltF8jIoAXVMFq3v1d_dTyZaQGhq2dkWk,7033
|
|
13
|
-
maya_umbrella/vaccines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
maya_umbrella/vaccines/vaccine1.py,sha256=oM41xlB49YPl_S760TqFyosDVIAIZOzsqkcL5sh679s,430
|
|
15
|
-
maya_umbrella/vaccines/vaccine2.py,sha256=XRnQFSvbTXxgr8FZ8eU6s_h_Uwyt429a93gyfDyglic,2526
|
|
16
|
-
maya_umbrella/vaccines/vaccine3.py,sha256=KLGSSLPqTjrVjcrT65wQNuM31MoDBFTc0kmAoLzu2NI,3053
|
|
17
|
-
maya_umbrella-0.4.1.dist-info/LICENSE,sha256=tJf0Pz8q_65AjEkm3872K1cl4jGil28vJO5Ko_LhUqc,1060
|
|
18
|
-
maya_umbrella-0.4.1.dist-info/METADATA,sha256=Vx3UbEyZHJnpJtVk2nak1RUgU4ZZ1MDjEm84CcdzcJo,6710
|
|
19
|
-
maya_umbrella-0.4.1.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
|
|
20
|
-
maya_umbrella-0.4.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|