loonghao / maya_umbrella

Check and fix maya virus.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

maya-umbrella

Python Version Nox PyPI Version Downloads Downloads Downloads License PyPI Format Maintenance maya-2024 maya-2023 maya-2022 maya-2021 maya-2020 maya-2019 maya-2018

All Contributors

This tool is designed to provide a robust solution for identifying and resolving any potential viruses within Autodesk Maya. It ensures a secure and seamless user experience by proactively scanning for threats and effectively neutralizing them.

It can be provided as an API for seamless integration into your existing pipeline.

安装

pip 安装

maya_umbrella是以标准pipy包去发布的,所以我们可以通过pip install去安装

your/maya-root/mayapy -m pip install maya-umbrella

一键安装

在release里面下载对应版本的zip包,解压后双击install.bat即可安装

更新版本

your/maya-root/mayapy -m pip install maya-umbrella --upgrade

卸载

your/maya-root/mayapy -m pip uninstall  maya-umbrella

开发环境设置

Set up the development environment using a virtual environment, and it is recommended to use Python 3.8 or higher versions.

通过虚拟环境去设置开发环境, 推荐python-3.8以上的版本

通过pip安装相关开发依赖

pip install -r requirements-dev.txt

开发调试

在maya中测试

通过nox -s maya -- <maya version>, 启动maya. nox会动态根据你本地安装得maya去注册nox session, 比如你本地安装了maya-2020, 那么通过可以启动带有测试环境的maya

nox -s maya -- 2018

注意:maya 与 版本号之间有 俩个-

启动maya后在脚本编辑器中执行下面得代码,就会动态的从<repo>/tests/virus/里面去open ma文件去进行测试.

import manual_test_in_maya

manual_test_in_maya.start()

也可以通过pytest去执行对应的测试,也需要本地安装了对应的maya

nox -s maya -- 2018 --test

注意:在maya-2022 (PY2) 以下的版本可能会出现命令行crash的情况

增加新的疫苗

<repo>/maya_umbrella/vaccines/ 新建一个py, 因为有很多病毒没有具体的名字代号,我们统一以vaccine<id>.py 继承from maya_umbrella.vaccine import AbstractVaccine并且class名字叫Vaccine即可, 然后去写具体的收集病毒逻辑

代码检查

我们可以利用封装好的nox命令去执行进行代码检查

nox -s lint

进行代码整理

nox -s lint-fix

生成安装包

执行下面的命令可以在/.zip下面创建zip,参数 --version 当前工具的版本号

注意:make-zip--version之间有 俩个-

nox -s make-zip -- --version 0.5.0

环境变量

我们可以通过下列环境变量去修改maya_umbrella的一些设置,方便有pipeline的公司可以更好的集成

修改maya umbrella的日志保存目录,默认是windows temp目录

MAYA_UMBRELLA_LOG_ROOT

修改maya umbrella的日志文件名称, 默认是maya_umbrella

MAYA_UMBRELLA_LOG_NAME

设置日志级别,默认是info, 可以是debug可以看到更多的日志信息

MAYA_UMBRELLA_LOG_LEVEL

修改杀毒后文件的备份文件夹名称, 默认是_virus 比如: 你文件路径是 c:/your/path/file.ma 那么备份文件路径是 c:/your/path/_virus/file.ma

MAYA_UMBRELLA_BACKUP_FOLDER_NAME

默认的显示语言,包含日志打印输出等,默认是根据你当前maya的界面语言来设置的,当然我们也可以通过下面的环境变量去设置

MAYA_UMBRELLA_LANG

忽略保存到备份文件夹,请注意,如果你不清楚这个会导致的后果请不要轻易修改,默认批量杀毒后会把源文件自动备份到当前文件的备份文件夹.

MAYA_UMBRELLA_IGNORE_BACKUP

如果忽略请设置为

SET MAYA_UMBRELLA_IGNORE_BACKUP=true

如果是便携版Maya,可以通过添加 MAYA_LOCATION 环境变量指定Maya路径

SET MAYA_LOCATION=d:/your/path/maya_version/

也可以通过命令行指定目录

nox -s maya -- 2018 --install-root /your/local/maya/root

API

获取当前场景没有被修复的病毒文件

from maya_umbrella import MayaVirusDefender

api = MayaVirusDefender()
print(api.get_unfixed_references())

批量修复文件, 通过正则表达式

from maya_umbrella import MayaVirusScanner

api = MayaVirusScanner()
print(api.scan_files_from_pattern("your/path/*.m[ab]"))

案例

如果你想要快速通过maya standalone去批量清理maya文件, 可以下载或者git clone当前main分支的工程, 根据上面指引设置好开发环境, 通过nox命令去启动maya standalone环境,maya版本根据你当前本地安装的maya为准, 比如你本地安装了2018, 那么就是 nox -s maya -- 2018 --standalone 下面的语法是启动一个maya-2020的环境去动态从c:/test文件夹下去查杀病毒

nox -s maya -- 2018 --standalone --pattern c:/test/*.m[ab]

Contributors ✨

Thanks goes to these wonderful people (emoji key):

Hal
Hal

💻 🚇 ⚠️
hotwinter0
hotwinter0

⚠️ 💻
lingyunfx
lingyunfx

⚠️
yjjjj
yjjjj

⚠️ 💻
Unclechen
Unclechen

⚠️
andyvfx
andyvfx

💻
cundesi
cundesi

💻
Wenfeng Zhang
Wenfeng Zhang

⚠️ 💻

This project follows the all-contributors specification. Contributions of any kind are welcome!

About

Check and fix maya virus.

License:MIT License


Languages

Language:Mathematica 99.7%Language:Python 0.3%