FxMaterialSet ​
This module contains functions for editing the items of a Material Set. Each material set has 128 items - or materials - which can be refered to by an ItemIndex. All functions of this module work on the open material set. To open a material set use FxFile.Open. A material can only be edited if it is available. To make a new material available use CreateItem. To save the changes made after editing the open material set use FxFile.Save.
Load ​
FxMaterialSet = require "FxMaterialSet";Functions ​
| Function | Description |
|---|---|
| Clear () | Clears all materials. |
| CreateItem () | Creates a new material. |
| DeleteItem (ItemIndex) | Deletes a material. |
| GetItemAlpha (ItemIndex) | Returns the alpha value of a material. |
| GetItemEmissive (ItemIndex) | Returns the emissive value of a material. |
| GetItemMetallic (ItemIndex) | Returns the metallic value of a material. |
| GetItemName (ItemIndex) | Returns the name of a material. |
| GetItemRoughness (ItemIndex) | Returns the roughness value of a material. |
| InitItem (ItemIndex, Metallic, Roughness, Emissive, Alpha) | Initializes a material. |
| SetItemAlpha (ItemIndex, Value) | Sets the alpha value of a material. |
| SetItemEmissive (ItemIndex, Value) | Sets the emissive value of a material. |
| SetItemMetallic (ItemIndex, Value) | Sets the metallic value of a material. |
| SetItemName (ItemIndex, Value) | Sets the name of a material. |
| SetItemRoughness (ItemIndex, Value) | Sets the roughness value of a material. |
Clear () ​
This function deletes all materials from the open material set.
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE
Since ​
Version 1.0
Example ​
FxMaterialSet.Clear();CreateItem () ​
This function creates a material, adds it to the opened material set, initializes it with default values and returns its index.
Returns ​
The ItemIndex of the new material.
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_FILE_OPERATION_FAILED
Since ​
Version 1.0
Example ​
itemindex = FxMaterialSet.CreateItem;DeleteItem (ItemIndex) ​
This function deletes the specified material, making it unavailable.
Parameters ​
- ItemIndex: The ItemIndex of the material to be deleted
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
FxMaterialSet.DeleteItem(20);GetItemAlpha (ItemIndex) ​
This function returns the alpha value of the specified material.
Parameters ​
- ItemIndex: The ItemIndex of the queried material
Returns ​
Alpha value
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
alpha = FxMaterialSet.GetItemAlpha(2);GetItemEmissive (ItemIndex) ​
This function returns the emissive value of the specified material.
Parameters ​
- ItemIndex: The ItemIndex of the queried material
Returns ​
Emissive value
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
emissive = FxMaterialSet.GetItemEmissive(2);GetItemMetallic (ItemIndex) ​
This function returns the metallic value of the specified material.
Parameters ​
- ItemIndex: The ItemIndex of the queried material
Returns ​
Metallic value
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
metallic = FxMaterialSet.GetItemMetallic(2);GetItemName (ItemIndex) ​
This function returns the name of the specified material.
Parameters ​
- ItemIndex: The ItemIndex of the queried material
Returns ​
Name
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
name = FxMaterialSet.GetItemName(2);GetItemRoughness (ItemIndex) ​
This function returns the roughness value of the specified material.
Parameters ​
- ItemIndex: The ItemIndex of the queried material
Returns ​
Roughness value
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
roughness = FxMaterialSet.GetItemRoughness(2);InitItem (ItemIndex, Metallic, Roughness, Emissive, Alpha) ​
This function initializes the specified material with given values.
Parameters ​
- ItemIndex: The ItemIndex of the material to be initialized
- Metallic: The new metallic value
- Roughness: The new roughness value
- Emissive: The new emissive value
- Alpha: The new alpha value
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
FxMaterialSet.InitItem(20, 0.5, 1.0, 0.0, 1.0);SetItemAlpha (ItemIndex, Value) ​
This function sets the alpha value of the specified material. The value is clamped to the range [0.1,1.0]
Parameters ​
- ItemIndex: The ItemIndex of the material
- Value: The new alpha value
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
FxMaterialSet.SetItemAlpha(10, 0.5);SetItemEmissive (ItemIndex, Value) ​
This function sets the emissive value of the specified material. The value is clamped to the range [0.0,1.0]
Parameters ​
- ItemIndex: The ItemIndex of the material
- Value: The new emissive value
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
FxMaterialSet.SetItemEmissive(10, 0.5);SetItemMetallic (ItemIndex, Value) ​
This function sets the metallic value of the specified material. The value is clamped to the range [0.0,1.0]
Parameters ​
- ItemIndex: The ItemIndex of the material
- Value: The new metallic value
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
FxMaterialSet.SetItemMetallic(10, 0.5);SetItemName (ItemIndex, Value) ​
This function sets the name of the specified material.
Parameters ​
- ItemIndex: The ItemIndex of the material
- Value: The new name
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
FxMaterialSet.SetItemName(10, "Fuchsia");SetItemRoughness (ItemIndex, Value) ​
This function sets the roughness value of the specified material. The value is clamped to the range [0.0,1.0]
Parameters ​
- ItemIndex: The ItemIndex of the material
- Value: The new roughness value
Errors ​
Possible errors include FX_REQUIRED_FILE_UNAVAILABLE, FX_ITEM_INDEX_INVALID, FX_ITEM_UNAVAILABLE
Since ​
Version 1.0
Example ​
FxMaterialSet.SetItemRoughness(10, 0.5);