Posts

Showing posts from July 7, 2016

Maya Expressions Part 02 - Conditional Statements

Image
In this second video of my Maya Expressions series, I show how use the graph editor to display a visual representation of the value of our expressions with a graph. Then I move on to explain the basics of conditional statements in Maya's expression language, which also works with MEL scripts. A basic conditional statement in MEL and Maya expression language has the structure as such: if (condition) {     statement1;     statement2; } Condition is a test to see if a comparison between values is true, or false, for most cases. Example 1: if (cube1.translateX > cube2.translateX) { do_something; } In the above example, if cube1's translateX value is greater than cube2's translateX value, then do_something will be performed. Example 2: if (cube1.translateX == cube2.translateX) { do_something; } In the above, we are testing for equality. if both the values are equal, the do_something will be executed. Example 3: if (cube1.scaleX >= cube2.scaleY) { d