MDL SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::IMdl_execution_context Class Referenceabstract

The execution context can be used to query status information like error and warning messages concerning the operation it was passed into. More...

#include <imdl_execution_context.h>

Inheritance diagram for mi::neuraylib::IMdl_execution_context:

Public Member Functions

Messages
virtual Size get_messages_count () const =0
 Returns the number of messages. More...
 
virtual Size get_error_messages_count () const =0
 Returns the number of error messages. More...
 
virtual const IMessageget_message (Size index) const =0
 Returns the message at index or NULL, if no such index exists. More...
 
virtual const IMessageget_error_message (Size index) const =0
 Returns the error message at index or NULL, if no such index exists. More...
 
virtual void clear_messages ()=0
 Clears all messages. More...
 
virtual void add_message (IMessage::Kind kind, base::Message_severity severity, Sint32 code, const char *message)=0
 Adds a message. More...
 
Options
virtual Size get_option_count () const =0
 Returns the number of supported options. More...
 
virtual const char * get_option_name (Size index) const =0
 Returns the option name at index. More...
 
virtual const char * get_option_type (const char *name) const =0
 Returns the option type name at index. More...
 
virtual Sint32 get_option (const char *name, const char *&value) const =0
 Returns a string option. More...
 
virtual Sint32 get_option (const char *name, Sint32 &value) const =0
 Returns an int option. More...
 
virtual Sint32 get_option (const char *name, Float32 &value) const =0
 Returns a float option. More...
 
virtual Sint32 get_option (const char *name, bool &value) const =0
 Returns a bool option. More...
 
virtual Sint32 get_option (const char *name, const base::IInterface **value) const =0
 Returns an interface option. More...
 
template<typename T>
const T * get_option (const char *name, Sint32 &return_code)
 Returns an interface option. More...
 
virtual Sint32 set_option (const char *name, const char *value)=0
 Sets a string option. More...
 
virtual Sint32 set_option (const char *name, Sint32 value)=0
 Sets an int option. More...
 
virtual Sint32 set_option (const char *name, Float32 value)=0
 Sets a float option. More...
 
virtual Sint32 set_option (const char *name, bool value)=0
 Sets a bool option. More...
 
virtual Sint32 set_option (const char *name, const base::IInterface *value)=0
 Sets an interface option. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_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 IInterfaceget_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...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x28eb1f99, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x28eb1f99, ... >
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 Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

The execution context can be used to query status information like error and warning messages concerning the operation it was passed into.

The context supports the following options:

Options for module loading

  • std::string "warning": Silence compiler warnings or promote them to errors. Format: options = (option ',')* option. option = 'err' | number '=' ('on' | 'off' | 'err'). A single 'err' promotes all compiler warnings to errors. Otherwise, warning number is either enabled ('on'), disabled ('off'), or promoted to an error ('err').
  • mi::Sint32 "optimization_level": Sets the optimization level. Possible values: 0 (all optimizations are disabled), 1 (only intra procedural optimizations are enabled), 2 (intra and inter procedural optimizations are enabled). Default: 2.
  • std::string "internal_space": Sets the internal space of the backend. Possible values: "coordinate_world", "coordinate_object". Default: "coordinate_world".
  • bool "mdl_next": If true, enables (possible incomplete) features from upcoming MDL version. Default: false.
  • bool "experimental": If true, enables undocumented experimental MDL features. Default: false.
  • mi::base::IInterface* "user_data": A user-supplied pointer to an arbitrary interface. This option can be used to pass additional data from a call site of mi::neuraylib::IMdl_impexp_api::load_module() to a custom implementation of the entity resolver. Default: NULL.

Options for MDL export

  • bool "bundle_resources": If true, referenced resources are exported into the same directory as the module, even if they can be found via the module search path. Default: false.
  • bool "export_resources_with_module_prefix": If true, the name of the exported resources start with the module name as prefix. Default: true.

Options for material compilation

  • bool "fold_meters_per_scene_unit": If true, occurrences of the functions state::meters_per_scene_unit() and state::scene_units_per_meter() will be folded using the meters_per_scene_unit option. Default: true
  • mi::Float32 "meters_per_scene_unit": The conversion ratio between meters and scene units for this material. Only used if folding is enabled. Default: 1.0f.
  • mi::Float32 "wavelength_min": The smallest supported wavelength. Default: 380.0f.
  • mi::Float32 "wavelength_max": The largest supported wavelength. Default: 780.0f.
  • mi::Float32 "fold_ternary_on_df": Fold all ternary operators of *df types, even in class compilation mode. Default: false.
  • bool "ignore_noinline": If true, anno::noinline() annotations are ignored during material compilation. Default: false.

Options for code generation

  • bool "fold_meters_per_scene_unit": If true, occurrences of the functions state::meters_per_scene_unit() and state::scene_units_per_meter() will be folded using the meters_per_scene_unit option. Default: true
  • mi::Float32 "meters_per_scene_unit": The conversion ratio between meters and scene units for this material. Only used if folding is enabled. Default: 1.0f.
  • mi::Float32 "wavelength_min": The smallest supported wavelength. Default: 380.0f.
  • mi::Float32 "wavelength_max": The largest supported wavelength. Default: 780.0f.
  • bool "include_geometry_normal": If true, the "geometry.normal" field will be applied to the MDL state prior to evaluation of the given DF. Default: true.

Member Function Documentation

 add_message()

virtual void mi::neuraylib::IMdl_execution_context::add_message ( IMessage::Kind  kind,
base::Message_severity  severity,
Sint32  code,
const char *  message 
)
pure virtual

Adds a message.

 clear_messages()

virtual void mi::neuraylib::IMdl_execution_context::clear_messages ( )
pure virtual

Clears all messages.

 get_error_message()

virtual const IMessage * mi::neuraylib::IMdl_execution_context::get_error_message ( Size  index) const
pure virtual

Returns the error message at index or NULL, if no such index exists.

 get_error_messages_count()

virtual Size mi::neuraylib::IMdl_execution_context::get_error_messages_count ( ) const
pure virtual

Returns the number of error messages.

 get_message()

virtual const IMessage * mi::neuraylib::IMdl_execution_context::get_message ( Size  index) const
pure virtual

Returns the message at index or NULL, if no such index exists.

 get_messages_count()

virtual Size mi::neuraylib::IMdl_execution_context::get_messages_count ( ) const
pure virtual

Returns the number of messages.

 get_option() [1/6]

virtual Sint32 mi::neuraylib::IMdl_execution_context::get_option ( const char *  name,
bool &  value 
) const
pure virtual

Returns a bool option.

Parameters
nameThe name of the option.
[out]valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.

 get_option() [2/6]

virtual Sint32 mi::neuraylib::IMdl_execution_context::get_option ( const char *  name,
const base::IInterface **  value 
) const
pure virtual

Returns an interface option.

Parameters
nameThe name of the option.
[out]valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.

 get_option() [3/6]

virtual Sint32 mi::neuraylib::IMdl_execution_context::get_option ( const char *  name,
const char *&  value 
) const
pure virtual

Returns a string option.

Parameters
nameThe name of the option.
[out]valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.

 get_option() [4/6]

virtual Sint32 mi::neuraylib::IMdl_execution_context::get_option ( const char *  name,
Float32 value 
) const
pure virtual

Returns a float option.

Parameters
nameThe name of the option.
[out]valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.

 get_option() [5/6]

template<typename T>
const T * mi::neuraylib::IMdl_execution_context::get_option ( const char *  name,
Sint32 return_code 
)
inline

Returns an interface option.

Parameters
nameThe name of the option.
return_code
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.
Returns
The interface value or NULL.

 get_option() [6/6]

virtual Sint32 mi::neuraylib::IMdl_execution_context::get_option ( const char *  name,
Sint32 value 
) const
pure virtual

Returns an int option.

Parameters
nameThe name of the option.
[out]valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.

 get_option_count()

virtual Size mi::neuraylib::IMdl_execution_context::get_option_count ( ) const
pure virtual

Returns the number of supported options.

 get_option_name()

virtual const char * mi::neuraylib::IMdl_execution_context::get_option_name ( Size  index) const
pure virtual

Returns the option name at index.

 get_option_type()

virtual const char * mi::neuraylib::IMdl_execution_context::get_option_type ( const char *  name) const
pure virtual

Returns the option type name at index.

 set_option() [1/5]

virtual Sint32 mi::neuraylib::IMdl_execution_context::set_option ( const char *  name,
bool  value 
)
pure virtual

Sets a bool option.

Parameters
nameThe name of the option.
valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.
  • -3: The value is invalid in the context of the option.

 set_option() [2/5]

virtual Sint32 mi::neuraylib::IMdl_execution_context::set_option ( const char *  name,
const base::IInterface value 
)
pure virtual

Sets an interface option.

Parameters
nameThe name of the option.
valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.
  • -3: The value is invalid in the context of the option.

 set_option() [3/5]

virtual Sint32 mi::neuraylib::IMdl_execution_context::set_option ( const char *  name,
const char *  value 
)
pure virtual

Sets a string option.

Parameters
nameThe name of the option.
valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.

 set_option() [4/5]

virtual Sint32 mi::neuraylib::IMdl_execution_context::set_option ( const char *  name,
Float32  value 
)
pure virtual

Sets a float option.

Parameters
nameThe name of the option.
valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.

 set_option() [5/5]

virtual Sint32 mi::neuraylib::IMdl_execution_context::set_option ( const char *  name,
Sint32  value 
)
pure virtual

Sets an int option.

Parameters
nameThe name of the option.
valueThe value of the option.
Returns
  • 0: Success.
  • -1: Invalid option name.
  • -2: The option type does not match the value type.