- Main Page
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Classes | Public Types | Public Member Functions | Protected Member Functions | Friends

# FbxLayerElementMaterial Class Reference

This reference page is linked to from the following overview topics: Layered Textures, List of Python Fbx classes.

Search for all occurrences

## Detailed Description

Layer element for mapping materials (FbxSurfaceMaterial) to a geometry.

FBX SDK 2011 and later connects materials (FbxSurfaceMaterial) to nodes (FbxNode). The direct array of this class is no longer used. The integer "n" in the index array of this class represents the n-th material (zero-based) connected to the node.

For example:

Mapping mode eAllSame and index array {0} means the whole geometry is assigned with the 0-th material connected to the node.

Mapping mode eByPolygon and index array {0, 1} means the first polygon is assigned with the 0-th material and the second polygon is assigned with the 1-th material.

You can access the materials from a node by using FbxNode::GetMaterialCount() and FbxNode::GetMaterial(int pIndex) or the more generic calls to GetSrcObjectCount(FBX_TYPE(FbxSurfaceMaterial)) and GetSrcObject(FBX_TYPE(FbxSurfaceMaterial), index)

For example:

     FbxNode* node;
     int nbMat = node->GetMaterialCount();
     int nbMat1= node->GetSrcObjectCount(FBX_TYPE(FbxSurfaceMaterial));

     FbxSurfaceMaterial* material;
     FbxLayerElementMaterial* layerElement;
     if (layerElement->GetMappingMode() == FbxLayerElement::eAllSame)
     {
         int index = layerElement->GetIndexArray()[0];
         material = node->GetMaterial(index);
     }

Remarks:
  The DirectArray() methods still exist for legacy reasons but has been made private and should not be used. Therefore, to be correctly saved in FBX file, this type of Layer element should have its reference mode set to eIndexToDirect.

See also:
  FbxSurfaceMaterial
  FbxNode

Examples:

  Common/GeometryUtility.cxx, ExportDocument/main.cxx, ExportScene02/main.cxx, ExportScene03/main.cxx, ImportScene/DisplayMesh.cxx, Instances/main.cxx, Layers/main.cxx, and ProceduralTexture/main.cxx.

Definition at line 1407 of file fbxlayer.h.

`#include <fbxlayer.h>`

Inheritance diagram for FbxLayerElementMaterial:
[legend]

List of all members.

## Classes
class | LayerElementArrayProxy
## Public Types
typedef FbxLayerElementTemplate < FbxSurfaceMaterial * > | ParentClass
## Public Member Functions
| FBXSDK_LAYER_ELEMENT_CREATE_DECLARE (LayerElementMaterial)
| Allocation method.
virtual void | AllocateArrays ()
virtual void | SetOwner (FbxLayerContainer *pOwner, int pInstance=0)
virtual void | SetInstance (int pInstance)
## Protected Member Functions
| FbxLayerElementMaterial ()
| ~FbxLayerElementMaterial ()
## Friends
class | FbxLayerContainer

## Member Typedef Documentation

typedef FbxLayerElementTemplate<FbxSurfaceMaterial*> ParentClass

Search for all occurrences

Definition at line 1410 of file fbxlayer.h.

## Constructor & Destructor Documentation

FbxLayerElementMaterial | ( |  | ) | `[protected]`

~FbxLayerElementMaterial | ( |  | ) | `[protected]`

## Member Function Documentation

FBXSDK_LAYER_ELEMENT_CREATE_DECLARE | ( | LayerElementMaterial |  | ) |

Search for all occurrences

Allocation method.

Returns:
  A pointer to the layer element or `NULL` if creation fails.

virtual void AllocateArrays | ( |  | ) | `[virtual]`

Search for all occurrences

Reimplemented from FbxLayerElementTemplate< FbxSurfaceMaterial * >.

virtual void SetOwner | ( | FbxLayerContainer * | pOwner,
|  | int | pInstance = `0`
| ) |  | `[virtual]`

Search for all occurrences

virtual void SetInstance | ( | int | pInstance | ) | `[inline, virtual]`

Search for all occurrences

Definition at line 1443 of file fbxlayer.h.

    { SetOwner( mOwner, pInstance ); }

## Friends And Related Function Documentation

friend class FbxLayerContainer `[friend]`

Search for all occurrences

Reimplemented from FbxLayerElement.

Definition at line 1460 of file fbxlayer.h.

The documentation for this class was generated from the following file:

- fbxsdk/scene/geometry/fbxlayer.h

FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial
FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial FbxLayerElementMaterial