# automatically generated by the FlatBuffers compiler, do not modify

# namespace: FBOutput

import tdw.flatbuffers

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

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

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

    # SubObjectMaterials
    def Name(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.String(o + self._tab.Pos)
        return None

    # SubObjectMaterials
    def Materials(self, j):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.String(a + tdw.flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return ""

    # SubObjectMaterials
    def MaterialsLength(self):
        o = tdw.flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

def SubObjectMaterialsStart(builder): builder.StartObject(2)
def SubObjectMaterialsAddName(builder, name): builder.PrependUOffsetTRelativeSlot(0, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(name), 0)
def SubObjectMaterialsAddMaterials(builder, materials): builder.PrependUOffsetTRelativeSlot(1, tdw.flatbuffers.number_types.UOffsetTFlags.py_type(materials), 0)
def SubObjectMaterialsStartMaterialsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def SubObjectMaterialsEnd(builder): return builder.EndObject()
