Home Website Youtube GitHub

Setting up a Development Environment

Hi all,

I would like to get started contributing code to mGear, such as features and bug fixes, and was wondering how I can get setup with a development environment?

At the moment, I can:

  1. Download an mGear release
  2. Edit a source file, e.g. mgear/widgets.py
  3. Launch Maya and see the results


  1. How can I contribute the change back to the project? Which project does it belong to, and how do I know?
  2. How can I shorten iteration time, as the process of restarting Maya takes a number of seconds?

How are you currently developing mGear? What would you recommend for someone just starting out contributing code?


Hi @mottosso

Good questions! Thanks for asking!

you can make a pull request anytime. Ideally should be pointing to a an existing issue/ticket.
For example if it is a new bug with not issue open, you can open first the issue, and later use it for the pull request. The person in charge of the project will review the pull request and merge it or talk with you if he has any question.
of course you can always ask in the forum if you have any question before do all this.

Also we have a couple of templates to create new issue in github:

if any of the templates fit your need you can also create a regular issue.

mGear menu have a “Reload” command to help with this:

if you are developing Shifter components, there is also a command only to reload components:

NOTE: there is a limitation on the reload, regarding the Qt widgets. Sometimes it doesn’t reload correctly. Specially editing the Synoptic tabs can be very annoying. I someone knows a solution for this, it is very welcome. Thanks!

Thanks, that’s great!

Here’s what I’ve tried.

$ git clone https://github.com/mgear-dev/mgear.git --recursive
$ cd mgear
$ scons with-maya=2018
$ set MAYA_MODULE_PATH=%cd%\release
$ start "" "c:\program files\autodesk\maya2018\bin\maya.exe"

With Maya up and running, loading the biped guide and building from selection works well.

If I now wanted to edit the "mGear" Maya menu to say "My mGear", do I edit "mgear\scripts\mGear_menu.py" and then re-run scons?

When I check git status, there is one more file added that I didn’t create myself.

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   scripts/mGear_menu.py
        modified:   scripts/mgear/__init__.py

no changes added to commit (use "git add" and/or "git commit -a")

Should I commit this to my PR as well?

@mottosso yes the scripts/mgear/__init__.py is created from the template __init__.py.in

basically is changing the mgear version number from the scons file configuration:

so in short yes, you should include it.

btw: changes in the menu will not take effect with the reload module function. I guess will be possible with the menu in version 3.0 but no yet implemented :stuck_out_tongue:


To finish things off, here’s what I’ve done next.

git add --all
git commit -m "Test commit"
git remote set-url origin git@github.com:mottosso/mgear.git
git push

And finally, a PR.

Anything you would do differently from here on? Is it the right branch? Is there something I’ve missed? Shouldn’t have done? Something that could be done more efficiently?

@mottosso thanks for the follow up on this. I think will be very useful for anybody interested in become a contributor :slight_smile:

Preferible you should create an issue first or refear the PR to an existing issue

Usually I ask the contributor to make the PR on develop branch. I keep master for the official releases. Not sure if is the best solution, but I have been using this kind of “rule”

a part of the previous comment I don’t see anything else :slight_smile:

At less to my knowledge it is perfect. But is someone know a better solution. We are (mGear_dev team) really open to new ideas and advice.


1 Like

@mottosso Just moved the topic to mGear Development category. I guess it make more sense here :stuck_out_tongue:

With mGear 3.x.x would it be possible to get an update method of setting up a development environment?

maybe this helps

and some instructions for coding

I initially tried with Github for Windows, but got this error message:

Then I tried manually with git, but only got as far as cloning:

PS C:\Users\admin\Desktop> git clone git@github.com:mgear-dev/mgear_dist.git
Cloning into 'mgear_dist'...
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

You need to use SSH. Sorry, this is the way that is configured.
Alternatively, You can do this manually by creating your own version of mgear_dist

Ohh, right. Anyway of removing that requirement?

I honestly haven’t used SSH before (maybe I should?), and it seems like it might be a hurdle for newcomers that wants to contribute.

Alternative repositories might just confuse things even more :slight_smile:

I’ve got mgear_dist cloned now, but do you need to build every time you make a change?

What is your development environment?

We are using Scons with Excons extension: https://github.com/gatgui/excons

The info is here: https://github.com/mgear-dev/mgear_dist/blob/master/BUILD.md
it is really easy

Sorry, I may not have been very clear.

I was wondering what your development workflow is? Do you for example make some changes to the python code and rebuild?
I appreciate that you would have to rebuild when working on the plugins, but if most of the time its just python code you wouldn’t need to rebuild.

Scons with Excons extension, not only rebuild the compiled C++ plugins, but also copy/deploy the .py files in the final distribution structure.

every time a change is made in a python file/files you deploy on a temporal “release folder”. but only modify files are copied.

Also, Excons have different targets, I.e: only python files or C++ or all. So the deploy can be very granular


Check the documentation, when you know the basics. it is really easy and flexible to use

Also, don’t forget to check the sConstruct configuration file

Probably this file is the most useful to learn how it works :wink:

So when you are developing, is this the workflow?

  1. Make changes to the python files.
  2. Build and launch Maya.
  3. Test the changes in Maya.

more like this:

  • Make changes to the python files.
  • Build and reload python files in Maya. (sometimes relaunch, specially id dealing with PySide)
  • Test the changes in Maya.

I’m currently exploring a development environment for mGear, and was wondering about the mgear python module in each repository like https://github.com/mgear-dev/shifter/tree/master/scripts/mgear.

Why are the repositories in a submodule called mgear?

to keep the folder structure consistent. This helps in some situation for debugging since everything is split in several repositories

if you check the init.py will see this

# imports
from pkgutil import extend_path

# extend mGear python package by adding the current module
__path__ = extend_path(__path__, __name__)

in the future with python 3.x this will be not needed