Commandlines

The next part are the commandlines.



Default render commandlines:

Commandlines start with

CommandLine=

You do not have to place all flags into one line, you should use multiple lines for better readability.


Commandlines are executed one after another.

Exception:

If you have defined a render config file for an archive render (sceneIsMultiFrame=1; .rib, .mi, ...), then some commandline are looped/executed for each frame.

The commandline are then seperated into three parts:

1. executed once before rendering

2. loop

3. executed once after rendering

The loop will start with the first commandline that has some kind of frame number (<FN>, <Scene>) in it.

And the loop ends with the last commandline that has some kind of frame number (<FN>, <Scene>) in it.

So you can set the environment and a cleanup function once, but the rendering is started for every frame.





OS Declaration/ Keep Scene Open:

Via header:

Each commandline part has to start with an setting for which OS this commandline is ment.

This settings line has to start with an # and contains one or multiple of the following variables:

    • [Windows]
    • [Linux]
    • [OSX] 
    • [KSO]


Example:        ############# [Windows] [Linux] [KSO] #############



Per Line:

Addtional to this declaration via a header, lines can start with

    • ::win
    • ::lx
    • ::osx 


If the OS does not match, the whole line is ignored (like a comment).

If the OS matches, the flag is removed and the rest of the line is taken.

Example 1.        

::win CommandLine= myScript.bat

::lx CommandLine= myScript.sh

::osx CommandLine=

-myFlag1

-moreflags

Example 2.        

CommandLine=

-myFlag1

::win -windowsFlag

::lx -linuxFlag

-moreflags




Variables as value or condition


All commandlines usally use some kind of variables.


They are inside the < > characters.


There are two kind of usage possibilities for these variables:


As value replacement:

The variable is replaced by the value.

E.g. <SeqStart> is replaced with the start frame, <Scene> with the scene name.

As conditional element

You can create a condition to check if a value is used at all.


The condition "if Sequence divide is enabled, execute -overwrite".

This would be <SequenceDivide -overwrite>


The condition "if Sequence divide is enabled, execute -overwrite, otherwise execute -skip".

This would be <SequenceDivide -overwrite ? -skip>


You have to set inside the <>:

- The value name

- followed by the commandline you want to execute if the value is non-zero/set/true/non-empty

Optional: - followed by a question mark ?

Optional: - followed by the commandline you want to execute otherwise




These types can be combined.

For example if you do not have layers in your scene, you must not set the layer name in the commandline.

So you want to set:

If layer-not-empty, then execute -Layer "LayerName", otherwise do nothing.

This would be <Layer -Layer "<Layer>" >.

As you can see, the first <Layer... was used as a condition, the second "<Layer>" as value replacement.


Variables - Scene information


These variables will be replaced with the same values as you have set for the job at submission:


<SeqStart>

<SeqEnd>

<SeqStep>

<SeqFileOffset>


Each client gets a part/chunk of the total sequence length for rendering.

These values are the frame range a client should render.

<SeqFrameSet>

Frames the client should render in the frameset format.

If SeqStep is 1, then the format is  SeqStart-SeqEnd.

In all other cases it is a list of all frames SeqStart,NextFrameNr,NextFrameNr,....,SeqEnd


<SeqFrameList>

<SeqFrameList+-1>

List with all frames to render in the format:

 SeqStart,NextFrameNr,NextFrameNr,....,SeqEnd 

+-1 adds one frame before and after the sequence IF these frames are part of the total job sequence.

<SeqStart-1>

<SeqEnd-1>

Start and end frame offsetted by -1

<SeqStartPadded>
<SeqStartLead2>
<SeqStartLead3>

<SeqStartLead4>

<SeqStartLead5>
<SeqStartLead6>

Start frame with leading zeros.
<SeqStartPadded> uses the frame padding of the job.

Otherwise the frame padding for the start frame will be either 2,3,4,5 or 6.

<SeqStartNStep>

<SeqStartNStep+1>

The number of the last frame before the next frame rendered. It will be calculated (Start+Step-1).

The second +1 is equal to (Start+Step)

<SeqStartIdx>

<SeqStartIdx-1>

<SeqEndIdx>

<SeqEndIdx-1>

<SeqEndIdx+1>


Same as above, but instead of the real frame number, it returns the index of the frame.
The first frame of the job has index 0.

<TotalSeqStart>

<TotalSeqEnd>

<TotalSeqStep>

<TotalSeqStartPadded>

<TotalSeqEndPadded>


Total sequence range of the scene/job. It is not the frame range a client should render.

"Padded" uses the frame padding of the job to add leading zeros to the number.

<TotalFrames> 

Total number of frames of the job. It is not the frame range a client should render.

<hasFirstJobFrame>

<hasLastJobFrame>

Used for conditional expressions. This statement returns true if the frame chunk the client got contains the first/last frame of the job.

<ImageFramePadding>

The frame padding of the job

<FramePadding #>

<FramePadding @>

Returns a number of #.

e.g. with a framepadding of 3 it genertates ###

# can be replaced with any other letter, e.g. @

<ImageHeight>
<ImageWidth>

Height and width of the rendered image if known.

<ImageDir>

<ImageDirComplete>

<ImageDir> is the directory for rendering.

For most renderer <ImageDirComplete> and <ImageDir> is the same.

For Maya renderings, the <ImageDir> does not include the Layer nor the channel name. <ImageDirComplete> does include the full path to your rendered images.

<ImageLastFolderName>

The last folder of the render output.
Example: If the render output is \\fileserver\share\projectX\render\SceneY\beauty.###.exr
then <ImageLastFolderName> is "SceneY".

<ImageFilename>

<ImageFilenameAssembled>

The output filename.

Assembled does not contain the tile name in case you have enabled tile rendering.

<ImageFilenameAssembled>

In case you are rendering images in tiles, this is the name of the assembled image.

<ImageFilenameOnly>

For Maya, the <ImageFilename> has to contain the layer folder. <ImageFilenameOnly> contains no folder.

<ImageFilenameVariables>

If you use file name variables like <RenderLayer> or <RenderChannel> in your Maya scene render settings, then RR has to set these variables at render time. It is not possible to tell Maya the resolved Layer or Channel names.

<ImageExtension>


<ImageStereoL>

<ImageStereoM>

<ImageStereoR>

If the filename contains the <Stereo> flag, then <Stereo> will be replaced by the value inside these variables.

<PNL>

(ImagePreNumberLetter)

Some applications always add a . or _ in front of the frame number. Set this variable to that character.

RR needs this letter at the end of the image file name to find the images. But for some render applications you have to remove this letter again, otherwise you end up with two of them, Typical use is therefore <ImageFilename><EL<PNL>>

<OverrideImageFormat>


<Camera>


<Layer>

<LayerAsFileName>

The layer variable of the job. It is used to select output nodes or render layers in the render application.


AsFileName removes all slashes and other invalid characters. So it can be used for file names.

<Channel>

Similar use as <Layer>, depending on the render application.

<SceneState>

Similar use as <Layer>, depending on the render application.

<Database>

<DatabaseName>

The path you set for the database.

Only the last folder of the path.

<Scene> 

Scene with total path 

<SceneFileName>

Scene filename only without extension 

<SceneFileExt> 

Scene files extension only 

<SceneFolder> 

Folder of scene only 

<SceneFN>

<SceneFileNameFN>

Same as <Scene> and <SceneFileName>, but it is used in the loop calculation for used for multi-file archive renderings (.rib, .mi), see introduction of this chapter (the "Exception:")

<SceneFNasWildcard>

The <FN...> part is  replaced by quotations marks ? as frame number placeholder. 


<ShotgunID>

The ShotgunID set for the job

<sceneOS>

<sceneOSstr>

The OS that was used to create the scene.
sceneOSstr returns a string, sceneOS an id number.



Variables - Job

<FN>

<FN1>

<FN2>

<FN3>

<FN4>

..

<FN7>

<FNimgPadded>



Frame Number, used for multi-file archive renderings (.ass, .ifd, .rib, .mi)

If you add a number, it uses this fixed frame padding.

<FNimgPadded> Uses the frame padding set for the image name (seen at the submitter as ### blow the output edit box)

<FN-2>

<FN-1>

<FN+1>

<FN+2>

...

<FN7+2>

All <FN> variables support a modification of the frame number -2, -1, +1, +2.

<containsFirstJobFrame TrueString ? FalseString>

<containsSecondJobFrame TrueString ? FalseString>

<containsSecondLastJobFrame TrueString ? FalseS>

<containsLastJobFrame TrueString ? FalseString>

These are used for conditions.

<hasFirstJobFrame> is true if the current segment that the client renders contains the first frame of the whole job.

<hasSecondJobFrame> is true if the current segment that the client renders contains the second frame of the whole job.

<SequenceDivide>

Mostly used as a condition to switch commandline parameter if SequenceDivide is enabled/disabled.

<CustomOptionName>

You can define custom options in your render config file. These options are then shown at the Submitter like all other RR settings. And you can use them via their "CustomOptionName" as a variable. Just like all other RR settings.

<ImageSingleOutputFile>

Mostly used as a condition to switch commandline parameter if you render a single output file (.avi .mov)

<UserInfos>

The custom user info that was set at submission or in rrControl/change settings.

<CustomA>

<CustomMy>

<CustomUser>

Your own custom variables that you have set for the job.

The variable name has to start always with "Custom"

<UserName>

The name of the user that submitted the job.

<SubmitMachine>

Name of the machine that submitted the job

<X1><X2><Y1><Y2>

If you use the RR "tile frame" feature: Coordinates in pixel of the region to render, used if you split a frame with RR for multiple clients.

<X1f><X2f><Y1f><Y2f>

If you use the RR "tile frame" feature: Same as above, but coordinates are a float value in the range 0-1, where 1 is the full size.

<TotalTiles>

If you use the RR "tile frame" feature: Total number of tiles

<TileNumber>

<TileNumber+1>

If you use the RR "tile frame" feature: Number of the current tile the client should render.

<CustomScene>

<CustomShot>

<CustomVersion>

Scene/shot/version of the scene.

<CompanyProjectName>

The company project name set/recognized for the job

<CompanyProjectRootFolder>

If you use the scene/output folder to detect the company name, then this variable returns the folder until your project name.

<ID>

<ID_S>

unique Job ID as a number

and as a human readable string

<verboseLevel>

Inserts the verbose flags you have set in the render config.

<renderQuality>

Inserts the quality flags you have set in the render config.

<PreviewGamma>

Enabled if Preview Gamma 2.2 is enabled for the job.

<JobPriority>

Priority of the job.

<AvFrameTimeSec>

<AvFrameTime>

The average frame time of the job. Can be used in post/done-scripts.

<AvFrameTimeSec> is the time in seconds

<AvFrameTime> is in  format hour:min.sec

<AvFrameTimeMin5>

<AvFrameTimeMin7>

<AvFrameTimeMin10>

<AvFrameTimeMin15>

This flag should can used as conditional element.
Returns 1 if the average frame time of the job is higher than 5 (or 7 or 10 or 15) minutes.
If RR does not yet have an average frame time, it returns 1 as well.

Useful for example to enable/disable detailed progress percentages for frames.

<MaxMemUsage>

The maximum memory usage the job used during render on clients

<previewFilenameThumbnail0>

<previewFilenameThumbnail1>

<previewFilenameThumbnail2>

<previewFilenameThumbnail3>

<previewFilenameThumbnail4>

<previewFilenameThumbnail5>

<previewFilenameThumbnail6>

<previewFilenameThumbnail7>

<previewFilenameThumbnail8>

<previewFilenameThumbnail9>
<previewFilenameThumbnail99>

<previewFilenameThumbnail-1>
<previewFilenameThumbnail-2>

<previewFilenameThumbnail-3>

Name of the preview image thumbnail.


0 is the first file, 1 the second file, ...


99 is the last one.


-1 is the 1/4 th preview file

-2 is the 2/4 th preview file

-3 is the 3/4 th preview file

<hasWaitForPreviewApproval>
<hasWaitForPreviewApproval>

Returns 1 if the job will wait for approval. 
Useful for conditional statements (see above)

<IsLocalRender>

Returns 1 if the option Local Render Out is set

<IsLocalScene>

Returns 1 if the option Local Scene Copy is set

<PreviewGamma>

Returns 1 if the option preview gamma 2.2 is set

<AuthStr>

If you want to send python commands to RR, then it might be required to authorize your command.
The <AuthStr> can be used for this.
See RR\render_apps\_prepost_scripts\Finished99__DeleteJob.* for an example.


<PrePostParamA>

<PrePostParamB>

If you have setup the pre/post-script config to take a value, then this returns the value.

<rrOptionName>
<rrParamName>

All job options and parameter can be accessed by their name.

The name is the same as in the Submitter defaults files.
E.g. 

<RenderPreviewFirst>
<GPUrequired>
<MaxCrashes>

<rrJobVersion>

<rrJobVersionMajor>
<rrJobVersionMinor>
<rrJobVersionMinorFull>
<rrJobVersionMinorTwoDigits>

Version of the render application as main (major) and minor version.


rrJobVersionMinorFull can contain additional points to separate the build version (e.g. 2.8.34).
rrJobVersionMinorTwoDigits contains at least 2 digits for the minor version (e.g.  2.80 ).

<rrJobRendererVersion>

Version of the renderer used by the render app.

<IsScriptStatus>

Returns either "true" or "false" depending on if it is a pre/preview/post/finished script execution or a default frame render.

<JobStatus>

Returns the current status of the job as text.



Variables - RR


<AdditionalCommandlineParam> 

You can set additional commandline flags for a job at the submitter

<Exe>

´The Executable you have set at the client for this render application.

Note: You can hardcode the exe, but then you loose the auto version change.

<ExeVersion>

<ExeVersionMayor>

<ExeVersionMinor>

<ExeVersionMinReq>
<ExeVersionMinReqUS>

The version of the Executable used.

Note: This does not have to be the same version as the render config nor the same as in the job.


ExeVersionMinReq: If the minor version is .0, then ExeVersionMinReq does not add the minor version. <ExeVersionMinReqUS>, but it uses an underscore instead of a point.

<ClientConfigParam>

You can set additional commandline flags in the client config for each render app



<SetEnvSoft>

<SetEnv_JobRenderApp> 

Executes the setenv file for the render application.

The setenv file used is named [RenderApp]_[Renderer], or if that file does not exists, [RenderApp].

The file names are always lowercase.

Examples:

RR\render_apps\_setenv\win\renderman_proserver.bat

RR\render_apps\_setenv\win\softimage.bat


SetEnv_JobRenderApp is used in pre-/post-scripts to get the setenv of the render application of the jobs render application, not the setenv of the script.

<ResetExitCode>

Should be called before you start the main render process

<CheckExitCode> <FN>

Must be called after the main render process. If it is not executed, the client does not know if the render was closed or successful.

<CPU <LimitCPUs> <CPU>> 

Windows only: Some render application have no option to set the number of Cpus used. Execute this at the beginning, it will limit the CPUs for the whole batch file.

<Memory>

<Memory-100>

<Memory-200>

<Memory-300>

<Memory-400>

<Memory-500>

<Memory-600>

<Memory-700>

<Memory-800>

<Memory-900>

<Memory-1000>

Some predefined variables which gives you access to a memory value relative to the client memory.

Note: This parameter does not support expressions. You cannot use any value, please choose one of the shown values.

E.g. Your machine has 10GB memory.

<Memory-700> : 9.3GB


Note:

If you start multiple render instances, then the memory value is split for each job.

<rrSharedExeDir>

<rrLocalExeDir>

See Shared Executables

<rrBaseAppPath>

The base path of the render application used. 

<rrLocalRoot>

...\RR_localdata

<rrLocalTemp>

...\RR_localdata\temp

<rrLocalRenderout>

...\RR_localdata\renderout

<rrLocalRenderoutOrg>

The rrClient renders to ...\RR_localdata\renderout, but keeps the last few folders of the original output path.
<rrLocalRenderoutOrg> is the path on the fileserver that matches the source folder for <rrLocalRenderout>.

<rrLocalRenderScripts>

...\RR_localdata\renderscripts

<rrWebsite>

resolved path for [RR]\rrJobData

<JobFilesFolder>

Folder which stores all rrJob files (render log files, rrViewer caches, preview jpegs)

<rrRoot>

path to the Royal Render network share

<rrBin64>

resolved path for [RR]\bin\win, [RR]\bin\lx64 or [RR]\bin\mac

<App>

<AppLow>

Name of the render application

"low" is the name in lower case.

<AppVer>

<AppVerMinor>

<AppVerMinorFull>

Version of the render application as main (major) and minor version.

AppVerMinorFull can contain additional points to separate the build version.

<AppRenderer>

<AppRendererLow>

Name renderer.

"low" is the name in lower case.

<AppRendererVersion>

Version of the renderer as string

<LocalHost>

The machine name of the client.

<rrOS>

Contains the value  "win", "lx" or "osx"

<jobBit>

x32 or x64

<Cores>

<CPU>

<InstanceCores>

number of cores that should be used


InstanceCores is the number of cores of the machine divided by the number if instances started.

<LogFileName> 

Name of the render log file used for this task.

<IsMultiInstance> 

Used as switch for multi-instance jobs.

E.g. <IsMultiInstance -multiparam ? -defaultparam > 

<FolderVideoPreview>

<FolderVideoFull>

Folders presets for the video creator post-script.

Set them in rrConfig.

<rrClientThreadID>

The number of the job thread which executes this job.

<rrClientThreadIDstr>

The letter of the thread. ranges from A to H

<rrClientThread_A>

<rrClientThread_B>

<rrClientThread_C>

<rrClientThread_D>

<rrClientThread_E>

<rrClientThread_F>

<rrClientThread_G>

<rrClientThread_H>

These values return 1 if the job thread matches. And 0 if the job thread does not match.

Useful for conditional flags e.g.  <rrClientThread_A    -useflagX >

<cfgLicPool_Default>

<cfgLicPool_Workstation>

<cfgLicPool_Renderfarm>

<cfgLicPool_Cloud>


These values return 1 if the flag matches the config setting of the client. And 0 if the job thread does not match.

Useful for conditional flags e.g.  <cfgLicPool_Workstation    -UseUILicense >

<cfgPreset_Default>

<cfgPreset_Workstation>

<cfgPreset_Renderfarm>

<cfgPreset_Cloud>

<cfgPreset_WorkRenderMix>

These values return 1 if the flag matches the config setting of the client. And 0 if the job thread does not match.

Useful for conditional flags e.g.  <cfgPreset_Cloud    -ConvertPaths >

<Gpu0>

<Gpu1>

<Gpu2>

<Gpu3>

<Gpu4>

<Gpu5>

<Gpu6>

<Gpu7>

Returns 1 if the GPU with the specified ID is assigned to this job thread.

<GpuList>

<GpuListC>

A list with all GPU IDs assigned for this render thread.
Either separated by a point or a comma.

<GpuBits>

A list of all assigned GPUs as bit list. E.g. 0001001




Variables - Special


       





<date>

<date ddd, dd.MMM>

The current Date. If you use <date XXXXXXX>, then you can specify your own format for the date. Possible variables are:


Expression     Output

d                   the day as number without a leading zero (1 to 31)

dd                   the day as number with a leading zero (01 to 31)

ddd                   the abbreviated localized day name (e.g. 'Mon' to 'Sun').

dddd                   the long localized day name (e.g. 'Monday' to 'Sunday').

M                   the month as number without a leading zero (1-12)

MM                   the month as number with a leading zero (01-12)

MMM                   the abbreviated localized month name (e.g. 'Jan' to 'Dec').

MMMM                   the long localized month name (e.g. 'January' to 'December').

yy                   the year as two digit number (00-99)

yyyy                   the year as four digit number

hh                   the hour

mm                   the minute

<NoUNC XXXXXXX>

  Windows only: replaces all UNC paths in string XXXXXXXX with drive mappings. The drive mappings have to be set in rrConfig.

<PD\\ XXXXXX>

<PD/ XXXXXX> 

Converts all slashes/backslashes in string XXXXXX with the one set after PD






<ESC XXXXXXX>

Escapes special characters inside the string XXXXXX.

Only required if you need to use quoted strings inside quoted strings.

Your script command inside your application is: 

SetRenderOutput "name_<Layer>_<Frame>"; 

The commandline to execute commands via commandline is:

myapp.exe -cmd "yourcommand"

So o execute your command via commandline you have to enter:

All " and < need to be escaped in a commandline.

myapp.exe -cmd "SetRenderOutput \"name_\<Layer\>_\<Frame\>\";"

With <Esc XXXX> the escaping is done for you.

myapp.exe -cmd "<Esc SetRenderOutput "name_<Layer>_<Frame>";>"

<ESC_XML XXXXXXX>

Escapes special characters inside the string XXXXXX with a syntax similar to XML and html.


(Side-Note: We have not been able to use the standard replacement starting with & as this is a special letter in commandlines.)


Replacements:

&

;amp;

<

;lt;

>

;gt;

"

;quot;

'

;apos;


<ED>

Used at the end of a path variable. It removes everything backwards to the last slash.

C:\Softimage\Softimage_2010\Application\bin\setenv.bat<ED> => C:\Softimage\Softimage_2010\Application\bin\

C:\Softimage\Softimage_2010\Application\bin\setenv.bat<ED><ED> => C:\Softimage\Softimage_2010\Application\

<EL><ELX>

Deletes the last letter before this variable. If something is specified after the EL inside the variable, then the last letter is only deleted if it matches.

RenderFrame_<EL> => RenderFrame

RenderFrame_<EL.> => RenderFrame_ (no change)

RenderFrame_<EL_> => RenderFrame 

<../>

Steps one directory back.

C:\Softimage\Softimage_2010\Application\bin\setenv.bat<../> => C:\Softimage\Softimage_2010\Application\

C:\Softimage\Softimage_2010\Application\bin\setenv.bat<../><../> => C:\Softimage\Softimage_2010\

<PD>

<\\>

</>

The first PD is replaced with the right slash type for a directory on the system. \ on windows, otherwise /.

The other two are replaced with the slash type they show.

<EndsWith(strg, endStrg) TrueStrg ? FalseStrg>

If the string strg ends with endStrg, then TrueStrg in places in the commandline, otherwise FalseStrg.
"? FalseStrg" is optional.

<Contains(strg, searchStr) TrueStrg ? FalseStrg>

If the string strg contains searchStr, then TrueStrg in places in the commandline, otherwise FalseStrg.
"? FalseStrg" is optional.

<renderApp:3dsmax-vray  TrueStrg ? FalseStrg>

<renderApp:3dsmax TrueStrg ? FalseStrg>

<renderApp:Maya TrueStrg ? FalseStrg>

Can be used as switch in post-scripts between the commandline part "TrueStrg" and "FalseStrg".

In case the render app of the job was the app you ask for, "TrueStrg" is kept.
"? FalseStrg" is optional.

<renderAppPath:Nuke>

<renderAppPath:Maya>

Searches the render app settings of the client config for the App you specified.
Note: This feature does not support auto-version change.

It will just take whichever version you have set in rrConfig for that client.

<Replace Strg, OldStrg, NewStrg>

Searches for "OldStrg" inside "Strg" and replaces it with "NewStrg".
Note: OldStrg and NewStrg must NOT contain a comma. Strg can contain any letter.

<dec>

Decimal mark of the local system. Half of the world uses a period (.) is used, the other half a comma (,). Some applications (like 3dsmax) require the exact mark, otherwise they refuse to work. (most other just use a period no matter the country)

<removeRemStrg Strg>

Removes the string RemStrg from Strg.

Note: There is no Space between <remove and RemStrg, but at least one space after RemStrg

<newLine>

<nL>

Adds a line break to the batch. In case you want to write two commandline in one config commandline line.

<callScript filename_base>

Example: if "filename_base" is //fileserver/share/myscript, then the results is:

Windows:

call //fileserver/share/myscript.bat

Linux: 

source //fileserver/share/myscript.sh

Mac: 

sourcel //fileserver/share/myscript.sh

<OsxApp Executable>

If the client is running on OSX, then the executable filename is extended to the osx executable name.

Example:

<OsxApp rrPythonconsole>


Result Windows/Linux: rrPythonconsole

Result OSX: rrPythonconsole.app/Contents/MacOS/rrPythonconsole

<lt>
<gt>

These variables will be replaced with the "less than" < and "greater than" > signs.
(It is not possible to use < or > directly as these signs are reserved for variable names)



Variables - OS environmnent variables


There are two options to use OS environment variables.


1) OS env variables that have been set when the client was started.

Use <VarName> instead of using %VarName% or ${VarName}.

It is useful if you want to use one commandline for multiple OS.
The rrClient replaces <VarName> with the value of the variable


2) OS variables that are available at render time only.

If you have set some env var in some other rrEnv file, then you have to use <OSEnv VarName>.

This replaces <OSEnv VarName> with %VarName% or ${VarName}.