The weird code dealing with `MeshPrimitive` didn't increment the material indices pointer for geometry types besides triangle fans. Also use a proper accessor to avoid adding a duplicate material indices attribute, just in case this code is used on existing meshes.