neuray Services API Programmer's Manual

mi::nservices::ICommand_context_neuray Class Reference

[Commands]

Description

The context is which neuray commands are executed. This extends the base command context to provide access to the neuray services scene management subsystem.

Public Member Functions

virtual IScenecreate_scene( const char* name, bool blocking = false) =0
Create a new scene object. More...
virtual ISceneget_scene( const char* name, bool blocking = false) =0
Retrieve a scene representation. More...
virtual Sint32 unblock_scene( const char* name) =0
Unblocks a scene previously blocked. More...

Member Functions

virtual IScene* mi::​nservices::​ICommand_context_neuray::create_scene( const char* name, bool blocking = false) [pure virtual]

Create a new scene object. If blocking is true then any other attempts to create the scene will stall until unblock_scene is called. This is useful to ensure that multiple users do not create the same scene at the same time. If blocking is false then the expiry timer is started immediately. If true then the timer is not started until the scene is unblocked. Note that if blocking is set but this method returns NULL then it is not required to call unblock_scene. Blocking will also cause the current transaction to be committed if it is open. Therefore any edits on the current transaction must be closed before performing a blocked create and all instances of the transaction released. ICommand_context::get_transaction should always be called to obtain the new transaction if blocking is used, even if NULL is returned.

Parameters

name
the name of the scene object
blocking
to block other access or not

Returns

the scene representation or NULL if a scene under that name already exists

virtual IScene* mi::​nservices::​ICommand_context_neuray::get_scene( const char* name, bool blocking = false) [pure virtual]

Retrieve a scene representation. If blocking is true then any other attempts to retrieve the scene will stall until unblock_scene is called. This is useful to block access while long running operations, like file loading, occur. If blocking is false then all expiry timers are restarted. If true then all timers are stopped until the scene is unblocked. Note that if blocking is set but this method returns NULL then it is not required to call unblock_scene. Blocking will also cause the current transaction to be committed if it is open. Therefore any edits on the current transaction must be closed before performing a blocked get and all instances of the transaction released. ICommand_context::get_transaction should always be called to obtain the new transaction if blocking is used, even if NULL is returned.

Parameters

name
the name of the scene object
blocking
to block other access or not

Returns

the scene representation or NULL if none exists under that name

virtual Sint32 mi::​nservices::​ICommand_context_neuray::unblock_scene( const char* name) [pure virtual]

Unblocks a scene previously blocked. This restarts all expiry timers. Unblocking will also cause the current transaction to be committed if it is open. Therefore any edits on the current transaction must be closed before performing a blocked create and all instances of the transaction released. ICommand_context::get_transaction should be always called to obtain the new transaction after unblocking.

Parameters

name
the name of the scene object

Returns

  • NRS_ERROR_NONE success.
  • NRS_ERROR_INVALID_PARAMETERS name is NULL.
  • NRS_ERROR_INVALID_OPERATION scene name was not blocked.
  • NRS_ERROR_NOT_FOUND scene name not found.