Python Scripts

The Python Scripts tool allows you to customize the rendering process or execute personalized commands during background rendering. This feature provides advanced users with the flexibility to extend Blender's capabilities and tailor the render pipeline to specific project needs.

User Responsibility & Safety

We do not provide support for custom scripts. The creation and execution of scripts are the sole responsibility of the user. We are not liable for any scripts that may corrupt data, delete files, or cause system instability.

To use this feature safely and effectively, it is highly recommended to study the Blender Python API and the Python language before deploying scripts in a production environment.

Python Scripts Interface

Overview

When you submit a job to the render queue, Batch Render Creator (BRC) starts a background instance of Blender. BRC manages the job's resolution, scale, camera, view layer, optional render samples, frame range, and output path. Custom scripts let you apply additional changes, such as material properties or world settings, before rendering starts.

Technical Documentation

To read this reference inside BRC, open Python Scripts and click View Documentation. It explains BRC's internal setup, Cycles and EEVEE render samples, and the order in which job settings and custom scripts are applied. Use Back to Scripts to return to your scripts.

Command Line Arguments

When starting a background rendering process, BRC explicitly supplies several arguments to the blender executable. Understanding these is crucial for script compatibility:

Internal BRC Python Setup Script

BRC applies the following settings through its internal setup script. You do not need to copy this setup into your custom script. Values in angle brackets are placeholders replaced by BRC before execution.

The internal script handles:

import bpy

def rendering_script():
    scene = bpy.context.scene

    # Set resolution and scale (percentage)
    scene.render.resolution_x = int("<Project_ResX>")
    scene.render.resolution_y = int("<Project_ResY>")
    scene.render.resolution_percentage = int("<Project_Scale>")
    
    # Enable file overwrite for render queue functionality
    scene.render.use_overwrite = True

    if "<Project_RenderSamplesEnabled>" == "True":
        samples = int("<Project_RenderSamples>")
        engine = scene.render.engine
        settings = None
        property_name = None
        if engine == "CYCLES":
            settings = getattr(scene, "cycles", None)
            property_name = "samples"
        elif engine in ("BLENDER_EEVEE", "BLENDER_EEVEE_NEXT"):
            settings = getattr(scene, "eevee", None)
            property_name = "taa_render_samples"

        if settings is not None and property_name is not None and hasattr(settings, property_name):
            try:
                setattr(settings, property_name, samples)
                applied_samples = getattr(settings, property_name)
                if applied_samples != samples:
                    print(f"BRC WARNING: {engine} accepted {applied_samples} render samples instead of {samples}")
                else:
                    print(f"BRC: Set {engine} render samples to {samples}")
            except Exception as error:
                print(f"BRC WARNING: Could not set {engine} render samples: {error}")
        else:
            print(f"BRC WARNING: Render samples override is unavailable for {engine}")

    # Disable other layers if <Project_RenderSingleLayer> is true
    if "<Project_RenderSingleLayer>" == "True":
        target_layer_name = "<Project_LayerName>"
        try:
            for layer in scene.view_layers:
                layer.use = (layer.name == target_layer_name)
        except Exception as e:
            print(f"Failed to set view layer: {e}")
    
    # Set camera based on substituted value
    try:
        scene.camera = scene.objects["<Project_Camera>"]
    except:
        pass

# Run the script when starting the render
if __name__ == "__main__":
    rendering_script()
Critical: Overriding BRC Parameters

Overwriting the essential parameters set by BRC's internal script can cause the application to malfunction. These settings are fundamental for the operation of the Render Queue.

In particular, if a custom script interferes with how Blender reports rendered frames via the CLI, BRC will lose its ability to track progress. This communication is the only way the application identifies which frame is being processed and updates the queue status accordingly.

Render Samples: Cycles and EEVEE

In the job editor, use Render samples below Resolution and scale to set 1–9999 samples with BRC Plus or an active trial. The override applies only to the scene and engine it was configured for.

Engine Property applied by BRC
Cycles (CYCLES) scene.cycles.samples (maximum render samples)
EEVEE (BLENDER_EEVEE or BLENDER_EEVEE_NEXT) scene.eevee.taa_render_samples, when available

Without an active override, or with another engine, BRC keeps the samples saved in the .blend file. If Blender cannot apply the override or adjusts its value, the setup script reports a warning.

This changes render samples only. Viewport samples, adaptive sampling, noise thresholds, and denoising keep their saved settings unless your custom script changes them.

Custom User Scripts

Blender processes the render command in this order:

  1. Load the .blend file and select the scene and render engine.
  2. Run BRC's internal setup, including any active render samples override.
  3. Run one custom script: an available job script takes priority over the global selection.
  4. Apply the job's frame range, frame step, and output path from the command line.
  5. Start rendering with -a.

Your script receives the configured scene through bpy.context.scene and can override its samples or other settings. Scripts run once per Blender process, including each restart for a retry; they do not automatically run before every frame. Let BRC start the render and keep Blender's progress output available so the queue can track completed frames.

Creating a Script

  1. Open the Python Scripts window from the main menu.
  2. Click Create New Script.
  3. Give your script a descriptive name.
  4. Write your code in the integrated editor.
  5. Click Save Script.

Using a Script in Rendering

Once saved, you can select your script from the dropdown menu in the Python Scripts window. When a script is active, its icon will be highlighted, and it will be automatically injected into every background render process started by BRC until you set the selection back to "None".

Individual Job Scripts

In addition to global scripts, you can assign a specific Python script to an individual job. This is useful when only certain scenes or projects require custom logic.

Individual Job Script Selection

To set an individual script:

  1. Open the Edit Menu for the specific job in your queue.
  2. In the title bar of the edit window, locate the script selection dropdown.
  3. Choose the script you wish to apply to this job.
Priority Rule

An available individual job script overrides the global script. When the job has no available script, BRC uses the global selection. Choosing None for a job therefore uses the global selection; choose None globally as well to run without a custom script. Only one custom script runs per job process.