MGPickerAnimation
MGPickerAnimation is NOT undoable, queryable, and editable.
This command creates / queries / edits / plays picker animation item.
Go to: [MEL Examples] [Python Examples]
Synopsis
MGPickerAnimation( allProperties=string, backward=boolean, clearKey=boolean, clear=boolean, deferHiding=boolean, duplicate=boolean, duration=boolean, easingType=string, exist=boolean, getIdFromName=string, keyframe=boolean, loadInEditor=boolean, mirror=boolean, name=string, play=boolean, playByName=string, properties=string, removeKey=boolean, remove=boolean, removeProperties=string, supportedEasingTypes=boolean, startValueBlending=boolean, time=unsignedint, view=string, value=float, )
MGPickerAnimation |
|---|
-allProperties(-aps) string
|
In query mode, this returns all the properties get animated in this animation item, each property is of “pickerItemID.propertyName” form. In edit mode, this set the properties to be animated, the keyframes of included properties will remain, but those not in the properties will be removed. An empty list of properties means clearing the content of the animation item; If there is any invalid properties, the whole action will be given up. |
-backward(-b) boolean
|
Part of playback api, to play the animation backward. |
-clearKey(-ck)
|
This is a edit only flag to clear all keyframes for an animated property. With Note that it only clears the keyframe, the properties are still left included in the animation item, but just not animated. |
-clear(-cl)
|
Clear all the properties and keyframes, which leaves this animation item empty. |
-deferHiding(-dh) boolean
|
Part of playback api, to solve one specific problem when this API is used in an attribute button’s post change command. An attribute button can control other picker items’ visibility, switching the attribute value will potentially turn off visibilities of some picker items. Without defer hiding flag on, these picker items may be hidden immediately when the attribute value changed, the possible animation on them will not be seen. With defer hiding, these items will only be hidden when the animation on them finish playing. |
-duplicate(-dup)
|
This is an edit-only only flag to duplicate an animation item, the duplicated new item ID will be returned. |
-duration(-dur)
|
Query only flag to get the keyframe duration of the animated property in milliseconds. 1000 mean one second. The duration always count from frame 0, regardless the first keyframe is larger than 0 or not. With You can then get the maximum number of these returned duration intergers to know the overall duration of the animation item. |
-easingType(-et) string
|
In query mode with In create/edit mode it works with The possible values can be known by running The type string is case-insensitive. |
-exist(-ex)
|
Query only flag to check if the animation item with ID exists or not. |
-getIdFromName(-gin) string
|
To get the animation item ID by its name. |
-keyframe(-k)
|
In query mode with In create/edit mode it works with |
-loadInEditor(-lie)
|
In query mode this returns the current animation item ID that is loaded in the Animation Editor. In create/edit mode this load the animation item in the Animation Editor, note that only the one belongs to the currently active picker view will be loaded in the Animation Editor. |
-mirror(-mrr)
|
This is an edit-only only flag to mirror duplicate an animation item, the item properties will be replaced to the mirrored item properties, as well as there mirror-sensitive property values, e.g. X, HAlignment, etc. The name of animation item will also be processed to switch betwen |
-name(-n) string
|
The name of the animation item. |
-play(-p)
|
Edit only flag to playback an existing animation item by its ID. |
-playByName(-pbn) string
|
Edit only flag to playback all animation items that have the name. All the matched animation item will be played back at the same time. With this flag set, you don’t need to specify a ID for this command, if you do, only the animation item of the ID will be played. |
-properties(-pps) string
|
This flag is mainly used for query / edit api to specify property filer, so that the query and edit are limited to the specific properties. All the animatable propery names of a picker item can be queried by |
-removeKey(-rk)
|
Edit only flag to remove keyframe at the time specified by |
-remove(-rm)
|
Edit only flag to remove the animation item from the scene. |
-removeProperties(-rps) string |
Remove the properties from the animation item. |
-supportedEasingTypes(-ses)
|
Query only flag to get all the supported easing types. |
-startValueBlending(-svb) boolean
|
Part of playback api, to avoid popping at the start of the animation playback. This flag ensure that from the starting keyframe and on, the current actual value of the property will be used until there is a different keyframe value. This applies to both forward playback and backward playback, it is just for backward playback this will blend last couple keyframe values. |
-time(-t) unsignedint
|
In query mode with In create/edit mode it works with |
-view(-v) string
|
This controls which picker view that the animation item belongs to, if this flag is not specified, then current view will be used by default. A picker view id string should be specified for this flag in query, create, edit mode. The picker view id could be retrieved by MGPicker commands such as: (Please refer to MGPicker command manual for further details.) // Get current script execution view id,
// eg. picker load command, picker mouse enter command.
// This is only set during the script being executed.
MGPicker -q -currentPickerView;
// Get current active view id.
MGPicker -q -activePickerView;
// Find picker view id via picker node name or picker file name and namespace.
MGPicker -q -findPickerView "pickerNodeOrFileName" 1 "namespace";
// List ids of all opened picker views.
MGPicker -q -listAllPickerViews;
// Create a temporary picker view and return its id.
MGPicker -e -createTempPicker;
// Create a picker view and return its id.
MGPicker -e -createPicker "pickerName" "namespace" "filePath" "nodeName";
// Read in-scene picker node and return its id.
MGPicker -e -readPickerNode "nodeName";
// Read in-scene picker node and return its id.
MGPicker -e -readScenePicker "nodeName" "pickerName" "namespace" "pickerDataString";
// Read a picker file and return its id.
MGPicker -e -readPickerFile "pickerFilePath" 1;
|
-value(-val) float
|
In query mode with In create/edit mode it works with |
Flag can appear in Create mode
Flag can appear in Edit mode
Flag can appear in Query mode
Flag can be used more than once.
MEL examples
// Make sure there is an active picker view, got at least one selection button.
$properties = {"selectButton1.X", "selectButton1.Y", "selectButton1.Width", "selectButton1.Height"};
$name = "testAnim";
$animItem = `MGPickerAnimation
-allProperties $properties[0]
-allProperties $properties[1]
-allProperties $properties[2]
-allProperties $properties[3]
-name $name`;
// Set keyframe all properties at the frame zero using easing type linear and current values:
MGPickerAnimation -e -time 0 -keyframe -easingType "Linear" $animItem;
// Set another keyframe at frame 500msec using custom value:
$values = {160.0, 240.0, 80.0, 50.0};
for($i=0; $i<4; $i++)
{
MGPickerAnimation -e -time 500 -properties $properties[$i]
-keyframe -easingType "Linear" -value $values[$i] $animItem;
}
// Now try to playback the animation by name.Note that if more then one item with the name,
// it will only plays the first one.
MGPickerAnimation -e -playByName $name;
// Or play the animation by ID, in backward:
MGPickerAnimation -e -play -backward 1 $animItem;
Python examples
from mgpicker import mgp
# Make sure there is an active picker view, got at least one selection button.
properties = (
"selectButton1.X",
"selectButton1.Y",
"selectButton1.Width",
"selectButton1.Height",
)
name = "testAnim"
animItem = mgp.MGPickerAnimation(allProperties=properties, name=name)
# Set keyframe all properties at the frame zero using easing type linear and current values:
mgp.MGPickerAnimation(animItem, e=True, time=0, keyframe=True, easingType="Linear")
# Set another keyframe at frame 500msec using custom value:
values = (160.0, 240.0, 80.0, 50.0)
for property, value in zip(properties, values):
mgp.MGPickerAnimation(
animItem,
e=True,
time=500,
properties=property,
keyframe=True,
easingType="Linear",
value=value,
)
# Now try to playback the animation by name.Note that if more then one item with the name,
# it will only plays the first one.
mgp.MGPickerAnimation(e=True, playByName=name)
# Or play the animation by ID, in backward:
mgp.MGPickerAnimation(animItem, e=True, playByName=name, backward=True)