Database

class Database
property read_only

The database read only status.

Type

bool, read-only

property active_material_group

The active material group.

Type

MaterialGroup

Raises

ReadOnlyError -- If Database is in read only mode.

save(clean_database = False)

Save the database.

Parameters

clean_database (bool) -- Whether to shrink the database to minimum size.

Returns

True if successful.

Return type

bool

Raises

ReadOnlyError -- If Database is in read only mode.

save_as(filename)

Save the database to another file.

Parameters

filename (str) -- The new database filename.

Returns

True if successful.

Return type

bool

Raises

ReadOnlyError -- If Database is in read only mode.

close()

Close the database

Note

The database is not automatically saved. Call save() or save_as() before close() if you want to do so.

find_camera(id)

Find a camera by id.

Parameters

id (str) -- Camera id to find.

Returns

The camera found or None if not found.

Return type

Camera or None

list_cameras(recursive = True)

List the cameras of the database.

Parameters

recursive (bool) -- If True, list all cameras in the database, otherwise only the root cameras are returned.

Returns

The list of cameras in the database.

Return type

list(Camera)

create_camera(group = None)

Create a camera.

Parameters

group (CameraGroup or None) -- Group of the new camera, or None to put the camera at the root of the hierarchy.

Returns

The new camera.

Return type

Camera

Raises

ReadOnlyError -- If Database is in read only mode.

find_camera_group(id)

Find a camera group by id.

Parameters

id (str) -- Camera group id to find.

Returns

The camera group found or None if not found.

Return type

CameraGroup or None

list_camera_groups(recursive = True)

List the camera groups of the database.

Parameters

recursive (bool) -- If True, list all camera groups in the database, otherwise only the root groups are returned.

Returns

The list of camera groups in the database.

Return type

list(CameraGroup)

create_camera_group(name, parent_group = None)

Create a camera group.

Parameters
  • name (str) -- Name of the new group.

  • parent_group (CameraGroup or None) -- Parent group of the new group, or None to put the group at the root of the hierarchy.

Returns

The new group.

Return type

CameraGroup

Raises

ReadOnlyError -- If Database is in read only mode.

find_model(id)

Find a model by id.

Parameters

id (str) -- Model id to find.

Returns

The model found or None if not found.

Return type

Model or None

list_models()

List the models of the database.

Returns

The list of models in the database.

Return type

list(Model)

create_material_group(name)

Create a new material group.

Parameters

name (str) -- Name of the group.

Returns

The newly created group.

Return type

MaterialGroup

Raises

ReadOnlyError -- If Database is in read only mode.

find_material_group(id)

Find a material group by id.

Parameters

id (str) -- Material group id to find.

Returns

The material group found or None if not found.

Return type

MaterialGroup or None

list_material_groups()

List the material groups of the database.

Returns

The list of material groups in the database.

Return type

list(MaterialGroup)