https://github.com/leixingyu/mayaconnector
Send command to Maya and stream its output
https://github.com/leixingyu/mayaconnector
maya-python
Last synced: about 1 year ago
JSON representation
Send command to Maya and stream its output
- Host: GitHub
- URL: https://github.com/leixingyu/mayaconnector
- Owner: leixingyu
- License: mit
- Created: 2021-12-19T02:14:25.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T15:45:25.000Z (over 3 years ago)
- Last Synced: 2023-03-09T23:47:03.442Z (about 3 years ago)
- Topics: maya-python
- Language: Python
- Homepage:
- Size: 27.3 KB
- Stars: 12
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## About The Project
Although there are a lot of tools that can run internally in Maya which facilitate
the pipeline. The capability of communicating (monitor and control) with Maya externally is very handy.
I covered the development of this tool in more detailed here:
[Part 1](https://www.xingyulei.com/post/maya-commandport/) |
[Part 2](https://www.xingyulei.com/post/maya-streaming/).
This tool has two major components:
1. command port: sending commands to maya to execute
2. output streaming: actively listening/receiving maya outputs
## Getting Started
### Prerequisites
- [Qt](https://github.com/mottosso/Qt.py): a module that supports different
python qt bindings
or alternatively, change the code below to whatever qt binding you have on your machine.
```python
from Qt import QtWidgets, QtCore, QtGui
from Qt import _loadUi
```
### Launch
1. Unzip the **maya-connector** package
2. Launch Maya and open port `5050`:
```python
import maya.cmds as cmds
port = 5050
if not cmds.commandPort(":{}".format(port), query=True):
cmds.commandPort(name=":{}".format(port))
```
3. Run `main.py` through `mayapy` or `python` externally
4. Click the **connect** button to establish streaming connection
5. Use the tool like an external script editor
## Features
- code editor with syntax highlighting and line counter
- save/open script
- execute selected script or all
- clear viewport
## Reference
[Google Group - Receiving data from commandPort](https://groups.google.com/g/python_inside_maya/c/7AgWlldtvbE/m/zUTQlAcjBgAJ?pli=1)
[Stack Overflow - c socket programming, only receiving one line at a time](https://stackoverflow.com/questions/10434525/c-socket-programming-only-receiving-one-line-at-a-time)
[CG Talk - Telnet or Socket: no result back from Maya](https://forums.cgsociety.org/t/telnet-or-socket-no-result-back-from-maya/1730817/2)
[Youtube - Python Socket Programming Tutorial](https://youtu.be/3QiPPX-KeSc)
[Maya Help - OpenMaya.MCommandMessage Class Reference](https://help.autodesk.com/view/MAYAUL/2016/ENU/?guid=__py_ref_class_open_maya_1_1_m_command_message_html)
[Google Groups - Extracting data from Output Window](https://groups.google.com/g/python_inside_maya/c/pp_E7rCs7d0)
[Github - MayaCharm](https://github.com/cmcpasserby/MayaCharm)
[Github - MayaSublime](https://github.com/justinfx/MayaSublime/)