脚本全貌
可实现全自动导出程序需调用的动作文件。
知识点:
deleteKeys mybox.pos.controller.Z_Position.controller –删除某物体的位移关键帧,精确到XYZ的任意一轴。
deleteKeys mybox.Rotation.controller –删除某物体的旋转关键帧
deleteKeys mybox.scale.controller –删除某物体的缩放关键帧
$Bip001.controller.inPlaceMode = 1 –开启BIPED的inPlace固定模式
BIPED默认的文件名有空格,这对脚本很不友好,临时想了个办法,先把空格替换为“_”,完成脚本后再把下划线取消。
TempMode = getCommandPanelTaskMode(); max create mode; for i in $bip*
do ( tempnames = filterstring i.name " " case of ( (tempnames.count ==
1) : i.name = tempnames[1] (tempnames.count == 2) : i.name = tempnames[1]
+ "_" + tempnames[2] (tempnames.count == 3) : i.name = tempnames[1] + "_"
+ tempnames[2] + "_" + tempnames[3] ) ) setCommandpanelTaskMode TempMode
删除BIP骨骼(质心点)位移关键帧
fn DelBipmove = ( bipobj=execute ("$"+ g_bip) try (bip = bipobj bipc =bip.transform.controller
biped.convertToFootSteps bipc keyPerFrame:true flattenToZ:false bipc.trackSelection
= 1 --定位到某一轨迹,对应X轴 biped.clearSelectedAnimation bipc --清除当前定位轨迹动画 bipc.trackSelection
= 2 biped.clearSelectedAnimation bipc animate on ( sliderTime = 0f --时间帧定位到0帧
biped.setTransform bipobj #pos [0,0,0] true --选择对象位移归零 ) ) catch() )