-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from loonghao/master
Deploy first version to support 3ds max-2020
- Loading branch information
Showing
13 changed files
with
263 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Byte-compiled / optimized / DLL files | ||
*.py[cod] | ||
|
||
# PyCharm project files | ||
.idea/ | ||
|
||
# Vim / Notepad++ temp files | ||
*~ | ||
.*/ | ||
*.egg-info | ||
# PyInstaller output | ||
build/ | ||
dist/ | ||
*.spec | ||
|
||
# PyBuilder output | ||
.build/ | ||
result/ | ||
|
||
# Coverage output | ||
.coverage | ||
/venv/ | ||
|
||
# Docs | ||
docs/_build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
python: | ||
enabled: true | ||
|
||
fail_on_violations: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Generated Pylint configuration file that disables default output tables. | ||
|
||
[MESSAGES CONTROL] | ||
disable=RP0001,RP0002,RP0003,RP0101,RP0401,RP0402,RP0701,RP0801,C0103,R0903 | ||
|
||
[REPORTS] | ||
output-format=text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
language: python | ||
|
||
python: | ||
- 3.7 | ||
|
||
script: | ||
- pip install file://$(pwd) | ||
|
||
deploy: | ||
provider: pypi | ||
user: mottosso | ||
distributions: "sdist bdist_wheel" | ||
password: | ||
secure: fwXIOGKn38gJFNkzlpvholQBhSBzNorOnMvs04JT3+Fdq6ys2TiUV6tlXHDwo6DkMY++USI19oD9NWlvg8gQaRJq4g2V/taazn8XDv1XnyKLzb6DnAT1ALilJtbIgotH/0QNOvkDP40a8UDwbelE0aR4AptNO1Ts7n1eERygENA= | ||
on: | ||
tags: true | ||
repo: pyblish/pyblish-3dsmax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,38 @@ | ||
# pyblish-3dsmax | ||
Pyblish for 3ds Max | ||
pyblish-3dsmax | ||
============== | ||
Pyblish for 3ds Max. | ||
|
||
Note: This only tested in `3dsmax-2020`. | ||
|
||
What is included? | ||
---------------- | ||
A set of common plug-ins and functions shared across other integrations - such as getting the current working file. It also visually integrates Pyblish into the File-menu for easy access. | ||
- Common [plug-ins](https://github.com/pyblish/pyblish-3dsmax/tree/master/pyblish_3dsmax/plugins) | ||
|
||
<br> | ||
<br> | ||
<br> | ||
|
||
Installation | ||
------------ | ||
Via pip install `pyblish-3dsmax` will be installing all depends packages. | ||
|
||
```cmd | ||
pip install pyblish_3dsmax | ||
``` | ||
|
||
- Copy module files to `<3dsmax_install_root/python/Lib/site-packages>` | ||
- Copy startup script `<root>/startup/pyblish_3dsmax.ms` to `<3dsmax_install_root>/scripts/startup/pyblish_3dsmax.ms`. | ||
|
||
For example: | ||
|
||
Copy `C:\Users\longhao\PycharmProjects\pyblish-3dsmax\startup\pyblish_3dsmax.ms` to `C:\Program Files\Autodesk\3ds Max 2020\scripts\Startup\pyblish_3dsmax.ms` | ||
|
||
Pyblish in 3dsmax main MenuBar | ||
------------------------------ | ||
<img src="https://i.imgur.com/sQvwGFF.png" alt="menu"></a> | ||
|
||
|
||
Quick demo in 3dsmax | ||
-------------------- | ||
<img src="https://i.imgur.com/76SH1xb.gif"> |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
# Standard library | ||
import os | ||
|
||
# Pyblish libraries | ||
import pyblish | ||
import pyblish.api | ||
|
||
# Import 3dsmax libraries | ||
from pymxs import runtime as rt | ||
|
||
# Local libraries | ||
from pyblish_3dsmax import plugins | ||
from Qt import QtWidgets | ||
|
||
|
||
def register_host(): | ||
"""Register supported hosts""" | ||
pyblish.api.register_host("3dsmax") | ||
|
||
|
||
def deregister_host(): | ||
"""Register supported hosts""" | ||
pyblish.api.deregister_host("3dsmax") | ||
|
||
|
||
def register_plugins(): | ||
# Register accompanying plugins | ||
plugin_path = os.path.dirname(plugins.__file__) | ||
pyblish.api.register_plugin_path(plugin_path) | ||
print("pyblish: Registered %s" % plugin_path) | ||
|
||
|
||
def deregister_plugins(): | ||
plugin_path = os.path.dirname(plugins.__file__) | ||
pyblish.api.deregister_plugin_path(plugin_path) | ||
|
||
|
||
def _discover_gui(): | ||
"""Return the most desirable of the currently registered GUIs""" | ||
|
||
# Prefer last registered | ||
guis = reversed(pyblish.api.registered_guis()) | ||
|
||
for gui in guis: | ||
try: | ||
gui = __import__(gui) | ||
except (ImportError, AttributeError): | ||
continue | ||
else: | ||
return gui | ||
|
||
|
||
def show(main_widget): | ||
"""Try showing the most desirable GUI.""" | ||
app = _discover_gui() | ||
app.settings.WindowTitle = "Pyblish (3dsmax)" | ||
app.show(main_widget) | ||
|
||
|
||
def setup(): | ||
"""Setup integration. | ||
Register plug-ins and integrate into the host | ||
""" | ||
pyblish.api.register_gui('pyblish_lite') | ||
register_plugins() | ||
register_host() | ||
print("pyblish: Pyblish loaded successfully.") | ||
main_widget = get_main_widget() | ||
show(main_widget) | ||
|
||
|
||
def get_main_widget(): | ||
"""Get 3dsmax main window.""" | ||
return QtWidgets.QWidget.find(rt.windows.getMAXHWND()) | ||
|
||
|
||
def get_main_menubar(main_widget): | ||
"""Get main Menubar by 3dsmax main windies.""" | ||
return [i for i in main_widget.findChildren(QtWidgets.QMenuBar)][0] | ||
|
||
|
||
def setup_menu(): | ||
main_widget = get_main_widget() | ||
menu_bar = get_main_menubar(main_widget) | ||
action = QtWidgets.QAction("Pyblish", menu_bar) | ||
action.triggered.connect(setup) | ||
menu_bar.addAction(action) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Import third-party modules | ||
import pyblish.api | ||
|
||
|
||
class CollectPhotoshopCurrentFile(pyblish.api.ContextPlugin): | ||
"""Inject the current active document file path into context.""" | ||
|
||
order = pyblish.api.CollectorOrder - 0.5 | ||
label = "3dsMax Current File." | ||
|
||
hosts = ['3dsmax'] | ||
version = (0, 1, 0) | ||
|
||
def process(self, context): | ||
"""Inject the current working file""" | ||
import os | ||
from pymxs import runtime as rt | ||
current_file = rt.maxFilePath + rt.maxFileName | ||
normalised = os.path.normpath(current_file) | ||
self.log.info("Find current working file %s", normalised) | ||
context.set_data('currentFile', value=normalised) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
VERSION_MAJOR = 0 | ||
VERSION_MINOR = 1 | ||
VERSION_PATCH = 0 | ||
|
||
version_info = (VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH) | ||
version = '%i.%i.%i' % version_info | ||
__version__ = version | ||
|
||
__all__ = ['version', 'version_info', '__version__'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[bdist_wheel] | ||
universal=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
"""This setup script packages pyblish-3dsmax.""" | ||
|
||
# Import built-in modules | ||
import importlib | ||
import os | ||
|
||
# Import third-party modules | ||
from setuptools import setup, find_packages | ||
|
||
with open("README.md", "r") as fh: | ||
long_description = fh.read() | ||
|
||
version_file = os.path.abspath("pyblish_3dsmax/version.py") | ||
version_mod = importlib.import_module("pyblish_3dsmax.version") | ||
version = version_mod.version | ||
|
||
classifiers = [ | ||
"Development Status :: 4 - Beta", | ||
"Intended Audience :: Developers", | ||
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)", | ||
"Programming Language :: Python :: 2", | ||
"Programming Language :: Python :: 3", | ||
"Programming Language :: Python :: 3.5", | ||
"Programming Language :: Python :: 3.6", | ||
"Programming Language :: Python :: 3.7", | ||
"Programming Language :: Python :: 3.8", | ||
"Topic :: Software Development :: Libraries :: Python Modules", | ||
] | ||
|
||
setup( | ||
name="pyblish-3dsmax", | ||
version=version, | ||
packages=find_packages(), | ||
url="https://github.com/pyblish/pyblish-3dsmax", | ||
license="LGPL", | ||
author="Abstract Factory and Contributors", | ||
author_email="marcus@abstractfactory.io", | ||
description="Pyblish for 3ds Max.", | ||
long_description=long_description, | ||
long_description_content_type="text/markdown", | ||
zip_safe=False, | ||
classifiers=classifiers, | ||
install_requires=[ | ||
"qt.py>=1.3", | ||
"pyblish_base>=1.2.1", | ||
"pyblish_lite>=0.8.0", | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
python.execute "import pyblish_3dsmax.app as app; app.setup_menu()" |