Managers reference#
- class blenderline.managers.BackgroundManager#
Manager for background-related operations, such as grabbing the background object and setting a random background.
- __init__(background_object_name, background_collection)#
Create background manager.
- Parameters:
background_object_name (str) – name of background object in scene.
background_collection (BackgroundCollection) – collection of background entries.
- Return type:
None
- initialize()#
Get background object.
- Return type:
None
- sample()#
Sample background entry from collection and apply it.
- Return type:
None
- class blenderline.managers.HDRManager#
Manager for HDR-related operations, such as creating a world texture and sampling and setting a random HDR background.
- __init__(hdr_collection)#
Create HDR background manager.
- Parameters:
hdr_collection (HDRCollection) – collection of HDR background entries.
- Return type:
None
- initialize()#
Create world texture with nodes to put HDR background texture on.
- Return type:
None
- sample()#
Sample HDR background entry from collection and apply it.
- Return type:
None
- class blenderline.managers.ItemManager#
Manager for item-related operations, such as spawning multiple items randomly along the defined path object.
- __init__(path_object_name, spawn_probability, max_tries, max_items, item_collection)#
Create item manager.
- Parameters:
path_object_name (str) – name of path object in scene.
spawn_probability (float) – probability to spawn a new item.
max_tries (int) – maximum number of times to attempt to spawn an item. Spawning may fail due to item minimum margin distance collisions.
max_items (int) – maximum number of items to spawn.
item_collection (ItemCollection) – collection of item entries.
- Return type:
None
- assign_pass_indices()#
Assign pass indices to all currently spawned items.
- Return type:
None
- clear()#
Remove all currently spawned item references from the scene.
- Return type:
None
- initialize()#
Get path reference object.
- Return type:
None
- location_is_valid(proposed_location, proposed_min_margin_distance)#
- Check if proposed object location is valid with respect to all currently
spawned items.
- Parameters:
proposed_location (mathutils.Vector) – proposed location for new item.
proposed_min_margin_distance (float) – minimum margin distance for proposed item.
- Returns:
True if proposed location is valid w.r.t. all spawned items.
- Return type:
bool
- max_items_reached()#
Checks if another item may be spawned according to maximum number of items configured.
- Return type:
bool
- sample()#
Sample a set of items along the path. Items are sampled until either the maximum number of items is reached, the random trial fails, or an item cannot be spawned within a maximum number of tries.
- Return type:
None
- trial_success()#
Perform random draw according to success probability based on number of items currently spawned.
- Return type:
bool
- class blenderline.managers.SceneManager#
Manager for scene-related operations, such as loading a scene and configuring the camera.
- __init__(filepath, camera_object_name, render_samples, render_use_cuda, render_denoising, render_resolution)#
Create scene manager.
- Parameters:
filepath (pathlib.Path) – absolute filepath to scene .blend asset.
camera_object_name (str) – name of camera object in scene.
render_samples (int) – number of samples to render with.
render_use_cuda (bool) – whether to use CPU (False) or CUDA GPU (True).
render_denoising (bool) – enable denoising on rendered image.
render_resolution (list[int, int]) – image resolution ([x, y]) to render at.
- Return type:
None
- add_item_reference_render_output(item_reference)#
Add nodes to get segmentation mask corresponding to an item reference.
- Parameters:
item_reference (ItemReference) – item reference to generate mask output for.
- Return type:
None
- configure_camera()#
Configure active camera in scene.
- Return type:
None
- initialize()#
Initialize scene using specified parameters by loading scene and configuring the camera.
- Return type:
None
- load_scene()#
Load scene .blend file as main Blender file.
- Return type:
None
- render(output_folder, item_references)#
- Render current scene, outputting rendered image and all item segmentation
masks. Rendered image will have filename “image__0001.png”. Segmentation masks will have filename “<label ID>__<random item ID>__0001.png”.
- Parameters:
output_folder (pathlib.Path) – folder to store images in.
item_references (list[ItemReference]) – list of item refereces to generate masks for.
- Return type:
None
- reset_compositor_nodes()#
Configure render settings.
- Return type:
None