change Environment Variable per plugin

Hi,
I am trying to find a way to render Maxwell 3.1 and 3.2 scenes with Deadline on Windows.

I have Maxwell 3.1 and 3.2 in different directories on a network share. So it is easy enough to duplicate (or edit) the plugin to point to the different .exe files. But Maxwell also has an environment variable MAXWELL_ROOT that point to the folder where Maxwell is installed.

Is there a way to change this variable based on which plugin is used from within Deadline?
Bonus question: is there a way to do this on Mac OS and Linux? I want to add the MacPro’s to the farm and maybe switch the rendernodes to Linux in the future.

Background:
Maxwell 3.2 made some changes to the way blurry reflections are calculated, resulting in a different look. They also made some undocumented changes (again) to the way lights with projectors look. Unfortunately these changes are not optional.
We frequently have to make changes to older renders. So we have to keep Maxwell 3.1 around for a while.

System Specs:
Windows 7
Maxwell 3.x
Deadline 7.2

Cheers, Florian

It’s definitely doable. The non-coding way is to modify the job properties and find the ‘Environment’ section.

That’ll get fiddly quickly, so it would be best to set the variables during submission time.

The way we do that is by adding an extra line to the JobInfo file. That line should be “EnvironmentKeyValue0=MAXWELL_ROOT=”.

Now that I think about it… What does MAXWELL_ROOT accomplish? If it’s absolutely required when there are multiple Maxwells on the same machine, we can just code that into the plugin.

I read about the Job Info File in the manual. But for me it is not clear where I can find the Job Info File or if I create it, where to put it.
Can you clarify this?
Does this also work with a mixed farm (Windows, Linux)? I guess what I want is to set a different path based on the OS.

I am not sure. This is what the manual says:

On Windows and Linux, the plug-in depends on the MAXWELL3_ROOT environment variable being set correctly. If this variable is missing or wrong, the plug-in will be unable to start the renderer or the standalone material editor.

When you open Maxwell Render and take a look at the console, it reports the MAXWELL3_ROOT directory and a bunch of extensions it loads from a sub directory.

If you change the environment variable, it still loads the extensions from the correct directory.

If you delete the environment variable, you get an error “MAXWELL3_ROOT environment variable not found”.

The manual only states that this variable is needed.
I will ask in the Maxwell forum.

I think you could hard code it so that it would always point to the same folder the render executable is in. Or make it configurable like the path to the executable.

Note: the Mac OS Version does not need any path configured.

On OS X, the plug-in locates the Maxwell executable by looking at the association for MXS files. This association is set up by Maxwell and Studio when they start up

It would be in the submission script while it is creating the job info file. Each submission requires a job info and plugin info pair. I have perhaps a much better solution to this.

I was doing a bit more thinking about this today. Deadline makes a point of setting its current working directory to the folder which holds the binary it is about to run. Here is the output from a C4D job for example:

2015-01-19 15:55:13:  0: INFO: Startup Directory: "C:\Program Files\Maxon\CINEMA 4D R16"

Now, if Maxwell can use relative paths, your solution may be to just set “MAXWELL3_ROOT=.”. This would mean that it would use its current working directory (denoted by that period). No matter what version you were running, Maxwell would use the right directory.

The bigger challenge now comes in how do we instruct Deadline to use a different version. As we don’t support minor revisions (it’s a policy since it becomes hard to maintain), you may need to configure the Maxwell plugin to use version “2” for 3.1 and version “3” to use 3.2. This would give you some control for using 3.1 as you could submit them from the Monitor submitter and specify version “2” there. The integrated submitter doesn’t allow you to override the version.

So, the test steps become:

  1. Set MAXWELL3_ROOT to “.” system-wide
  2. Configure the Maxwell plugin to have version 2 point to 3.1 (see ‘tools’ menu then ‘configure plugins’ as super-user)
  3. Test submitting 3.1 jobs from the Monitor submitter
  4. Test submitting 3.2 jobs from within Maxwell.

This may be a much easier solution than the programming approach.

I will try this. I hope this also works when rendering wit Maxwell locally (e.g. Directly from Maya).

I thought I would just copy the Maxwell plugin directory in the repository, rename it and edit the plugin files to point to 3.1. Wouldn’t this work?

Did you mean to set it to
.
.".
or
“.” ? I tried all anyway.

When I set the variable like this, Maxwell does not recognize it.

I will try to do this via the Job Info File next. Just have to figure out which files to edit.

Hi Edwin,
I gave this some more thought and came up with this solution:

  1. copy the Maxwell Plugin to the manual plugin directory twice
  2. rename the plugins (and all the necessary files) to Maxwell31 and Maxwell 32
  3. Add a JobPreLoad.py or PluginPreLoad.py file that sets the environment variable with:
os.environ['MAXWELL3_ROOT'] = '//server/share/Maxwell31'

Any thoughts on it before I break stuff.

Cheers, Florian

That seems fine by me actually. It’s a bit strange, but as long as it’s the ‘custom’ directory it will survive an upgrade. You can duplicate that work after finishing an upgrade.

I’ve created a ticket internally here, it’s #2007 for reference but I’m considering it low priority since I don’t think it’s common to have the two versions installed.