For importing the Multi-User Sightlab into your existing project the process and code is similar to the single user except that you have to use a separate file for the server and client. Note, if setting up the scene in code, you will need to manually add the environment model to both the server and the client and choose "Empty" when selecting the environment from the server.
Code for server:
import vizimport vizfxfrom utils import sightlab_serverFor Client:
import vizimport vizfxfrom utils import sightlab_clientTo trigger events from the server to the clients you will need to first create an event ID and then use that for the callback, similar to the following code:
Add this to both server and client:
import viznetdef id(name): """Generate unique ID for use over viznet""" return f'viznet:{name}'YOUR_EVENT = id('YOUR_EVENT')Create function on server side:
Create function on client side that is triggered by the event sent from the server:
Getting environment and Scene Objects
Server:
env = sightlab_server.objects_server[0]
Client:
env = sightlab_client.objects[0]