Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp
bool Actor::CheckIfIsMaterialUsed(Mesh* mesh, size_t materialIndex) const
    {
        // check if the mesh is valid
        if (mesh == nullptr)
        {
            return false;
        }

        // iterate through the submeshes
        const size_t numSubMeshes = mesh->GetNumSubMeshes();
        for (size_t s = 0; s < numSubMeshes; ++s)
        {
            // if the submesh material index is the same as the material index we search for, then it is being used
            if (mesh->GetSubMesh(s)->GetMaterial() == materialIndex)
            {
                return true;
            }
        }

        return false;
    }
// check if the material is used by the given mesh
check if the material is used by the given mesh
check if the material is used by the given mesh
bool Actor::CheckIfIsMaterialUsed(Mesh* mesh, size_t materialIndex) const
    {
        if (mesh == nullptr)
        {
            return false;
        }
        const size_t numSubMeshes = mesh->GetNumSubMeshes();
        for (size_t s = 0; s < numSubMeshes; ++s)
        {
            if (mesh->GetSubMesh(s)->GetMaterial() == materialIndex)
            {
                return true;
            }
        }
        return false;
    }
bool Actor :: CheckIfIsMaterialUsed ( Mesh * mesh , size_t materialIndex ) const { if ( mesh == nullptr ) { return false ; } const size_t numSubMeshes = mesh -> GetNumSubMeshes ( ) ; for ( size_t s = 0 ; s < numSubMeshes ; ++ s ) { if ( mesh -> GetSubMesh ( s ) -> GetMaterial ( ) == materialIndex ) { return true ; } } return false ; }
check if the material is used by the given mesh
check if the material is used by the given mesh
// check if the mesh is valid // iterate through the submeshes // if the submesh material index is the same as the material index we search for, then it is being used