/*********************************************************************************************************/ /* Les fonctions relatives à la selection d'un bouton dans la barre d'outils */ /*********************************************************************************************************/ fun clickView(state, dev) = TEXT_Disable TEXT_X; TEXT_Disable TEXT_Y; TEXT_Disable TEXT_Z; TEXT_Disable TEXT_A; TEXT_Disable TEXT_B; TEXT_Disable TEXT_C; TEXT_Disable TEXT_SCALE; set dev.DEVtypeOperation=OP_VIEW; evalStateViewBtn dev; restoreAvatarViewReflexes dev; dsAxisView dev.DEVaxis; set dev.DEVaxis=nil; resetCursorView3d dev.DEVhg3d; resetCursorView3d dev.DEVhd3d; resetCursorView3d dev.DEVbg3d; 0 ;; fun clickPan(state,dev) = set dev.DEVtypeOperation=OP_PAN; setCursorView3d dev.DEVhg3d HandCursor; setCursorView3d dev.DEVhd3d HandCursor; setCursorView3d dev.DEVbg3d HandCursor; 0 ;; fun clickProfondeur(state, dev) = set dev.DEVtypeOperation=OP_PROF; setCursorView3d dev.DEVhg3d ProfCursor; setCursorView3d dev.DEVhd3d ProfCursor; setCursorView3d dev.DEVbg3d ProfCursor ;; fun clickMoveObject(state, dev) = TEXT_Enable TEXT_X; TEXT_Enable TEXT_Y; TEXT_Enable TEXT_Z; TEXT_Disable TEXT_A; TEXT_Disable TEXT_B; TEXT_Disable TEXT_C; TEXT_Disable TEXT_SCALE; set dev.DEVtypeOperation=OP_MOVEOBJ; evalStateViewBtn dev; resetAvatarViewMoveReflexes dev; if dev.DEVaxis!=nil && dev.DEVaxis.AVtypeaxis&AXIS_SINGLE then { dsAxisView dev.DEVaxis; set dev.DEVaxis=nil; } else nil; if dev.DEVaxis==nil then let getView3dSize dev.DEVselected3d -> [w h] in set dev.DEVaxis=newAxisView dev.DEVselectedObj w h AXIS_TRIEDRE else nil; resetCursorView3d dev.DEVhg3d; resetCursorView3d dev.DEVhd3d; resetCursorView3d dev.DEVbg3d ;; /* MODIF 11-10 */ fun clickMinMaxToggle(state, dev) = if dev.DEVtypeView&VIEW_ONE && dev.DEVhg3d==nil && dev.DEVhd3d==nil && dev.DEVbg3d==nil then ( let dev.DEVmanager.MV3dSize -> [w h] in let (w-3*DECAL)/2 -> w2 in let (h-3*DECAL)/2 -> h2 in let 2*DECAL+w2 -> posx2 in let 2*DECAL+h2 -> posy2 in let make_rgb 128 128 128 -> grey in ( set dev.DEVtypeView=VIEW_FOUR; set dev.DEVhg3d=iniView3d dev.DEVmanager WIREORTHO [DECAL DECAL ] [w2 h2] grey; set dev.DEVhd3d=iniView3d dev.DEVmanager WIREORTHO [posx2 DECAL ] [w2 h2] grey; set dev.DEVbg3d=iniView3d dev.DEVmanager WIREORTHO [DECAL posy2 ] [w2 h2] grey; resizeView3d dev.DEVbd3d posx2 posy2 w2 h2; resizeAxisView dev.DEVaxis w2 h2 ); setView3dCallbacks dev.DEVhg3d dev.DEVbd3d.V3dsession dev.DEVbd3d.V3dcamera dev VIEW_TOP; setView3dCallbacks dev.DEVhd3d dev.DEVbd3d.V3dsession dev.DEVbd3d.V3dcamera dev VIEW_LEFT; setView3dCallbacks dev.DEVbg3d dev.DEVbd3d.V3dsession dev.DEVbd3d.V3dcamera dev VIEW_BACK; setView3dCallbacks dev.DEVbd3d dev.DEVbd3d.V3dsession dev.DEVbd3d.V3dcamera dev VIEW_AVATAR; 1 ) else ( set dev.DEVtypeView=if (dev.DEVtypeView&VIEW_FOUR) then VIEW_ONE else VIEW_FOUR; let dev.DEVmanager.MV3dSize -> [w h] in ( cbUserResize dev.DEVhg3d w h dev; cbUserResize dev.DEVhd3d w h dev; cbUserResize dev.DEVbg3d w h dev; cbUserResize dev.DEVbd3d w h dev; ); 0 ) ;; /* click sur le bouton save */ /* MODIF 11-10 */ /* fun clickSave(state, dev) = C3DsaveOnDisk nil nil 1 ;; */ /* MODIF 11-10 */ fun clickApp (state, dev) = exec Tool.TBenterScale with [atoi getTextVal Tool TEXT_SCALE]; exec Tool.TBenterPos with [ [atoi getTextVal Tool TEXT_X atoi getTextVal Tool TEXT_Y atoi getTextVal Tool TEXT_Z] [DegToInt atoi getTextVal Tool TEXT_B DegToInt atoi getTextVal Tool TEXT_A DegToInt atoi getTextVal Tool TEXT_C] ] ;; fun clickRotate(state, dev) = TEXT_Enable TEXT_A; TEXT_Enable TEXT_B; TEXT_Enable TEXT_C; TEXT_Disable TEXT_X; TEXT_Disable TEXT_Y; TEXT_Disable TEXT_Z; TEXT_Disable TEXT_SCALE; set dev.DEVtypeOperation=OP_ROTOBJ; evalStateViewBtn dev; resetAvatarViewMoveReflexes dev; if dev.DEVaxis!=nil && dev.DEVaxis.AVtypeaxis&AXIS_SINGLE then { dsAxisView dev.DEVaxis; set dev.DEVaxis=nil; } else nil; if dev.DEVaxis==nil then let getView3dSize dev.DEVselected3d -> [w h] in set dev.DEVaxis=newAxisView dev.DEVselectedObj w h AXIS_TRIEDRE else nil; resetCursorView3d dev.DEVhg3d; resetCursorView3d dev.DEVhd3d; resetCursorView3d dev.DEVbg3d ;; fun clickScale(state, dev) = TEXT_Disable TEXT_A; TEXT_Disable TEXT_B; TEXT_Disable TEXT_C; TEXT_Disable TEXT_X; TEXT_Disable TEXT_Y; TEXT_Disable TEXT_Z; TEXT_Enable TEXT_SCALE; set dev.DEVtypeOperation=OP_SCALE; evalStateViewBtn dev; resetAvatarViewMoveReflexes dev; if dev.DEVaxis!=nil && dev.DEVaxis.AVtypeaxis&AXIS_TRIEDRE then { dsAxisView dev.DEVaxis; set dev.DEVaxis=nil; } else nil; if dev.DEVaxis==nil then let getView3dSize dev.DEVselected3d -> [w h] in set dev.DEVaxis=newAxisView dev.DEVselectedObj w h AXIS_SINGLE else nil; resetCursorView3d dev.DEVhg3d; resetCursorView3d dev.DEVhd3d; resetCursorView3d dev.DEVbg3d ;; fun clickGlobalRef(state, dev) = set dev.DEVtypeCoords= if dev.DEVtypeCoords==COORDS_RELATIF then COORDS_GLOBAL else COORDS_RELATIF; setToolBarPos dev.DEVselectedObj dev.DEVbd3d dev.DEVtypeCoords; setToolBarAng dev.DEVselectedObj dev.DEVbd3d dev.DEVtypeCoords; setToolBarScale dev.DEVselectedObj dev.DEVbd3d; setToolBarSize dev.DEVselectedObj dev.DEVbd3d; 0 ;; fun clickClose(state, dev) = closeGlobalEditorView; set DEVview.DEVtypeMenu = DEVview.DEVtypeMenu & ~DYN_EDIT; 0 ;; fun getRadius(session, h, shell) = let M3getRadius session h->r in if r==nil then nil else let M3convVec session h shell [r 0 0] -> [x y z] in ftoi sqrt (sqr itof x)+.(sqr itof y)+.(sqr itof z) ;; fun centerView(view, z) = if view.V3drenderType!=WIREORTHO then nil else let z->[dev vec rad] in ( M3setObjVec view.V3dsession view.V3dcamera vec; if rad==nil then nil else let M3getCamera view.V3dsession view.V3dcamera -> [[d _] xx z] in let xx->[x _] in let max 10 666*x/rad -> newrad in M3setCamera view.V3dsession view.V3dcamera [[newrad newrad] xx z]; 0 ) ;; fun clickCenterView(state, dev) = if dev.DEVselectedObj==nil then nil else let M3calcPosRef dev.DEVbd3d.V3dsession dev.DEVselectedObj shell ->[vec _] in apply_on_list dev.DEVmanager.MV3dListV3d @centerView [dev vec getRadius dev.DEVbd3d.V3dsession dev.DEVselectedObj shell] ;; /****************************************** Modification du contenu d'un texte relatif à la position de l'objet selectionné dans la toolbar *******************************************/ fun ChangePosInToolBar(pos, ang, dev) = let let dev.DEVselected3d.V3dsession -> ss in let M3getFather ss dev.DEVselectedObj-> father in if dev.DEVtypeCoords&COORDS_GLOBAL then let M3calcPosRef ss shell father -> [_ matf] in let M3angularFromMatrix matf -> [af bf cf] in let ang -> [ao bo co] in [M3convVrt ss shell father pos [(ao-af) (bo-bf) (co-cf)] ] else [pos ang] -> [posref angref] in ( C3DsetObjPosAng dev.DEVselectedObj [posref angref] SAVE_NO BROAD_OTHER; /* MODIF 11-10 */ M3setObjVec session dev.DEVselectedObj posref; M3setObjAng session dev.DEVselectedObj angref; 0 ) ;; /****************************************** Modification du contenu d'un texte relatif à la taille de l'objet selectionné dans la toolbar *******************************************/ fun ChangeScaleInToolBar(scale, dev) = C3DsetObjScale dev.DEVselectedObj scale SAVE_NO BROAD_OTHER; /* MODIF 11-10 */ M3setObjScale session dev.DEVselectedObj scale; 0 ;; fun TOOL_Init (vview) = /* initialisation et affichage de la toolbar */ TOOL_Create 10 10 vview.DEVmanager.MV3dWin; initFuncBtn CHECK_VIEW mkfun2 @clickView vview; initFuncBtn CHECK_PAN mkfun2 @clickPan vview; initFuncBtn CHECK_PROFONDEUR mkfun2 @clickProfondeur vview; initFuncBtn CHECK_MOVE mkfun2 @clickMoveObject vview; initFuncBtn ROL_MINMAXTOGGLE mkfun2 @clickMinMaxToggle vview; initFuncBtn CHECK_ROTATE mkfun2 @clickRotate vview; initFuncBtn CHECK_SCALE mkfun2 @clickScale vview; initFuncBtn ROL_CLOSE mkfun2 @clickClose vview; initFuncBtn ROL_GLOBALREF mkfun2 @clickGlobalRef vview; initFuncBtn ROL_CENTER mkfun2 @clickCenterView vview; initFuncBtn APP mkfun2 @clickApp vview; /*initFuncBtn ROL_SAVE mkfun2 @clickSave vview;*/ /* MODIF 11-10 */ /*initFuncBtn CREATE mkfun2 @clickCreate vview;*/ /* MODIF 11-10 */ initEnterTextPos mkfun3 @ChangePosInToolBar DEVview; initEnterTextScale mkfun2 @ChangeScaleInToolBar DEVview; 0 ;;