/* PlayAnim Editor - DMS2 - Jun 99 - by Christophe LOREK */ typeof plugin=S;; typeof class=S;; fun InstName(UI)=UI.nameInst;; fun InstParam(UI)=UI.paramInst;; typeof ed = PluginEditor;; typeof SrvAnimAutoStart = ObjCheck;; 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;; typeof LBsequences = ObjText;; typeof LSsequences = ObjList;; typeof sequenceslist = [[S I I] r1];; typeof sequence = ObjText;; typeof sequencestart = ObjText;; typeof sequenceend = ObjText;; typeof AddSequence = ObjButton;; typeof RemoveSequence = ObjButton;; proto save=fun [[Inst r1]] [[S r1] [S r1] [[S r1] r1] [[S r1] r1]];; /* generates a list of strings containing the name of the sequences coming from the sequence parameters of a given instance of the plugin. */ fun paramSequences(paramlist)= if paramlist == nil then nil else let paramlist -> [paramline nparamlist] in let paramline -> [paramname paramvalues] in if !strcmp paramname "sequence" then let paramvalues -> [name [startframeS [endframeS _]]] in [name (atoi startframeS) (atoi endframeS)]::(paramSequences nparamlist) else (paramSequences nparamlist);; /* generates a list of actions corresponding to the sequence parameters of a given instance of the plugin. */ fun suppsequences(l,UIname)= if l == nil then nil else let l -> [[seqName startframe endframe] nl] in ("actionC"::(strcatn UIname::"."::seqName::".playonce"::nil)::nil):: ("actionC"::(strcatn UIname::"."::seqName::".playloop"::nil)::nil):: ("actionC"::(strcatn UIname::"."::seqName::".stop"::nil)::nil):: ("action"::(strcatn UIname::"."::seqName::".playonceS"::nil)::nil):: ("action"::(strcatn UIname::"."::seqName::".playloopS"::nil)::nil):: ("action"::(strcatn UIname::"."::seqName::".stopS"::nil)::nil):: (suppsequences nl UIname);; /* 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 listcat (suppsequences (paramSequences strextr (InstParam UI)) name) (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) ];; /* FRAME EVENT EDITOR */ 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;; /* SEQUENCE EDITOR */ fun AddSequenceInList(l,name,startframe,endframe,pos)= if !strcmp name "" then nil else if l == nil then ( _ADDlist LSsequences pos strcatn name::" "::(itoa startframe)::" "::(itoa endframe)::nil; [[name startframe endframe] nil] ) else let l -> [[currentname currentstartframe currentendframe] nl] in ( if !strcmp name currentname then l else if (strcmp name currentname) < 0 then ( _ADDlist LSsequences pos strcatn name::" "::(itoa startframe)::" "::(itoa endframe)::nil; [[name startframe endframe] [[currentname currentstartframe currentendframe] nl]] ) else [[currentname currentstartframe currentendframe] (AddSequenceInList nl name startframe endframe pos+1)]; );; fun RemoveSequenceFromList(l,name,pos)= if l == nil then nil else let l -> [[currentname currentstartframe currentendframe] nl] in ( if !strcmp name currentname then ( _DELlist LSsequences pos; nl ) else [currentname currentstartframe currentendframe]::(RemoveSequenceFromList nl name pos+1) );; fun _CBaddSequence(a,b)= set sequenceslist = AddSequenceInList sequenceslist _GETtext sequence atoi _GETtext sequencestart atoi _GETtext sequenceend 0; _SETtext sequence nil; _SETtext sequencestart nil; _SETtext sequenceend nil;; fun _CBremoveSequence(a,b)= let _GETlist LSsequences -> [_ string] in let hd hd strextr string -> name in set sequenceslist = RemoveSequenceFromList sequenceslist name 0;; /* fun _CBsequenceOk(a,b,c)= _CBaddSequence 0 0;; */ fun getSequenceList(l)= if l == nil then nil else let l -> [[param [name [startframeS [endframeS _]]]] nl] in if !strcmp param "sequence" then let getSequenceList nl -> fseq in ( _ADDlist LSsequences 0 strcatn name::" "::startframeS::" "::endframeS::nil; [[name atoi startframeS atoi endframeS] fseq] ) else getSequenceList 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 LBframerate = _CRtext _channel ed.PluginEditorEditWin 5 35 80 16 ET_ALIGN_LEFT "framerate : "; set Framerate = _CReditLine _channel ed.PluginEditorEditWin 85 34 40 18 ET_DOWN|ET_NUMBER|ET_AHSCROLL 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 155 200 LB_DOWN|LB_VSCROLL; set frameEvent = _CReditLine _channel ed.PluginEditorEditWin 170 230 155 20 ET_ALIGN_LEFT|ET_DOWN|ET_NUMBER|ET_AHSCROLL nil; set AddFrameEvent = _CRbutton _channel ed.PluginEditorEditWin 170 255 75 20 0 "Add"; set RemoveFrameEvent = _CRbutton _channel ed.PluginEditorEditWin 250 255 75 20 0 "Remove"; _CBbutton AddFrameEvent @_CBaddFrameEvent 0; _CBlineOk frameEvent @_CBeditlineOk 0; _CBbutton RemoveFrameEvent @_CBremoveFrameEvent 0; set frameEventslist = getFrameEventList l; set LBsequences = _CRtext _channel ed.PluginEditorEditWin 340 5 80 16 ET_ALIGN_LEFT "Sequences"; set LSsequences = _CRlist _channel ed.PluginEditorEditWin 340 25 155 200 LB_DOWN|LB_VSCROLL; set sequence = _CReditLine _channel ed.PluginEditorEditWin 340 230 95 20 ET_ALIGN_LEFT|ET_DOWN|ET_AHSCROLL nil; set sequencestart = _CReditLine _channel ed.PluginEditorEditWin 435 230 30 20 ET_ALIGN_LEFT|ET_DOWN|ET_NUMBER|ET_AHSCROLL nil; set sequenceend = _CReditLine _channel ed.PluginEditorEditWin 465 230 30 20 ET_ALIGN_LEFT|ET_DOWN|ET_NUMBER|ET_AHSCROLL nil; set AddSequence = _CRbutton _channel ed.PluginEditorEditWin 340 255 75 20 0 "Add"; set RemoveSequence = _CRbutton _channel ed.PluginEditorEditWin 420 255 75 20 0 "Remove"; _CBbutton AddSequence @_CBaddSequence 0; /* _CBlineOk sequence @_CBsequenceOk 0;*/ _CBbutton RemoveSequence @_CBremoveSequence 0; set sequenceslist = getSequenceList l; 0 );; fun genFrameEventsStrings(l)= if l == nil then nil else let l-> [currentframe nl] in ("FrameEvent"::(itoa currentframe)::nil)::(genFrameEventsStrings nl);; fun gensequencesStrings(l)= if l == nil then nil else let l-> [[name startframe endframe] nl] in ("sequence"::name::(itoa startframe)::(itoa endframe)::nil)::(gensequencesStrings nl);; fun closeedit()= strbuild listcat ("SrvAnimAutoStart"::(itoa _GETcheck SrvAnimAutoStart)::nil):: ("Framerate"::(_GETtext Framerate)::nil)::nil listcat genFrameEventsStrings frameEventslist gensequencesStrings sequenceslist;; fun IniPlug(file)= set plugin=file; set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @save nil @openedit @closeedit;;