Git Product home page Git Product logo

mayaport's Introduction

mayaport README

MayaPort is a simple extension to allow sending the text document or selected text to the maya, you must first enable the commandPort in maya. To open a port for mel and python use the following code, which uses the default values, change to different port values as applicable.

import maya.cmds as cmds
# Open new ports
cmds.commandPort(name=":7001", sourceType="mel", echoOutput=True)
cmds.commandPort(name=":7002", sourceType="python", echoOutput=True)

To enable ports at startup create a file named userSetup.mel in the following folder:

Windows: <drive>:\Documents and Settings\<username>\My Documents\maya\<Version>\scripts
Mac OS X: ~/Library/Preferences/Autodesk/maya/<version>/scripts.
Linux: ~/maya/<version>/scripts.
(where ~ is your home folder)

In the userSetup.mel file add the following

commandPort -name "localhost:7001" -sourceType "mel" -echoOutput; 
commandPort -name "localhost:7002" -sourceType "python" -echoOutput;

If you require a different client machine it is possible to set the host variable and send to another host. In this case the port needs to be explicitly opened in maya as follows passing in the ip address (or hostname if DNS working etc) of the machine.

import maya.cmds as cmds
# Open new ports
cmds.commandPort(name="192.168.0.4:7001", sourceType="mel")
cmds.commandPort(name="192.168.0.4:7002", sourceType="python")

Features

You can send both mel and python code via the different commands sendPythonToMaya or sendMelToMaya

To get started use CMD + Shift P and run mayaPort, this will attempt to open two sockets on the localhost, using ports 7001 and 7002 one for Mel code and one for python code.

To send all the text so maya use CMD + Shift P and run sendMelToMaya or sendPythonToMaya depending upon the code you are writing. If you only wish to send a small segement of code just select the code required and use the same commands.

The output from maya will be sent back to the debug console, to enable full logging the commandPort must have the -echoOutput flag set otherwise only the results are showm.

###Keyboard Shortcuts

On Mac

Use CTRL+SHIFT+P to send python code to Maya. Use CTRL+SHIFT+M to send mel code to Maya.

On Windows and Linux

Use ALT+SHIFT+P to send python code to Maya. Use ALT+SHIFT+M to send mel code to Maya.

Requirements

Autodesk Maya (Should work with all version) tested on Maya 2016 Mac and Linux.

Extension Settings

To set custom port ID's edit the user settings (File > Preferences (Code > Preferences on Mac)) and add the following key values to override the defaults

{
    "mayaport.melPortID": 7005,
    "mayaport.pythonPortID": 7007
    "mayaport.mayahost" : "192.168.0.4"
}

and restart the extension.

Known Issues

Can occasionally lose connection to maya, not yet tested on windows or linux.

Release Notes

Release 1.0

First major release complete, the output from maya is now captured and logged to the debug console and all things seem to work ok.

Release 0.3

Added the ability to specify the host machine for maya. Updated the key bidings for Windows as the keys clashed with command palette use.

Release 0.2 Updated README.md as was ill formated in the store.

ToDo

  • get user feedback and see what else can be added.
  • see how to add menu items

mayaport's People

Contributors

jmacey avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.