Building a custom (mini) pipeline – part 1

First blog post in years! I need to update my site at some point, but I thought it’d be fun to document a little experiment I started recently.

Like the title says, the experiment and challenge is to build a little personal pipeline that can connect people remotely, I might use this with some friends.

Basic requirements:

  • It will be mostly used for Maya
  • Should be able to connect people to a single code base that can be easily updated
  • Should connect with as little setup and trouble as possible
  • Should not mess with people’s computers, workflow, memory, etc.

The idea is for it to be something simple where I could put new tools (both mine and 3rd party) that people can access, it would be fun and probably useful, specially for animators since I am an animator myself.

The first step was to find a simple way to share the files with people, and be able to update it easily. Dropbox came to mind right away, specially because of its desktop application, so I went with that; I would simply have to invite people to the folder and then Maya can connect to that directly, the updates would either happen automatically or the user simply has to update it manually, which shouldn’t be a big burden.

The second step was to connect Maya’s Python path to the Dropbox folder, and for that I’d need to find that folder. This became the first limitation. By default Dropbox installs the app folder at the root of the user directory (C:\Users\username), so I could just find that by querying the user name with Python (os.getenv(‘USER’)), and as long as the user chooses the default location of Dropbox it shouldn’t be a problem. This is not ideal, there has to be a way to find the Dropbox location no matter where it is in the computer, but that will happen in the future.

Connecting Maya to the new custom location is done by running

import sys
sys.path.append("C:\Users\username\Dropbox\customfolder")

The user could launch Maya and run the code above to plug into the new pipeline, but this is too much clicking, a better solution is to launch Maya with a .bat file, this way we can run a Python file to do all the setting up we need. The bat file can be in the folder, so the user just needs to double click on it and the python script will do all the work, less clicking!

The bat file looks like this:


cd Dropbox\ThePlace\PyPlace

pyPlace.py

(Yes, I called it PyPlace, for now at least)

To launch Maya we can use subprocess:


subprocess.call([r'C:\Program Files\Autodesk\<mayaversion>\bin\maya.exe'])

At launch Maya will look for a userSetup.py file to run custom code before loading, so we can put our code to connect to the new pipeline here, as well as any other customization, such as a shelf, or even modifying Maya’s look and get fancy 🙂

Overall it’s a simple setup, and it works! I am now able to update the code base in the Dropbox PyPlace folder and have it work in real time within my Maya scene.

I tested it with a friend of mine and it worked well, but there is another limitation.. the person needs to have Python installed in their computer, which is quite annoying and adding a work around to access Maya’s Python libraries might not be ideal. Converting the launch python code to a standalone binary file is probably best, this way we can also skip the bat file and do everything with Python. Seems like PyInstaller or Py2Exe are good options.. so that’s the next step now.

Here’s a screen grab of Maya customized with a shelf and a red color to identify that it’s a “PyPlace” Maya. The color was done with Qt’s styling sheets.

customMaya

A pic of where the pipeline code will live within Dropbox (it’s messy, needs some clean up):

place

That’s all for now!

F

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s