/* Authors: Arkeon */ /* Last update: 07.04.02 */ /* Version: 1.0 */ typeof class = S;; typeof scaleob = I;; typeof oldfather = H3d;; typeof OldFatherOB = H3d;; typeof linkob = H3d;; typeof avfile = S;; typeof camH3D = H3d;; fun MakeObj(l, dx, dy, dz, px, py, pz, scale,o) = if l==nil then nil else let l->[x n] in let match x with (objAnchor [h _ _ _] -> let M3getObjScale session h -> Oldscaleob in let M3getFather session h -> ObjFather in ( if ObjFather == camH3D then nil else ( set scaleob = Oldscaleob; set oldfather = ObjFather; M3link session h camH3D; M3setObjVec session h [px py pz]; M3setObjAng session h [dx dy dz]; M3setObjScale session h scale; 0 ) ) ) |(_->nil) -> y in if y==nil then MakeObj n dx dy dz px py pz scale o else y::MakeObj n dx dy dz px py pz scale o ;; fun ReleaseObj(l) = if l==nil then nil else let l->[x n] in let match x with (objAnchor [h _ _ _] -> let M3getFather session ObGetMain owner -> camAvH3D in let M3getFather session h -> ObjFather in if ObjFather != camH3D then nil else ( let M3getObjAng session camAvH3D -> [olddx olddy olddz] in let M3getObjVec session camAvH3D -> [oldpx oldpy oldpz] in ( M3link session h oldfather; M3setObjScale session h scaleob; M3setObjAng session h [olddx olddy olddz]; M3setObjVec session h [oldpx oldpy oldpz]; 0 ) ) ) |(_->nil) -> y in if y==nil then ReleaseObj n else y::ReleaseObj n ;; fun MakeAVObj(l, dx, dy, dz, px, py, pz) = if l==nil then nil else let l->[x n] in let match x with (objAnchor [h _ _ _] -> let M3getFather session camH3D -> fatherOb in ( if fatherOb == h then nil else ( set OldFatherOB = fatherOb; M3unLink session camH3D; M3link session camH3D h; M3setObjVec session camH3D [px py pz]; M3setObjAng session camH3D [dx dy dz]; 0 ) ) ) |(_->nil) -> y in if y==nil then MakeAVObj n dx dy dz px py pz else y::MakeAVObj n dx dy dz px py pz ;; fun ReleaseAVObj(l) = if l==nil then (_fooS ">>>>>>>>>>>>> l=nil"; nil;) else let l->[x n] in let match x with (objAnchor [h _ _ _] -> let M3getFather session camH3D -> fatherOb in ( if fatherOb != h then nil else ( let M3getObjVec session h -> camPos in ( M3unLink session camH3D; M3link session camH3D OldFatherOB; // M3setObjAng session camH3D [0 0 0]; M3setObjVec session camH3D camPos; ); 0 ) ) ) |(_->nil) -> y in if y==nil then ReleaseAVObj n else y::ReleaseAVObj n ;; fun CBlink (o, from, action, param, reply)= let atoi hd UgetParam ObUi o "rotx" -> rotx in let atoi hd UgetParam ObUi o "roty" -> roty in let atoi hd UgetParam ObUi o "rotz" -> rotz in let atoi hd UgetParam ObUi o "posx" -> posx in let atoi hd UgetParam ObUi o "posy" -> posy in let atoi hd UgetParam ObUi o "posz" -> posz in let atoi hd UgetParam ObUi o "scale" -> scale in MakeObj ObAnchor o rotx roty rotz posx posy posz scale o; 0 ;; fun CBunlink (o, from, action, param, reply)= ReleaseObj ObAnchor o; 0 ;; fun CBlinkAV (o, from, action, param, reply)= let atoi hd UgetParam ObUi o "rotx" -> rotx in let atoi hd UgetParam ObUi o "roty" -> roty in let atoi hd UgetParam ObUi o "rotz" -> rotz in let atoi hd UgetParam ObUi o "posx" -> posx in let atoi hd UgetParam ObUi o "posy" -> posy in let atoi hd UgetParam ObUi o "posz" -> posz in MakeAVObj ObAnchor o rotx roty rotz posx posy posz; 0 ;; fun CBunlinkAV (o, from, action, param, reply)= ReleaseAVObj ObAnchor o; 0 ;; fun cbcomm(ui, action, param, z) = let z->[o l] in let [o nil] -> z in ( set camH3D = if !strcmp "on" hd UgetParam ObUi o "ObjAv" then M3getFather session ObGetMain owner else cam; if !strcmp action "setState" then let atoi param -> state in mutate z<-[_ if state then CBlink o nil nil nil nil else CBunlink o nil nil nil nil] else nil; 0 ); 0 ;; /* fun CAMTOOL_O3dChanged (o, destOb, previousH3d) = if camH3D != cam then ( set camH3D = M3getFirstSon session shellav; CBlink o nil nil nil nil; ) else nil; 0 ;; */ fun newOb(o) = let [o nil] -> z in ( set camH3D = if !strcmp "on" hd UgetParam ObUi o "ObjAv" then M3getFather session ObGetMain owner else cam; UcbComm this ObUi o mkfun4 @cbcomm z; UsendSrv this ObUi o "state?" nil; ObRegisterAction o (strcatn (ObName o)::".link"::nil) @CBlink; ObRegisterAction o (strcatn (ObName o)::".unlink"::nil) @CBunlink; 0 ); ObRegisterAction o (strcatn (ObName o)::".UnLinkAV"::nil) @CBunlinkAV; ObRegisterAction o (strcatn (ObName o)::".LinkAv"::nil) @CBlinkAV; 0 ;; fun IniPlug(file)= /*_showconsole;*/ set class=getInfo strextr _getpack _checkpack file "name"; PLUGsetinfo thisplug PLUGIN_ONLINE_EDITING|PLUGIN_OBJECT|PLUGIN_NOTRESERVED; PlugRegister class @newOb nil; 0 ;;