/* Trajectory Editor - DMS - Nov 98 - by Sylvain HUET */ /* Rev. Aug. '98 - by Marc BARILLEY */ /* Trajectory Editor - DMS2 - May 99 - by Patrice FAVRE */ /* modified on the 7th of Jun 99 by Christophe LOREK */ typeof plugin=S;; typeof class=S;; /* vvv shall be removed when available in the UserInstance API vvv */ fun InstName(UI)=UI.nameInst;; fun InstParam(UI)=UI.paramInst;; /* ^^^ shall be removed when available in the UserInstance API ^^^ */ typeof ed = PluginEditor;; typeof SrvAnimAutoStart = ObjCheck;; typeof CHini = ObjCheck;; typeof CHloop = ObjCheck;; typeof Interpolate = ObjCheck;; typeof CHpos = ObjCheck;; typeof CHall = ObjCheck;; typeof LBPosAng = ObjText;; typeof LBNbFrames = ObjText;; typeof NbFrames = ObjText;; typeof LBframerate = ObjText;; typeof Framerate = ObjText;; typeof LBframeEvents = ObjText;; typeof LSframeEvents = ObjList;; typeof frameEventslist = [I r1];; typeof frameEvent = ObjText;; typeof AddFrameEvent = ObjButton;; typeof RemoveFrameEvent = ObjButton;; proto save=fun [[Inst r1]] [[S r1] [S r1] [[S r1] r1] [[S r1] r1]];; /* generates a list of strings containing the number of the frames coming from the FrameEvent parameters of a given instance of the plugin. */ fun paramFrames(paramlist)= if paramlist == nil then nil else let paramlist -> [[name r] nparamlist] in ( if !strcmp name "FrameEvent" then let r -> [frameNum _] in (strcat ".Frame#" (itoa (atoi frameNum)))::(paramFrames nparamlist) else (paramFrames nparamlist) );; /* generates a list of events corresponding to the FrameEvent parameters of a given instance of the plugin. */ fun suppframes(l,UIname)= if l == nil then nil else let l -> [currentFrame nl] in ("eventC"::(strcatn UIname::currentFrame::nil)::nil):: (suppframes nl UIname);; /* generates the list of supp. events for all the instances of the plugin. */ fun suppevents(l)= if l == nil then nil else let l -> [UI nl] in let (InstName UI) -> name in listcat (suppframes (paramFrames strextr (InstParam UI)) name) (suppevents nl);; /* generates the list of supp. actions for all the instances of the plugin. */ fun suppactions(l)= if l == nil then nil else let l -> [UI nl] in let (InstName UI) -> name in ("actionC"::(strcatn name::".playonce"::nil)::nil):: ("actionC"::(strcatn name::".playloop"::nil)::nil):: ("actionC"::(strcatn name::".stop"::nil)::nil):: ("action"::(strcatn name::".playonceS"::nil)::nil):: ("action"::(strcatn name::".playloopS"::nil)::nil):: ("action"::(strcatn name::".stopS"::nil)::nil)::(suppactions nl);; fun save(l)= if l==nil then [nil nil nil nil] else [ /* registerF */ nil /* register */ nil /* supplemental dat */ ("plugin"::plugin::nil)::nil /* supplemental dmi */ listcat (suppactions l) (suppevents l) ];; fun AddFrameEventInList(l,frame,pos)= if l == nil then ( _ADDlist LSframeEvents pos itoa frame; [frame nil] ) else let l -> [currentframe nl] in ( if frame == currentframe then l else if frame < currentframe then ( _ADDlist LSframeEvents pos itoa frame; [frame [currentframe nl]] ) else [currentframe (AddFrameEventInList nl frame pos+1)]; );; fun RemoveFrameEventFromList(l,frame,pos)= if l == nil then nil else let l -> [currentframe nl] in ( if frame == currentframe then ( _DELlist LSframeEvents pos; nl ) else currentframe::(RemoveFrameEventFromList nl frame pos+1) );; fun _CBaddFrameEvent(a,b)= set frameEventslist = AddFrameEventInList frameEventslist atoi _GETtext frameEvent 0; _SETtext frameEvent nil;; fun _CBremoveFrameEvent(a,b)= let _GETlist LSframeEvents -> [_ frame] in set frameEventslist = RemoveFrameEventFromList frameEventslist atoi frame 0;; fun _CBeditlineOk(a,b,c)= _CBaddFrameEvent 0 0;; fun getFrameEventList(l)= if l == nil then nil else let l -> [[param [value _]] nl] in if !strcmp param "FrameEvent" then let getFrameEventList nl -> fel in ( _ADDlist LSframeEvents 0 value; [atoi value fel] ) else getFrameEventList nl;; fun openedit(win,param)= let strextr param -> l in let _GETwindowSizePosition win -> [w h x y] in ( set ed = startPluginEditor _channel win 0 0 w h WN_CHILDINSIDE|WN_NOBORDER class; set SrvAnimAutoStart = _CRcheck _channel ed.PluginEditorEditWin 5 5 120 20 0 "SrvAnimAutoStart"; let getInfo l "SrvAnimAutoStart" -> string in if string == nil then _SETcheck SrvAnimAutoStart 1 else if (atoi string) then _SETcheck SrvAnimAutoStart 1 else _SETcheck SrvAnimAutoStart 0; set CHini = _CRcheck _channel ed.PluginEditorEditWin 5 35 80 16 0 "AutoStart"; let getInfo l "Ini" -> string in if string == nil then _SETcheck CHini 1 else if (atoi string) then _SETcheck CHini 1 else _SETcheck CHini 0; set CHloop = _CRcheck _channel ed.PluginEditorEditWin 85 35 60 16 0 "Loop"; let getInfo l "Loop" -> string in if string == nil then _SETcheck CHloop 1 else if (atoi string) then _SETcheck CHloop 1 else _SETcheck CHloop 0; set Interpolate = _CRcheck _channel ed.PluginEditorEditWin 5 65 120 16 0 "Interpolate"; let getInfo l "Interpolate" -> string in if string == nil then _SETcheck Interpolate 1 else if (atoi string) then _SETcheck Interpolate 1 else _SETcheck Interpolate 0; set LBPosAng = _CRtext _channel ed.PluginEditorEditWin 5 95 150 16 ET_ALIGN_LEFT "From Anchor, use : "; set CHall = _CRcheck _channel ed.PluginEditorEditWin 5 110 150 16 CH_RADIO "Positions and orientations"; set CHpos = _CRcheck _channel ed.PluginEditorEditWin 5 125 150 16 CH_RADIO "Positions only"; let getInfo l "PosAng" -> string in if (string == nil) || (!strcmp string "All") then ( _SETcheck CHall 1; _SETcheck CHpos 0 ) else ( _SETcheck CHall 0; _SETcheck CHpos 1 ); set LBNbFrames = _CRtext _channel ed.PluginEditorEditWin 5 145 80 16 ET_ALIGN_LEFT "NbFrames : "; set NbFrames = _CReditLine _channel ed.PluginEditorEditWin 85 144 40 18 ET_DOWN|ET_NUMBER let getInfo l "NbFrames" -> string in if (nil == string) then "0" else string; set LBframerate = _CRtext _channel ed.PluginEditorEditWin 5 165 80 16 ET_ALIGN_LEFT "framerate : "; set Framerate = _CReditLine _channel ed.PluginEditorEditWin 85 164 40 18 ET_DOWN|ET_NUMBER let getInfo l "Framerate" -> string in if (nil == string) then "30" else string; set LBframeEvents = _CRtext _channel ed.PluginEditorEditWin 170 5 80 16 ET_ALIGN_LEFT "Frame Events"; set LSframeEvents = _CRlist _channel ed.PluginEditorEditWin 170 25 325 200 LB_DOWN|LB_VSCROLL; set frameEvent = _CReditLine _channel ed.PluginEditorEditWin 170 230 325 20 ET_ALIGN_LEFT|ET_DOWN|ET_NUMBER nil; set AddFrameEvent = _CRbutton _channel ed.PluginEditorEditWin 190 255 130 20 0 "Add Frame Event"; set RemoveFrameEvent = _CRbutton _channel ed.PluginEditorEditWin 345 255 130 20 0 "Remove Frame Event"; _CBbutton AddFrameEvent @_CBaddFrameEvent 0; _CBlineOk frameEvent @_CBeditlineOk 0; _CBbutton RemoveFrameEvent @_CBremoveFrameEvent 0; set frameEventslist = getFrameEventList l; 0 );; fun genFrameEventsStrings(l)= if l == nil then nil else let l-> [currentframe nl] in ("FrameEvent"::(itoa currentframe)::nil)::(genFrameEventsStrings nl);; fun closeedit()= strbuild listcat ("SrvAnimAutoStart"::(itoa _GETcheck SrvAnimAutoStart)::nil):: ("Ini"::(itoa _GETcheck CHini)::nil):: ("Loop"::(itoa _GETcheck CHloop)::nil):: ("Interpolate"::(itoa _GETcheck Interpolate)::nil):: ("PosAng"::(if _GETcheck CHall then "All" else "Pos")::nil):: ("NbFrames"::(_GETtext NbFrames)::nil):: ("Framerate"::(_GETtext Framerate)::nil)::nil genFrameEventsStrings frameEventslist;; fun IniPlug(file)= set plugin=file; set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @save nil @openedit @closeedit;;