[Closed] Can someone help me understand the principles of maxscript directories?
I wonder if someone could give me a walkthrough to the 3dsmax script jungle.
Everytime I download a script I get different kind of info from the readme-file included.
I noticed these directories (or maybe there are even more to put your script in??)
Autodesk\3dsMax8\UI\MacroScripts
Autodesk\3dsMax8\stdplugs\stdscripts
Autodesk\3dsMax8\Scripts
Autodesk\3dsMax8\Scripts\Startup
And there are these extensions: *.ms, *.mcr (dont know if there are more)
Also, I wonder where the UI settings are stored in case that I want to “transfer” my 3dsmax from one computer to another. In Maya, I would transfer the Document\Maya\7.0 folder so take with me all the settings, shortcuts etc.
Finally, I wonder how to assign an icon I have done to a button that I added into the Toolbar
Thank you in advance, your feedback will surely help
Autodesk\3dsMax8\UI\MacroScripts:
scripts that can be put in a toolbar in max (mcr)
Autodesk\3dsMax8\stdplugs\stdscripts:
standard scripts shipped with 3dsMax (ms)
Autodesk\3dsMax8\Scripts:
scripts that can be manually executed via the maxscript menu in max (ms)
Autodesk\3dsMax8\Scripts\Startup:
scripts that are run at max start, useful for custom made materials and stuff (ms, mcr)
icons are stored in Autodesk\3dsMax8\UI\Icons
I would like to point out that the MAXScript Reference has a whole topic with in-depth explanation on how autostart scripts are handled. (see “Startup Scripts” topic, or in Index tab, startup>organizing scripts).
First, the Autodesk\3dsMax8\Scripts folder is for your storage needs – nothing is run automatically from there, except for the sub-folder Autodesk\3dsMax8\Scripts\Startup. You can create sub-folders inside the Autodesk\3dsMax8\Scripts or save scripts directly into it – it is just a default place to save your work and load it manually later.
When Max is booting up, the first location to scan for autorun scripts is the Autodesk\3dsMax8\stdplugs\stdscripts folder and its subfolders. Standard functions shipping with Max are placed there. It is important to remember that Max has not been started up completely at this point, so these scripts cannot perform scene-related operations, they should only declare and define global functions to be used by other scripts in the system.
After the special scripts folder has been processed, Max continues scanning for scripts in all folders defined in the Plugins paths, AND their sub-folders! (real plugin DLLs are loaded only from the defined paths, but scripts will be loaded from all sub-directories of such paths!). This is to allow .MS files containing scripted Plugins to be installed as regular DLL plugins.
You should NEVER touch anything in Autodesk\3dsMax8\UI\MacroScripts nor copy your scripts into that folder. This directory is for automatically created copies of MacroScript code. When you have a MacroScript SomeName category:“BlaBla” () in your .MS file, evaluating that file will create a file called BlaBla-SomeName.mcr in the UI\MacroScripts directory. These macroScripts are needed by the UI (toolbars, menus, QuadMenus, shortcuts) and are being processed in STEP 3 described in the Reference.
The only valid reason to copy .MCR files into UI\MacroScripts would be when synching two installations (we do this automatically at Frantic, so each time we boot max, a central folder structure is synched to the local machine before 3dsmax.exe is started)
Finally, the Autodesk\3dsMax8\Scripts\Startup folder is scanned for a file called startup.ms which could contain both code and fileIn() calls to load other scripts. If the startup.ms is not found at that location, an extended search in system folders is performed as described in the Reference. Then, any other .MS files in the Autodesk\3dsMax8\Scripts\Startup folder are being run. Since the Max scene and UI are fully loaded and available at this point, scripts in this folder can operate on them, for example install additional menu items, alter scene settings and so on.
Of course, you can save your sources anywhere you want as long as you don’t need them auto-run each time you start Max. You should be very careful not to place .MS files in plugin directories as these WILL be run at startup and could cause errors.
I personally store my working copies in a completely different (and version-controlled) directory structure far away from Max. I only bring in finished code and place it in the correct folder as explained above.
If your script defines a MacroScript, your source (usually an .MS) does not need to be anywhere near Max either – the moment you evaluate your MacroScript source, the .MCR will be created automatically in the UI/Macroscripts and will stay with the system until you delete the .MCR manually.
When you select some code from the Listener or another script editor window and drag it to a toolbar, the code will be automatically wrapped in a MacroScript definition and an .MCR (short from MaCroRecorder) file will again be created automatically in the UI/MacroScripts folder. Thus dragging code with an existing MacroScript definition to a toolbar is a bad idea as it would cause two nested MacroScript definitions to be created and you will get an error.
You can also drag&drop MS files from Windows Explorer or similar browsers onto the Max toolbars – this will automatically run the MS file and if it contains a MacroScript definition, an .MCR file will be created in the UI/Macroscripts folder.
There are also special script zip packages that can be dragged onto the Max UI and will perform auto-installation like copying the files to the right folders etc. Read the Reference if you need more info.
There are also special MacroScripts (using a particular event hander in the definition) that can be dragged onto scene objects to perform certain operations (instead of selecting an object and clicking a button), but nobody seems to use these.
UI Settings are stored in the .CUI files under Autodesk\3dsMax8\UI, esp. MaxStartUI.cui which contains the latest changes. You can create your own setups to load later, but the MaxStartUi.cui is the one that is automatically saved when you exit the application and contains any changes you might have made.
There are also the files MaxStartUI.mnu (containing the menu definitions), MaxStartUi.clr (containing the color settings), MaxStartUi.kbd containing the keyboard shortcuts etc.
So copying the content of Autodesk\3dsMax8\UI and all its folders should give you all settings, icons and macroscript you had installed on your source machine.
To add an icon to a button in the UI, you can either specify the icon in the MacroScript definition itself, or later right-click the button, select “Edit Button Appearance…” and select an icon from an existing library. You can also create your own icon libraries – read “Creating Icon Bitmap Files” in the reference.