MGPickerAnimation命令
MGPickerAnimation不可撤消, 可以查询且可以编辑。
这个命令创建, 查询, 编辑或播放动画对象。
跳转到: [MEL例子] [Python例子]
概要
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
|
在查询模式下,返回该动画对象里所有被动画的属性, 每个属性都是对象ID.属性名的格式。 在编辑模式下则是设置动画对象里所包含的属性,已经包含的即有属性如果没在指定的属性外则被移除。 指定空数组则是清空该动画属性。如果指定了非法或不存在的属性,则操作取消。 |
-backward(-b) boolean
|
用于播放的API, 来倒着播放动画。 |
-clearKey(-ck)
|
只用于编辑的标签,用来清除指定属性的关键帧。 通过指定 注意它只清空关键帧,属性成员及动画对象本身仍然存在,只是它没有动画。 |
-clear(-cl)
|
清空动画对象里的所有动画。所包含的picker对象属性的记录也会被清除。 |
-deferHiding(-dh) boolean
|
用于播放的API, 特定作用于属性按钮的数值改变后命令的情况下。 属性按钮在其属性值变动时可以控制其它picker对象的可见性,如果这时指定其播放一段关于这些Picker对象的动画,等动画还未播放则这些对象就被隐藏了,结果动画也不会被看到。 当这个标签指定为真时,则会等动画都播放完了才会隐藏这些对象。 |
-duplicate(-dup)
|
复制该动画对象,以方便做单独的编辑。 |
-duration(-dur)
|
只用于查询指定属性的动画时间长度,以毫秒为单位。 时间永远从0起算,即使第一个关键帧是从非零开始。 通过指定 你可以通过取最大值来知道整个动画动像的整体动画长度。 |
-easingType(-et) string
|
查询特定被动画属性的关键帧曲线类型, 比如线性,慢入慢出等。通过指定 如果没有指定这个标签则会返回所有被动画属性的动画关键帧曲线类型。将返回字符窜数组。 可以通过运行 指定的关键帧曲线类型是不区分大小写的。 |
-exist(-ex)
|
查询某动画对象是否存在。 |
-getIdFromName(-gin) string
|
通过名字来查询动画对象的ID。将返回所有匹配的ID字符窜数组。 |
-keyframe(-k)
|
查询特定被动画属性的关键帧信息,每个关键帧将包含时间,数值及曲线类型的字符窜化信息。 通过指定 在创建或编辑模式下,用来配合其它标签来设置关键帧。 |
-loadInEditor(-lie)
|
查询模式下将返回当前在动画编辑器所加载的动画对象的ID。 在编辑模式下,会将指定ID动画对象加载到动画编辑器里以便编辑或预览。注意只有该动画对象来自当前激活的picker视图时才会加载。 |
-mirror(-mrr)
|
镜像复制该动画对象,会基于picker对象的镜像关系来自动替换动画对象里被动画的属性。像一些属性如水平坐标或者水平对齐属性的动画数值也会做相应的镜像。 动画对象本身的名字也会做一些左右的替换处理。 |
-name(-n) string
|
动画对象的名字。不像ID, 名字可以由用户自由取,也可以指定名字来播放某动画对象。 |
-play(-p)
|
通过ID来拾取并播放某个动画对象。 |
-playByName(-pbn) string
|
通过名字来匹配并播放所有具有该名字的动画对象。如果有多个对象则它们会被同时播放。 注意如果指定了这个标签,你就不需要为这个命令指定动画对象的ID,如果指定了,只有这个ID的动画对象被播放。 |
-properties(-pps) string
|
主要用来配合其它标签来设置编辑关键帧或者做一些查询。 如果要查询picker对象所有可被动画的属性,可以运行 |
-removeKey(-rk)
|
只用于编辑,如果有指定 |
-remove(-rm)
|
从场景删除该动画对象。 |
-removeProperties(-rps) string |
该动画对象里移除某个被动画的属性,连同其关键帧等。 |
-supportedEasingTypes(-ses)
|
用来查询目前支持的所有关键帧曲线类型。 |
-startValueBlending(-svb) boolean
|
用于播放的API, 来消除动画播放一开始的跳动现象。 在播放动画前,涉及到的picker对象的属性可以是任何数值,当动画开始播放时,第一帧的数值可能跟当前数值不同,这个选项没有开的话就会导致播放开始时的跳动。 打开了这个选项,则会将开始的数值替换成实际的当前数值,这样就不会有跳动。注意不管正常播放还是倒放这个都起作用,只不过倒放整合的是倒数的关键帧数值。 |
-time(-t) unsignedint
|
查询特定被动画属性的关键帧时间信息,通过指定 在创建或编辑模式下,用来配合其它标签来设置关键帧。 |
-view(-v) string
|
控制要查询,编辑或创建在哪个picker视图的动画对象,在未使用该标签的情况下,默认是在当前激活的picker视图。 该标签需要您指定一个picker视图id字符窜。该id可以通过下方式来获取(具体请查询MGPicker命名参考文档): // 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
|
查询特定被动画属性的关键帧属性数值信息,通过指定 在创建或编辑模式下,用来配合其它标签来设置关键帧。 |
标签可以在创建模式中使用;
标签可以在编辑模式中使用
标签可以在查询模式中使用
标签可以在一条命令中多次使用.
MEL例子
// 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例子
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)