element_set_attribute
Sets an attribute on a database element. If the attribute does not exist it can be created. If the element is of type IMdl_material_instance or IMdl_function_call then by default arguments are set rather than an attribute. Note that it is not possible to set argument references using this command.
References:
- A list of commonly used element level rendering attributes can be found in the neuray library api documentation for the mi::neuraylib::IAttribute_set class.
- A list of commonly used rendering options can be found in the neuray library api documentation for the mi::neuraylib::IOptions class.
- A list of specific types used for shader parameters that reference other database objects (eg: textures, light profiles etc.) can be found in the mi::IRef class.
arguments
-
"attribute_name" : String
The name of the attribute to set.
-
"attribute_type" : String (default: null)
The type of the value being set. This can be any supported neuray library attribute type. If 'create' is set to true then this argument must be supplied so the correct type of attribute can be created. Note that if creating the material array on an instance the type Ref[] must be used. When creating shader parameter references the specific typed reference must be used.
Possible Values:
- Boolean
- Sint8
- Sint16
- Sint32
- Sint64
- Float32
- Float64
- String
- Ref - attribute_value would be the name of the element to reference
- Ref<Texture_1d> - a Texture1d shader parameter.
- Ref<Texture_2d> - a Texture2d shader parameter.
- Ref<Texture_3d> - a Texture3d shader parameter.
- Ref<Texture_cubemap> - a Texture_cube shader parameter.
- Ref<Light> - a Light shader parameter.
- Ref<Lightprofile> - a Light_profile shader parameter.
- Ref<Shader> - a Shader shader parameter.
- Type[N] - array of size N of supplied type.
- Type[] - dynamically sized array of supplied type.
- Boolean<N> - vector of N Booleans.
- Sint32<N> - vector of N Sint32s.
- Float32<N> - vector of N Float32s.
- Float64<N> - vector of N Float64s.
- Float32<M,N> - array of MxN Float32s.
- Float64<M,N> - array of MxN Float64s.
- Color
- Color3
- Spectrum
- Parameter
- Temporary
References:
-
"attribute_value" : Data
The value of the attribute to set.
-
"create" : Boolean (default: false)
A boolean flag indicating if the attribute should be created if it does not exist.
-
"element_name" : String
The name of the database element to set the attribute on.
-
"force_attribute" : Boolean (default: false)
If element is of type IMdl_material_instance or IMdl_function_call then set the actual attribute rather than an argument.