mi::neuraylib::IMdl_module_builder Class Reference
[Miscellaneous MDL-related Interfaces]
Description
The module builder allows to create new MDL modules.
See also:
mi::neuraylib::IMdl_factory::create_module_builder()
Public Member Functions
- virtual Sint32 add_annotation( const char* name, const IType_list* parameters, const IExpression_list* defaults, const IAnnotation_list* parameter_annotations, const IAnnotation_block* annotations, bool is_exported, IMdl_execution_context* context) =0
- Adds an annotation to the module. More...
- virtual Sint32 add_constant( const char* name, const IExpression* expr, const IAnnotation_block* annotations, bool is_exported, IMdl_execution_context* context) =0
- Adds a constant to the module. More...
- virtual Sint32 add_enum_type( const char* name, const IExpression_list* enumerators, const IAnnotation_list* enumerator_annotations, const IAnnotation_block* annotations, bool is_exported, IMdl_execution_context* context) =0
- Adds an enum type to the module. More...
- virtual Sint32 add_function( const char* name, const IExpression* body, const IType_list* parameters, const IExpression_list* defaults, const IAnnotation_list* parameter_annotations, const IAnnotation_block* annotations, const IAnnotation_block* return_annotations, bool is_exported, IType::Modifier frequency_qualifier, IMdl_execution_context* context) =0
- Adds a material or function to the module. More...
- virtual Sint32 add_struct_type( const char* name, const IType_list* fields, const IExpression_list* field_defaults, const IAnnotation_list* field_annotations, const IAnnotation_block* annotations, bool is_exported, IMdl_execution_context* context) =0
- Adds a struct type to the module. More...
- virtual Sint32 add_variant( const char* name, const char* prototype_name, const IExpression_list* defaults, const IAnnotation_block* annotations, const IAnnotation_block* return_annotations, bool is_exported, IMdl_execution_context* context) =0
- Adds a variant to the module. More...
- virtual const IArray* analyze_uniform( const IExpression* root_expr, bool root_expr_uniform, IMdl_execution_context* context) =0
- Analyzes which parameters need to be uniform. More...
- virtual Sint32 clear_module( IMdl_execution_context* context) =0
- Clears the module, i.e., removes all declarations from the module.
- virtual Sint32 remove_entity( const char* name, Size index, IMdl_execution_context* context) =0
- Removes a material, function, enum or struct type from the module. More...
- virtual Sint32 set_module_annotations( const IAnnotation_block* annotations, IMdl_execution_context* context) =0
- Sets the annotations of the module itself. More...
Member Functions
- virtual Sint32 mi::neuraylib::IMdl_module_builder::add_annotation( const char* name, const IType_list* parameters, const IExpression_list* defaults, const IAnnotation_list* parameter_annotations, const IAnnotation_block* annotations, bool is_exported, IMdl_execution_context* context) [pure virtual]
-
Adds an annotation to the module.
Parameters
- name
- The simple name of the annotation.
- parameters
- Types and names of the parameters. Can be NULL (treated like an empty parameter list).
- defaults
- Default values. Can be NULL or incomplete. Feasible sub-expression kinds: constants, calls, and direct calls.
- parameter_annotations
- Parameter annotations. Can be NULL or incomplete.
- annotations
- Annotations of the annotation. Can be NULL.
- is_exported
- Indicates whether the annotation will have the 'export' keyword.
- context
- The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL.
- virtual Sint32 mi::neuraylib::IMdl_module_builder::add_constant( const char* name, const IExpression* expr, const IAnnotation_block* annotations, bool is_exported, IMdl_execution_context* context) [pure virtual]
-
Adds a constant to the module.
Parameters
- name
- The simple name of the constant.
- expr
- The value of the constant. Feasible sub-expression kinds: constants and direct calls.
- annotations
- Annotations of the constant. Can be NULL.
- is_exported
- Indicates whether the constant will have the 'export' keyword.
- context
- The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL.
- virtual Sint32 mi::neuraylib::IMdl_module_builder::add_enum_type( const char* name, const IExpression_list* enumerators, const IAnnotation_list* enumerator_annotations, const IAnnotation_block* annotations, bool is_exported, IMdl_execution_context* context) [pure virtual]
-
Adds an enum type to the module.
Note:Changing a particular enum type, i.e., removing it and re-adding it differently, is not supported.
Parameters
- name
- The simple name of the enum type.
- enumerators
- Enumerators of the enum type. Must not be empty. Feasible sub-expression kinds: constants and direct calls.
- enumerator_annotations
- Enumerator annotations. Can be NULL or incomplete.
- annotations
- Annotations of the enum type. Can be NULL.
- is_exported
- Indicates whether the enum type will have the 'export' keyword.
- context
- The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL.
- virtual Sint32 mi::neuraylib::IMdl_module_builder::add_function( const char* name, const IExpression* body, const IType_list* parameters, const IExpression_list* defaults, const IAnnotation_list* parameter_annotations, const IAnnotation_block* annotations, const IAnnotation_block* return_annotations, bool is_exported, IType::Modifier frequency_qualifier, IMdl_execution_context* context) [pure virtual]
-
Adds a material or function to the module.
Parameters
- name
- The simple name of the material or function.
- body
- The body of the new material or function (constants, direct calls, and parameter references). Feasible sub-expression kinds: constants, direct calls, and parameter references.
- parameters
- Types and names of the parameters. Can be NULL (treated like an empty parameter list).
- defaults
- Default values. Can be NULL or incomplete. Feasible sub-expression kinds: constants, calls, and direct calls.
- parameter_annotations
- Parameter annotations. Can be NULL or incomplete.
- annotations
- Annotations of the material or function. Can be NULL.
- return_annotations
- Return annotations of the function. Can be NULL for functions, must be NULL for materials.
- is_exported
- Indicates whether the material or function will have the 'export' keyword.
- frequency_qualifier
- The frequency qualifier for functions, or mi::neuraylib::IType::MK_NONE for materials.
- context
- The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL.
- virtual Sint32 mi::neuraylib::IMdl_module_builder::add_struct_type( const char* name, const IType_list* fields, const IExpression_list* field_defaults, const IAnnotation_list* field_annotations, const IAnnotation_block* annotations, bool is_exported, IMdl_execution_context* context) [pure virtual]
-
Adds a struct type to the module.
Note:Changing a particular struct type, i.e., removing it and re-adding it differently, is not supported.
Parameters
- name
- The simple name of the enum type.
- fields
- Fields of the struct type. Must not be empty.
- field_defaults
- Defaults of the struct fields. Can be NULL or incomplete. Feasible sub-expression kinds: constants and direct calls.
- field_annotations
- Field annotations of the struct type. Can be NULL or incomplete.
- annotations
- Annotations of the struct type. Can be NULL.
- is_exported
- Indicates whether the struct type will have the 'export' keyword.
- context
- The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL.
- virtual Sint32 mi::neuraylib::IMdl_module_builder::add_variant( const char* name, const char* prototype_name, const IExpression_list* defaults, const IAnnotation_block* annotations, const IAnnotation_block* return_annotations, bool is_exported, IMdl_execution_context* context) [pure virtual]
-
Adds a variant to the module.
Parameters
- name
- The simple name of the material or function variant.
- prototype_name
- The DB name of the prototype of the new variant.
- defaults
- Default values to set. If NULL, the defaults of the original material or function are used. Feasible sub-expression kinds: constants and calls.
- annotations
- Annotations to set. If NULL, the annotations of the original material or function are used. Pass an empty block to remove all annotations.
- return_annotations
- Return annotations to set. If NULL, the annotations of the original material or function are used. Pass an empty block to remove all annotations. Materials require NULL or an empty annotation block here.
- is_exported
- Indicates whether the variant will have the 'export' keyword.
- context
- The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL.
Returns
0 in case of success, or -1 in case of failure.
- virtual const IArray* mi::neuraylib::IMdl_module_builder::analyze_uniform( const IExpression* root_expr, bool root_expr_uniform, IMdl_execution_context* context) [pure virtual]
-
Analyzes which parameters need to be uniform.
Parameters
- root_expr
- Root expression of the graph, i.e., the body of the new material or function.
- root_expr_uniform
- Indicates whether the root expression should be uniform.
- context
- The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL.
Returns
Indicates which parameters need to be uniform. The array might be shorter than expected if trailing parameters are not referenced by root_expr (or in case of errors).
- virtual Sint32 mi::neuraylib::IMdl_module_builder::clear_module( IMdl_execution_context* context) [pure virtual]
-
Clears the module, i.e., removes all declarations from the module.
- virtual Sint32 mi::neuraylib::IMdl_module_builder::remove_entity( const char* name, Size index, IMdl_execution_context* context) [pure virtual]
-
Removes a material, function, enum or struct type from the module.
Parameters
- name
- The simple name of material, function, enum or struct type to be removed.
- index
- The index of the function with the given name to be removed. Used to distinguish overloads of functions. Zero 0 for materials, enum or struct types.
- context
- The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL.
- virtual Sint32 mi::neuraylib::IMdl_module_builder::set_module_annotations( const IAnnotation_block* annotations, IMdl_execution_context* context) [pure virtual]
-
Sets the annotations of the module itself.
Parameters
- annotations
- Annotations of the module. Pass NULL to remove existing annotations.
- context
- The execution context can be used to pass options and to retrieve error and/or warning messages. Can be NULL.