The IIray_bridge_snapshot_handler can be used to control snapshot creation for an Iray bridge server application.
More...
#include <iiray_bridge_server.h>
|
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...
|
|
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 Uint32 | retain () const =0 |
| Increments the reference count. More...
|
|
virtual Uint32 | release () const =0 |
| Decrements the reference count. More...
|
|
virtual const IInterface * | get_interface (const Uuid &interface_id) const =0 |
| Acquires a const interface from another. More...
|
|
template<class T> |
const T * | get_interface () const |
| Acquires a const interface from another. More...
|
|
virtual IInterface * | get_interface (const Uuid &interface_id)=0 |
| Acquires a mutable interface from another. More...
|
|
template<class T> |
T * | get_interface () |
| Acquires a mutable interface from another. More...
|
|
virtual Uuid | get_iid () const =0 |
| Returns the interface ID of the most derived interface. More...
|
|
|
using | Self = Interface_declare< id1, ... > |
| Own type. More...
|
|
using | IID = Uuid_t< id1, ... > |
| Declares the interface ID (IID) of this interface. More...
|
|
using | IID = Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> |
| Declares the interface ID (IID) of this interface. More...
|
|
static bool | compare_iid (const Uuid &iid) |
| Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
|
|
static bool | compare_iid (const Uuid &iid) |
| Compares the interface ID iid against the interface ID of this interface. More...
|
|
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.
◆ on_snapshot_creation()
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. |
[out] | 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. |
[out] | 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.
◆ on_snapshot_error()
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. |
◆ on_snapshot_request()
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.