Royal Render supports the package manager Rez ( https://github.com/AcademySoftwareFoundation/rez/wiki ).


Royal Render contains the rez scripts in RR\plugins\python_modules. 
So there is no need for you to download and install Rez.

The version of Rez is printed in every render log file after the render was executed.
Or you can read the file RR\plugins\python_modules\rez\utils\_version.py.


Note that Rez in RR is not compiled because compiled rez executables must not be moved after compilation.
Which means if your RR network folder is on a different path/fileserver than ours (which it is), it would not work.

We have slightly modified Rez to fix some issues. (option RR_REZ_NO_UNC in the setup section)

Please see RR\plugins\python_modules\rez\___RR_Readme.txt for more information.


Setup



To activate Rez for a render application, you have to specify two Rez config lines for a render application.

You can add settings for a render application with __inhouse.inc config files.


Note that the following examples state settings for each OS (Windows, Linux, Mac).
You may set them for all OS, you may set them for one or two OS only.


1) The path+filename to your rez package python script:

REZ_CONFIG_FILE_WIN=  path\filename.py

REZ_CONFIG_FILE_LX=    path/filename.py
REZ_CONFIG_FILE_MAC=  path/filename.py



2) The name of the executable of your render application:

REZ_EXE_WIN=  filename
REZ_EXE_LX=  filename
REZ_EXE_MAC=  filename



3) Optional: auto Rez or no Rez?

There are two modes if the job you submitted does not contain any REZ packs.
(Please see next section about the rrSubmitter reading the REZ env)

a) Do not use REZ at all

(default, no setting required)

b) Auto-generate a pack name

The generated pack name is <RenderApp>-<version>
For example "Maya-2022.1"

Enable this setting with the line

REZ_AUTO_PACK_NAME = 1



4) Optional: Override rez command.
By default RR uses the rez package shipped with Royal Render and python3.
It is possible to override the command.
Examples:

This is the default value if you do not override it

REZ_COMMAND_WIN= <rrLocalBin><OsxApp rrPythonconsole> <rrLocalRenderScripts>rez-env.py

REZ_COMMAND_LX= <rrLocalBin><OsxApp rrPythonconsole> <rrLocalRenderScripts>rez-env.py

REZ_COMMAND_MAC= <rrLocalBin><OsxApp rrPythonconsole> <rrLocalRenderScripts>rez-env.py

Override the command to use python2

REZ_COMMAND_WIN= <rrLocalBin><OsxApp rrPythonconsole2> <rrLocalRenderScripts>rez-env.py

REZ_COMMAND_LX= <rrLocalBin><OsxApp rrPythonconsole2> <rrLocalRenderScripts>rez-env.py

REZ_COMMAND_MAC= <rrLocalBin><OsxApp rrPythonconsole2> <rrLocalRenderScripts>rez-env.py

Override the command to use your own REZ 

REZ_COMMAND_WIN= C:\rez\rez-env.exe

REZ_COMMAND_LX=  /opt/rez/rez-env

REZ_COMMAND_MAC=  /opt/rez/rez-env



5) Optional: Remove packages

Some packages are OS dependend and might be required to be removed if you render cross-OS.
By default the rrSubmitter adds all packages set in REZ_USED_RESOLVE.
And then removes the packages set in REZ_USED_IMPLICIT_PACKAGES.
You can override the packages that should be removed.

This is the default value if you do not override it

REZ_REMOVE_PACKS= <REZ_USED_IMPLICIT_PACKAGES>

Add some more packages

REZ_REMOVE_PACKS= <REZ_USED_IMPLICIT_PACKAGES>  MayaUITools RRSubmissionPlugin 

Define your own packages

REZ_REMOVE_PACKS= MayaUITools RRSubmissionPlugin platform-windows arch-AMD64



6) Optional, Windows only:   No UNC path

Python 39 changed the behavoir of a function that should return the "original path" of a REZ package.

This function was added to REZ in case the same package location has been added twice with different paths.

E.g. on Linux a local file link and the original ones on the fileserver. Or on Windows a drive letter and the original UNC share.


But a customer had a case in which a plugin was working with a drive letter only. And broke if you use an UNC path.

Therefore we have implemented a fix.

If you do not want to convert the drive letters of package paths into UNC paths, 

then please edit the file [RR]\render_apps\_setenv\all\_global__inhouse.rrEnv.

(This is not the render config that you have edited before. It is an environment variable, not an RR setting)

Then please add the line 

RR_REZ_NO_UNC= 1



Examples


Examples enabling Rez for Nuke for Windows and Linux, but not MacOS:

Nuke:
Edit/Create the file [RR_ROOT]\render_apps\_config__inhouse\C13__Nuke____global__inhouse.inc

Add the lines 

REZ_CONFIG_FILE_WIN =   \\fileserver\share\configs\rez-packages\rezconfig.py

REZ_CONFIG_FILE_LX =   /mnt/fileserver/share/configs/rez-packages/rezconfig.py

REZ_EXE_WIN=   Nuke<rrExeVersionNuke>.exe

REZ_EXE_LX=    Nuke<rrExeVersionNuke>


Note:

<rrExeVersionNuke> is a special variable name as Nuke names its exe with the version "10.3v5".

Most applications do not add a version name to the .exe file (Mayabatch.exe) 
or do not use a "v" in between the minor version and release version (MyApp<rrExeVersion>.exe). 


Maya:

Edit/Create the file [RR_ROOT]\render_apps\_config__inhouse\3D02__Maya____global_kso__inhouse.inc

Add the lines 

REZ_CONFIG_FILE_WIN =   \\fileserver\share\configs\rez-packages\rezconfig.py

REZ_CONFIG_FILE_LX =   /mnt/fileserver/share/configs/rez-packages/rezconfig.py

REZ_EXE_WIN=   mayabatch.exe

REZ_EXE_LX=   maya


How it works

rrSubmitter


The rrSubmitter reads the env var REZ_USED_RESOLVE and adds it to the job as variable name <CustomRezPacks>.
It removes all packages set in REZ_USED_IMPLICIT_PACKAGES.

Of course you can set CustomRezPacks in as a commandline flag or within the submission xml as well.
In this case the rrSubmitter does NOT read the current environment.


rrClient


The client adds the environment variable REZ_CONFIG_FILE to the render script.



Then the rrClient uses the commandline
rez-env <CustomRezPacks>  -- <REZ_EXE> .....


If <CustomRezPacks> was not set for the rrJob, then the rrClient uses the commandline
rez-env <rrJobRenderapp>-<rrExeVersionFull>  -- <REZ_EXE> .....


<rrJobRenderapp> is the name of the render application. (Maya, Nuke)

<rrExeVersionFull> is the render application version as set in the job (e.g. 18.0.597   or   2023.1)



Information

Although you can call rez commands on a machine to know which package was used,

the rrClient creates timestamp files with the last usage as well.

So you can easily check which package was used the last time.

The timestamp files are located on the local drive in ../RR_LocalData/rez/ .