/* ShiftTexture Plugin - DMS - March 99 - by Sylvain HUET */ /* rev. 01-2002 - by Sebastien DENEUX */ typeof class = S;; fun shiftobj2(a,v)= let v->[x y _ _] in match a with (objAnchor [h m _ _] -> M3shiftTextureXY session h m x y) |(_->nil); 0 ;; fun shiftobj(o,v)= let v->[_ _ sec preced] in let _tickcount -> tick in if (tick >= (preced + sec)) then ( apply_on_list ObAnchor o @shiftobj2 v; mutate v <- [ _ _ _ tick ]; ) else nil; 0 ;; fun f_replace_in_list (list, oldSearchFun, searchParam, newL)= if list==nil then nil else let list -> [first next] in if (exec oldSearchFun with [first searchParam]) then (hd newL)::(f_replace_in_list next oldSearchFun searchParam tl newL) else first::(f_replace_in_list next oldSearchFun searchParam newL);; fun search_all_in_list (l, f, x)= if l==nil then nil else let l -> [a nxt] in if exec f with [a x] then a::search_all_in_list nxt f x else search_all_in_list nxt f x;; fun PolyByMat(poly,m2) = let poly -> [m1 _] in m1 == m2 ;; fun delete(o,polyList) = ObCbAnim o nil; match hd ObAnchor o with (objAnchor [ah am _ _] -> ( M3setPolygons session ah (f_replace_in_list (M3listOfPolygons session ah) @PolyByMat am polyList); 0 ) ) ;; fun newOb(o)= let hd UgetParam ObUi o "u"-> a in let hd UgetParam ObUi o "v"-> b in let hd UgetParam ObUi o "a"-> c in ( match hd (ObAnchor o) with (objAnchor [ah am _ _] -> ObCbDestroy o mkfun2 @delete search_all_in_list M3listOfPolygons session ah @PolyByMat am) |(_->nil); ObCbAnim o mkfun2 @shiftobj [atoi a atoi b atoi c 0] ); 0 ;; fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PLUGsetinfo thisplug PLUGIN_ONLINE_EDITING|PLUGIN_MATERIAL; PLUGdefineEditor thisplug @dynamicedit; PlugRegister class @newOb nil; 0 ;;