neuray API Programmer's Manual

mi::bridge::IIray_bridge_snapshot_context Class Reference

[Bridge client]

Description

Context for creating Iray Bridge snapshots. A snapshot context is very similar to a render context, but instead of rendering it allows to create scene snapshots on the server. Instances of this class are meant to be used together with Bridge render contexts to save snapshots to take advantage of Bridge features such as incremental changes.

This context will, just as the Bridge renderer contexts, use the Iray Bridge server URL and security token as set on the API component mi::bridge::IIray_bridge_client, and will also detect changes to the application URL which will trigger an automatic reconnect to the new Iray Bridge server.

See also:

mi::bridge::IIray_bridge_client::create_snapshot_context()

Public Member Functions

virtual Sint32 cancel_snapshot() =0
Cancels the snapshot currently being created by this snapshot context. More...
virtual Sint32 create_snapshot( neuraylib::​ITransaction* transaction, const char* file_name, IIray_bridge_snapshot_callback* callback, bool incremental = false) =0
Creates a scene snapshot on the Iray Bridge server. More...
virtual const IDataget_option( const char* name) const =0
Returns the value of a snapshot context option. More...
template< class T>const T* get_option( const char* name) const
Returns the value of a snapshot context option. More...
virtual const char* get_option_name( Size index) const =0
Returns the name of a render context option. More...
virtual const char* get_option_type( Size index) const =0
Returns the type of a render context option. More...
virtual Size get_options_length() const =0
Returns the number of render context options. More...
virtual Sint32 set_option( const char* name, const IData* value) =0
Sets the value of a snapshot context option. More...

Member Functions

virtual Sint32 mi::​bridge::​IIray_bridge_snapshot_context::cancel_snapshot() [pure virtual]

Cancels the snapshot currently being created by this snapshot context.

Note:

This method returns immediately and the snapshot will be canceled as quickly as possible, at which time the provided callback will be invoked with an error code. Note that the snapshot might still be created after successfully calling cancel if it was to late to cancel it.

Returns

  • 0: Success.
  • -2: Network error.
  • -3: Failed to abort the snapshot.
  • <= -4: Unspecified error.

virtual Sint32 mi::​bridge::​IIray_bridge_snapshot_context::create_snapshot( neuraylib::​ITransaction* transaction, const char* file_name, IIray_bridge_snapshot_callback* callback, bool incremental = false) [pure virtual]

Creates a scene snapshot on the Iray Bridge server. Optionally the created snapshot is incremental which means that only the changes since the last call to create_snapshot() on this context are saved.

Only one snapshot can be created at a time. Calling this method while another snapshot is being created will fail.

Parameters

transaction
The transaction to use when creating the snapshot. Any data that is not up to date on the server will be sent automatically. The transaction needs to be from the same scope as the transaction used to create the context.
file_name
The name of the file to save the snapshot to. The location of the file is configured on the server. If called with an empty string (or NULL) the server will generate a unique name for the snapshot. This name will be provided in the callback to the provided mi::bridge::IIray_bridge_snapshot_callback instance.
callback
The callback that will be called on progress and when the snapshot has been successfully saved, or if there was an error.
incremental
If true, then only the changes since the last call to create_snapshot() will be saved. If this is the first call for this context then a full snapshot will be saved even if set to true. Fully restoring an incremental snapshot requires loading the full snapshot first and then any subsequent incremental snapshots in the order they were created.

Returns

  • 0: Success.
  • -1: Invalid arguments.
  • -2: Network error.
  • -3: A snapshot is currently already being created.
  • -4: The scene element could not be accessed.
  • <= -5: Unspecified error.

virtual const IData* mi::​bridge::​IIray_bridge_snapshot_context::get_option( const char* name) const [pure virtual]

Returns the value of a snapshot context option.

See also:

set_option(), get_option_name()

Parameters

name
The name of the option.

Returns

The value of the option, or NULL in case of failure, e.g., if there is no such option.

template< class T>

const T* mi::​bridge::​IIray_bridge_snapshot_context::get_option( const char* name) const [inline]

Returns the value of a snapshot context option.

See also:

set_option(), get_option_name()

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface( const Uuid &) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

Parameters

name
The name of the option.

Returns

The value of the option, or NULL in case of failure, e.g., if there is no such option.

virtual const char* mi::​bridge::​IIray_bridge_snapshot_context::get_option_name( Size index) const [pure virtual]

Returns the name of a render context option.

See also:

get_options_length(), get_option_type(), get_option(), set_option()

Parameters

index
The index of the render context option in question.

Returns

The name of the specified render context option, or NULL if index is out of bounds.

virtual const char* mi::​bridge::​IIray_bridge_snapshot_context::get_option_type( Size index) const [pure virtual]

Returns the type of a render context option.

See also:

get_options_length(), get_option_name(), get_option(), set_option()

Parameters

index
The index of the render context option in question.

Returns

The type of the specified render context option, or NULL if index is out of bounds.

virtual Size mi::​bridge::​IIray_bridge_snapshot_context::get_options_length() const [pure virtual]

Returns the number of render context options.

See also:

get_option_name()

virtual Sint32 mi::​bridge::​IIray_bridge_snapshot_context::set_option( const char* name, const IData* value) [pure virtual]

Sets the value of a snapshot context option. Supported options are "bridge_address" and "bridge_security_token", both of type IString, which override the default settings for the bridge server and security token to use when saving snapshots.

See also:

get_option(), get_option_name(), get_option_type()

Parameters

name
The name of the option to be set.
value
The value of the option to be set.

Returns

  • 0: Success.
  • -1: name is invalid.
  • -2: value is invalid.
  • -3: The option can not be set at this point in time.