Link Search Menu Expand Document

arena-py API v1.3.0

arena.scene

Gives access to an ARENA scene. Can create and execute various user-defined functions/tasks.

Parameters
  • str host: Hostname of the ARENA webserver (required).
  • str realm: Reserved topic fork for future use (optional).
  • str namespace: Username of authenticated user or other namespace (automatic).
  • str scene: The name of the scene, without namespace (required).
  • int network_latency_interval: Interval (in ms) to run network graph latency update. Default value is 10000 (10 secs). Ignore this parameter (optional).
  • func on_msg_callback: Called on all MQTT messages received (optional).
  • func new_obj_callback: Called on object 'create' MQTT messages received (optional).
  • func user_join_callback: Called on user id 'new' MQTT messages received (optional).
  • func user_left_callback: Called on user id 'leave' MQTT messages received (optional).
  • func delete_obj_callback: Called on object 'delete' MQTT messages received (optional).
  • func end_program_callback: Called on MQTT disconnect (optional).
  • func on_chat_callback: Called on chat messages received (optional).
  • bool video: If true, request permissions for video conference (optional).
  • bool debug: If true, print a log of all publish messages from this client (optional).
  • bool cli_args: If true, require CLI standardized parameters (optional).
  • bool headless: If true, force limited input device auth flow (optional).
Scene( host='arenaxr.org', realm='realm', network_latency_interval=10000, on_msg_callback=None, new_obj_callback=None, user_join_callback=None, user_left_callback=None, delete_obj_callback=None, end_program_callback=None, on_chat_callback=None, video=False, debug=False, cli_args=False, headless=False, **kwargs)
telemetry
connected_evt
cmd_interpreter
def parse_cli(self, cli_args=False):

Reusable command-line options to give apps flexible options to avoid hard-coding locations.

def exit(self, arg=None):

Custom exit to push errors to telemetry.

def on_connect(self, client, userdata, flags, rc):

Paho MQTT client on_connect callback.

def on_message(self, client, userdata, msg):
def on_message_private(self, client, userdata, msg):
def on_publish(self, client, userdata, mid):
async def process_message(self):
def callback_wrapper(self, func, arg, msg):

Checks for number of arguments for callback.

def generate_custom_event(self, evt, action='clientEvent'):

Publishes an custom event. Could be user or library defined.

def generate_click_event( self, obj: arena.objects.arena_object.Object, type='mousedown', **kwargs):

Publishes an click event.

def manipulate_camera(self, cam, **kwargs):

Publishes a camera manipulation event.

def look_at(self, cam, target):

Publishes a camera manipulation event.

def teleport_to_landmark(self, cam, target):

Publishes a camera manipulation event.

all_objects

Returns all the objects in a scene.

def get_private_objects(self, userid=None):

Returns all private user objects.

def reset_private_objects(self, userid):

Resets all private user objects.

def add_object(self, obj):

Public function to create an object.

def add_objects(self, objs):

Public function to create multiple objects in a list.

def update_object(self, obj: arena.objects.arena_object.Object, **kwargs):

Public function to update an object.

def update_objects(self, objs, **kwargs):

Public function to update multiple objects in a list.

def delete_object(self, obj):

Public function to delete an object.

def delete_user_objects(self, userid):

Deletes any private user objects.

def delete_program(self, obj):
def delete_attributes(self, obj: arena.objects.arena_object.Object, attributes=None):

Public function to delete a list of 'attributes' as a string[], updating each to null.

def run_animations(self, obj: arena.objects.arena_object.Object):

Runs all dispatched animations.

Creates a delayed task to push the end state of an animation after the expected duration. Uses async sleep to avoid blocking.

Parameters
  • obj: arena object to update.
  • anim: Animation to run.
Returns

created async task.

def get_persisted_obj(self, object_id):

Returns a dictionary for a persisted object.

If object is known by arena-py, return local object, not persisted.

def get_persisted_objs(self):

Returns a dictionary of persisted objects.

If object is known by arena-py, return our local object, not persisted. Silently fails/skip objects without object_id and object_type (except programs). Instantiates generic Object if object_type is given but unknown to arena-py.

def get_persisted_scene_option(self):

Returns a dictionary for scene-options.

def get_writable_scenes(self):

Request list of scene names for logged in user account that user has publish permission for.

:returns list: list of scenes.

def get_user_list(self):

Returns a list of users.

def get_rcv_pub_queue_len(self):

Return QueueStats object with receive and publish queue length.

def run_info_update(self, run_info):

Callback when program stats are updated; publish program object update.

def upload_store_file(self, src_file_path, dest_file_path=None):

Upload a file to the filestore using the user's Google account.

Parameters
  • str src_file_path: Local path to the file to upload (required).
  • str dest_file_path: Destination file path, can include dirs. Defaults to filename from src_file_path (optional).
Returns

Url address of successful file upload location, or None if failed.

class Arena(Scene):

Another name for Scene.


Table of contents