palletdatagenerator.blender_runner module

Blender runner module for integrating with Blender’s Python environment.

This module provides the interface for running the PalletDataGenerator within Blender’s Python environment.

class palletdatagenerator.blender_runner.BlenderEnvironmentManager[source]

Bases: object

Manages Blender environment setup and configuration.

__init__()[source]
validate_blender_environment() bool[source]

Validate that Blender environment is properly set up.

Returns:

True if Blender environment is valid

setup_blender_preferences(use_gpu: bool = True) None[source]

Setup Blender preferences for optimal rendering.

Parameters:

use_gpu – Whether to enable GPU rendering if available

get_scene_info() dict[str, Any][source]

Get information about the current Blender scene.

Returns:

Dictionary with scene information

palletdatagenerator.blender_runner.setup_background_images(background_dir: str) list[str][source]

Setup random background images for rendering.

Parameters:

background_dir – Directory containing background images

Returns:

List of valid background image paths

palletdatagenerator.blender_runner.apply_random_background(background_images: list[str]) str | None[source]

Apply a random background image to the scene.

Parameters:

background_images – List of background image paths

Returns:

Path to the applied background image, or None if failed

palletdatagenerator.blender_runner.run_with_blender_args()[source]

Main entry point when running with Blender.

This function handles Blender-specific setup and then runs the CLI.