maya-umbrella 0.6.1__py2.py3-none-any.whl → 0.7.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.

@@ -1 +1 @@
1
- __version__ = "0.6.1"
1
+ __version__ = "0.7.0"
@@ -10,6 +10,7 @@ try:
10
10
  import maya.api.OpenMaya as om
11
11
  import maya.cmds as cmds
12
12
  import maya.mel as mel
13
+ import maya.standalone as maya_standalone
13
14
  except ImportError:
14
15
  # Backward compatibility to support test in uinstalled maya.
15
16
  try:
@@ -21,8 +22,10 @@ except ImportError:
21
22
  cmds = MagicMock()
22
23
  om = MagicMock()
23
24
  mel = MagicMock()
25
+ maya_standalone = MagicMock()
24
26
 
25
27
  # Import built-in modules
28
+ from contextlib import contextmanager
26
29
  from functools import wraps
27
30
 
28
31
 
@@ -99,6 +102,7 @@ def block_prompt(func):
99
102
  Returns:
100
103
  function: The decorated function.
101
104
  """
105
+
102
106
  @wraps(func)
103
107
  def wrap(*args, **kwargs):
104
108
  # Grabs the initial value.
@@ -134,3 +138,10 @@ def save_as_file(file_name):
134
138
  """
135
139
  cmds.file(rename=file_name)
136
140
  cmds.file(s=True, f=True)
141
+
142
+
143
+ @contextmanager
144
+ def maya_standalone_context():
145
+ maya_standalone.initialize()
146
+ yield cmds
147
+ maya_standalone.uninitialize()
maya_umbrella/scanner.py CHANGED
@@ -64,7 +64,6 @@ class MayaVirusScanner(object):
64
64
  self.defender = defender
65
65
  for maya_file in files:
66
66
  self._fix(maya_file)
67
- while len(self._reference_files) > 0:
68
67
  for ref in self._reference_files:
69
68
  self._fix(ref)
70
69
  return self._fixed_files
@@ -92,7 +91,9 @@ class MayaVirusScanner(object):
92
91
  maya_funs.open_maya_file(maya_file)
93
92
  self.defender.collect()
94
93
  except Exception:
94
+ self.logger.debug("failed to open maya file: {maya_file}".format(maya_file=maya_file))
95
95
  self._failed_files.append(maya_file)
96
+
96
97
  if self.defender.have_issues:
97
98
  self.defender.fix()
98
99
  backup_path = get_backup_path(maya_file, root_path=self.output_path)
@@ -101,6 +102,4 @@ class MayaVirusScanner(object):
101
102
  cmds.file(s=True, f=True)
102
103
  self._fixed_files.append(maya_file)
103
104
  self._reference_files.extend(self.defender.collector.infected_reference_files)
104
- if maya_file in self._reference_files:
105
- self._reference_files.remove(maya_file)
106
105
  cmds.file(new=True, force=True)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maya_umbrella
3
- Version: 0.6.1
3
+ Version: 0.7.0
4
4
  Summary: Check and fix maya virus.
5
5
  Home-page: https://github.com/loonghao/maya_umbrella
6
6
  License: MIT
@@ -43,7 +43,7 @@ Description-Content-Type: text/markdown
43
43
  [![maya-2018](https://img.shields.io/badge/maya-2018-green)](https://img.shields.io/badge/maya-2018-green)
44
44
 
45
45
  <!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
46
- [![All Contributors](https://img.shields.io/badge/all_contributors-5-orange.svg?style=flat-square)](#contributors-)
46
+ [![All Contributors](https://img.shields.io/badge/all_contributors-8-orange.svg?style=flat-square)](#contributors-)
47
47
  <!-- ALL-CONTRIBUTORS-BADGE:END -->
48
48
 
49
49
  This tool is designed to provide a robust solution for identifying and resolving any potential viruses within Autodesk
@@ -141,7 +141,7 @@ MAYA_UMBRELLA_LOG_LEVEL
141
141
  修改杀毒后文件的备份文件夹名称, 默认是`_virus`
142
142
  比如:
143
143
  你文件路径是 `c:/your/path/file.ma`
144
- 那么备份文件路径是 `c:/your/path/_maya_umbrella/file.ma`
144
+ 那么备份文件路径是 `c:/your/path/_virus/file.ma`
145
145
  ```shell
146
146
  MAYA_UMBRELLA_BACKUP_FOLDER_NAME
147
147
  ```
@@ -169,7 +169,7 @@ api = MayaVirusDefender()
169
169
  print(api.get_unfixed_references())
170
170
  ```
171
171
 
172
- 批量修复文件
172
+ 批量修复文件, 通过正则表达式
173
173
  ```python
174
174
  from maya_umbrella import MayaVirusScanner
175
175
 
@@ -178,6 +178,16 @@ print(api.scan_files_from_pattern("your/path/*.m[ab]"))
178
178
 
179
179
  ```
180
180
 
181
+ # 案例
182
+ 如果你想要快速通过maya standalone去批量清理maya文件,可以`下载`或者`git clone`当前`main`分支的工程,
183
+ 根据上面指引设置好开发环境
184
+ 通过`nox`命令去启动maya standalone环境,maya版本根据你当前本地安装的maya为准,比如你本地安装了`2018`,
185
+ 那么就是 `nox -s maya-2018-s`
186
+ 下面的语法是启动一个maya-2020的环境去动态从`c:/test`文件夹下去查杀病毒
187
+ ```shell
188
+ nox -s maya-2020-s -- c:/test/*.m[ab]
189
+ ```
190
+
181
191
  ## Contributors ✨
182
192
 
183
193
  Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
@@ -193,6 +203,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
193
203
  <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>
194
204
  <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
205
  <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>
206
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/CGRnDStudio"><img src="https://avatars.githubusercontent.com/u/8320794?v=4?s=100" width="100px;" alt="andyvfx"/><br /><sub><b>andyvfx</b></sub></a><br /><a href="https://github.com/loonghao/maya_umbrella/commits?author=CGRnDStudio" title="Code">💻</a></td>
207
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/cundesi"><img src="https://avatars.githubusercontent.com/u/15829469?v=4?s=100" width="100px;" alt="cundesi"/><br /><sub><b>cundesi</b></sub></a><br /><a href="https://github.com/loonghao/maya_umbrella/commits?author=cundesi" title="Code">💻</a></td>
208
+ </tr>
209
+ <tr>
210
+ <td align="center" valign="top" width="14.28%"><a href="https://github.com/Wenfeng-Zhang"><img src="https://avatars.githubusercontent.com/u/54899080?v=4?s=100" width="100px;" alt="Wenfeng Zhang"/><br /><sub><b>Wenfeng Zhang</b></sub></a><br /><a href="https://github.com/loonghao/maya_umbrella/commits?author=Wenfeng-Zhang" title="Tests">⚠️</a> <a href="https://github.com/loonghao/maya_umbrella/commits?author=Wenfeng-Zhang" title="Code">💻</a></td>
196
211
  </tr>
197
212
  </tbody>
198
213
  </table>
@@ -1,5 +1,5 @@
1
1
  maya_umbrella/__init__.py,sha256=uHgbJ-AL3NOfDNB55_7a4_c-OAuP4X8eQ_Yi1udaA0I,401
2
- maya_umbrella/__version__.py,sha256=baAcEjLSYFIeNZF51tOMmA_zAMhN8HvKael-UU-Ruec,22
2
+ maya_umbrella/__version__.py,sha256=RaANGbRu5e-vehwXI1-Qe2ggPPfs1TQaZj072JdbLk4,22
3
3
  maya_umbrella/cleaner.py,sha256=5EC3w4qRkIsr9AIZneEV8ljhxaOw385Gj2C2KTrzyJg,5044
4
4
  maya_umbrella/collector.py,sha256=rAFmvY8Isdle89ezn2-H36hSJd77iBvPBLRPzruCycA,13111
5
5
  maya_umbrella/constants.py,sha256=2sl0dL0U82mwu-Msda9B8-USxr89Wu2yu6SYiuaaJZk,539
@@ -14,15 +14,15 @@ maya_umbrella/i18n.py,sha256=NCC6isPdchv3yRBS2F4Cguu1bVyi0VoMMcI4YOIxBtU,2683
14
14
  maya_umbrella/locales/en_US.json,sha256=LW2gPgO2YJIYR5UfcIBuxW_DS7rf4gkjeVuADqs1V5s,962
15
15
  maya_umbrella/locales/zh_CN.json,sha256=UsuRN2yaxxc9LE-7NQkbMqrkjXjNhNegS0QRkQLSTiE,1006
16
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=WdTLigT3wVxaCXzZiwdul56wGNjWqOyB928hvazqCIk,3970
17
+ maya_umbrella/maya_funs.py,sha256=4Wty8e722V-stYofPGHGHKCIURP5Gp-qTOsodqXJ4MA,3645
18
+ maya_umbrella/scanner.py,sha256=Souu4iFrYPJVV34actQf69Po6hHhGDv_7cRuKtGoygc,3921
19
19
  maya_umbrella/signatures.py,sha256=RkEXChch7tdqA9Yq6YQ8AMnK2ra6ih0dfnpeZy5FkYs,354
20
20
  maya_umbrella/vaccine.py,sha256=aBW6pdT4tD4OMBPZ-d3E4_n16Rylz-2gb7JWzMZVPK0,1022
21
21
  maya_umbrella/vaccines/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  maya_umbrella/vaccines/vaccine1.py,sha256=WLo1uJElTLSjVCf5CBtRNU4HKs63my5mkHiGqTfnNEE,489
23
23
  maya_umbrella/vaccines/vaccine2.py,sha256=yvHpnrQ6Jts9_zCy8WRJcbxz0CVSRAPkn2vF552atQs,2123
24
24
  maya_umbrella/vaccines/vaccine3.py,sha256=d89Ocj1AmsZt9YJjggjDJqAWXcckGLMl-6u8jXeAPjg,3493
25
- maya_umbrella-0.6.1.dist-info/LICENSE,sha256=tJf0Pz8q_65AjEkm3872K1cl4jGil28vJO5Ko_LhUqc,1060
26
- maya_umbrella-0.6.1.dist-info/METADATA,sha256=EoHpo3gNKyQGh0_7z1E6dFO4d6kG_HFaz0MFB9p6s8k,9178
27
- maya_umbrella-0.6.1.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
28
- maya_umbrella-0.6.1.dist-info/RECORD,,
25
+ maya_umbrella-0.7.0.dist-info/LICENSE,sha256=tJf0Pz8q_65AjEkm3872K1cl4jGil28vJO5Ko_LhUqc,1060
26
+ maya_umbrella-0.7.0.dist-info/METADATA,sha256=jgCXimSbweHh85lZRmdIJJc5P030SAs9Vc3je-4EawA,10847
27
+ maya_umbrella-0.7.0.dist-info/WHEEL,sha256=IrRNNNJ-uuL1ggO5qMvT1GGhQVdQU54d6ZpYqEZfEWo,92
28
+ maya_umbrella-0.7.0.dist-info/RECORD,,