/* Rotate Plugin Client - DMS - Mar 99 - by Sylvain HUET */ /* modified - Jun 99 - by Christophe LOREK */ var FRAMES_PER_SECOND = 30;; /* default framerate value */ typeof class=S;; fun rotobj2(x, v) = match x with (objAnchor [h _ _ _] -> M3rotateObjExt session h v) |(_->nil) ;; fun rotobj(o,v)= let v -> [framerate tick angx angxaccum angy angyaccum angz angzaccum] in ( if tick == nil then set tick = _tickcount else nil; let _tickcount -> currenttick in let ((currenttick - tick) * framerate) -> timeframe in let 0 -> a in let 0 -> b in let 0 -> c in ( if angx == nil then nil else let (timeframe * angx) -> xtimeframe in let mod xtimeframe 1000 -> xaccum in ( set b = (xtimeframe / 1000); set angxaccum = angxaccum + xaccum; if xaccum >= 1000 then ( set b = b + 1; set angxaccum = angxaccum - 1000 ) else nil; ); if angy == nil then nil else let (timeframe * angy) -> ytimeframe in let mod ytimeframe 1000 -> yaccum in ( set a = (ytimeframe / 1000); set angyaccum = angyaccum + yaccum; if yaccum >= 1000 then ( set a = a + 1; set angyaccum = angyaccum - 1000 ) else nil; ); if angz == nil then nil else let (timeframe * angz) -> ztimeframe in let mod ztimeframe 1000 -> zaccum in ( set c = (ztimeframe / 1000); set angzaccum = angzaccum + zaccum; if zaccum >= 1000 then ( set c = c + 1; set angzaccum = angzaccum - 1000 ) else nil; ); mutate v <- [_ currenttick _ angxaccum _ angyaccum _ angzaccum]; apply_on_list (ObAnchor o) @rotobj2 [a b c]; 0 ) ) ;; fun delete(o,paramU) = ObCbAnim o nil; let paramU -> [ax ay az] in match hd (ObAnchor o) with (objAnchor [h _ _ _] -> M3setObjAng session h [ax ay az]) |(_->nil) ;; fun newOb(o)= let atoi hd UgetParam ObUi o "angularX" -> angx in let atoi hd UgetParam ObUi o "angularY" -> angy in let atoi hd UgetParam ObUi o "angularZ" -> angz in let atoi hd UgetParam ObUi o "framerate" -> framerate in ( if framerate == nil then set framerate = FRAMES_PER_SECOND /* default value */ else nil; let [framerate nil angx 0 angy 0 angz 0] -> v in ObCbAnim o mkfun2 @rotobj v; let match hd (ObAnchor o) with (objAnchor [h _ _ _] -> M3getObjAng session h ) |(_->nil) -> [ax ay az] in ObCbDestroy o mkfun2 @delete [ax ay az]; 0 ) ;; fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PLUGsetinfo thisplug PLUGIN_ONLINE_EDITING|PLUGIN_OBJECT|PLUGIN_RESERVED; PLUGdefineEditor thisplug @dynamicedit; PlugRegister class @newOb nil; 0 ;;