GetMeshMaterial

Category: Objects / Display
Since engine version: 1.0 OC

Description

Returns the material currently set for the calling object. May also be called from definition context to return the default material of the graphics of this definition.

Syntax

string GetMeshMaterial(int submesh);

Parameter

submesh:
[opt] If the mesh is composed of multiple submeshes then this parameter can be used to specify the submesh whose material to query.

Examples

if(GetMeshMaterial() == "Clonk_Body")
	SetMeshMaterial("Clonk_Body_EyesClosed")
else
	SetMeshMaterial("Clonk_Body");
If a clonk has its eyes open then this script makes it close them, otherwise they are opened.
for (var i=0,mat; mat=GetID()->GetMeshMaterial(i); ++i)
	SetMeshMaterial(mat, i);
Resets the mesh material of all submeshes of this object to their respective defaults.
See also: SetMeshMaterial
Clonk-Karl, 2010-04
Sven2, 2014-04