Tags

Saturday, October 29, 2011

Installing PyQT on OSX

Here are two websites I found very helpful with installing PyQT on my Mac.


This tutorial would seem like the installation is pretty straight forward... however I ran into some trouble where I couldn't install PyQT4 in the terminal due to an annoying error. I eventually came across this site:


...and it worked! Here is a link to a forum post I made which has a lot more information on what was happening and what platform I was using.

EDIT:
Or... you could head over here and read this post:
http://www.justinfx.com/2011/11/09/installing-pyqt4-for-maya-2012-osx/

Inside is a fantastic little package that does everything for you from one install! Awesome.

Sunday, October 23, 2011

D'aww, my first script.

I've been learning Python for a few months now and have been really enjoying it. To start off this new section of my blog, here is my first script I've written here at home! It's written in Python, using the PyMEL module.

This script will take what ever you have selected, group and add a '_Group' suffix. Very simple, but I use it often.

import pymel.core as pm
import maya.OpenMaya as om
 
# List our selection
sel = pm.ls(sl=1)
 
# Check to see if you have objects selected or not.
if len(sel) < 1:
    # No objects selected? Display this message.
    om.MGlobal.displayError("No objects selected.")
else:
    # 1 or more objects selected? Group all of them and 
    # add  '_Group' suffix
    for item in sel:
        pm.group(item, n=str(item) + "_Group")
It took me a while to get that Syntax Highlighter script working, but it was worth it. Click the little question mark in the top right of the code to find out more. Fantastic!