/* CMD: Freeze Motion * Freezes Motion File so there is a key at every frame. All points in layer * are used in the order they were created if you are using v3.1 modeler * By Arnie Cachelin © 1993 NewTek Inc. Modified By Jon Tindall 2-18-94 */ NUMERIC DIGITS 6 call addlib "LWModelerARexx.port", 0 call addlib "rexxsupport.library", 0, -30, 0 signal on error signal on syntax sysnam = 'Freeze motion ' curlay=CurrentLayer elay=Emptylayers() Call setLayer(word(elay,1)) LFile.name=getfilename("-- Load Envelope --","Motions") if LFile ="(none)" then exit call Add_Begin() call Add_point 0 0 0 call Add_end if open(infile,LFile.name,'R') then do Do i = 1 to 4 keyqty = readln(infile) End do i = 1 to (keyqty*2) lastkey = readln(infile) end call close infile end call Pathclone(LFile.name,1,0, Word(lastkey,1) ) /* name step start end */ File.name=getfilename("-- Save Envelope --","Motions:") if File.name ="(none)" then exit h=0; p=0; b=0 xsc=1; ysc=1; zsc=1 File.type="LWMO" n = xfrm_begin() Keys=n KeySpacing=1 /* (Frames/Keys)%1+1 */ call WriteHeader(mot,keys) do i=1 to n parse value xfrm_getpos(i) with x y z . k=(i-1) call WriteKey(mot,k,0) end call xfrm_end call close mot call cut call notify(1,'!Created Motion File: 'File.name) Call setlayer(curlay) exit WriteKey: PROCEDURE EXPOSE x y z h p b xsc ysc zsc arg MotFile, frame, lin channels=x y z h p b xsc ysc zsc spline=frame lin "0.0 0.0 0.0" say channels spline call writeln(MotFile,channels) call writeln(MotFile,spline) return frame WriteHeader: PROCEDURE EXPOSE File. arg MotFile, Keys if open(MotFile,File.name,'W') then do call writeln(MotFile,File.type) call writeln(MotFile,"1") /* magic # */ call writeln(MotFile,"9") /* Channels */ call writeln(MotFile,Keys) end else do Bummer("Can't open Motion file : "File.name) end return 1 Bummer: ARG etxt t=Notify(1,'!Rexx Script Error','@'ETxt) exit syntax: error: call end_all t=Notify(1,'!Rexx Script Error','@'ErrorText(rc),'Line 'SIGL) exit