# automatically generated by the FlatBuffers compiler, do not modify

# namespace: FacesoftFlatbuffersSchema

import flatbuffers

class SerializedMorphableModel(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAsSerializedMorphableModel(cls, buf, offset):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = SerializedMorphableModel()
        x.Init(buf, n + offset)
        return x

    # SerializedMorphableModel
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # SerializedMorphableModel
    def Version(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Uint16Flags, o + self._tab.Pos)
        return 0

    # SerializedMorphableModel
    def MeanMesh(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Indirect(o + self._tab.Pos)
            from .SerializedTriMesh import SerializedTriMesh
            obj = SerializedTriMesh()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SerializedMorphableModel
    def Components(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .SerializedComponent import SerializedComponent
            obj = SerializedComponent()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SerializedMorphableModel
    def ComponentsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def SerializedMorphableModelStart(builder): builder.StartObject(3)
def SerializedMorphableModelAddVersion(builder, Version): builder.PrependUint16Slot(0, Version, 0)
def SerializedMorphableModelAddMeanMesh(builder, MeanMesh): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(MeanMesh), 0)
def SerializedMorphableModelAddComponents(builder, Components): builder.PrependUOffsetTRelativeSlot(2, flatbuffers.number_types.UOffsetTFlags.py_type(Components), 0)
def SerializedMorphableModelStartComponentsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def SerializedMorphableModelEnd(builder): return builder.EndObject()
