/* Rotate Plugin Client - DMS - Mar 99 - by Sylvain HUET */ /* modified - Jun 99 - by Christophe LOREK */ /* plugin Movobjet par iri - http://www.irizone.net */ var FRAMES_PER_SECOND = 1;; /* default framerate value */ typeof class=S;; var movobj_click = 0;; var actif = 0;; fun movclick(o, p)= let p -> [h3d mat btn] in let match hd (ObAnchor o) with (objAnchor [h _ _ _] -> h ) |(_->nil) -> h in set movobj_click = if (btn == RBUTTON) && (h == h3d) && (actif == 1) then 1 else 0;; fun movobj2(x, u) = let u -> [v [axex axey axez boxok deltax deltay deltaz]] in match x with (objAnchor [h _ _ _] -> let if boxok == 1 then let inboxTesting coll session h v -> [_ [x y z]] in [if axex == 1 then x + deltax else x if axey == 1 then y + deltay else y if axez == 1 then z + deltaz else z] else v -> v in M3setObjVec session h v) |(_->nil);; fun movobj(o, p)= let p -> [axex axey axez framerate boxok deltax deltay deltaz] in if movobj_click == 1 then let w3d.V3dcursor -> [xc yc] in let match hd (ObAnchor o) with (objAnchor [h _ _ _] -> M3getObjVec session h ) |(_->nil) -> [x y z] in let if axex == 1 then (xc-x)/framerate else 0 -> a in let if axey == 1 then (yc-y)/framerate else 0 -> b in let if axez == 1 then (yc-z)/framerate else 0 -> c in apply_on_list (ObAnchor o) @movobj2 [[a b c] [axex axey axez boxok deltax deltay deltaz]] else 0;; fun activate(o, from, action, param, rep) = set actif = 1; _DMSevent this strcat class ".activated" nil nil;; fun desactivate(o, from, action, param, rep) = set actif = 0; _DMSevent this strcat class ".desactivated" nil nil;; 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 "axeX" -> axex in let atoi hd UgetParam ObUi o "axeY" -> axey in let atoi hd UgetParam ObUi o "axeZ" -> axez in let atoi hd UgetParam ObUi o "framerate" -> framerate in let atoi hd UgetParam ObUi o "boxok" -> boxok in let atoi hd UgetParam ObUi o "deltax" -> deltax in let atoi hd UgetParam ObUi o "deltay" -> deltay in let atoi hd UgetParam ObUi o "deltaz" -> deltaz in let if framerate == nil || framerate == 0 then FRAMES_PER_SECOND else framerate -> framerate in let if deltax == nil then 0 else deltax -> deltax in let if deltay == nil then 0 else deltay -> deltay in let if deltaz == nil then 0 else deltaz -> deltaz in let match hd (ObAnchor o) with (objAnchor [h _ _ _] -> M3getObjAng session h ) |(_->nil) -> [ax ay az] in ( ObCbControlClick o @movclick; ObCbAnim o mkfun2 @movobj [axex axey axez framerate boxok deltax deltay deltaz]; ObCbDestroy o mkfun2 @delete [ax ay az]; ObRegisterAction o strcat ObName o ".activate" @activate; ObRegisterAction o strcat ObName o ".desactivate" @desactivate; 0 );; fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PLUGsetinfo thisplug PLUGIN_OBJECT|PLUGIN_RESERVED; PlugRegister class @newOb nil; 0;;