
So recently i had to figure out how to deploy Blur Python at pixomondo. most of you are probably thinking what’s the big deal?
blur python comes with an nice self contained installer? you just run the installer and “finito” Blur python for max is deployed…
well unfortunately, this type of installation is not ideal in a large studio where hundreds of machines might need python installed deployed and configured. needless to say that if you ever need to remove or upgrade the plugin this method can turn into a nightmare to manage.
Obviously this particular scenario is not unique to blur python, but it’s actually very common when configuring and managing all the 3rd party plugins that a studio might use at any given time along with max. in this situation most places that have the ability and resources to do so you usually setup up a bat file or script that artist can use to launch max.. this script usually copies all the script plugins and thing the artist needs from a network location and then initiates max start-up script copied over during the sync process can then configure max on start-up.. this way we can guarantee that every time the artist launches max his has the latest and greatest plugins every time he start a max session. so by now you are probably like “Blah Blah Blah, what does that have to do with running blur python from the network?”..
well the thing is that, if you ever tried to deploy blur python to a machine by poorly copying files or trying to load things from the network you might brake your max installation all together.. that’s why i figure i put this poorly written article together, and try and document what I’ve had to do to get blur python and blur qt running inside of max.
Ok so for my case test i was installing
BlurOffline_python26_2013-01-28_install_13200_64.exe on to 3dsmax 2012 sp10
it’s important to note this seance things might be different in previous or feature releases..
So the first thing we need to do to get the whole thing going, is to actually run the installer so that we can pull all the files from the installer and move them to our network location.
once you have ran the installer and made sure that blur python properly running in the test machine inside of max, we need to find all the difference components that are needed to run blur python, so that we can move them to the network.
the main sections we want to concern our self with are…
- the main python directory
- the folder containing all of blur Qt.dll’s
- C:\Windows\System32\blur64
- python26.dll
- C:\Windows\SysWOW64\python26.dll
- the blur python max plugin
- c:\3dmax2012\plugins\blur\blurpython26.dlx
- Blur Dev configuration filder
- Blur Scripts
- c:\3dsmax2012\scripts\starup
- init_python.ms
- init_pyhelper.ms
- c:\3dsmax2012\scripts\python
- 3dsmax factory QT dll’s
- C:\Program Files\Autodesk\3DS Max 2012\bin\qt_bak
ideally we want to copy all this different components to a single network location from where to run copy or source them in from, an example of this would be
- \\netowrklocation\pluginModules\blur_python26\python26
- \\netowrklocation\pluginModules\blur_python26\blur64
- \\netowrklocation\pluginModules\blur_python26\python26.dll
- \\netowrklocation\pluginModules\blur_python26\plugins\blurpython26.dlx
- \\netowrklocation\pluginModules\blur_python26\blur
- \\netowrklocation\pluginModules\blur_python26\scripts
- \\netowrklocation\pluginModules\blur_python26\bin\qt_bak
The biggest challenge with deploying blur python for max is that blur python needs to replace the factory qt dll’s with newer ones. if you don’t set this up properly it can completely hose your max installation. this will be very obvious if it happens seance on max start-up you will start seeing multiple “caddies.gup” errors. this basically means that max could not find QT on start-up, and max will quit out as soon as the initialization process is finished.
in order to setup the necessary qt dll’s there are two things that need to happen…
- you need to remove the following dll’s from the max root (i suggest you back this up somewhere so that you can restore them if needed)
- QtCore4.dll
- QtGui4.dll
- QtXml4.dll
- add the path to the blur64 directory to the windows “Path” environment variable
- set Path=\\netowrklocation\pluginModules\blur_python26\blur64;%Path%
the thing to understand is that on start up, max will look for this dll’s on it’s root folder, but if it fails to find them it will then try and look for them in all the directories register in the windows “Path” environment variable. so by adding the path to the blur64 folder to the front of the “path” environment variable we make sure that max checks that folder first and loads everything it needs from that folder…
when you do this you should see max initialize with no more problems..
After qt is loaded the next thing we need to do to make sure the blurpython.dlx actually initializes. to ensure this we copy the “C:\Windows\SysWOW64\python26.dll” to the 3ds max root directory…
this dll is installed when python is installed, and the blurPython.dlx will try to find it by looking in the max directory first, if it fails to find it, it then will then look inside the windows system paths, but by copying it to the max root directory we make sure that 3ds max finds the python version on the first try, and with out actually having to install python on the local machine..
Once you’ve done that the BlurPython.dlx will actually initialize, and if you have copied the “Blur Scripts” (look at the notes above) local max folder you should see the python menu get generated on max start-up..
at this point Blur Python still doesn’t know where to load the python.exe and all it’s libraries, this symptom is easily exhibited when you click on the python menu/new script and nothing happens (blur python idle should open up but it doesn’t)..
in order to fix this, we resolve once again to adding a few things to our windows environment..
- add the path to the python installation the “Path” windows environment variable
- set Path=\\netowrklocation\pluginModules\blur_python26\python26;%Path%
- set up the defualt pythonpath environment variable
- set pythonpath=\\netowrklocation\pluginModules\blur_python26\python26\Lib;\\netowrklocation\pluginModules\blur_python26\python26DLLs;\\netowrklocation\pluginModules\blur_python26\python26\lib-tk;\\netowrklocation\pluginModules\blur_python26\python26\lib\site-packages
at this point you should be able to fire up max, click on the python menu/new script and get the idle ui and start programing some max goodness with python..
if you don’t want to have to start max via a batch process then you could manually edit the system environment variables for the machine to make things work.. but i have found that wrapping everything in a nice batch file works well, and could be used but tools such a deadlie to render as well…
here an example of what the batch file would look like (i did not actually test this code so know you are using it at your own risk)…
@echo off
setlocal
set Path=\\netowrklocation\pluginModules\blur_python26\python26;%Path%
set pythonpath=\\netowrklocation\pluginModules\blur_python26\python26\Lib;\\netowrklocation\pluginModules\blur_python26\python26DLLs;\\netowrklocation\pluginModules\blur_python26\python26\lib-tk;\\netowrklocation\pluginModules\blur_python26\python26\lib\site-packages
set maxPath=C:\Program Files\Autodesk\3DS Max 2012
xcopy \\netowrklocation\pluginModules\blur_python26\blur c:\blur
xcopy \\netowrklocation\pluginModules\blur_python26\scripts %maxPath%scripts
xcopy \\netowrklocation\pluginModules\blur_python26\plugins %maxPath%plugins
copy \\netowrklocation\pluginModules\blur_python26\python26.dll %maxPath%\python26.dll
start "" "%maxPath%3dsmax.exe" %*
if you wanted to optimize the batch file for speed you could switch the copy command to use robocopy.. and that way the files would only get copied if the one on the target machine are older than the ones on the network location..
Note
I have updated to the post to reflect something i left out… in some cases the python directory to the site packages will also have to be included in the pythonpath or blur python will not be able to find the IDLE libraries..