class Material
Material object that keeps material information used while rendering.
Properties
Methods
| Method | Description |
| AddMaterialChannel | Add a material channel. |
| ChangeTexturePrefixPath | Changes the prefix path (drive, directory) of all matching texture paths in the material, with the new one. This method is useful when external textures are placed in a specific folder, which needs to be moved. |
| ConvertHandedness | Converts parameters such as UVTiling and UVOffset in shading networks. |
| GetClass | Get the name of the Material class. |
| GetMaterialChannelCount | Returns the number of material channels in the material. |
| GetMaterialChannelFromIndex | Returns the name of a channel from the index. Note that by adding/removing channels the indices are changed, and this method should only be used for enumeration. |
| GetShadingNetwork | Get which shading network to use for the material channel. |
| HasMaterialChannel | Check if the channel exists within the material. |
| IsA | Returns true if Material is a or is a descendant of the class named as the type parameter. |
| IsIdenticalTo | Returns true if the material is setup identical to this material. |
| IsNull | Returns true if the Material object is invalid. |
| IsTransparent | Returns true if the material could be transparent. |
| LoadShadingNetworkFromXML | Save shading network to XML. |
| RemoveMaterialChannel | Remove a material channel. |
| SaveShadingNetworkToXML | Save shading network to XML. |
| SetOpacityFromDiffuseAlpha | Maps the alpha component of the diffuse channel to all the RGBA components in the opacity channel (by using a swizzle node). |
| SetShadingNetwork | Set which shading network to use for the material channel. |
Static methods
| Method | Description |
| IsClassA | Returns true if the class is a or is a descendant of the class named as the type parameter. |
| SafeCast | SafeCast makes sure the input object is of a class that can be cast into spMaterial, and if this is the case, returns the object cast into spMaterial. |
Properties details
MaterialGUID
The unique id for this node.
Syntax
SetMaterialGUID parameters
| Type | Name | Min | Max | Description |
const char * | value | | | The node id of type string. |
GetMaterialGUID return value
Type: spString
Syntax
SetMaterialGUID parameters
| Type | Name | Min | Max | Description |
string | value | | | The node id of type string. |
GetMaterialGUID return value
Type: string
Syntax
SetMaterialGUID parameters
| Name | Type | Min | Max | Description |
| value | str | | | The node id of type string. |
GetMaterialGUID return value
Type: str
MaterialType
The MaterialType.
Syntax
SetMaterialType parameters
| Type | Name | Min | Max | Description |
| EMaterialType | value | | | The Material type. One of the following: Standard -> Use the standard shaderSG_MATERIALTYPE_FLIPBOOK -> Use the flipbook shader. BillboardCloud -> Use the billboard cloud shader. |
GetMaterialType return value
Type: EMaterialType
Default: Standard
| Key | Value | Comment |
| Standard | 0 | Use the standard shader. |
| Flipbook | 1 | Use the flipbook shader. |
| BillboardCloud | 2 | Use the billboard cloud shader. |
Syntax
SetMaterialType parameters
| Type | Name | Min | Max | Description |
| EMaterialType | value | | | The Material type. One of the following: Standard -> Use the standard shaderSG_MATERIALTYPE_FLIPBOOK -> Use the flipbook shader. BillboardCloud -> Use the billboard cloud shader. |
GetMaterialType return value
Type: ``````
Default: Standard
| Key | Value | Comment |
| Standard | 0 | Use the standard shader. |
| Flipbook | 1 | Use the flipbook shader. |
| BillboardCloud | 2 | Use the billboard cloud shader. |
Syntax
SetMaterialType parameters
| Name | Type | Min | Max | Description |
| value | EMaterialType | | | The Material type. One of the following: Standard -> Use the standard shaderSG_MATERIALTYPE_FLIPBOOK -> Use the flipbook shader. BillboardCloud -> Use the billboard cloud shader. |
GetMaterialType return value
Type: EMaterialType
Default: Standard
| Key | Value | Comment |
| EMaterialType_Standard | 0 | Use the standard shader. |
| EMaterialType_Flipbook | 1 | Use the flipbook shader. |
| EMaterialType_BillboardCloud | 2 | Use the billboard cloud shader. |
UseTangentSpaceNormals
The UseTangentSpaceNormals flag. If set, the normal map has tangent space normals.
Syntax
SetUseTangentSpaceNormals parameters
| Type | Name | Min | Max | Description |
bool | value | | | The desired flag value. |
GetUseTangentSpaceNormals return value
Type: bool
Syntax
SetUseTangentSpaceNormals parameters
| Type | Name | Min | Max | Description |
bool | value | | | The desired flag value. |
GetUseTangentSpaceNormals return value
Type: bool
Syntax
SetUseTangentSpaceNormals parameters
| Name | Type | Min | Max | Description |
| value | bool | | | The desired flag value. |
GetUseTangentSpaceNormals return value
Type: bool
Methods details
AddMaterialChannel
Add a material channel.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | channel_name | | | The name of the material channel. |
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | channel_name | | | The name of the material channel. |
Syntax
Parameters
| Name | Type | Min | Max | Description |
| channel_name | str | | | The name of the material channel. |
ChangeTexturePrefixPath
Changes the prefix path (drive, directory) of all matching texture paths in the material, with the new one. This method is useful when external textures are placed in a specific folder, which needs to be moved.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | current_path_prefix | | | The current prefix path, either relative or absolute. |
const char * | new_path_prefix | | | The new prefix path. |
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | current_path_prefix | | | The current prefix path, either relative or absolute. |
string | new_path_prefix | | | The new prefix path. |
Syntax
Parameters
| Name | Type | Min | Max | Description |
| current_path_prefix | str | | | The current prefix path, either relative or absolute. |
| new_path_prefix | str | | | The new prefix path. |
ConvertHandedness
Converts parameters such as UVTiling and UVOffset in shading networks.
Syntax
Parameters
ConvertHandedness takes no parameters.
Syntax
Parameters
ConvertHandedness takes no parameters.
Syntax
Parameters
ConvertHandedness takes no parameters.
GetClass
Get the name of the Material class.
Syntax
Parameters
GetClass takes no parameters.
Return value
Type: spString
Syntax
Parameters
GetClass takes no parameters.
Return value
Type: string
Syntax
Parameters
GetClass takes no parameters.
Return value
Type: str
GetMaterialChannelCount
Returns the number of material channels in the material.
Syntax
Parameters
GetMaterialChannelCount takes no parameters.
Return value
Type: unsigned int
Syntax
Parameters
GetMaterialChannelCount takes no parameters.
Return value
Type: uint
Syntax
Parameters
GetMaterialChannelCount takes no parameters.
Return value
Type: int
GetMaterialChannelFromIndex
Returns the name of a channel from the index. Note that by adding/removing channels the indices are changed, and this method should only be used for enumeration.
Syntax
Parameters
| Type | Name | Min | Max | Description |
rid | index | | | The index to the channel to be fetched. |
Return value
Type: spString
Syntax
Parameters
| Type | Name | Min | Max | Description |
rid | index | | | The index to the channel to be fetched. |
Return value
Type: string
Syntax
Parameters
| Name | Type | Min | Max | Description |
| index | int | | | The index to the channel to be fetched. |
Return value
Type: str
GetShadingNetwork
Get which shading network to use for the material channel.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | channel_name | | | The name of the channel. |
Return value
Type: ShadingNode
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | channel_name | | | The name of the channel. |
Return value
Type: ShadingNode
Syntax
Parameters
| Name | Type | Min | Max | Description |
| channel_name | str | | | The name of the channel. |
Return value
Type: ShadingNode
HasMaterialChannel
Check if the channel exists within the material.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | channel_name | | | The name of the material channel. |
Return value
Type: bool
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | channel_name | | | The name of the material channel. |
Return value
Type: bool
Syntax
Parameters
| Name | Type | Min | Max | Description |
| channel_name | str | | | The name of the material channel. |
Return value
Type: bool
IsA
Returns true if Material is a or is a descendant of the class named as the type parameter.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | type | | | Name of the class to check if Material is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | type | | | Name of the class to check if Material is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
| Name | Type | Min | Max | Description |
| type | str | | | Name of the class to check if Material is, or is a descendant of. |
Return value
Type: bool
IsIdenticalTo
Returns true if the material is setup identical to this material.
Syntax
Parameters
| Type | Name | Min | Max | Description |
| Material | mat | | | The material to compare to. |
Return value
Type: bool
Syntax
Parameters
| Type | Name | Min | Max | Description |
| Material | mat | | | The material to compare to. |
Return value
Type: bool
Syntax
Parameters
| Name | Type | Min | Max | Description |
| mat | Material | | | The material to compare to. |
Return value
Type: bool
IsNull
Returns true if the Material object is invalid.
Syntax
Parameters
IsNull takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsNull takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsNull takes no parameters.
Return value
Type: bool
IsTransparent
Returns true if the material could be transparent.
Syntax
Parameters
IsTransparent takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsTransparent takes no parameters.
Return value
Type: bool
Syntax
Parameters
IsTransparent takes no parameters.
Return value
Type: bool
LoadShadingNetworkFromXML
Save shading network to XML.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | channel_name | | | The name of the channel. |
const char * | in_xml | | | The xml descriping the shading node graph. |
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | channel_name | | | The name of the channel. |
string | in_xml | | | The xml descriping the shading node graph. |
Syntax
Parameters
| Name | Type | Min | Max | Description |
| channel_name | str | | | The name of the channel. |
| in_xml | str | | | The xml descriping the shading node graph. |
RemoveMaterialChannel
Remove a material channel.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | channel_name | | | The name of the material channel. |
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | channel_name | | | The name of the material channel. |
Syntax
Parameters
| Name | Type | Min | Max | Description |
| channel_name | str | | | The name of the material channel. |
SaveShadingNetworkToXML
Save shading network to XML.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | channel_name | | | The name of the channel. |
Return value
Type: spString
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | channel_name | | | The name of the channel. |
Return value
Type: string
Syntax
Parameters
| Name | Type | Min | Max | Description |
| channel_name | str | | | The name of the channel. |
Return value
Type: str
SetOpacityFromDiffuseAlpha
Maps the alpha component of the diffuse channel to all the RGBA components in the opacity channel (by using a swizzle node).
Syntax
Parameters
SetOpacityFromDiffuseAlpha takes no parameters.
Syntax
Parameters
SetOpacityFromDiffuseAlpha takes no parameters.
Syntax
Parameters
SetOpacityFromDiffuseAlpha takes no parameters.
SetShadingNetwork
Set which shading network to use for the material channel.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | channel_name | | | The name of the new channel. |
ShadingNode | node | | | The shading network exit node. |
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | channel_name | | | The name of the new channel. |
ShadingNode | node | | | The shading network exit node. |
Syntax
Parameters
| Name | Type | Min | Max | Description |
| channel_name | str | | | The name of the new channel. |
| node | ShadingNode | | | The shading network exit node. |
Static methods details
IsClassA
Returns true if the class is a or is a descendant of the class named as the type parameter.
Syntax
Parameters
| Type | Name | Min | Max | Description |
const char * | type | | | Name of the class to check if the class is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
| Type | Name | Min | Max | Description |
string | type | | | Name of the class to check if the class is, or is a descendant of. |
Return value
Type: bool
Syntax
Parameters
| Name | Type | Min | Max | Description |
| type | str | | | Name of the class to check if the class is, or is a descendant of. |
Return value
Type: bool
SafeCast
SafeCast makes sure the input object is of a class that can be cast into spMaterial, and if this is the case, returns the object cast into spMaterial.
Syntax
Parameters
| Type | Name | Min | Max | Description |
Object | object | | | Object to cast. |
Return value
Type: Material
Syntax
Parameters
| Type | Name | Min | Max | Description |
Object | object | | | Object to cast. |
Return value
Type: Material
Syntax
Parameters
| Name | Type | Min | Max | Description |
| object | Object | | | Object to cast. |
Return value
Type: Material