Building PyQt for Maya 2012 ( Linux x64 )

                   

SIP needs to be built prior to building PyQt.

Download SIP from here

Maya 2012 uses Qt 4.7.1.

Download it from here

Download PyQt from here

First step is to build qt from source. Extract the tarball and CD in to the directory

./configure

While running configure, if you get the following error

Basic XLib functionality test failed!

You might need to modify the include and library search paths by editing

QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in /home/anoop/apps/sources/qt-everywhere-opensource-src-4.7.1 /mkspecs/linux-g++-64.

install teh libXext development package. I used zypper to install the package from the web

zypper install xorg-x11-libXext-devel

executing the configure after the installation gave the following error

cannot find -lXrender

this was happening because configure couldn’t find libXrender.so. This can be fixed by creating a symlink to libXrender.so.1 in the /usr/lib64 directory

ln -s /usr/lib64/libXrender.so.1 /usr/lib64/libXrender.so

After successful configuration run the following to install Qt to /usr/local/Trolltech/Qt-4.7.1 directory

make

make install

Building SIP

Extract the SIP zip archive to /home/username/SIP

cd /home/username/SIP

After setting the variables, run the following

/usr/autodesk/maya2012/bin/mayapy configure.py

make

make install

Building PyQt

Extract the archive to /home/username/PyQt-x11-gpl-4.7.4

cd PyPyQt-x11-gpl-4.7.4

/usr/autodesk/maya2012/bin/mayapy configure.py -q /usr/local/Trolltech/Qt-4.7.1/bin/qmake

make -j4

make install

Building OpenEXR libraries on Linux ( openSUSE 11.4 )

 

OpenEXR is a high dynamic-range (HDR) image file format developed by Industrial Light & Magic for use in computer imaging applications. In order to develop plugins and tools that can handle OpenEXR file formats, you need to have the OpenEXR libraries built for your OS.

I had been not using Maya for the past few months since I have been dealing with proprietary applications used at my workplace. So I decided to continue work on Maya whenever I get back home after the days work. And what better way to start things all over again than starting with the API.

So I made a checklist of the libraries and other tools which I need to get built to start working on the same.So here I was building OpenEXR on openSUSE 11.4 and I stumbled across few things here and there which I felt would be valuable if I share with you all.

Building OpenEXR on you OS requires the zlib and ilmbase libraries which has to be linked at the time of configuring.So the first task is to get zlib and ilmbase libraries built on your machine.
I had my libraries installed in my sandbox folder which is /usr/local/sandbox referred by environment variable $SANDBOX. In case you have installed in locations other than standard paths like(/usr/include and /usr/lib) you need to make the build aware of the same.

setting the the environment variable PKG_CONFIG_PATH to $SANDBOX/lib/pkgconfig will let OpenEXR get the package info regarding zlib and ilmbase.

./configure –prefix $SANDBOX LDFLAGS=-L$SANDBOX/lib CPPFLAGS=-I$SANDBOX/include

make

While executing make if you come across the following error

main.cpp:195:28: error: ‘strcmp’ was not declared in this scope
make[1]: *** [main.o] Error 1
make[1]: Leaving directory `/home/anoop/apps/sources/openexr-1.6.1/exrenvmap’
make: *** [all-recursive] Error 1

you can fix it by including

#include <string.h>

in the header file list of main.cpp in both exrmaketiled and exrenvmap dirs.

and then execute

make install

File Handling in MEL – Part2


Problem:
To perform a set of file operations including creation, deletion and listing of files and directories
Solution:

Creating  folders using sysFile command

 sysFile -makeDir "/home/user/mayaFolder"; //unix
 sysFile -makeDir "C:/Documents and Settings/MayaFolder"; //windows
 

Get the list of mel scripts in the  maya scripts directory

 getFileList -folder "/home/user/maya/scripts" -filespec "*.mel";
 

Stripping a file path in to directory name and base name.

 $filePath = "/home/user/maya/2011-x64/scripts/userSetup.mel";
 $dirName = dirname($filePath);
 $baseName = basename($filePath , "/");
 

Commands:
sysFile, dirname, basename
Discussion:
The sysFile command can be used to create, delete or rename files and directories from within Maya. The dirname and basename commands can be used to strip a file path in to the absolute path and filename. Using a combination of these three commands its possible to perform a variety of OS level operations from within the Maya workspace itself.

File Handling in MEL – Part1

In this tutorial, we will be covering the file handling functionality provided by MEL.
Problem:
Writing out to and reading from file formats other than maya ascii and binary.
Solution:
Write the file location of texture maps used in a scene

 $fileId = `fopen "/home/user/textureList.txt" "w"`;
 $fileNodes = `ls -type "file"`;
 if( size($fileNodes)==0 ) {
 fprint $fileHandle "No File Nodes found in scene";
 }
 else {
 for ($each in `ls -type "file"`) {
 fprint $fileHandle (getAttr ($each + ".fileTextureName") + "n");
 }
 }
 fclose $fileHandle;
 

Read the contents of the written file and print the contents of each line.

 $fileHandle = `fopen "/home/user/textureList.txt" "r"`;
 while (! `feof $fileHandle`) {
 $eachLine = `fgetline $fileHandle`;
 print $eachLine;
 }
 fclose $fileHandle;
 


Commands:

fopen,fprint,fgetline,fclose,getAttr

Discussion:

The first code block writes the file paths of all the texture maps in the scene to a text file names textureList.txt. The fopen command returns a file identifier which can be used to write in to or read from the file specified in the command.An additional string can also be mentioned to denote whether to open the file for read,write or append operation(r ,w or a). Data can be written to the file using fprint command. Its advised to close the file handle once the read, write or append operation is finished. This can be done using the command fclose.

Data can be read by opening the file handle in “r” mode. The fgetline command reads the contents of the file line by line, which is then printed on to the screen.

PyQt4 for Maya2011 on Windows XP x64

Finally got some time to get back to python after a long break, only to find that I don’t have a working copy of PyQt4. Instead of spending time on google trying to figure out whether anyone has decided to share a copy of PyQt built against Qt4.5.3, decided to build one myself. Having Windows SDK already installed on my XP proved out to be handy since the Visual Studio version I was running was still 32-bit one. Downloaded SIP4.12 source and Qt4.5.3 SDK and within few seconds the PyQt4 module was successfully added to the site-packages.

Thought of sharing the build for those of you who are planning ahead to design awesome GUIs in Maya.You may download it here

CODE – CG – MEL Scripting – Preface

After coming across so many queries about MEL Scripting in several computer graphics forums, I felt it would be a great idea to start a MEL Scripting Tutorial Series under CODE-CG where Artists and Programmers can learn how to get their job done by making use of MEL. You might be skeptical why we need a Tutorial series when we already have numerous books available in the market that cover MEL. I would say, all those books will tell you how to write a MEL Script but fail to tell where to use them. Having spend a couple of years in the Computer Graphics industry this is the pattern that I observed.

1. Artists are too lazy to learn Scripting even if they know that scripting knowledge can streamline their workflow a lot.

2. Programmers who know Scripting, never always come up with the Scripts that completely makes use of the techniques an experienced Artist is equipped with.

There will always be a communication gap between the Artists and the Programmers which results in a few thousand lines of code, which would have made use of better logic, if they both knew what the other person was looking for.

Hence I decided that the structure of the Tutorials should be in such a way that each MEL command that we examine here should point to the exact production scenario where it can be made use of, so that whether you are an Artist or a Programmer, you know exactly Where and How you gotta use it.

Indian film festivals get to feel the punch again!

DNA Inc’s FEEL THE PUNCH was awarded with the BEST 3D ANIMATED SHORT FILM AWARD at the  7th edition of MAAC’s Annual 24 FPS Animation awards.

The film has already won several prestigious awards including

  • The Special Jury Award at the Awards of Excellence, Asifa IAD-2010
  • The Special Jury Award at the Short and Documentary Film Festival of Hyderabad (SDFFH)-2010
  • and The TASI Viewer’s Choice Award in the “Student Films Category” at Anifest India-2010

The 7th Annual 24 FPS Animation awards were held at the SRPF Grounds in Goregaon, Mumbai on November 19, 2010. The Awards showcased the best animation & VFX work in Hollywood, Bollywood, gaming and commercials. The prestigious event had nominations not only from young Animators and studios in India but also from countries like China, France, Germany and the US.

The jury was drawn from studios like DreamWorks, Lucas film, Rhythm & Hues, Prime Focus, Prana, Pixion, Crest Animation, Maya Digital Media, and more and the awards were given away in over 20 categories covering Gaming, TV, VFX and Advertising.