[PYTHON] Send commands from Atom to Maya

Maya's script editor isn't very popular. It's easy to write in a chat, though. atomMaya_scripteditor.png

So write the code in an external editor and send it to Maya, There are several editors that offer this method.

I tried it via Atom, so it's a memorandum.

Installation

Python

You need to have Python installed in advance. https://www.python.org/downloads/

Atom side

atomMaya_install.png

File > Setting (ctl + ,) Open the Setting tab with, and search for "maya" with "Install". You will see a ** atom to Maya ** package at the top (▲).

atomMaya_detail.png Details like this. Run the Python Script. * MEL cannot be sent *. Click "Install".

atomMaya_run.png Then, "** Maya **" will be added to the Packages menu. The transmission from Atom to Maya is ʻalt+ctrl + r`.

Maya side

This is the preparation on the Atom side. Next is the preparation on the Maya side.

Create the following content with the file name ** userSetup.py ** Save to "Scripts" in the Maya folder under the document.

userSetup.py


import maya.cmds as cmds

cmds.commandPort(name=":7005", sourceType="python")

atomMaya_usersetup.png

Then start Maya and All you have to do is write the code in Atom and do ʻalt+ctrl + r`.

Run

For the time being, ʻalt+ctl + r` will send the entire ** code you are writing ** to Maya.

If you select a part, ** only the selected part ** will be sent.

Caution

Maya must start

atomMaya_withoutMaya_.png Nothing happens if Maya is not running.

Must be saved

You need to save the file you are writing before sending it to Maya. The standard script editor can be executed immediately after writing, so this is more troublesome.

I think it's a good idea to set the ** file extension ** to ** .py **, but In fact, no matter what the extension, ** select a part and Run ** will pass. (If you want to run without selection, it must be .py)

There is a report on this matter here https://github.com/davidpaulrosser/atom-maya/issues/11

reference

Editor Atom developed by Github https://atom.io/

Autodesk Maya http://www.autodesk.co.jp/products/maya/overview

"Atom-maya" is a package developed by david paulrosser https://github.com/davidpaulrosser/atom-maya https://atom.io/packages/maya

bonus

atom animation format

Searching for "atom maya" will bring up a page about ** ATOM ** in the Maya documentation. This is a description of the file format provided by Maya for inputting and outputting animations. ** Not related to Atom in the editor **.

http://help.autodesk.com/cloudhelp/2016/JPN/Maya/files/GUID-6C84AB97-1766-4260-9C2A-754C9578AE42.htm

sublime plugin

I also found a plugin for the sublime editor, so make a note

--Development: justinfx --Plugin name: MayaSublime

This environment

Atom 1.2.4 atom-maya package 0.17.0 Autodesk Maya 2016 Extension 1 + SP4

Recommended Posts

Send commands from Atom to Maya
Send a message from Python to Slack
Sum from 1 to 10
Send a message from Slack to a Python server
How to handle Linux commands well from Python
How to clone github remote repository from atom
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Transition from WSL1 to WSL2
Send log data from the server to Splunk Cloud
Linux commands to remember
Send data from Python to Processing via socket communication
From editing to execution
Send accelerometer value from Eaglet + Intel Edison to Kinesis
I want to send a message from Python to LINE Bot
Send a request from AWS Lambda to Amazon Elasticsearch Service
Post from Python to Slack
Porting from argparse to hydra
Migrating from Chainer v1 to Chainer v2
Anaconda updated from 4.2.0 to 4.3.0 (python3.5 updated to python3.6)
Migrated from Flask-RESTPlus to Flask-RESTX
Send a signal to subprocess
Get clipboard from Maya settings
Update python-social-auth from 0.1.x to 0.2.x
Migrate from requirements.txt to pipenv
Switch from python2.7 to python3.6 (centos7)
Connect to sqlite from python
How to extract the desired character string from a line 4 commands