Mel Script - The expression Command




In addition to using the script editor to create expressions, we can also use the mel command expression. This allows us to automatically generate expressions within our scene, something that is very handy indeed!





The code to generate the above set of nodes is listed below. It's interesting to note that an expression node is generated and stored in the scene graph.




			// create a NURBS sphere
			$s = `sphere`;

			// create an expression which is attached to the nurbs sphere
			// and makes it's Y translation oscillate with time.
			expression -object $s -string "ty = sin( time1.outTime )";