/* Authors: Arkeon */ /* Last update: 07.04.02 */ /* Version: 1.0 */ typeof class = S;; fun applyOnAllBrothersON(elem)= if elem == nil then 0 else ( M3setEmitterState session elem PCL_RESTART; applyOnAllBrothersON M3getBrother session elem; ); 0 ;; fun getAllSonsON(h)= let M3getFirstSon session h -> PartH3D in if PartH3D == nil then nil else applyOnAllBrothersON PartH3D ;; fun applyOnAllBrothersOFF(elem)= if elem == nil then 0 else ( M3setEmitterState session elem PCL_DISABLE; applyOnAllBrothersOFF M3getBrother session elem; ); 0 ;; fun getAllSonsOFF(h)= let M3getFirstSon session h -> PartH3D in if PartH3D == nil then nil else applyOnAllBrothersOFF PartH3D ;; fun MakeObj(l, ob) = if l==nil then nil else let l->[x n] in let match x with (objAnchor [h _ _ _] -> getAllSonsON h ) |(_->nil) -> y in if y==nil then MakeObj n ob else y::MakeObj n ob ;; fun ReleaseObj(l) = if l==nil then nil else let l->[x n] in let match x with (objAnchor [h _ _ _] -> getAllSonsOFF h ) |(_->nil) -> y in if y==nil then ReleaseObj n else y::ReleaseObj n ;; fun CBStart (o, from, action, param, reply)= MakeObj ObAnchor o o; 0 ;; fun CBStop (o, from, action, param, reply)= ReleaseObj ObAnchor o; 0 ;; /* fun delparts(o,x) = M3delPart3d session o ;; */ fun cbcomm(ui, action, param, z) = let z->[o l] in if !strcmp action "setState" then let atoi param -> state in ( /* apply_on_list l @delparts nil;*/ mutate z<-[_ if state then CBStart o nil nil nil nil else CBStop o nil nil nil nil] ) else nil; 0 ;; /* fun delete(o,z) = let z -> [_ l] in apply_on_list l @delparts nil; 0 ;; */ fun newOb(o) = let [o nil] -> z in ( UcbComm this ObUi o mkfun4 @cbcomm z; UsendSrv this ObUi o "state?" nil; /* ObCbDestroy o mkfun2 @delete z;*/ ObRegisterAction o (strcatn (ObName o)::".start"::nil) @CBStart; ObRegisterAction o (strcatn (ObName o)::".stop"::nil) @CBStop; 0 ) ;; fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PLUGsetinfo thisplug PLUGIN_ONLINE_EDITING|PLUGIN_OBJECT|PLUGIN_NOTRESERVED; PlugRegister class @newOb nil; 0 ;;