<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
  SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
  <func>
    <title>GetMeshMaterial</title>
    <category>Objects</category>
    <subcat>Display</subcat>
    <version>5.1 OC</version>
    <syntax>
      <rtype>string</rtype>
      <params>
        <param>
          <type>int</type>
          <name>submesh</name>
          <desc>If the mesh is composed of multiple submeshes then this parameter can be used to specify the submesh whose material to query.</desc>
          <optional />
        </param>
      </params>
    </syntax>
    <desc>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.</desc>
    <examples>
      <example>
        <code><funclink>if</funclink>(<funclink>GetMeshMaterial</funclink>() == &quot;Clonk_Body&quot;)
	<funclink>SetMeshMaterial</funclink>(&quot;Clonk_Body_EyesClosed&quot;)
else
	<funclink>SetMeshMaterial</funclink>(&quot;Clonk_Body&quot;);</code>
        <text>If a clonk has its eyes open then this script makes it close them, otherwise they are opened.</text>
      </example>
      <example>
        <code><funclink>for</funclink> (var i=0,mat; mat=<funclink>GetID</funclink>()->GetMeshMaterial(i); ++i)
	<funclink>SetMeshMaterial</funclink>(mat, i);</code>
        <text>Resets the mesh material of all submeshes of this object to their respective defaults.</text>
      </example>
    </examples>
    <related><funclink>SetMeshMaterial</funclink></related>
  </func>
  <author>Clonk-Karl</author><date>2010-04</date>
  <author>Sven2</author><date>2014-04</date>
</funcs>
