home *** CD-ROM | disk | FTP | other *** search
Wrap
-- UI Scheme MacroScript File -- -- Created: Nov 1 2000 -- Last Updated: Dec 15 2000 -- May 17 2001 - Michael Russo - uses new SaveQuadOptions function with .qmo files -- uses .idr instead of .dat for icon dir settings -- June 7 2001 - Michael Russo - uses new CUI IO methods for quad menus and icon dir -- -- Author : Fredrick Ruff, Frank DeLise -- Version: 3D Studio Max Version 4.0 -- -- -- This script allows users to load UI schemes and icon directories. --*********************************************************************************************** -- MODIFY THIS AT YOUR OWN RISK MacroScript LoadScheme category:"Customize User Interface" internalcategory:"Customize User Interface" tooltip:"Load Custom UI Scheme" ButtonText:"Load Custom UI Scheme" SilentErrors:(Debug != True) ( Global UIScheme_Icon_Folder, UIScheme_Icon_Type, UIScheme_Filename, UIScheme_Icon_Setup, LoadSchemename, UIScheme_Root Global UIScheme_Directories, UIScheme_LoadDialog, UIScheme_IconDialog, UIScheme_Bitmap_Init fn existFile fname = (getfiles fname).count != 0 -- Get filename from an open dialog --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Default Directory and Filename "DefaultUI" --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ local DirectorySeed = getdir(#UI)+"\\DefaultUI" --\\\\\\\\\\\\\\\\\\\\\ -- Disable Esacpe Key --\\\\\\\\\\\\\\\\\\\\\ EscapeEnable=false --\\\\\\\\\\\\\\\\\\\\\ -- Disable Esacpe Key --\\\\\\\\\\\\\\\\\\\\\ UIScheme_Filename = getOpenFilename filename:DirectorySeed caption:"Load Custom UI Scheme" types:"UI File(*.cui)|*.cui|Menu File(*.mnu)|*.mnu|Color File(*.clr)|*.clr|Shortcuts File(*.kbd)|*.kbd|Quad Options File(*.qmo)|*.qmo" ---\\\\\\\\\\\\\\\\\\\\\ -- Enable Esacpe Key --\\\\\\\\\\\\\\\\\\\\\\\ EscapeEnabled = true If UIScheme_Filename != undefined do ( --\\\\\\\\\\\\\\\\\\\\\ -- Create Loading dialog --\\\\\\\\\\\\\\\\\\\\\ Rollout UIScheme_LoadDialog "Custom Scheme" Width:200 Height:100 ( label lbl2 "Loading Custom Scheme" offset:[0,30] label lbl3 "Please Wait..." ) CreateDialog UIScheme_LoadDialog width:200 height:100 --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Load all interface files using name from open dialog --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LoadSchemeName = GetFileNameFile UIScheme_Filename --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Load Menu File, Color File, and Keyboard File --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MenuMan.LoadMenuFile (LoadSchemeName +".mnu" ) ColorMan.LoadColorFile (LoadSchemeName +".clr" ) ActionMan.LoadKeyboardFile (LoadSchemeName +".kbd" ) --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Load .CUI File and QuadMenu File --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ if (existfile (LoadSchemeName +".cui" )) == true do cui.loadConfig (LoadSchemeName +".cui" ) -- russom 06/07/01 -- if (existfile (LoadSchemeName +".qmo" )) == true do LoadQuadOptions (GetDir #ui) LoadSchemeName ".qmo" if (existfile (LoadSchemeName +".qmo" )) == true do QuadMenuSettings.LoadSettingsFile (LoadSchemeName+".qmo") --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Save Quad colors as startup --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- russom SaveQuadOptions (GetDir #ui) "MaxQuadMenus" ".qmo" QuadMenuSettings.SaveSettingsFile "MaxQuadMenus.qmo" Print UIScheme_Filename --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Save CUI file as startup so your changes are loaded when restarting MAX --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ cui.saveConfigAs ("MaxStart.cui") --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- If an Icon .Dat file exisit, Use it when loading Scheme --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- russom - 05/18/01 - changes for gmax security -- UIScheme_Icon_Folder = OpenFile (GetDir #maxroot + "ui\\" + LoadSchemeName + ".dat") -- If UIScheme_Icon_Folder != undefined then (UIScheme_Icon_Type = ReadLine UIScheme_Icon_Folder) -- russom 06/07/01 -- UIScheme_Icon_Folder = getINISetting ((GetDir #ui) + "\\" + LoadSchemeName + ".idr") "IconSettings" "Directory" ColorMan.LoadIconFile (LoadSchemeName + ".dat") UIScheme_Icon_Folder = ColorMan.ReadIconFile() if UIScheme_Icon_Folder != "" then (UIScheme_Icon_Type = UIScheme_Icon_Folder ) --\\\\\\\\\\\\\\\\\\\\\\ -- Loading Icons Dialog --\\\\\\\\\\\\\\\\\\\\\\ DestroyDialog UIScheme_LoadDialog UIScheme_Root = (GetDir #maxroot + "ui\\") Try(UIScheme_Bitmap_Init = OpenBitmap (UIScheme_Root + UIScheme_Icon_Type + "\\CreateTypes_16i.bmp")) Catch(Try(UIScheme_Bitmap_Init = OpenBitmap (UIScheme_Root + "Icons" + "\\Null_24i.bmp"))Catch()) Try( Rollout UIScheme_IconDialog "Custom Scheme" Width:200 Height:200 ( Bitmap UIScheme_Icon_Display "" Bitmap:UIScheme_Bitmap_Init label lbl2 "Loading Icons" offset:[0,5] label lbl3 "Please Wait..." On UIScheme_IconDialog Open do (UIScheme_Icon_Display.Bitmap = UIScheme_Bitmap_Init) ) CreateDialog UIScheme_IconDialog width:200 height:100 --\\\\\\\\\\\\\ -- Load Icons --\\\\\\\\\\\\\ ColorMan.SetIconFolder UIScheme_Icon_Type Close UIScheme_Icon_Folder DestroyDialog UIScheme_IconDialog --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Force Redraw to clean up the UI --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ forceCompleteRedraw() --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- End --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ) Catch(DestroyDialog UIScheme_IconDialog) ) ) MacroScript SaveScheme category:"Customize User Interface" internalcategory:"Customize User Interface" tooltip:"Save Custom UI Scheme" ButtonText:"Save Custom UI Scheme" SilentErrors:(Debug != True) ( Global UIScheme_Directories_Names, UIScheme_Directories_Name, UIScheme_Bitmap_Preview --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Get filename from Save dialog --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ local DirectorySeed = getdir(#UI)+"\\DefaultUI" --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Set types of files to load --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ UIScheme_Filename = getSaveFilename filename:DirectorySeed caption:"Save Custom UI Scheme" types:"UI File(*.cui)|*.cui|Menu File(*.mnu)|*.mnu|Color File(*.clr)|*.clr|Shortcut File(*.kbd)|*.kbd|" If UIScheme_Filename != undefined do ( Rollout SaveDialog "Custom Scheme" width:200 height:100 ( label lbl2 "Saving Custom Interface Scheme" offset:[0,30] label lbl3 "Please Wait..." ) CreateDialog SaveDialog width:200 height:100 --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Save all interface file formats out to name aquired from dialog --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ SaveSchemeName = GetFileNameFile UIScheme_Filename MenuMan.saveMenuFile (SaveSchemeName +".mnu") ColorMan.saveColorFIle (SaveSchemeName +".clr" ) ActionMan.saveKeyboardFile (SaveSchemeName +".kbd" ) Cui.saveConfigAs (SaveSchemeName +".cui") --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Save CUI file as startup so your changes are loaded when restarting MAX --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ cui.saveConfigAs ("MaxStart.cui") --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Saves Quad Colors into a MAXScript file in your UI directory with .qcl extention --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- russom 06/07/01 -- SaveQuadOptions (GetDir #ui) SaveSchemeName ".qmo" QuadMenuSettings.SaveSettingsFile (SaveSchemeName + ".qmo") --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Save Icon Folder setup --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ If QueryBox "Would You Like to Save an Icon Setup for This Scheme?" title:"UI Scheme Icons" then ( UIScheme_Directories = GetDirectories (GetDir #maxroot + "ui\\*") UIScheme_Directories_Names = #() UIScheme_Root = (GetDir #maxroot + "ui\\") UIScheme_Directories_Name = StringStream UIScheme_Directories_Name = "" --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Parse directories for valid directories only --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ For D in 1 to UIScheme_Directories.count do ( UIScheme_Directories_Name = "" for L in 1 to UIScheme_Directories[D].count do (If UIScheme_Directories[D][L] != UIScheme_Root[L] and UIScheme_Directories[D][L] != "\\" then UIScheme_Directories_Name += UIScheme_Directories[D][L]) If UIScheme_Directories_Name != "macroscripts" then (Append UIScheme_Directories_Names UIScheme_Directories_Name) ) --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Icon pack lister, List all valid icon folders --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ UIScheme_Bitmap_Preview = (UIScheme_Root + "Icons" + "\\CreateTypes_16i.bmp") Rollout UIScheme_IconRoll "Icon Directory" ( Bitmap UIScheme_Icon_Preview "" Filename:UIScheme_Bitmap_Preview ListBox UIScheme_Folders "Icon Packs" items:UIScheme_Directories_Names Height:8 Button UIScheme_Folder_Use "Use This Directory" Width:100 On UIScheme_IconRoll open do ( Try( UIScheme_Bitmap_Preview = OpenBitmap (UIScheme_Root + UIScheme_Folders.selected + "\\CreateTypes_16i.bmp") UIScheme_Icon_Preview.Bitmap = UIScheme_Bitmap_Preview )Catch() ) On UIScheme_Folders selected i do ( Try( UIScheme_Bitmap_Preview = OpenBitmap (UIScheme_Root + UIScheme_Folders.selected + "\\CreateTypes_16i.bmp") UIScheme_Icon_Preview.Bitmap = UIScheme_Bitmap_Preview )Catch(Try(UIScheme_Icon_Preview.Bitmap = OpenBitmap (UIScheme_Root + "Icons" + "\\Null_24i.bmp"))Catch()) ) On UIScheme_Folder_Use pressed do ( --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- Generate a Scheme name . dat file containing the directory name --\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ -- russom - 05/18/01 - changes for gmax security -- UIScheme_Icon_Setup = CreateFile (GetDir #maxroot + "ui\\" + SaveSchemeName + ".dat") -- Format "%" UIScheme_Folders.selected to:UIScheme_Icon_Setup -- Close UIScheme_Icon_Setup -- russom 06/07/01 -- setINISetting ((GetDir #ui) + "\\" + SaveSchemeName + ".idr") "IconSettings" "Directory" ((UIScheme_Folders.selected) as string) ColorMan.SaveIconFile (SaveSchemeName + ".dat") ((UIScheme_Folders.selected) as string) DestroyDialog UIScheme_IconRoll ) ) CreateDialog UIScheme_IconRoll Width:200 Height:200 ) DestroyDialog SaveDialog ) )