_______________________


Rob Galanakis
Technical Artist
516.680.1603
robg@robg3d.com

Setting up Scripts for a Studio

I just thought I'd write a quick article on how I set up tools on the artists machines at a previous job. I'm not sure how things are traditionally done at studios or what other people do, but we had a pretty small studio and this worked quite well... I'm sure it'd be transferrable to personal/independent projects as well, since it is driven through source-control.

One of the problems I had (and, I hear, many technical artists have) is for artists to embrace tools and pipeline improvements. Add to this the idea that an artist would have to install the tool each time he wants the newest version, and it quickly becomes a frightening prospect and artists are even less likely to use the tools. So, I set something up to make sure the process is as simple and painless as possible for the artist, and manage to do automatically anything that needed to be done. There are better ways to do this for the larger studio, but they all involve more knowledge and complexity... this is very simple, requiring only a bit of maxScript skill and time.

Quite simply, the setup has three components: a startup script, a script loader script, and the actual script directory. The startup script, on the artist's local machine, simply loads ("fileIn( )") the script loader, which resides on source control. This script loader loads all the scripts in a certain directory, also on version control. This chain can even be lengthened further if needed, but generally this is sufficient.

So the first script, then, the startup script, is placed in your Scripts/Startup, is automatically done on loading max, and is merely the following: (I assume Max 9 but replace with any version)
C:/Program Files/Autodesk/3ds max 9/Scripts/Startup/scriptStartup.ms:
(
   fileIn "C:\\where_ever_your_scripts_are_on_version_control\\scriptLoader.ms"
)
Your script loader is also simple. We just get the mcr and ms files and fileIn them. However, we can also do some additional cool things with it, such as deleting/copying icons, adding a custom splashscreen picker, etc., which will be at the end of this tutorial.
C:/where_ever_your_scripts_are_on_version_control/scriptLoader.ms:
(
   --get the script directory, and make arrays of everything ending with .mcr and .ms in it
   scriptDir = C:\\where_ever_your_scripts_are_on_version_control\\maxScripts\\"
   scriptMcrArr = getFiles (scriptDir + "*.mcr")
   scriptMsArr = getFiles (scriptDir + "*.ms")
 
   --iterate through arrays, doing a fileIn for each script, thus evaluating them all
   for i=1 to scriptMcrArr.count do (
      fileIn scriptMcrArr[i]
   )
 
   for i=1 to scriptMsArr.count do (
      fileIn scriptMsArr[i]
   )
 
   --now get array of all bmp icons, delete old, copy new
   iconsArr = getFiles (scriptDir + "*.bmp")
   for i in 1 to iconsArr.count do
   (
      iconFileName = getFilenameFile iconsArr[i]
      --copy from version control to max path
      --we may also need to delete from the /Local Settings/ user path, add if needed
      iconsDir = "C:\\Program Files\\Autodesk\\3ds Max 9\\ui\\Icons\\"
      deleteFile (iconsDir + iconFileName + ".bmp")
      copyFile (iconsArr[i]) (iconsDir + iconFileName + ".bmp")
   )
)
Some cool things to add to your script loader:
   --get array of all bmp icons, delete old, copy new
   iconsArr = getFiles (scriptDir + "*.bmp")
   for i in 1 to iconsArr.count do
   (
      iconFileName = getFilenameFile iconsArr[i]
      --copy from version control to max path
      --we may also need to delete from the /Local Settings/ user path, add if needed
      iconsDir = "C:\\Program Files\\Autodesk\\3ds Max 9\\ui\\Icons\\"
      deleteFile (iconsDir + iconFileName + ".bmp")
      copyFile (iconsArr[i]) (iconsDir + iconFileName + ".bmp")
   )

   --random splashscreen chooser... have the artists add their own splash screens!
   try (
      bmpArr = getFiles (scriptDir + "splashScreens\\*.bmp")
      chooseNum = random 1 bmpArr.count
      try (deleteFile "C:\\Program Files\\Autodesk\\3ds Max 9\\splash.bmp") catch ()
      copyFile (bmpArr[chooseNum]) ("C:\\Program Files\\Autodesk\\3ds Max 9\\splash.bmp")
   ) catch ()