PyCharm and Maya integration, with some UI stuff.

In this article I’ll write about how to integrate pycharm with maya and ┬árun UI in a very simple way.

All these articles i write mostly for myself, so if you find nothing interesting here, sorry then. And if it helps, well, then it’s even better.

So let’s get started.

 

Fisrt of all, you need to install PyCharm professional edition and Maya.

Also you need PyQT4.

https://www.riverbankcomputing.com/software/pyqt/download

Maya 2016 uses python 2.7.6 so you need a 2.7 version of pyqt4.

You need to install it to

Once its done, you need to open pycharm and configure python interpreter.

Here is the settings window.

pycharms_interpreter_settings

 

Then click on gear button and add those paths:

  • C:\Program Files\Autodesk\Maya2016\Python\Lib\site-packages;
  • C:\Program Files\Autodesk\Maya2016\devkit\other\pymel\extras\completion\py\maya;
  • C:\Program Files\Autodesk\Maya2016\Python\Lib\site-packages\pymel\core;
  • C:\Program Files\Autodesk\Maya2016\lib;
  • C:\Program Files\Autodesk\Maya2016\devkit\other\pymel\extras\completion\py

Actually they are the same with VS instruction.

After pycharm will update all the skeletons, you need to go to plugns and install MayaCharm. Original pare is here.

Once all the preparations is over, it’s time to run UI file in Maya.

First of all you need to build it with QtDesigner, which is included in Maya

 

I’m also recommend to use ” Maya python for games and film” book. It has really nice description of the process of ui file creation.

Just for example purposes I’ve created a simple ui file.

 

On next step there is few options.


 

First one is to convert *.ui file to *.py file and run it as normal script.

To do that you need to run pyuic4.bet file in command line, but first it’s necessary to fix path to the python interpeter.

Insince bat file you need to write this:

And don’t forget to add python path toyour environment.

Now open cmd, go to the folder with your *.ui file and run this command

You will get a *.py file in the same directory.


 

The second one is to run ui file directly.

To do this you need to run this code in maya.


 

For me the scond way looks way simpler and faster, however it might have some disadvantaget, but I know nothing about them yet.

2 Comments

  • Paul Alain Says

    Nice share.

    Can you point me to some examples where I can see how to connect the Qt UI with some Maya Python or PyMel logic?

    • Michael M. Says


      from PySide.QtGui import *

      class myWidget(QWidget):
      def __init__(self):
      super(myWidget, self).__init__()
      layout = QVBoxLayout(self)
      self.setLayout(layout)
      label = QLabel("text")
      layout.addWidget(label)
      b = QPushButton("button")
      layout.addWidget(b)
      b.clicked.connect(self.act)

      def act(self):
      print "act"

      app = QApplication([])
      w = myWidget()
      w.show()
      app.exec_()

Leave a Reply

Your email address will not be published. Required fields are marked *