Basic Information / Script Generators

About generators

Script generators are responsible for creating job scripts with the help of script templates. They are part of libdrqueue and are used in Drqman, Python bindings and Ruby bindings.

Generator development

The source files are located in the "libdrqueue" subdirectory in the DrQueue sources. They consist of a C module and a header file. The filenames follow the pattern "RENDERERsg.[c|h]".

Generator API

There is a simple API for creating job scripts. It's defined libdrqueue/jobscript.h in the DrQueue sources.

You basically do the following things:
  1. Create a new jobscript with a specific filename and type (JOBSCRIPT_TCSH, JOBSCRIPT_PYTHON) with "jobscript_new"
  2. write a header at the top of the script with "jobscript_write_heading"
  3. Set variables with "jobscript_set_variable" (Strings) and "jobscript_set_variable_int" (Integers)
  4. Append a specific script template with "jobscript_template_write"
  5. Close the jobscript with "jobscript_close"

Here is an example:

struct jobscript_info *ji = jobscript_new (JOBSCRIPT_PYTHON,filename);
jobscript_write_heading (ji);
jobscript_set_variable (ji,"RENDERDIR",info->renderdir);
jobscript_set_variable (ji,"PROJECTDIR",info->projectdir);
jobscript_set_variable (ji,"SCENE",info->scene);
jobscript_set_variable_int (ji,"RESX",info->resx);
jobscript_set_variable_int (ji,"RESY",info->resy);
jobscript_template_write (ji,"");
jobscript_close (ji);


Under directory drqueue_root/etc you'll find many files named "*.sg" those are the script generator templates.

When you use drqman or libdrqueue to generate a script for a particular rendering engine, drqueue will use those template files to crete the final [JobScripts job script].

So all your customizations should go there. Then they'll apply to every other script generated using that template.