Link Search Menu Expand Document

arena-py API v0.8.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).
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, video=False, debug=False, cli_args=False, **kwargs)
persist_host
persist_path
persist_url
new_obj_callback
delete_obj_callback
user_join_callback
user_left_callback
unspecified_object_ids
users
def on_connect(self, client, userdata, flags, rc):

Paho MQTT client on_connect callback

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, 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

all_objects

Returns all the objects in a scene

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, **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_attributes(self, obj, attributes=None):

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

def run_animations(self, obj):

Runs all dispatched animations

def create_delayed_task(self, obj, anim):

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.

def get_persisted_objs(self):

Returns a dictionary of persisted objects. [TODO] check object_type

def get_persisted_scene_option(self):

Returns a dictionary for scene-options. [TODO] wrap the output as a BaseObject

def get_writable_scenes(self):

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

def get_user_list(self):

Returns a list of users

class Arena(Scene):

Another name for Scene.


Table of contents