Saturday, October 17, 2009

Blur Gives Us Python And PyQT In 3DSMax

http://forums.cgsociety.org/showthread.php?f=98&t=816475

Developed by Blur, these plugins have the potential to replace Maxscript and finally let us use Python properly in 3DS Max.

I'm just starting to dig into it, fingers crossed...

Thursday, October 1, 2009

MEL: Check If An Object Or Attribute Exists

Ever needed to check if an object exists in your Maya scene? Or perhaps you need to check if a certain object has an attribute or not?

Use the objExists mel command.

First let's use it in a simple way to check for the existence of an object saved in $myObject
// objExists will return true or false (1 or 0), so you can use it multiple ways.
int $objTest = `objExists $myObject` ;

// If that object exists, it will return 1 (true), so then you could say something like:
if($objTest == 1) {
print "It Exists!" ;
}

// Another trick you can do is an IF statement will simply test a boolean (true or false) and fire if it's true, example:
if($objTest) {
print "It Exists!" ;
}

// So using that, we can simply test for the return of objExists in our IF statement, to simplify it even more.
if(`objExists $myObj`) {
print "It Exists!" ;
}

This works for attributes too, so to check for the existence of an attribute on a certain object, let's say "R_Arm_Ctrl.IKFK" we can use the following:

if(`objExists "R_Arm_Ctrl.IKFK"`) print "It Exists!" ;

Huzzah!