1、MAX高级应用么什么高级意思,只是用来刷分,谨慎进入if Pw_tools != undefined then closeRolloutFloater Pw_toolsPw_tools=newrolloutfloater 完美工具 160 235 920 75rollout Spring_tools 裙摆工具 width:165 height:298( local FirstBoneArray = #() local LastBoneArray = #() local LastPointArray = #() local ChildArray = #() -子物体的数组 local PosAr
2、ray = #() -用来创建线的坐标数组 local AddSpringPoints = #() -加弹簧的点 local LyLine -创建线性骨骼用的线 local MySpline local AllObj local PtTension = 1 -越小越有弹性 local PtInd = 1.8 local PtMass = 300.0 -越重越有弹性 越大越有弹性 local MassInd = 1.3 local MyIks = #() local filename = Global EC_OBJ, EC_TargetObj, EC_SplineOBJ, EC_HelperOB
3、J fn GetChildren Obj = ( if Obj.children.count != 0 then ( EC_TargetObj = Obj.children1 if EC_TargetObj.children.count != 0 then (GetChildren EC_TargetObj) ) ) fn SplinIk = ( IF getCommandPanelTaskMode() != #motion then SetCommandPanelTaskMode Mode:#Motion - - Check for Groups and act accordingly -
4、EC_OBJ = selection1 if selection.count 1 do ( local h = EC_OBJ.parent if (h != undefined and h.isSelected and isGroupHead h) do EC_OBJ = h ) Animate off ( - - Define Filter Functions for PickObject Selection - fn ChildFilt o = Filters.Is_Child EC_OBJ o or Filters.Is_Parent EC_OBJ o fn ShapeFilt o =
5、superClassOf o = Shape and o != EC_OBJ - GetChildren EC_OBJ -EC_TargetOBJ = PickObject count:1 select:true filter:ChildFilt count:#Multiple Message:Pick Joint to complete IK Chain Rubberband:EC_OBJ.pos ForceListenerFocus:False If EC_TargetOBJ != #escape or EC_TargetOBJ != undefined then ( if Filters
6、.Is_Child EC_OBJ EC_TargetOBJ then ( NIK = iksys.IKChain EC_OBJ EC_TargetOBJ SplineIKSolver append MyIks NIK ) Else ( NIK = iksys.IKChain EC_TargetOBJ EC_OBJ SplineIKSolver append MyIks NIK ) ) EC_SplineOBJ = MySpline -EC_SplineOBJ = PickObject count:1 select:true filter:ShapeFilt count:#Multiple Me
7、ssage:Pick Spline to assign SplineIK Rubberband:EC_TargetOBJ.pos ForceListenerFo If EC_SplineOBJ != undefined and EC_SplineOBJ != None then ( - - Make the Spline the goal shape of the SplineIK - NIK.transform.controller.pickShape = EC_SplineOBJ - - Add SplinIKControl Modifier and Create Helpers - mo
8、d = Spline_IK_Control() AddModifier EC_SplineOBJ (mod) mod.createHelper(0) EC_HelperOBJ = mod.helper_list1 - Set the upnode to the first helper NIK.controller.upnode = EC_HelperObj - - Add List Controller and Path Constraint - local cont if Filters.Is_Child EC_OBJ EC_TargetOBJ then ( cont = AddListC
9、ontroller EC_OBJ Pos Position_List If classof contlistCtrl.GetActive cont.object != Path_Constraint then constraint = AddConstraint EC_OBJ Pos Path_Constraint true else constraint = contlistCtrl.GetActive cont.object ) else ( cont = AddListController EC_TargetOBJ Pos Position_List If classof contlis
10、tCtrl.GetActive cont.object != Path_Constraint then constraint = AddConstraint EC_TargetOBJ Pos Path_Constraint true else constraint = contlistCtrl.GetActive cont.object ) - - Add Path Constraint Object Target as the spline - constraint.AppendTarget EC_SplineObj 50 DeleteKeys constraint.percent.cont
11、roller constraint.percent = 0.0 - - Set Active Controller - SetActiveController cont constraint -Format %n (EC_OBJ.name + is Position Constrained to + EC_HelperOBJ.name) to:Listener Select EC_OBJ ) Max Motion Mode ) ) fn SaveOName Obj= ( f = createFile filename for o in Obj do ( format $%n o.name to
12、:f - output name in a pathname form ) close f ) fn deleteObj = ( f = openFile filename while not eof f do ( o = readValue f - read object try (delete o) catch () ) close f ) fn SelChildren sel SelChilds = -把子物体加进选择集函数 ( for i = 1 to sel.children.count do ( tempsel = sel.childreni append SelChilds te
13、mpsel if tempsel != undefined do SelChildren tempsel SelChilds ) return SelChilds ) fn SelArrayToPosArray SelArray = -选择集转换成坐标pos集函数 ( for i in SelArray do ( append PosArray i.pos ) return PosArray ) fn drawLine ptArray = -画线函数 ( LyLine = SplineShape pos:ptArray1 addNewSpline LyLine for i in 1 to pt
14、Array.count do ( addKnot LyLine 1 #corner #line ptArrayi ) updateShape LyLine return LyLine ) fn copybones sel = - 拷贝骨骼并隐藏 ( FirstBoneArray = #() -子物体数组 append FirstBoneArray sel -把自己加进选择集 SelChildren sel FirstBoneArray -把子骨骼加入数组 LastBoneArray = #() for i in FirstBoneArray do ( append LastBoneArray
15、(copy i) ) for i in 2 to LastBoneArray.count do ( LastBoneArrayi.parent = LastBoneArrayi-1 ) hide FirstBoneArray Select LastBoneArray1 -选择新复制骨骼的跟骨骼 ) fn SetTension objs Tension Ind = - 设置弹簧拉力 ( for i in objs do ( i.pos.controller.Spring.setTension 1 Tension Tension = Tension / Ind ) ) fn setMass obj
16、s Mass Ind = - 设置弹簧重力 ( for i in objs do ( i.pos.controller.Spring.setMass Mass Mass = Mass * Ind ) ) fn bakeAnim sel = - 烘焙关键帧 ( FirstBoneArray = #() -子物体数组 append FirstBoneArray sel -把自己加进选择集 SelChildren sel FirstBoneArray -把子骨骼加入数组 bakepoints = #() starttime = animationrange.start endtime = anima
17、tionrange.end for i in 1 to (FirstBoneArray.count-1) do ( bakepoint = Point transform:FirstBoneArrayi.transform isSelected:on append bakepoints bakepoint ) try( AllObj = AllObj + bakepoints SaveOName AllObj -保存所有物体名称到文本文件 )catch() for t in starttime to endtime by 1 do ( sliderTime = t with animate o
18、n ( for i in 1 to bakepoints.count do -点跟着骨骼打关键帧 ( bakepointsi.transform = FirstBoneArrayi.transform ) ) ) if MyIks.count != 0 then (delete MyIks )else(delete $IK Chain*) for t in starttime to endtime by 1 do ( sliderTime = t with animate on ( for i in 1 to bakepoints.count do -真正烘焙骨骼关键帧 ( FirstBone
19、Arrayi.transform = bakepointsi.transform ) ) ) ) button btn_CreatIk 创建软物体 pos:5,10 width:136 height:20 button btn_verysoft 软 pos:5,35 width:20 height:20 button btn_veryhard 硬 pos:120,35 width:20 height:20 button btn5 savedate pos:5,60 width:136 height:20 button btn_soft 软 pos:29,35 width:20 height:2
20、0 button btn_yiban 一般 pos:53,35 width:38 height:20 button btn_hard 硬 pos:96,35 width:20 height:20 button btn_bakeAnim 烘焙关键帧 pos:5,85 width:136 height:20 button btn_clearscene 清理场景 pos:5,110 width:136 height:20 on Spring_tools open do ( animButtonState = off ) on btn_CreatIk pressed do ( if selection
21、.count = 1 then ( FirstBoneArray = #() -清空变量 LastBoneArray = #() -清空变量 MyIks = #() -清空变量 filename = maxFilePath + (getFilenameFile maxFileName) + _ + $.name + .dat copybones $ -拷贝骨骼 并隐藏原来的骨骼 PosArray = #() -画线用的坐标 AddSpringPoints = #() -清空变量 加弹簧控制的点 SelArrayToPosArray LastBoneArray MySpline = drawLi
22、ne PosArray SplinIk () - 我的创建spline ik的函数,创建线性ik,替代了下面这行的命令,哈哈! -macros.run Inverse Kinematics SPLINE_IK LyLine.modifiers#Spline_IK_Control.linkTypes = 1 -下面是给每个控制点加上弹簧 for i in 2 to LyLine.modifiers#Spline_IK_Control.helper_list.count do ( TempPoint = LyLine.modifiers#Spline_IK_Control.helper_listi
23、 append AddSpringPoints TempPoint TempPoint.pos.controller = SpringPositionController () ) AddSpringPoints1.parent.parent = LastBoneArray1.parent completeRedraw() -刷新一下场景,不然弹簧拉力设置不上。 SetTension AddSpringPoints PtTension PtInd -设置弹性 setMass AddSpringPoints PtMass MassInd -设置点重量 for i in 1 to (FirstBo
24、neArray.count-1) do ( myik = IKSys.ikChain FirstBoneArrayi FirstBoneArrayi+1 IKHiSolver append MyIks myik myik.parent = LastBoneArrayi hide myik ) select FirstBoneArray1 Allpoints = #() - 创建线性ik时候产生的point点集合 for i in 1 to LyLine.modifiers#Spline_IK_Control.helper_list.count do ( TempPoint = LyLine.modifiers#Spline_IK_Control.helper_listi append Allpoints TempPoint ) -下面保存数据-
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1