Tags

Tuesday, July 24, 2012

More car

Just a few updates...





I'll write up next when I finish the model, will probably be a while away though, still gotta model the interior and connect everything up!

Monday, July 16, 2012

Peugeot 206 WRC

I remembered I bought a toy model last year of a Peugeot 206 WRC and had been meaning put it together. I decided to pull it out of my cupboard and make it in 3D as a weekend project... which I think I'd now like to push towards having a new portfolio piece. My ultimate goal is model and rig, as primarily I'd like to give a decent vehicle rig a go.

I've been learning a lot about topology for hard body modeling, there's a reason why I ended up being a rigger and not a modeler, heh. Anyways, I'm getting better I think, especially after saving some reference images of other artists cars and studying their wireframes.


First up, this is my toy model in the box:

Saturday's effort:

Sunday:

Monday:

Starting to flesh out the guts a bit now and tidying up some edge loops as I go.

Saturday, July 7, 2012

Qt Designer

Before I begin writing a new UI in PyQt, I like to use Designer to help design my UI and get some ideas down on screen. Designer is a tool that is part of the Qt download package, you can read more about it here.

It's great for putting some widgets and layouts together to visualise how you'd like your UI to look before writing it in Python. Or... you could just use the loadUI() method in Maya to bring it directly into Maya. I don't recommend this though, it's not very optimised and a bit annoying to connect up to custom methods.

Converting a .ui file to .py:
Save your .ui file you've just made in Designer, then load up command window (Windows) or terminal for OSX/Linux. Navigate to the folder where the .ui file is and type:

pyuic4 example.ui > example.py

This converts your .ui to a .py file, which you can now open and pick out what code you'd like to re-write and optimise. Pretty handy!

Check out this page for a slightly dated but still relevant tutorial: http://www.cs.usfca.edu/~afedosov/qttut/

Friday, July 6, 2012

First PyQt window in Maya

I've been using a bit of PyQt in Maya lately and felt like writing up some of my thoughts and solutions to problems I've come across in learning this module. I'm going to assume who ever is reading this has Maya 2011+ installed and intermediate knowledge of Python. If you're reading this as a beginner, I suggest checking out the following sites:

Python in Maya:
http://www.chadvernon.com/blog/resources/python-scripting-for-maya-artists/

PyQt examples:
http://diotavelli.net/PyQtWiki/Tutorials - A collection of PyQt tutorial websites.
http://zetcode.com/tutorials/pyqt4/ - One of my favourites. Note: These are written as standalone applications so won't work in Maya if you copy/paste. Just run these examples in IDLE or interpreter of your choice. This is what causes Maya to stall:
def main():
    app = QtGui.QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())
Maya already has it's own QApplication running when it opens, so creating a new one isn't necessary.

Maya PyQt window:
First up, let's start with a simple PyQt window in Maya that has a button which prints out a message!







Paste this into Maya:
from PyQt4 import QtGui
# inherit QtGui.QMainWindow class
class Main(QtGui.QMainWindow):
    def __init__(self, parent=None):
        # runs __init__ in QMainWindow first, then overrides with Main
        super(Main, self).__init__(parent)

        # make a central widget
        self.centralWidget = QtGui.QWidget(self)
        # attach widget to the PyQt window
        self.setCentralWidget(self.centralWidget)

        # set the window title     
        self.setWindowTitle("PyQt window")
       
        # setup UI method
        self.setup_UI()

    # this method add things to the QMainWindow
    def setup_UI(self):
        # make a vertical box layout and set it's parent to the central widget           
        self.mainLayout=QtGui.QVBoxLayout(self.centralWidget)
      
        # make a button
        helloButton=QtGui.QPushButton("Hello")
        # connect button's click slot to say_hello method
        helloButton.clicked.connect(self.say_hello)

        # add the button to the main layout
        self.mainLayout.addWidget(helloButton)

        # set the QMainWindow's height and width to be fixed with given integers
        self.setFixedWidth(200)
        self.setFixedHeight(40)
        
        # bind this layout to QMainWindow
        self.setLayout(self.mainLayout)

    # make a print method
    def say_hello(self, *args):
     print "Hello, Maya!"

# show the window!
myWindow=Main()
myWindow.show()

There you have it! An example of displaying a simple PyQt window in Maya. Over the next couple of weeks I'd like write about some of the following topics:

  • How to work with a QTreeWidget
  • Mixing PyQt and Maya UI (reparenting windows and scripted panels)
  • Custom right click menus on QWidgets
  • Adding popup windows
  • Parenting to Maya's window explanation