View Single Post
# 4 28-12-2014 , 02:00 AM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
The building blocks for what you're asking are in the previous code, I'll explain the syntax of this line of MEL code in hopes it'll help you develop your own.
When you call a command, it can be put into 1 of 3 modes using a couple of flags(these flags don't need any values assigned):

-edit or -e for short. This allows you to change the values of additional flags(not all flags can be edited and the help files label them accordingly).
ex:
Code:
playbackOptions -e -maxTime 500;
-query or -q. This returns the value for the flag that follows.
ex:
Code:
playbackOptions -q -maxTime;
create, there is no -create flag to activate this mode, it is the default and is understood when you don't specify -edit or -query.
ex:
Code:
playbackOptions -maxTime 500;
In the case of :
Code:
playbackOptions -edit -maxTime `currentTime -q`;
The `` tells Maya to calculate the contents of the backquotes and return the result and we're using that result as a value for the maxTime flag. Its just quicker to type it this way instead of having to query and store the currentTime in a variable beforehand like:
Code:
int $currentFrame = `currentTime -q`;
or since you said you wanted to add some stuff onto the frames
Code:
int $currentFrame = `currentTime -q` + 100;
then assign the $currentFrame variable to the maxTime flag
Code:
playbackOptions -edit -maxTime $currentFrame;
The good thing about creating the $currentFrame variable is that you are able to reuse it further down the script, if you don't care about having that option then...
Code:
playbackOptions -edit -maxTime (`currentTime -q` + 100);
..would be the same thing.
The parentheses () create an expression out of the contained code. Expressions group parts of the code where operators and values need to be calculated in a particular order to produce a value.

Hope I helped more than confuse user added image. If you have any questions, let me know.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::