Procedures and Functions
2005
This chapter focuses on procedures, functions, and top-down design in MEL. While designing a script to solve a complicated problem, it's rarely a good idea to try to write the entire script, beginning to end, in one sitting. Since programming in MEL is simply creating a set of instructions that tell Maya to do a series of actions, one by one, a substantial piece of the challenge is figuring out what the script should do in the first place. Although, there are other strategies, the simplest, most common, and easiest-to-apply approach to developing software, including MEL scripts, is called top-down design. The top-down approach requires that first work out a statement of what problem one is trying to solve with program, then a statement of the basic steps that program has to take to yield a solution. Procedures and functions are simple ways to group together a number of MEL statements into a single operation that one script can use again and again. When a script (or another procedure) uses one of these predefined groupings of MEL statements, that script is said to call the procedure or function, in the sense that the procedure or function is called upon to do its job. A function is a special type of procedure that is able to hand a data value back to the script that called it. This value is called the function's return value. Functions, then, are procedures that return values to the script that calls them.
Keywords:
- Correction
- Source
- Cite
- Save
- Machine Reading By IdeaReader
0
References
0
Citations
NaN
KQI