vrSessionService

class vrSessionService

(Inherits vrBaseService)

Interface to work with collaboration sessions.

Summary

Functions:
Signals:

Functions

vrSessionService.abortProgress()

Aborts a running project file upload or download.

vrSessionService.addNodeSync(node)

Transformation and visibility changes will by synchronized for all registered nodes This node sync is only used in python and does not affect transformations that are triggered by the transformation module or variant sets. By default functions like setTransformNodeXXXX are not synced automatically. Adding a node sync will send all changes, independent from the source of the change, to all connected users.

Parameters:node (vrdNode) – to be synchronized
vrSessionService.blockSync(commandTypeName='')

Calling blockSync, blocks all synchronizations to other users.

vrSessionService.blockSync()
# nothing will be synchronized here
vrSessionService.unblockSync()
Parameters:commandTypeName (string) – command to be blocked or empty to block all. This can be used for example to switch on a variant or variant set in python without synchronizing this with other users. To get a list of all currently available commands, use vrSessionService.getSyncCommandNames()

Checks if the password is valid.

Parameters:
  • passwd (string) – Password to check
  • sessionLink (string) – Session connection string
Returns:

True, if password is correct

Return type:

bool

Creates a connection string from the hostname and a password.

Parameters:
  • server (string) – Host name or IP address
  • passwd (string) – Password that should be used to secure the session
Returns:

A string that can be used to join a session

Return type:

string

vrSessionService.getDefaultColors()
Returns:Returns a map of default avatar color names and colors
Return type:Dict[string,QColor]
vrSessionService.getPauseSync()

Get the current pause state

Returns:True, if synchronization is paused
Return type:bool
vrSessionService.getRemoteUsers()
Returns:A list of all other users without the local user
Return type:List[vrdSessionUser]

Returns the connection string of the collaboration session.

Returns:The hostname/id session string
Return type:string
vrSessionService.getShowSceneDownloadWarning()
Returns:True, a massage box on scene download will be displayed
Return type:bool
vrSessionService.getShowSceneUploadWarning()
Returns:True, a massage box on scene upload will be displayed
Return type:bool
vrSessionService.getSyncCommandNames()

Get all known command type names. These names can be used in blockSync and unblockSync.

Returns:A list of all known command type names
Return type:List[string]
vrSessionService.getUser()
Returns:Information about the local user
Return type:vrdSessionUser
vrSessionService.getUsers()
Returns:A list of all connected users
Return type:List[vrdSessionUser]
vrSessionService.isConnected()

Checks whether vred is connected to a collaboration session.

Returns:True, if connected
Return type:bool
vrSessionService.isJoinCompleted()

Checks whether the connection has been established.

Returns:True, if join operation completed
Return type:bool
vrSessionService.isMicrophoneMute()

Get microphone muted state.

Returns:true, if microphone is muted
Return type:bool
vrSessionService.isSpatialAudio()

Get spatioal audio setting.

Returns:true, if spatial audio is enabled
Return type:bool
vrSessionService.isSpeakerMute()

Get speaker muted state.

Returns:true, if speaker is muted
Return type:bool
vrSessionService.isUserAutoColor()
Returns:True, if auto color was selected or transparent passed to setUsetColor
Return type:bool
vrSessionService.join(sessionLink, userName='', color=Qt.transparent, roomName='', passwd='', forceVersion=False)

Joins an existing or creates a new vr collaboration sesson.

# example function call
vrSessionService.join("localhost", userName="user1",
    color=PySide6.QtGui.Qt.transparent,  roomName="",
    passwd="", forceVersion=False)
Parameters:
  • sessionLink (string) – Session connection string
  • userName (string) – Name used for the Avatar
  • color (QColor) – Avatar color. If transparent (0,0,0,0), use automatic default color
  • roomName (string) – Safety avatars are displayed for users in the same physical room
  • passwd (string) – Password for secured sessions
  • forceVersion (bool) – If true, stops the session and creates a new session for the current vred version.
vrSessionService.leave()

Leaves the collaboration session.

vrSessionService.removeNodeSync(node)

Remove node from synchronization. Like addNodeSync, this does not have an effect on changes triggered by variant sets and other interactively triggered transformations.

Parameters:node (vrdNode) – stop synchronizing this node
vrSessionService.sendPython(command, commandId='')

Sends a python command to all other users.

The given python command is sent to all connected users. This is done asynchronously. All commands will arrive in the same order on all connected clients. Commands should not contain references to local python variables. If nodes should be referenced, getUniquePath and findUniquePath can be used. For example, to move a node that is assigned to a local python variable n, the following command can be.

cmd = "setTransformNodeTranslation({},20,0,1600,True)"
    .format(vrSessionService.toPythonString(n))
vrSessionService.sendPython(cmd)

The command ID is used to merge multiple changes to the same target. If a user connects a session later, the last command for each commandID is executed on connect. For example if the above command should merge all transformaton changes to the node n:

stateId = "Transform/" + getUniquePath(n)
vrSessionService.sendPython(cmd,stateId)
Parameters:
  • command (string) – The python command to send
  • commandId (string) – For the same commandId, only the last command is synchronized
vrSessionService.setAudioEnabled(value)

Enables audio communication.

Parameters:value (bool) – If true, audio communication is enabled
vrSessionService.setAvatarProximityOpaqueDistance(value)

Changes the distance from which avatars are opaque.

Parameters:value (float) – Distance in mm
vrSessionService.setAvatarProximityTransparentDistance(value)

Changes the distance from which avatars become fully transparent.

Parameters:value (float) – Distance in mm
vrSessionService.setAvatarSafetyOpaqueDistance(value)

Changes the distance to fade safety avatars.

Parameters:value (float) – Distance in mm
vrSessionService.setAvatarSafetyTransparentDistance(value)

Changes distance to hide safety avatars.

Parameters:value (float) – Distance in mm
vrSessionService.setMicrophoneLevel(value)

Adjusts microphone level.

Parameters:value (float) – Amplificaton 0 - 1
vrSessionService.setMicrophoneMute(value)

Mutes the microphone.

Parameters:value (bool) – If true, microphone is disabled
vrSessionService.setPauseSync(value)

Pause synchronizaiton.

Parameters:value (bool) – It True, synchronization is paused
vrSessionService.setPointerToolActive(on)

Activates the pointing tool.

Parameters:on (bool) – If True, tool is active
vrSessionService.setPointerVisible(value)

Makes the pointing tool visible for all other users.

Parameters:value (bool) – If True, tool is visible
vrSessionService.setRoom(room)

Changes the room name, used for safety avatar visualization.

Parameters:room (string) –
vrSessionService.setShowSceneDownloadWarning(value)

Enable or disable massage box on scene download.

Parameters:value (bool) – True, show the message box
vrSessionService.setShowSceneUploadWarning(value)

Enable or disable massage box on scene upload.

Parameters:value (bool) – True, show the message box
vrSessionService.setSpatialAudio(value)

Enables 3D sound for collaboration audio communications.

Parameters:value (bool) – True, enables 3D audio
vrSessionService.setSpeakerLevel(value)

Adjusts speaker volume.

Parameters:value (float) – Amplificaton 0 - 1
vrSessionService.setSpeakerMute(value)

Mutes the speaker.

Parameters:value (bool) – If true, speaker is disabled
vrSessionService.setUserColor(userColor)

Change the user color.

Parameters:userColor (QColor) – Avatar color. If transparent (0,0,0,0), use automatic default color
vrSessionService.setUserName(userName)

Changes the user name.

Parameters:userName (string) –
vrSessionService.showDesktopAvatar(on)

Toggles how the local user is shown in desktop mode to the other users, either as tablet (default) or as avatar.

Parameters:on (bool) – True, show as avatar. False, show as tablet
vrSessionService.spectate(on, userId=0)

Turns spectator mode on or off.

Parameters:
  • on (bool) – If True, enables spectator mode
  • userId (integer) – The spectator mode is enabled for the user with this id
vrSessionService.stopForAll()

Stops the collaboration session for all connected users.

vrSessionService.syncNode(node)

Synchronize position and visibility with all other users.

Parameters:node (vrdNode) – synchronize this node
vrSessionService.toPythonString(matrix)

Convert matrix to a python string that can used in sendPython.

Parameters:matrix (QMatrix4x4) – the value to be encoded
Returns:A string representaton of the given matrix
Return type:string
vrSessionService.toPythonString(vector2d)

Convert vector to a python string that can used in sendPython.

Parameters:vector2d (QVector2D) – the value to be encoded
Returns:A string representation of the given vector
Return type:string
vrSessionService.toPythonString(vector3d)

Convert vector to a python string that can used in sendPython.

Parameters:vector3d (QVector3D) – the value to be encoded
Returns:A string representation of the given vector
Return type:string
vrSessionService.toPythonString(node)

Convert a node to a python string that can used in sendPython.

Parameters:node (vrdNode) – to be encoded
Returns:A string encoded reference to the node
Return type:string
vrSessionService.toPythonString(material)

Convert a material to a python string that can used in sendPython.

Parameters:material (vrdMaterial) – to be encoded
Returns:A string encoded reference to the material
Return type:string
vrSessionService.toPythonString(nodes)

Convert a list of nodes to a python string that can used in sendPython.

Parameters:nodes (List[vrdNode]) – a list of nodes to be encoded
Returns:A string encoded reference to all nodes
Return type:string
vrSessionService.unblockSync(commandTypeName='')

Calling unblockSync resumes synchronizations to other users.

Parameters:commandTypeName (string) – command to be blocked or empty to block all
vrSessionService.uploadScene()

Sends the current project in the memory to all connected users.

vrSessionService.uploadScenePath(path)

Sends the path of the project to be loaded to all users.

Parameters:path (string) – The filename of the project to be uploaded

Signals

vrSessionService.joinFailed(message, wrongVersion)

The join operation has failed.

Parameters:
  • message (string) – An error message
  • wrongVersion (bool) – If True, the connection failed because the VRED version does not match
vrSessionService.microphoneMuted(value)

Microphone has been muted or unmuted.

Parameters:value (bool) – If true, microphone has been muted
vrSessionService.pointerToolActiveChanged(on)

The pointing tool has been activated.

Parameters:on (bool) – If True, tool is active
vrSessionService.progressChanged(action, progress)

Project upload or download progress has changed.

Parameters:
  • action (string) – Description of the current activity
  • progress (integer) – Progress in the range 0 - 100
vrSessionService.progressFinished()

Project upload or download operatrion has been completed.

vrSessionService.receivedSessionConfig(config)

A session configuration has been double clicked or dropped to the VRED window.

Parameters:config (string) – Configuration file
vrSessionService.requestSceneDownload(reject)

A collaboration session has been left.

Parameters:reject (bool) – If set to True, the download is aborted
vrSessionService.sessionJoined()

A collaboration session has been joined.

vrSessionService.sessionLeft()

A collaboration session has been left.

vrSessionService.speakerMuted(value)

Speaker has been muted or unmuted.

Parameters:value (bool) – If true, speaker has been muted
vrSessionService.spectateChanged(on, userId)

Spectator mode has been changed.

Parameters:
  • on (bool) – If True, spectator mode has been enabled
  • userId (integer) – ID of the user to look at
vrSessionService.statusChanged()

Connection status or other user properties have been changed.

vrSessionService.userArrives(user)

A new user has joined the session.

Parameters:user (vrdSessionUser) – Arrived user
vrSessionService.userLeaves(user)

A user has left the session.

Parameters:user (vrdSessionUser) – User that has left