bbi.core.node

class Node(node_id: str, transform: Transform)

Bases: object

A scriptable node in the scene hierarchy.

Scriptable nodes have transforms and can have parents and children.

Parameters:
  • node_id (str) – The user defined unique id of the node.

  • transform (Transform) – The transform of the node.

property node_id: str

Get the unique id of the instance.

property parent: Node | None

Get the parent of the instance.

property children: list[Node]

Get the children of the instance.

property transform: Transform

Get the absolute transform of the instance.

property position: Vector3

Get current position of the instance.

property rotation: Vector3

Get current rotation of the instance.

property scale: Vector3

Get current scale of the instance.

set_transform(transform: Transform) None

Set the transform of the instance. For efficiency, this method is preferred over setting individual transform components.

Parameters:

transform (Transform) – The transform.

set_relative_transform(relative_transform: Transform) None

Set the relative transform of the instance in relation parent transform. If there is no parent, set in relation to the world origin transform. For efficiency, this method is preferred over setting individual relative transform components.

Parameters:

relative_transform (Transform) – The relative transform.

set_position(position: Vector3) None

Set the position of the instance.

Parameters:

position (Vector3) – The position.

set_relative_position(relative_position: Vector3) None

Set the relative position of the instance in relation to parent transform. If there is no parent, set in relation to the world origin transform.

Parameters:

relative_position (Vector3) – The relative position.

set_rotation(rotation: Vector3) None

Set the rotation of the instance.

Parameters:

rotation (Vector3) – The rotation.

set_relative_rotation(relative_rotation: Vector3) None

Set the relative rotation of the instance in relation to parent transform rotation. If there is no parent, set in relation to the world origin transform.

Parameters:

relative_rotation (Vector3) – The relative rotation.

set_scale(scale: Vector3) None

Set the scale of the instance.

Parameters:

scale (Vector3) – The scale.

set_relative_scale(relative_scale: Vector3) None

Set the relative scale of the instance in relation to parent transform scale. If there is no parent, set in relation to the world origin transform.

Parameters:

relative_scale (Vector3) – The relative scale.

find_child(node_id: str, recursive: bool) Node | None

Finds a child node by its unique id.

Parameters:
  • node_id (str) – The unique id of the child node.

  • recursive (bool) – Whether to search recursively.

Returns:

The child node, or None if not found.

Return type:

Node

traverse(callback: Callable[[Node], None]) None

Traverses the node hierarchy, calling the callback for each node.

Parameters:

callback (Callable) – The callback function.

attach_to(parent: Node, rule: TransformAttachmentRule = TransformAttachmentRule.KEEP_WORLD) None

Attach the asset to another node inheriting its transform operations.

Parameters:
  • parent (Node) – The parent node to attach the asset to.

  • rule (TransformAttachmentRule, optional) – How to handle transforms and welding when attaching, defaults to TransformAttachmentRule.KEEP_WORLD.

attach_to_root() None

Attach the asset to its root node .

on_begin_scenario(total_seconds: float) None

Called before scenario execution begins to handle any setup operations.

on_end_scenario(total_seconds: float) None

Called after scenario execution ends to handle any cleanup operations.

execute(frame_id: int | None = None, frame_max: int | None = None, delta_seconds: float | None = None) None

Updates the node to the specified frame. Override this to implement animation.

Parameters:
  • frame_id (int | None, optional) – The frame ID. Defaults to None.

  • frame_max (int | None, optional) – Max frame count in the current loop Defaults to None.

  • delta_seconds (float | None, optional) – The target real-time in seconds between frames. This is used to calculate physical displacement for certain assets. Defaults to None.

pre_execute(frame_id: int | None = None, frame_max: int | None = None, delta_seconds: float | None = None) None

Called before all nodes are executed to handle any setup operations.

class HasExtentProtocol(*args, **kwargs)

Bases: Protocol

property node_id: str