macroScript Svoe_ViewsHotbox Category:"ASvoe" Tooltip:"ViewHotBox" /* ---Nikolay Antropov--- Customize User Interface > Keyboard > Category Asvoe>ViewHotBox - Assign «z» hotkey */ (if ::_SvDialoguView != undefined do try(destroydialog _SvDialoguView)catch() -- Pri otkritii zakriv sozdannoe ranee local TxtHlp0 = "-------ViewHotBox - 3ds MAX----\n ---Nikolay Antropov---\n Customize User Interface > Keyboard > Category Asvoe>ViewHotBox - Assign «z» hotkey \n" local TxtHlp1 = " \n When Window script open (after press z-hotkey):\n Press Z (keyboard) - Zoom Extents Selected\n Press Space (keyboard) - Maximize Viewport\n Press a (keyboard) - Isolate select+zoom.\n" local TxtHlp2 = " \n --FRONT--\n \n MousLeft - Front view\n MousLeft+Alt - Enviroment window\n" local TxtHlp3 = "\n --TOP--\n \n MousLeft - Top view\n MousLeft+Alt - Material Editor Toggle\n" local TxtHlp4 = " \n --BACK--\n \n MousLeft - Back view\n MousLeft+Alt - Render Setup\n" local TxtHlp5 = " \n--LEFT--\n \n MousLeft - Left view\n MousLeft+Alt - Properties Window\n *MousMiddle - Freeze selection \n" local TxtHlp6 = " --PERCP--\n \n MousLeft - Perspective view\n MousLeft+Ctrl - Orthographic view\n MousLeft+Shift - Isolate Selection Toggle\n MousLeft+Alt - Zoom Extends All\n *MousMiddle - UnFreeze by select\n" local TxtHlp7 = "\n --RIGHT--\n \n MousLeft - Riht view\n MousLeft+Alt - select from scene Window\n *MousMiddle - UnFreeze All\n" local TxtHlp8 = " \n --EDG--\n \n MousLeft - Views: Wireframe\n MousLeft+Alt - Layer Manager\n" local TxtHlp9 = " \n --BOTTOM--\n \n MousLeft - Bottom view\n MousLeft+Ctrl - Zoom Extents All Selected\n MousLeft+Alt - Particle View \n " local TxtHlp10 ="\n --ISOLATE--\n \n MousLeft - Isolate select\n MousLeft+Ctrl - shade selected polygon\n MousLeft+ Ctrl +Shift - MAX DELETE!\n MousMiddle -backface cull toggle for object \n MousRight - Box Mode for object" local TxtStylV = (dotNetObject "System.Drawing.Font" "Century Gothyc" 8 ((dotNetClass "System.Drawing.FontStyle").regular)) Local TxtForeColV = ((dotNetClass "System.Drawing.Color").fromArgb 10 10 10) local BackColorMessV = ((dotNetClass "System.Drawing.Color").fromArgb 220 100 100) local FontViewt = (dotNetObject "System.Drawing.Font" "Century Gothyc" 6.5 ((dotNetClass "System.Drawing.FontStyle").regular)) local BckColorV1 = ((dotNetClass "System.Drawing.Color").fromArgb 220 100 100) fn Messg1 = (if ::_Messg1 != undefined do try(destroydialog _Messg1)catch() rollout _Messg1 "flat dialog" height:20 width:120 ( dotNetControl Mesg1 "System.Windows.Forms.Button" align:#center height:20 width:120 pos:[0, 0] timer zt interval:1 active:True timer zclock "Clock" interval:1000 --tick once a second on _Messg1 open do ( if ::_helpZoom != undefined do try(destroydialog _helpZoom)catch() if ::_SvDialoguView != undefined do try(destroydialog _SvDialoguView)catch() (mp = mouse.screenpos - [_Messg1.width-60, _Messg1.height-2] ---- Posiciya ot Mouse SetDialogPos _Messg1 mp) Mesg1.backColor = BackColorMessV Mesg1.FlatStyle =Mesg1.FlatStyle.Flat Mesg1.Font = TxtStylV Mesg1.Forecolor = TxtForeColV Mesg1.FlatAppearance.BorderSize = 0 Mesg1.Text = "Unfreeze All" ) on zclock tick do (destroydialog _Messg1) on zt tick do ( mp = mouse.screenpos - [_Messg1.width-150, _Messg1.height/2] SetDialogPos _Messg1 mp) ) createdialog _Messg1 style:#() bgcolor: (color 2 50 60) ) fn Messg2 = (if ::_Messg2 != undefined do try(destroydialog _Messg2)catch() rollout _Messg2 "flat dialog" height:20 width:120 ( dotNetControl Mesg2 "System.Windows.Forms.Button" align:#center height:20 width:120 pos:[0, 0] timer zt interval:1 active:True timer zclock2 "Clock" interval:1000 --tick once a second on _Messg2 open do ( if ::_helpZoom != undefined do try(destroydialog _helpZoom)catch() if ::_SvDialoguView != undefined do try(destroydialog _SvDialoguView)catch() (mp = mouse.screenpos - [_Messg2.width-60, _Messg2.height-2] ---- Posiciya ot Mouse SetDialogPos _Messg2 mp) Mesg2.backColor = BackColorMessV Mesg2.FlatStyle =Mesg2.FlatStyle.Flat Mesg2.Font = TxtStylV Mesg2.Forecolor = TxtForeColV Mesg2.FlatAppearance.BorderSize = 0 Mesg2.Text = "DELETE !!!" ) on zclock2 tick do (destroydialog _Messg2) on zt tick do ( mp = mouse.screenpos - [_Messg2.width-150, _Messg2.height/2] SetDialogPos _Messg2 mp) ) createdialog _Messg2 style:#() bgcolor: (color 2 50 60) ) fn Messg3 = (if ::_Messg3 != undefined do try(destroydialog _Messg3)catch() rollout _Messg3 "flat dialog" height:20 width:120 ( dotNetControl Mesg3 "System.Windows.Forms.Button" align:#center height:20 width:120 pos:[0, 0] timer zt interval:1 active:True timer zclock3 "Clock" interval:1000 --tick once a second on _Messg3 open do ( if ::_helpZoom != undefined do try(destroydialog _helpZoom)catch() if ::_SvDialoguView != undefined do try(destroydialog _SvDialoguView)catch() (mp = mouse.screenpos - [_Messg3.width-60, _Messg3.height-2] ---- Posiciya ot Mouse SetDialogPos _Messg3 mp) Mesg3.backColor = BackColorMessV Mesg3.FlatStyle =Mesg3.FlatStyle.Flat Mesg3.Font = TxtStylV Mesg3.Forecolor = TxtForeColV Mesg3.FlatAppearance.BorderSize = 0 Mesg3.Text = "backface cull toggle" ) on zclock3 tick do (destroydialog _Messg3) on zt tick do ( mp = mouse.screenpos - [_Messg3.width-150, _Messg3.height/2] SetDialogPos _Messg3 mp) ) createdialog _Messg3 style:#() bgcolor: (color 2 50 60) ) fn Messg4 = (if ::_Messg4 != undefined do try(destroydialog _Messg4)catch() rollout _Messg4 "flat dialog" height:20 width:120 ( dotNetControl Mesg4 "System.Windows.Forms.Button" align:#center height:20 width:120 pos:[0, 0] timer zt interval:1 active:True timer zclock4 "Clock" interval:1000 --tick once a second on _Messg4 open do ( if ::_helpZoom != undefined do try(destroydialog _helpZoom)catch() if ::_SvDialoguView != undefined do try(destroydialog _SvDialoguView)catch() (mp = mouse.screenpos - [_Messg4.width-60, _Messg4.height-2] ---- Posiciya ot Mouse SetDialogPos _Messg4 mp) Mesg4.backColor = BackColorMessV Mesg4.FlatStyle =Mesg4.FlatStyle.Flat Mesg4.Font = TxtStylV Mesg4.Forecolor = TxtForeColV Mesg4.FlatAppearance.BorderSize = 0 Mesg4.Text = "Shade selected" ) on zclock4 tick do (destroydialog _Messg4) on zt tick do ( mp = mouse.screenpos - [_Messg4.width-150, _Messg4.height/2] SetDialogPos _Messg4 mp) ) createdialog _Messg4 style:#() bgcolor: (color 2 50 60) ) fn Messg5 = (if ::_Messg5 != undefined do try(destroydialog _Messg5)catch() rollout _Messg5 "flat dialog" height:20 width:120 ( dotNetControl Mesg5 "System.Windows.Forms.Button" align:#center height:20 width:120 pos:[0, 0] timer zt interval:1 active:True timer zclock5 "Clock" interval:1000 --tick once a second on _Messg5 open do ( if ::_helpZoom != undefined do try(destroydialog _helpZoom)catch() if ::_SvDialoguView != undefined do try(destroydialog _SvDialoguView)catch() (mp = mouse.screenpos - [_Messg5.width-60, _Messg5.height-2] ---- Posiciya ot Mouse SetDialogPos _Messg5 mp) Mesg5.backColor = BackColorMessV Mesg5.FlatStyle =Mesg5.FlatStyle.Flat Mesg5.Font = TxtStylV Mesg5.Forecolor = TxtForeColV Mesg5.FlatAppearance.BorderSize = 0 Mesg5.Text = "Box mode" ) on zclock5 tick do (destroydialog _Messg5) on zt tick do ( mp = mouse.screenpos - [_Messg5.width-150, _Messg5.height/2] SetDialogPos _Messg5 mp) ) createdialog _Messg5 style:#() bgcolor: (color 2 50 60) ) fn helpZoom = (if ::_helpZoom != undefined do try(destroydialog _helpZoom)catch() rollout _helpZoom "flat dialog" height:400 width:600 ( dotNetControl Hsg "System.Windows.Forms.Button" align:#center height:400 width:300 pos:[0, 0] dotNetControl Hsg2 "System.Windows.Forms.Button" align:#center height:400 width:300 pos:[300, 0] on _helpZoom open do ( if ::_Messg1 != undefined do try(destroydialog _Messg1)catch() if ::_SvDialoguView != undefined do try(destroydialog _SvDialoguView)catch() (mp = mouse.screenpos - [_helpZoom.width-300, _helpZoom.height-180] ---- Posiciya ot Mouse SetDialogPos _helpZoom mp) Hsg.backColor = ((dotNetClass "System.Drawing.Color").fromArgb 225 150 150) Hsg.FlatStyle =Hsg.FlatStyle.Flat Hsg.Font = (dotNetObject "System.Drawing.Font" "Century Gothyc" 8 ((dotNetClass "System.Drawing.FontStyle").regular)) Hsg.Forecolor = ((dotNetClass "System.Drawing.Color").fromArgb 10 10 10) Hsg.FlatAppearance.BorderSize = 0 Hsg.TextAlign = Hsg.TextAlign.MiddleLeft Hsg.Text = TxtHlp0+TxtHlp1+TxtHlp2+TxtHlp3+TxtHlp4+TxtHlp5 Hsg2.backColor = ((dotNetClass "System.Drawing.Color").fromArgb 225 150 150) Hsg2.FlatStyle =Hsg.FlatStyle.Flat Hsg2.Font = (dotNetObject "System.Drawing.Font" "Century Gothyc" 8 ((dotNetClass "System.Drawing.FontStyle").regular)) Hsg2.Forecolor = ((dotNetClass "System.Drawing.Color").fromArgb 10 10 10) Hsg2.FlatAppearance.BorderSize = 0 Hsg2.TextAlign = Hsg2.TextAlign.MiddleLeft Hsg2.Text = TxtHlp6+TxtHlp7+TxtHlp8+TxtHlp9+TxtHlp10 ) on Hsg mousedown evnt do (destroydialog _helpZoom) on Hsg2 mousedown evnt do (destroydialog _helpZoom) ) createdialog _helpZoom style:#() bgcolor: (color 2 50 60) ) rollout _SvDialoguView "flat dialog" height:75 width:150 ( timer t interval:2000 active:True dotNetControl ButtonF "System.Windows.Forms.Button" align:#center height:25 width:50 pos:[0, 0] --- fgcolor: (color 250 200 220) --- sozdaniye LIST knopki dotNetControl ButtonTp "System.Windows.Forms.Button" align:#center height:25 width:50 pos:[50, 0] dotNetControl ButtonBck "System.Windows.Forms.Button" align:#center height:25 width:45 pos:[100, 0] dotNetControl ButtonL "System.Windows.Forms.Button" align:#center height:25 width:50 pos:[0, 25] dotNetControl ButtonP "System.Windows.Forms.Button" align:#center height:25 width:50 pos:[50, 25] -- dotNetControl ButtonP "System.Windows.Forms.Button" align:#center height:25 width:50 pos:[50, 25] dotNetControl ButtonR "System.Windows.Forms.Button" align:#center height:25 width:50 pos:[100, 25] dotNetControl ButtonM "System.Windows.Forms.Button" align:#center height:25 width:50 pos:[0, 50] dotNetControl ButtonBtm "System.Windows.Forms.Button" align:#center height:25 width:50 pos:[50, 50] dotNetControl ButtonIs "System.Windows.Forms.Button" align:#center height:25 width:50 pos:[100, 50] dotNetControl ButtonHelper "System.Windows.Forms.Button" align:#center height:25 width:10 pos:[145, 0] ---------------------------------------------------------------------------- on ButtonF mousedown evnt do ( If keyboard.AltPressed then (actionMan.executeAction 0 "40029" ) -- Enviroment window else (actionMan.executeAction 0 "40060" -- Views: Front View actionMan.executeAction 0 "310") -- Tools: Zoom Extents Selected -- any mouse key closes dialog destroydialog _SvDialoguView ) on ButtonTp mousedown arg do ( case arg.Button of ( (arg.Button.Left): (If keyboard.AltPressed then ( max mtledit ) else (actionMan.executeAction 0 "40059" -- Views: Top View actionMan.executeAction 0 "310") -- Tools: Zoom Extents Selected destroydialog _SvDialoguView) (arg.Button.Middle): (max quick render destroydialog _SvDialoguView ) (arg.Button.Right): (If keyboard.controlPressed then (max show last img) else (max render last) destroydialog _SvDialoguView) ) ) on ButtonBck mousedown evnt do ( If keyboard.AltPressed then ( max render scene ) else (actionMan.executeAction 0 "40064" -- Views: Back View actionMan.executeAction 0 "310") -- Tools: Zoom Extents Selected -- any mouse key closes dialog destroydialog _SvDialoguView ) on ButtonL mousedown arg do ( case arg.Button of ( (arg.Button.Left): ( If keyboard.AltPressed then (max properties) else (actionMan.executeAction 0 "40061" -- Views: Left View actionMan.executeAction 0 "310") -- Tools: Zoom Extents Selected -- any mouse key closes dialog destroydialog _SvDialoguView ) (arg.Button.Middle): (freeze $ destroydialog _SvDialoguView ) (arg.Button.Right): ( destroydialog _SvDialoguView) ) ) on ButtonP mousedown arg do ( case arg.Button of ( (arg.Button.Left): ( If keyboard.controlPressed then (actionMan.executeAction 0 "40183" -- Views: Orthographic User View actionMan.executeAction 0 "310" )-- else If keyboard.ShiftPressed then (actionMan.executeAction 0 "268")-- Views: Orthographic User View else If keyboard.AltPressed then (actionMan.executeAction 0 "330") --Tools: Zoom Extents else (actionMan.executeAction 0 "40182" -- Views: Perspective actionMan.executeAction 0 "310") -- Tools: Zoom Extents Selected destroydialog _SvDialoguView ) (arg.Button.Middle): (max unfreeze by hit destroydialog _SvDialoguView ) (arg.Button.Right): ( destroydialog _SvDialoguView) ) ) ---------------------------------------- ------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------- on ButtonR mousedown arg do ( case arg.Button of ( (arg.Button.Left): ( If keyboard.AltPressed then (max tool hlist ) -- select from scene Window else (actionMan.executeAction 0 "40062" -- Views: Right View actionMan.executeAction 0 "310") -- Tools: Zoom Extents Selected -- closes dialog destroydialog _SvDialoguView ) (arg.Button.Middle): ( actionMan.executeAction 0 "283" -- Tools: Unfreeze All Messg1() destroydialog _SvDialoguView ) (arg.Button.Right): ( destroydialog _SvDialoguView) ) ) on ButtonM mousedown evnt do ( If keyboard.controlPressed then (actionMan.executeAction 0 "369") -- Views: View Edged Faces Toggle else If keyboard.AltPressed then (macros.run "Layers" "LayerManager") -- Layer Manager else (actionMan.executeAction 0 "272" ) -- Views: Wireframe / Smooth+Highlights Toggle destroydialog _SvDialoguView ) on ButtonBtm mousedown evnt do ( If keyboard.controlPressed then () -- Tools: Zoom Extents All Selected else If keyboard.AltPressed then (actionMan.executeAction 135018554 "32771") -- Particle View Open/Close Toggle else ( actionMan.executeAction 0 "40063" -- Views: Bottom View actionMan.executeAction 0 "310") -- Tools: Zoom Extents Selected destroydialog _SvDialoguView ) on ButtonIs mousedown arg do ( case arg.Button of ( (arg.Button.Left): (If keyboard.controlPressed and keyboard.ShiftPressed then ((max delete ) Messg2() ) else If keyboard.controlPressed Then (actionMan.executeAction 0 "371") ---Viewport Selection Shade Selected Faces Toggle else (actionMan.executeAction 0 "262" actionMan.executeAction 0 "268" ) destroydialog _SvDialoguView ) (arg.Button.Middle): ( (max backface cull toggle) Messg3 () destroydialog _SvDialoguView ) (arg.Button.Right): (If keyboard.controlPressed then (max shade selected Messg4 ()) else (max box mode Messg5 ()) destroydialog _SvDialoguView) ) ) on ButtonHelper mousedown evnt do (helpZoom() destroydialog _SvDialoguView ) --------------- on t tick do ( destroydialog _SvDialoguView ) on ButtonP keydown evnt do ( if evnt.keycode == evnt.keycode.space do (actionMan.executeAction 0 "50026" --- Maximize viewport destroydialog _SvDialoguView) if evnt.keycode == evnt.keycode.z do (actionMan.executeAction 0 "310" destroydialog _SvDialoguView ) if evnt.keycode == evnt.keycode.a do (actionMan.executeAction 0 "268" destroydialog _SvDialoguView ) if evnt.keycode == evnt.keycode.x do (actionMan.executeAction 0 "40182" destroydialog _SvDialoguView) if evnt.keycode == evnt.keycode.escape do (destroydialog _SvDialoguView) ) -------------------------------------------------------------------------- -----zapusk funkciy pri open on _SvDialoguView open do ( if ::_Messg1 != undefined do try(destroydialog _Messg1)catch() if ::_helpZoom != undefined do try(destroydialog _helpZoom)catch() (mp = mouse.screenpos - [_SvDialoguView.width-75, _SvDialoguView.height/2] ---------------------------------------------- Posiciya ot Mouse SetDialogPos _SvDialoguView mp) ButtonP.backColor = (dotNetClass "System.Drawing.Color").fromArgb 100 100 100 --- Cvet fona ------ ButtonP.refresh() --- bez etogo ne rabotaet knopki tipo goryachih klavish ButtonP.focus() ---- --------------------- (ButtonF.backColor = (dotNetClass "System.Drawing.Color").fromArgb 130 145 25) --- Cvet fona Front ButtonF.FlatStyle = ButtonF.FlatStyle.Flat ButtonF.TextAlign = ButtonF.TextAlign.MiddleCenter ButtonF.Font = FontViewt ButtonF.Text = "Front" ButtonTp.backColor = BckColorV1 --- Top ButtonTp.FlatStyle = ButtonTp.FlatStyle.Flat ButtonTp.Font = FontViewt ButtonTp.Text = "Top" (ButtonBck.backColor = (dotNetClass "System.Drawing.Color").fromArgb 130 145 25) --- Back ButtonBck.FlatStyle = ButtonBck.FlatStyle.Flat ButtonBck.Font = FontViewt ButtonBck.Text = "Back" ButtonL.backColor = BckColorV1 --- Left ButtonL.FlatStyle = ButtonL.FlatStyle.Flat ButtonL.Font = FontViewt ButtonL.Text = "Left" ButtonP.backColor = BckColorV1 --- Perspective ButtonP.FlatStyle = ButtonP.FlatStyle.Flat ButtonP.Font = FontViewt ButtonP.Text = "Persp" ButtonR.backColor = BckColorV1 --- Right ButtonR.FlatStyle = ButtonR.FlatStyle.Flat ButtonR.Font = FontViewt ButtonR.Text = "Right" ButtonM.backColor = ((dotNetClass "System.Drawing.Color").fromArgb 95 20 110) ---Maximize ButtonM.FlatStyle = ButtonM.FlatStyle.Flat ButtonM.Font = FontViewt ButtonM.Text = "Edg" ButtonBtm.backColor = BckColorV1 --- Bottom ButtonBtm.FlatStyle = ButtonBtm.FlatStyle.Flat ButtonBtm.Font = FontViewt ButtonBtm.Text = "Bottom" ButtonIs.backColor = ((dotNetClass "System.Drawing.Color").fromArgb 95 20 110) --- Isolate ButtonIs.FlatStyle = ButtonIs.FlatStyle.Flat ButtonIs.Font = FontViewt ButtonIs.Text = "Isolate" ButtonHelper.backColor = (dotNetClass "System.Drawing.Color").fromArgb 125 0 0 --- Help ButtonHelper.FlatStyle = ButtonHelper.FlatStyle.Flat ButtonHelper.Font = FontViewt ButtonHelper.Text = "?" ) --on ButtonIs KeyPress "System.Windows.Forms.KeyPressEventArgs.Shift" do (ButtonIs.Text = "Is222te") ---dotNet.addEventHandler ButtonIs "KeyPress" Shift (fn _netLabel = (ButtonIs.Text = "Is222te")) ) createdialog _SvDialoguView style:#() )