neuray API Programmer's Manual

mi::bridge::IIray_bridge_snapshot_handler Class Reference

[Bridge server]

Description

The IIray_bridge_snapshot_handler can be used to control snapshot creation for an Iray bridge server application. By default the bridge server accepts all snapshot creation requests and writes the snapshot data into the snapshot path set by mi::bridge::IIray_bridge_application::set_snapshot_path(). By installing a custom IIray_bridge_snapshot_handler it is possible to limit the snapshots created per user and how to store the .cb snapshot file data.

Note that all callback methods of this interface can be called concurrently, so implementations must be thread safe.

Public Member Functions

virtual Sint32 on_snapshot_creation( IServer_session* session, Uint32 context_id, const char* scene_name, bool incremental, const char* suggested_snapshot_name, const char* cb_file_data, IString* final_snapshot_name, IString* error_message) =0
If the call to on_snapshot_request() allowed the snapshot and it was created successfully, then this method will be called with the result. More...
virtual void on_snapshot_error( IServer_session* session, Uint32 context_id, Sint32 error_code, const char* error_message) =0
If the call to on_snapshot_request() allows the snapshot but the snapshot creation failed, then this callback is called instead of on_snapshot_creation(). More...
virtual bool  on_snapshot_request( IServer_session* session, Uint32 context_id) =0
This function is called when the Iray Bridge application receives a requests to create a snapshot to decide if the snapshot is allowed or not. More...

Member Functions

virtual Sint32 mi::​bridge::​IIray_bridge_snapshot_handler::on_snapshot_creation( IServer_session* session, Uint32 context_id, const char* scene_name, bool incremental, const char* suggested_snapshot_name, const char* cb_file_data, IString* final_snapshot_name, IString* error_message) [pure virtual]

If the call to on_snapshot_request() allowed the snapshot and it was created successfully, then this method will be called with the result. It is up to the implementation to save the contents of the .cb file data to a file on disk, store it in a data base, or something similar.

Parameters

session
The session of the request.
context_id
The id of the snapshot context that made the request. Only one snapshot can be created at a time per session/context_id pair.
scene_name
The name of the scene the snapshot is for.
incremental
True if the snapshot is incremental, false otherwise.
suggested_snapshot_name
This is the name for the snapshot provided by the client, or an empty string if the client didn't provide a name. In that case it is the responsibility of the implementation to provide a unique name for the snapshot within the context of where it is stored.
cb_file_data
A string containing the contents of the .cb file that can be used to import the snapshot or delete it.
final_snapshot_name
The name for the snapshot that the implementation decided to use. If the client supplied name is kept, it must still be set here.
error_message
Set with a short message describing the error, or leave as is.

Returns

An error code indicating if handling the snapshot went well.

  • 0 If the snapshot could be handled successfully.
  • -1 to -1000 Reserved error codes.
  • <-1000 Handler specific error codes.

virtual void mi::​bridge::​IIray_bridge_snapshot_handler::on_snapshot_error( IServer_session* session, Uint32 context_id, Sint32 error_code, const char* error_message) [pure virtual]

If the call to on_snapshot_request() allows the snapshot but the snapshot creation failed, then this callback is called instead of on_snapshot_creation(). This allows the server to perform cleanup or show the error in a UI or something similar. The client will be notified about the error without the handler needing to take action.

Parameters

session
The session of the request.
context_id
The id of the snapshot context that made the request. Only one snapshot can be created at a time per session/context_id pair.
error_code
An error code indicating what the error was.
error_message
A short description of the error.
virtual bool mi::​bridge::​IIray_bridge_snapshot_handler::on_snapshot_request( IServer_session* session, Uint32 context_id) [pure virtual]

This function is called when the Iray Bridge application receives a requests to create a snapshot to decide if the snapshot is allowed or not.

Parameters

session
The session of the request.
context_id
The id of the snapshot context that made the request. Only one snapshot can be created at a time per session/context_id pair.

Returns

True to allow the creation of a snapshot, false to reject it.