/* PlayAnim - DMS2 Jun 99 - by Christophe LOREK */ typeof class=S;; /*typeof listanim=[[S I I S] r1];;/* instancename stopplay looponce */*/ /* fun animByName(x, name)= let x -> [currentname _ _ _] in !strcmp currentname name;; */ fun activate(o,from,cli,action,param,reply,a)= let (strfind "." action 0) -> firstDotPos in let (strfind "." action firstDotPos+1) -> secondDotPos in let (substr action 0 firstDotPos) -> current_ObName in let (substr action firstDotPos+1 secondDotPos-firstDotPos-1) -> current_SeqName in let (substr action secondDotPos+1 (strlen action)-(secondDotPos)) -> current_action in if !strcmp current_ObName (ObName o) then ( if !strcmp current_action "playonceS" then ( /* let search_in_list listanim @animByName (ObName o) -> a in*/ mutate a <- [_ 1 1 _]; UsendCli this nil (ObUi o) (strcat current_SeqName ".playonce") (ObName o); 0 ) else if !strcmp current_action "playloopS" then ( /* let search_in_list listanim @animByName (ObName o) -> a in*/ mutate a <- [_ 1 0 _]; UsendCli this nil (ObUi o) (strcat current_SeqName ".playloop") (ObName o); 0 ) else if !strcmp current_action "stopS" then ( /* let search_in_list listanim @animByName (ObName o) -> a in*/ mutate a <- [_ 0 _ _]; UsendCli this nil (ObUi o) (strcat current_SeqName ".stop") (ObName o); 0 ) else nil ) else nil;; fun cbcomm(ui,cli,action,param,anim)= let anim -> [_ playstop onceloop SeqName] in if !strcmp action "newclient" then ( /* let search_in_list listanim @animByName param -> [_ playstop onceloop SeqName] in*/ if playstop then ( if onceloop then UsendCli this cli ui (strcat SeqName ".playonce") param else UsendCli this cli ui (strcat SeqName ".playloop") param; ) else UsendCli this cli ui (strcat SeqName ".stop") param; ) else nil;; fun getsequences(l)= if l == nil then nil else let l -> [paramline nl] in let paramline -> [paramname paramvalues] in if !strcmp paramname "sequence" then ( let paramvalues -> [name [startframeS [endframeS _]]] in [name (atoi startframeS) (atoi endframeS)]::(getsequences nl) ) else (getsequences nl);; fun RegisterSequenceActions(current_Ob,l,anim)= if l == nil then nil else let l -> [[SeqName _ _] nl] in ( ObRegisterAction current_Ob (strcatn (ObName current_Ob)::"."::SeqName::".playonceS"::nil) mkfun7 @activate anim; ObRegisterAction current_Ob (strcatn (ObName current_Ob)::"."::SeqName::".playloopS"::nil) mkfun7 @activate anim; ObRegisterAction current_Ob (strcatn (ObName current_Ob)::"."::SeqName::".stopS"::nil) mkfun7 @activate anim; RegisterSequenceActions current_Ob nl anim; 0 );; fun RegisterActions(current_Ob,l,a)= let getsequences l -> seqlist in RegisterSequenceActions current_Ob seqlist a;; fun newOb(o)= /* set listanim=[(ObName o) 0 0 nil]::listanim;*/ let UgetParams ObUi o -> paramlist in RegisterActions o paramlist [(ObName o) 0 0 nil]; UcbComm this ObUi o mkfun5 @cbcomm [(ObName o) 0 0 nil]; 0;; fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0;;