/* Authors: Arkeon */ /* Last update: 10.01.03 */ /* Version: 1.0 */ typeof AnimTimer=Timer;; typeof class=S;; /* *************** */ /* Set Mat Opacity */ /* *************** */ fun setOpacityOb2 (mat,param)= if param ==nil then nil else let M3getMaterialTransparency session mat -> CurOpacity in if CurOpacity==param then _deltimer AnimTimer else ( let if param>CurOpacity then (CurOpacity+1) else (CurOpacity-1) -> NewOpacity in ( M3setType session mat (M3getType session mat)|MAT_TRANSP; M3setMaterialTransparency session mat NewOpacity; if NewOpacity==param then _deltimer AnimTimer else nil; ) ); 0 ;; fun setOpacityOb (x,param)= if param ==nil then nil else ( match x with (objAnchor [h _ _ _] -> let M3listOfMaterials session h -> matlst in apply_on_list matlst @setOpacityOb2 param ) |(_->nil); ); 0 ;; fun setOpacity (x,param)= if param ==nil then nil else ( match x with (objAnchor [h m _ _] -> ( let M3getMaterialTransparency session m -> CurOpacity in if CurOpacity==param then _deltimer AnimTimer else ( let if param>CurOpacity then (CurOpacity+1) else (CurOpacity-1) -> NewOpacity in ( M3setType session m (M3getType session m)|MAT_TRANSP; M3setMaterialTransparency session m NewOpacity; if NewOpacity==param then _deltimer AnimTimer else nil; ) ); ) ) |(_->nil); ); 0 ;; /* *************** */ /* Apply on Anchor */ /* *************** */ fun OpacityAnchor2 (timer, param)= let param -> [o value Obj] in if Obj==1 then apply_on_list ObAnchor o @setOpacityOb value else apply_on_list ObAnchor o @setOpacity value; 0 ;; fun OpacityAnchor (o, from, action, param, reply)= _deltimer AnimTimer; let atoi hd UgetParam ObUi o "speed" -> speed_tmp in let if speed_tmp==nil || speed_tmp==0 then 1 else speed_tmp -> speed in let lineextr param -> [value _] in let if value==nil then 0 else atoi value -> new_value in if !strcmp hd UgetParam ObUi o "ToObj" "on" then set AnimTimer=_rfltimer _starttimer _channel speed @OpacityAnchor2 [o new_value 1] else set AnimTimer=_rfltimer _starttimer _channel speed @OpacityAnchor2 [o new_value 0]; 0 ;; /* *************** */ /* Serveur Actions */ /* *************** */ fun cbcomm(ui,action,param,o)= if !strcmp action "set2all" then ( OpacityAnchor o nil nil param nil; ) else nil; 0 ;; /* ****** */ /* New Ob */ /* ****** */ fun newOb(o)= UcbComm this ObUi o mkfun4 @cbcomm o; ObRegisterAction o (strcatn (ObName o)::".set"::nil) @OpacityAnchor; 0 ;; fun IniPlug(file)= /*_showconsole;*/ set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0 ;;