StateChunk *ChunkMaterial::find(const FieldContainerType &type, 
                                      Int32               slot) const
{
    UInt32 index = 0;

    for(UInt32 i = 0; i < _mfChunks.size(); ++i)
    {
        StateChunk *p = _mfChunks[i];

        Int32 s = State::AutoSlotReplace;

        if(i < getMFSlots()->size())
            s = getSlots(i);

        if(s == State::AutoSlotReplace)
            s = index;

        if(p->getType() == type)
        {           
            if(slot == State::AutoSlotReplace || slot == s)
                return (p);

            ++index;
        }
    }

    return NULL;
}