Skip to content
On this page

class MaterialTable

MaterialTable keeps information on materials used while rendering. Note that the table will make sure that the names of objects added are unique within the table, and will rename objects with non-unique names.

Properties

PropertyDescription
NameThe name of the MaterialTable object. (Inherited from Object)

Methods

MethodDescription
AddItemAdds an item to the table. The returned value is the id of the item within the table, which can be used to retrieve the item using GetItem(). (Inherited from Table)
AddMaterialAdds a material to the table. The returned value is the id of the material within the table.
AddObserverAdds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)
ChangeTexturePrefixPathChanges the prefix path (drive, directory) of all matching texture paths in all the materials in the table, with the new one. This method is useful when external textures are placed in a specific folder, which needs to be moved.
ClearClears the table, and removes all items. If AddItem is called after Clear, the item ids will start over from 0. (Inherited from Table)
CopyClears the current table and copies the items from a source table. (Inherited from Table)
FindIdenticalMaterialFinds a material in the table that is setup identical to the specified material.
FindIdenticalMaterialIdFinds the id of a material in the table that is setup identical to the specified material.
FindIdenticalMaterialIdsFinds the materials in the table that are setup identical to the specified material.
FindItemFinds a named item in the table. If multiple items have the same name, the first will be returned. If no item was found, null will be returned. (Inherited from Table)
FindItemIdFinds the id of an item in the table, using the name. If multiple items have the same name, the first will be returned. If no item was found, the return will be -1. (Inherited from Table)
FindMaterialFinds a material in the table, using the material name. If multiple materials have the same name, the first will be returned. If the material was not found, null is returned.
FindMaterialIdFinds the id of a material in the table, using the material name. If multiple materials have the same name, the first will be returned. If the material was not found, the return will be -1.
GetClassGet the name of the MaterialTable class. (Inherited from Object)
GetItemReturns the i:th item, using the id of the item. (Inherited from Table)
GetItemsCountThe number of item id:s in the table. If an item has been removed, using RemoveItem, the id is still counted in this method. GetIdsCount also equals the id that will be applied to the next item added to the table. (Inherited from Table)
GetMaterialReturns the i:th material, using the id of the material.
GetMaterialChannelsGet all unique material channel names for all materials in table.
GetMaterialChannelsWithTextureInputsGet all unique material channel names having texture inputs for all materials in table.
GetMaterialsCountReturns the number of materials in the table.
IsAReturns true if MaterialTable is a or is a descendant of the class named as the type parameter. (Inherited from Object)
IsNullReturns true if the MaterialTable object is invalid. (Inherited from Object)
IsSameObjectAsReturns true if the MaterialTable object is valid. (Inherited from Object)
NonNullReturns true if the MaterialTable object is valid. (Inherited from Object)
PrintInfoPrints the content/info of the MaterialTable object to the log. (Inherited from Object)
RemoveItemRemoves an item, and invalidates the id. The id will not point at a valid item, until Clear is called and new items are added up until the id. (Inherited from Table)
RemoveMaterialRemoves a material. If GetMaterial is subsequently called with the same material id, the value returned will be null.
RemoveObserverRemoves a previously added observer object. (Inherited from Object)
SetItemSets an item in the table. The id must exist in the table. (Inherited from Table)
SetMaterialSets a material in the table.

Static methods

MethodDescription
IsClassAReturns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)
SafeCastSafeCast makes sure the input object is of a class that can be cast into spMaterialTable, and if this is the case, returns the object cast into spMaterialTable. (Inherited from Object)

Properties details

Name

The name of the MaterialTable object. (Inherited from Object)

Methods details

AddItem

Adds an item to the table. The returned value is the id of the item within the table, which can be used to retrieve the item using GetItem().

AddMaterial

Adds a material to the table. The returned value is the id of the material within the table.

AddObserver

Adds a user-defined observer object to the interface, that will receive events from the interface. (Inherited from Object)

ChangeTexturePrefixPath

Changes the prefix path (drive, directory) of all matching texture paths in all the materials in the table, with the new one. This method is useful when external textures are placed in a specific folder, which needs to be moved.

Clear

Clears the table, and removes all items. If AddItem is called after Clear, the item ids will start over from 0.

Copy

Clears the current table and copies the items from a source table.

FindIdenticalMaterial

Finds a material in the table that is setup identical to the specified material.

FindIdenticalMaterialId

Finds the id of a material in the table that is setup identical to the specified material.

FindIdenticalMaterialIds

Finds the materials in the table that are setup identical to the specified material.

FindItem

Finds a named item in the table. If multiple items have the same name, the first will be returned. If no item was found, null will be returned.

FindItemId

Finds the id of an item in the table, using the name. If multiple items have the same name, the first will be returned. If no item was found, the return will be -1.

FindMaterial

Finds a material in the table, using the material name. If multiple materials have the same name, the first will be returned. If the material was not found, null is returned.

FindMaterialId

Finds the id of a material in the table, using the material name. If multiple materials have the same name, the first will be returned. If the material was not found, the return will be -1.

GetClass

Get the name of the MaterialTable class. (Inherited from Object)

GetItem

Returns the i:th item, using the id of the item.

GetItemsCount

The number of item id:s in the table. If an item has been removed, using RemoveItem, the id is still counted in this method. GetIdsCount also equals the id that will be applied to the next item added to the table.

GetMaterial

Returns the i:th material, using the id of the material.

GetMaterialChannels

Get all unique material channel names for all materials in table.

GetMaterialChannelsWithTextureInputs

Get all unique material channel names having texture inputs for all materials in table.

GetMaterialsCount

Returns the number of materials in the table.

IsA

Returns true if MaterialTable is a or is a descendant of the class named as the type parameter. (Inherited from Object)

IsNull

Returns true if the MaterialTable object is invalid. (Inherited from Object)

IsSameObjectAs

Returns true if the MaterialTable object is valid. (Inherited from Object)

NonNull

Returns true if the MaterialTable object is valid. (Inherited from Object)

PrintInfo

Prints the content/info of the MaterialTable object to the log. (Inherited from Object)

RemoveItem

Removes an item, and invalidates the id. The id will not point at a valid item, until Clear is called and new items are added up until the id.

RemoveMaterial

Removes a material. If GetMaterial is subsequently called with the same material id, the value returned will be null.

RemoveObserver

Removes a previously added observer object. (Inherited from Object)

SetItem

Sets an item in the table. The id must exist in the table.

SetMaterial

Sets a material in the table.

Static methods details

IsClassA

Returns true if the class is a or is a descendant of the class named as the type parameter. (Inherited from Object)

SafeCast

SafeCast makes sure the input object is of a class that can be cast into spMaterialTable, and if this is the case, returns the object cast into spMaterialTable. (Inherited from Object)