NVIDIA Iray API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::IMdl_factory Class Referenceabstract

Factory for MDL interfaces, e.g., modules with presets. More...

Inheritance diagram for mi::neuraylib::IMdl_factory:
Inheritance graph
[legend]

Public Member Functions

virtual Sint32  create_presets (ITransaction *transaction, const char *module_name, const IArray *preset_data)=0
  Creates a new MDL module containing presets. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xba936279, 0x4b71, 0x42a4, 0x95, 0x37, 0x98, 0x69, 0x97, 0xb3, 0x47, 0x72 >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
  Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
  Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xba936279, 0x4b71, 0x42a4, 0x95, 0x37, 0x98, 0x69, 0x97, 0xb3, 0x47, 0x72 >
static bool  compare_iid (const Uuid &iid)
  Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 

Detailed Description

Factory for MDL interfaces, e.g., modules with presets.

Member Function Documentation

virtual Sint32 mi::neuraylib::IMdl_factory::create_presets ( ITransaction transaction,
const char *  module_name,
const IArray preset_data 
)
pure virtual

Creates a new MDL module containing presets.

A preset is basically a clone of another material definition (the prototype) with different defaults.

See Also
mi::neuraylib::IMdl_material_definition::create_preset() for an alternative way to create presets. However, the alternative is restricted to modules that contain exactly one preset.
Parameters
transaction The transaction.
module_name The fully-qualified MDL name of the new module (including package names, starts with "::").
preset_data A static or dynamic array of structures of type Preset_data. Such a structure has the following members:
  • const char* preset_name
    The name of the preset (non-qualified, without module prefix). The DB name of the preset is created by prefixing this name with the DB name of the new module plus "::".
  • const char* prototype_name
    The DB name of the prototype for this preset.
  • mi::neuraylib::IAttribute_container* defaults
    The preset inherits the defaults from the prototype. This member allows to change the defaults and/or to add new defaults. The type of an attribute in the attribute container must match the type of the parameter of the same name of the prototype.
    Note that the values in defaults are copied; passing an attribute container obtained from another MDL interface does not create a link between both instances.
    NULL is a valid value which is handled like an empty attribute container.
  • mi::neuraylib::IAttribute_container* annotations
    The preset does not inherit any annotations from the prototype. This member allows to specify annotations for the preset, i.e., for the material declaration itself (but not for its arguments). So far, only annotations with a single string argument are supported. Therefore, the type of an attribute in the attribute container must be a struct with a single string member. The name of that member does not matter. The predefined type name String_annotation can be used to create such attributes. The name of the attribute identifies the annotation (fully-qualified MDL name starting with a double colon, without signature).
    Note that the values in annotations are copied; passing an attribute container obtained from another MDL interface does not create a link between both instances.
    NULL is a valid value which is handled like an empty attribute container.
Returns
  • 1: Success (module exists already, creation was skipped).
  • 0: Success (module was actually created with the presets as its only material definitions).
  • -1: The module name module_name is invalid.
  • -2: Failed to compile the module module_name.
  • -3: The DB name for an imported module is already in use but is not an MDL module, or the DB name for a definition in this module is already in use.
  • -4: Initialization of an imported module failed.
  • -5: transaction, module_name or preset_data are invalid, preset_data is empty, or a struct member for the prototype name, defaults, or annotations has an incorrect type.
  • -6: A default for a non-existing parameter was provided.
  • -7: The type of a default does not have the correct type.
  • -8: Unspecified error.
  • -9: The type of an annotation value does not have the correct type (only annotations with a single string argument are supported).
  • -10: One of the annotations does not exist or does not have the correct type (only annotations with a single string argument are supported).