# automatically generated by the FlatBuffers compiler, do not modify # namespace: Example import flatbuffers from flatbuffers.compat import import_numpy np = import_numpy() # an example documentation comment: "monster object" class Monster(object): __slots__ = ['_tab'] @classmethod def GetRootAsMonster(cls, buf, offset): n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset) x = Monster() x.Init(buf, n + offset) return x @classmethod def MonsterBufferHasIdentifier(cls, buf, offset, size_prefixed=False): return flatbuffers.util.BufferHasIdentifier(buf, offset, b"\x4D\x4F\x4E\x53", size_prefixed=size_prefixed) # Monster def Init(self, buf, pos): self._tab = flatbuffers.table.Table(buf, pos) # Monster def Pos(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4)) if o != 0: x = o + self._tab.Pos from MyGame.Example.Vec3 import Vec3 obj = Vec3() obj.Init(self._tab.Bytes, x) return obj return None # Monster def Mana(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6)) if o != 0: return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos) return 150 # Monster def Hp(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8)) if o != 0: return self._tab.Get(flatbuffers.number_types.Int16Flags, o + self._tab.Pos) return 100 # Monster def Name(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10)) if o != 0: return self._tab.String(o + self._tab.Pos) return None # Monster def Inventory(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) return 0 # Monster def InventoryAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) return 0 # Monster def InventoryLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def InventoryIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14)) return o == 0 # Monster def Color(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) return 8 # Monster def TestType(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) return 0 # Monster def Test(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(20)) if o != 0: from flatbuffers.table import Table obj = Table(bytearray(), 0) self._tab.Union(obj, o) return obj return None # Monster def Test4(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) if o != 0: x = self._tab.Vector(o) x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 from MyGame.Example.Test import Test obj = Test() obj.Init(self._tab.Bytes, x) return obj return None # Monster def Test4Length(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def Test4IsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(22)) return o == 0 # Monster def Testarrayofstring(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) if o != 0: a = self._tab.Vector(o) return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) return "" # Monster def TestarrayofstringLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def TestarrayofstringIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(24)) return o == 0 # an example documentation comment: this will end up in the generated code # multiline too # Monster def Testarrayoftables(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) if o != 0: x = self._tab.Vector(o) x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 x = self._tab.Indirect(x) from MyGame.Example.Monster import Monster obj = Monster() obj.Init(self._tab.Bytes, x) return obj return None # Monster def TestarrayoftablesLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def TestarrayoftablesIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(26)) return o == 0 # Monster def Enemy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(28)) if o != 0: x = self._tab.Indirect(o + self._tab.Pos) from MyGame.Example.Monster import Monster obj = Monster() obj.Init(self._tab.Bytes, x) return obj return None # Monster def Testnestedflatbuffer(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) return 0 # Monster def TestnestedflatbufferAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) return 0 # Monster def TestnestedflatbufferLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def TestnestedflatbufferIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(30)) return o == 0 # Monster def Testempty(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(32)) if o != 0: x = self._tab.Indirect(o + self._tab.Pos) from MyGame.Example.Stat import Stat obj = Stat() obj.Init(self._tab.Bytes, x) return obj return None # Monster def Testbool(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(34)) if o != 0: return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos)) return False # Monster def Testhashs32Fnv1(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(36)) if o != 0: return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) return 0 # Monster def Testhashu32Fnv1(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(38)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) return 0 # Monster def Testhashs64Fnv1(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(40)) if o != 0: return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) return 0 # Monster def Testhashu64Fnv1(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(42)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos) return 0 # Monster def Testhashs32Fnv1a(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(44)) if o != 0: return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos) return 0 # Monster def Testhashu32Fnv1a(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(46)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint32Flags, o + self._tab.Pos) return 0 # Monster def Testhashs64Fnv1a(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(48)) if o != 0: return self._tab.Get(flatbuffers.number_types.Int64Flags, o + self._tab.Pos) return 0 # Monster def Testhashu64Fnv1a(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(50)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos) return 0 # Monster def Testarrayofbools(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(52)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.BoolFlags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) return 0 # Monster def TestarrayofboolsAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(52)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.BoolFlags, o) return 0 # Monster def TestarrayofboolsLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(52)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def TestarrayofboolsIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(52)) return o == 0 # Monster def Testf(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(54)) if o != 0: return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) return 3.14159 # Monster def Testf2(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(56)) if o != 0: return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) return 3.0 # Monster def Testf3(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(58)) if o != 0: return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos) return 0.0 # Monster def Testarrayofstring2(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60)) if o != 0: a = self._tab.Vector(o) return self._tab.String(a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4)) return "" # Monster def Testarrayofstring2Length(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def Testarrayofstring2IsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(60)) return o == 0 # Monster def Testarrayofsortedstruct(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62)) if o != 0: x = self._tab.Vector(o) x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 8 from MyGame.Example.Ability import Ability obj = Ability() obj.Init(self._tab.Bytes, x) return obj return None # Monster def TestarrayofsortedstructLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def TestarrayofsortedstructIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(62)) return o == 0 # Monster def Flex(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) return 0 # Monster def FlexAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) return 0 # Monster def FlexLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def FlexIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(64)) return o == 0 # Monster def Test5(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(66)) if o != 0: x = self._tab.Vector(o) x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 from MyGame.Example.Test import Test obj = Test() obj.Init(self._tab.Bytes, x) return obj return None # Monster def Test5Length(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(66)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def Test5IsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(66)) return o == 0 # Monster def VectorOfLongs(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(68)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.Int64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) return 0 # Monster def VectorOfLongsAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(68)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Int64Flags, o) return 0 # Monster def VectorOfLongsLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(68)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def VectorOfLongsIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(68)) return o == 0 # Monster def VectorOfDoubles(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(70)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.Float64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) return 0 # Monster def VectorOfDoublesAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(70)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float64Flags, o) return 0 # Monster def VectorOfDoublesLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(70)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def VectorOfDoublesIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(70)) return o == 0 # Monster def ParentNamespaceTest(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(72)) if o != 0: x = self._tab.Indirect(o + self._tab.Pos) from MyGame.InParentNamespace import InParentNamespace obj = InParentNamespace() obj.Init(self._tab.Bytes, x) return obj return None # Monster def VectorOfReferrables(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(74)) if o != 0: x = self._tab.Vector(o) x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 x = self._tab.Indirect(x) from MyGame.Example.Referrable import Referrable obj = Referrable() obj.Init(self._tab.Bytes, x) return obj return None # Monster def VectorOfReferrablesLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(74)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def VectorOfReferrablesIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(74)) return o == 0 # Monster def SingleWeakReference(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(76)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos) return 0 # Monster def VectorOfWeakReferences(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(78)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.Uint64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) return 0 # Monster def VectorOfWeakReferencesAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(78)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint64Flags, o) return 0 # Monster def VectorOfWeakReferencesLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(78)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def VectorOfWeakReferencesIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(78)) return o == 0 # Monster def VectorOfStrongReferrables(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(80)) if o != 0: x = self._tab.Vector(o) x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4 x = self._tab.Indirect(x) from MyGame.Example.Referrable import Referrable obj = Referrable() obj.Init(self._tab.Bytes, x) return obj return None # Monster def VectorOfStrongReferrablesLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(80)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def VectorOfStrongReferrablesIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(80)) return o == 0 # Monster def CoOwningReference(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(82)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos) return 0 # Monster def VectorOfCoOwningReferences(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(84)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.Uint64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) return 0 # Monster def VectorOfCoOwningReferencesAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(84)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint64Flags, o) return 0 # Monster def VectorOfCoOwningReferencesLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(84)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def VectorOfCoOwningReferencesIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(84)) return o == 0 # Monster def NonOwningReference(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(86)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint64Flags, o + self._tab.Pos) return 0 # Monster def VectorOfNonOwningReferences(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(88)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.Uint64Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 8)) return 0 # Monster def VectorOfNonOwningReferencesAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(88)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint64Flags, o) return 0 # Monster def VectorOfNonOwningReferencesLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(88)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def VectorOfNonOwningReferencesIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(88)) return o == 0 # Monster def AnyUniqueType(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(90)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) return 0 # Monster def AnyUnique(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(92)) if o != 0: from flatbuffers.table import Table obj = Table(bytearray(), 0) self._tab.Union(obj, o) return obj return None # Monster def AnyAmbiguousType(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(94)) if o != 0: return self._tab.Get(flatbuffers.number_types.Uint8Flags, o + self._tab.Pos) return 0 # Monster def AnyAmbiguous(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(96)) if o != 0: from flatbuffers.table import Table obj = Table(bytearray(), 0) self._tab.Union(obj, o) return obj return None # Monster def VectorOfEnums(self, j): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(98)) if o != 0: a = self._tab.Vector(o) return self._tab.Get(flatbuffers.number_types.Uint8Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 1)) return 0 # Monster def VectorOfEnumsAsNumpy(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(98)) if o != 0: return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Uint8Flags, o) return 0 # Monster def VectorOfEnumsLength(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(98)) if o != 0: return self._tab.VectorLen(o) return 0 # Monster def VectorOfEnumsIsNone(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(98)) return o == 0 # Monster def SignedEnum(self): o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(100)) if o != 0: return self._tab.Get(flatbuffers.number_types.Int8Flags, o + self._tab.Pos) return -1 def MonsterStart(builder): builder.StartObject(49) def MonsterAddPos(builder, pos): builder.PrependStructSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(pos), 0) def MonsterAddMana(builder, mana): builder.PrependInt16Slot(1, mana, 150) def MonsterAddHp(builder, hp): builder.PrependInt16Slot(2, hp, 100) def MonsterAddName(builder, name): builder.PrependUOffsetTRelativeSlot(3, flatbuffers.number_types.UOffsetTFlags.py_type(name), 0) def MonsterAddInventory(builder, inventory): builder.PrependUOffsetTRelativeSlot(5, flatbuffers.number_types.UOffsetTFlags.py_type(inventory), 0) def MonsterStartInventoryVector(builder, numElems): return builder.StartVector(1, numElems, 1) def MonsterAddColor(builder, color): builder.PrependUint8Slot(6, color, 8) def MonsterAddTestType(builder, testType): builder.PrependUint8Slot(7, testType, 0) def MonsterAddTest(builder, test): builder.PrependUOffsetTRelativeSlot(8, flatbuffers.number_types.UOffsetTFlags.py_type(test), 0) def MonsterAddTest4(builder, test4): builder.PrependUOffsetTRelativeSlot(9, flatbuffers.number_types.UOffsetTFlags.py_type(test4), 0) def MonsterStartTest4Vector(builder, numElems): return builder.StartVector(4, numElems, 2) def MonsterAddTestarrayofstring(builder, testarrayofstring): builder.PrependUOffsetTRelativeSlot(10, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring), 0) def MonsterStartTestarrayofstringVector(builder, numElems): return builder.StartVector(4, numElems, 4) def MonsterAddTestarrayoftables(builder, testarrayoftables): builder.PrependUOffsetTRelativeSlot(11, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayoftables), 0) def MonsterStartTestarrayoftablesVector(builder, numElems): return builder.StartVector(4, numElems, 4) def MonsterAddEnemy(builder, enemy): builder.PrependUOffsetTRelativeSlot(12, flatbuffers.number_types.UOffsetTFlags.py_type(enemy), 0) def MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer): builder.PrependUOffsetTRelativeSlot(13, flatbuffers.number_types.UOffsetTFlags.py_type(testnestedflatbuffer), 0) def MonsterStartTestnestedflatbufferVector(builder, numElems): return builder.StartVector(1, numElems, 1) def MonsterAddTestempty(builder, testempty): builder.PrependUOffsetTRelativeSlot(14, flatbuffers.number_types.UOffsetTFlags.py_type(testempty), 0) def MonsterAddTestbool(builder, testbool): builder.PrependBoolSlot(15, testbool, 0) def MonsterAddTesthashs32Fnv1(builder, testhashs32Fnv1): builder.PrependInt32Slot(16, testhashs32Fnv1, 0) def MonsterAddTesthashu32Fnv1(builder, testhashu32Fnv1): builder.PrependUint32Slot(17, testhashu32Fnv1, 0) def MonsterAddTesthashs64Fnv1(builder, testhashs64Fnv1): builder.PrependInt64Slot(18, testhashs64Fnv1, 0) def MonsterAddTesthashu64Fnv1(builder, testhashu64Fnv1): builder.PrependUint64Slot(19, testhashu64Fnv1, 0) def MonsterAddTesthashs32Fnv1a(builder, testhashs32Fnv1a): builder.PrependInt32Slot(20, testhashs32Fnv1a, 0) def MonsterAddTesthashu32Fnv1a(builder, testhashu32Fnv1a): builder.PrependUint32Slot(21, testhashu32Fnv1a, 0) def MonsterAddTesthashs64Fnv1a(builder, testhashs64Fnv1a): builder.PrependInt64Slot(22, testhashs64Fnv1a, 0) def MonsterAddTesthashu64Fnv1a(builder, testhashu64Fnv1a): builder.PrependUint64Slot(23, testhashu64Fnv1a, 0) def MonsterAddTestarrayofbools(builder, testarrayofbools): builder.PrependUOffsetTRelativeSlot(24, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofbools), 0) def MonsterStartTestarrayofboolsVector(builder, numElems): return builder.StartVector(1, numElems, 1) def MonsterAddTestf(builder, testf): builder.PrependFloat32Slot(25, testf, 3.14159) def MonsterAddTestf2(builder, testf2): builder.PrependFloat32Slot(26, testf2, 3.0) def MonsterAddTestf3(builder, testf3): builder.PrependFloat32Slot(27, testf3, 0.0) def MonsterAddTestarrayofstring2(builder, testarrayofstring2): builder.PrependUOffsetTRelativeSlot(28, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofstring2), 0) def MonsterStartTestarrayofstring2Vector(builder, numElems): return builder.StartVector(4, numElems, 4) def MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct): builder.PrependUOffsetTRelativeSlot(29, flatbuffers.number_types.UOffsetTFlags.py_type(testarrayofsortedstruct), 0) def MonsterStartTestarrayofsortedstructVector(builder, numElems): return builder.StartVector(8, numElems, 4) def MonsterAddFlex(builder, flex): builder.PrependUOffsetTRelativeSlot(30, flatbuffers.number_types.UOffsetTFlags.py_type(flex), 0) def MonsterStartFlexVector(builder, numElems): return builder.StartVector(1, numElems, 1) def MonsterAddTest5(builder, test5): builder.PrependUOffsetTRelativeSlot(31, flatbuffers.number_types.UOffsetTFlags.py_type(test5), 0) def MonsterStartTest5Vector(builder, numElems): return builder.StartVector(4, numElems, 2) def MonsterAddVectorOfLongs(builder, vectorOfLongs): builder.PrependUOffsetTRelativeSlot(32, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfLongs), 0) def MonsterStartVectorOfLongsVector(builder, numElems): return builder.StartVector(8, numElems, 8) def MonsterAddVectorOfDoubles(builder, vectorOfDoubles): builder.PrependUOffsetTRelativeSlot(33, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfDoubles), 0) def MonsterStartVectorOfDoublesVector(builder, numElems): return builder.StartVector(8, numElems, 8) def MonsterAddParentNamespaceTest(builder, parentNamespaceTest): builder.PrependUOffsetTRelativeSlot(34, flatbuffers.number_types.UOffsetTFlags.py_type(parentNamespaceTest), 0) def MonsterAddVectorOfReferrables(builder, vectorOfReferrables): builder.PrependUOffsetTRelativeSlot(35, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfReferrables), 0) def MonsterStartVectorOfReferrablesVector(builder, numElems): return builder.StartVector(4, numElems, 4) def MonsterAddSingleWeakReference(builder, singleWeakReference): builder.PrependUint64Slot(36, singleWeakReference, 0) def MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences): builder.PrependUOffsetTRelativeSlot(37, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfWeakReferences), 0) def MonsterStartVectorOfWeakReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8) def MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables): builder.PrependUOffsetTRelativeSlot(38, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfStrongReferrables), 0) def MonsterStartVectorOfStrongReferrablesVector(builder, numElems): return builder.StartVector(4, numElems, 4) def MonsterAddCoOwningReference(builder, coOwningReference): builder.PrependUint64Slot(39, coOwningReference, 0) def MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences): builder.PrependUOffsetTRelativeSlot(40, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfCoOwningReferences), 0) def MonsterStartVectorOfCoOwningReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8) def MonsterAddNonOwningReference(builder, nonOwningReference): builder.PrependUint64Slot(41, nonOwningReference, 0) def MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences): builder.PrependUOffsetTRelativeSlot(42, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfNonOwningReferences), 0) def MonsterStartVectorOfNonOwningReferencesVector(builder, numElems): return builder.StartVector(8, numElems, 8) def MonsterAddAnyUniqueType(builder, anyUniqueType): builder.PrependUint8Slot(43, anyUniqueType, 0) def MonsterAddAnyUnique(builder, anyUnique): builder.PrependUOffsetTRelativeSlot(44, flatbuffers.number_types.UOffsetTFlags.py_type(anyUnique), 0) def MonsterAddAnyAmbiguousType(builder, anyAmbiguousType): builder.PrependUint8Slot(45, anyAmbiguousType, 0) def MonsterAddAnyAmbiguous(builder, anyAmbiguous): builder.PrependUOffsetTRelativeSlot(46, flatbuffers.number_types.UOffsetTFlags.py_type(anyAmbiguous), 0) def MonsterAddVectorOfEnums(builder, vectorOfEnums): builder.PrependUOffsetTRelativeSlot(47, flatbuffers.number_types.UOffsetTFlags.py_type(vectorOfEnums), 0) def MonsterStartVectorOfEnumsVector(builder, numElems): return builder.StartVector(1, numElems, 1) def MonsterAddSignedEnum(builder, signedEnum): builder.PrependInt8Slot(48, signedEnum, -1) def MonsterEnd(builder): return builder.EndObject() import MyGame.Example.Ability import MyGame.Example.Any import MyGame.Example.AnyAmbiguousAliases import MyGame.Example.AnyUniqueAliases import MyGame.Example.Referrable import MyGame.Example.Stat import MyGame.Example.Test import MyGame.Example.TestSimpleTableWithEnum import MyGame.Example.Vec3 import MyGame.Example2.Monster import MyGame.InParentNamespace try: from typing import List, Optional, Union except: pass class MonsterT(object): # MonsterT def __init__(self): self.pos = None # type: Optional[MyGame.Example.Vec3.Vec3T] self.mana = 150 # type: int self.hp = 100 # type: int self.name = None # type: str self.inventory = None # type: List[int] self.color = 8 # type: int self.testType = 0 # type: int self.test = None # type: Union[None, MyGame.Example.Monster.MonsterT, MyGame.Example.TestSimpleTableWithEnum.TestSimpleTableWithEnumT, MyGame.Example2.Monster.MonsterT] self.test4 = None # type: List[MyGame.Example.Test.TestT] self.testarrayofstring = None # type: List[str] self.testarrayoftables = None # type: List[MyGame.Example.Monster.MonsterT] self.enemy = None # type: Optional[MyGame.Example.Monster.MonsterT] self.testnestedflatbuffer = None # type: List[int] self.testempty = None # type: Optional[MyGame.Example.Stat.StatT] self.testbool = False # type: bool self.testhashs32Fnv1 = 0 # type: int self.testhashu32Fnv1 = 0 # type: int self.testhashs64Fnv1 = 0 # type: int self.testhashu64Fnv1 = 0 # type: int self.testhashs32Fnv1a = 0 # type: int self.testhashu32Fnv1a = 0 # type: int self.testhashs64Fnv1a = 0 # type: int self.testhashu64Fnv1a = 0 # type: int self.testarrayofbools = None # type: List[bool] self.testf = 3.14159 # type: float self.testf2 = 3.0 # type: float self.testf3 = 0.0 # type: float self.testarrayofstring2 = None # type: List[str] self.testarrayofsortedstruct = None # type: List[MyGame.Example.Ability.AbilityT] self.flex = None # type: List[int] self.test5 = None # type: List[MyGame.Example.Test.TestT] self.vectorOfLongs = None # type: List[int] self.vectorOfDoubles = None # type: List[float] self.parentNamespaceTest = None # type: Optional[MyGame.InParentNamespace.InParentNamespaceT] self.vectorOfReferrables = None # type: List[MyGame.Example.Referrable.ReferrableT] self.singleWeakReference = 0 # type: int self.vectorOfWeakReferences = None # type: List[int] self.vectorOfStrongReferrables = None # type: List[MyGame.Example.Referrable.ReferrableT] self.coOwningReference = 0 # type: int self.vectorOfCoOwningReferences = None # type: List[int] self.nonOwningReference = 0 # type: int self.vectorOfNonOwningReferences = None # type: List[int] self.anyUniqueType = 0 # type: int self.anyUnique = None # type: Union[None, MyGame.Example.Monster.MonsterT, MyGame.Example.TestSimpleTableWithEnum.TestSimpleTableWithEnumT, MyGame.Example2.Monster.MonsterT] self.anyAmbiguousType = 0 # type: int self.anyAmbiguous = None # type: Union[None, MyGame.Example.Monster.MonsterT, MyGame.Example.Monster.MonsterT, MyGame.Example.Monster.MonsterT] self.vectorOfEnums = None # type: List[int] self.signedEnum = -1 # type: int @classmethod def InitFromBuf(cls, buf, pos): monster = Monster() monster.Init(buf, pos) return cls.InitFromObj(monster) @classmethod def InitFromObj(cls, monster): x = MonsterT() x._UnPack(monster) return x # MonsterT def _UnPack(self, monster): if monster is None: return if monster.Pos() is not None: self.pos = MyGame.Example.Vec3.Vec3T.InitFromObj(monster.Pos()) self.mana = monster.Mana() self.hp = monster.Hp() self.name = monster.Name() if not monster.InventoryIsNone(): if np is None: self.inventory = [] for i in range(monster.InventoryLength()): self.inventory.append(monster.Inventory(i)) else: self.inventory = monster.InventoryAsNumpy() self.color = monster.Color() self.testType = monster.TestType() self.test = MyGame.Example.Any.AnyCreator(self.testType, monster.Test()) if not monster.Test4IsNone(): self.test4 = [] for i in range(monster.Test4Length()): if monster.Test4(i) is None: self.test4.append(None) else: test_ = MyGame.Example.Test.TestT.InitFromObj(monster.Test4(i)) self.test4.append(test_) if not monster.TestarrayofstringIsNone(): self.testarrayofstring = [] for i in range(monster.TestarrayofstringLength()): self.testarrayofstring.append(monster.Testarrayofstring(i)) if not monster.TestarrayoftablesIsNone(): self.testarrayoftables = [] for i in range(monster.TestarrayoftablesLength()): if monster.Testarrayoftables(i) is None: self.testarrayoftables.append(None) else: monster_ = MyGame.Example.Monster.MonsterT.InitFromObj(monster.Testarrayoftables(i)) self.testarrayoftables.append(monster_) if monster.Enemy() is not None: self.enemy = MyGame.Example.Monster.MonsterT.InitFromObj(monster.Enemy()) if not monster.TestnestedflatbufferIsNone(): if np is None: self.testnestedflatbuffer = [] for i in range(monster.TestnestedflatbufferLength()): self.testnestedflatbuffer.append(monster.Testnestedflatbuffer(i)) else: self.testnestedflatbuffer = monster.TestnestedflatbufferAsNumpy() if monster.Testempty() is not None: self.testempty = MyGame.Example.Stat.StatT.InitFromObj(monster.Testempty()) self.testbool = monster.Testbool() self.testhashs32Fnv1 = monster.Testhashs32Fnv1() self.testhashu32Fnv1 = monster.Testhashu32Fnv1() self.testhashs64Fnv1 = monster.Testhashs64Fnv1() self.testhashu64Fnv1 = monster.Testhashu64Fnv1() self.testhashs32Fnv1a = monster.Testhashs32Fnv1a() self.testhashu32Fnv1a = monster.Testhashu32Fnv1a() self.testhashs64Fnv1a = monster.Testhashs64Fnv1a() self.testhashu64Fnv1a = monster.Testhashu64Fnv1a() if not monster.TestarrayofboolsIsNone(): if np is None: self.testarrayofbools = [] for i in range(monster.TestarrayofboolsLength()): self.testarrayofbools.append(monster.Testarrayofbools(i)) else: self.testarrayofbools = monster.TestarrayofboolsAsNumpy() self.testf = monster.Testf() self.testf2 = monster.Testf2() self.testf3 = monster.Testf3() if not monster.Testarrayofstring2IsNone(): self.testarrayofstring2 = [] for i in range(monster.Testarrayofstring2Length()): self.testarrayofstring2.append(monster.Testarrayofstring2(i)) if not monster.TestarrayofsortedstructIsNone(): self.testarrayofsortedstruct = [] for i in range(monster.TestarrayofsortedstructLength()): if monster.Testarrayofsortedstruct(i) is None: self.testarrayofsortedstruct.append(None) else: ability_ = MyGame.Example.Ability.AbilityT.InitFromObj(monster.Testarrayofsortedstruct(i)) self.testarrayofsortedstruct.append(ability_) if not monster.FlexIsNone(): if np is None: self.flex = [] for i in range(monster.FlexLength()): self.flex.append(monster.Flex(i)) else: self.flex = monster.FlexAsNumpy() if not monster.Test5IsNone(): self.test5 = [] for i in range(monster.Test5Length()): if monster.Test5(i) is None: self.test5.append(None) else: test_ = MyGame.Example.Test.TestT.InitFromObj(monster.Test5(i)) self.test5.append(test_) if not monster.VectorOfLongsIsNone(): if np is None: self.vectorOfLongs = [] for i in range(monster.VectorOfLongsLength()): self.vectorOfLongs.append(monster.VectorOfLongs(i)) else: self.vectorOfLongs = monster.VectorOfLongsAsNumpy() if not monster.VectorOfDoublesIsNone(): if np is None: self.vectorOfDoubles = [] for i in range(monster.VectorOfDoublesLength()): self.vectorOfDoubles.append(monster.VectorOfDoubles(i)) else: self.vectorOfDoubles = monster.VectorOfDoublesAsNumpy() if monster.ParentNamespaceTest() is not None: self.parentNamespaceTest = MyGame.InParentNamespace.InParentNamespaceT.InitFromObj(monster.ParentNamespaceTest()) if not monster.VectorOfReferrablesIsNone(): self.vectorOfReferrables = [] for i in range(monster.VectorOfReferrablesLength()): if monster.VectorOfReferrables(i) is None: self.vectorOfReferrables.append(None) else: referrable_ = MyGame.Example.Referrable.ReferrableT.InitFromObj(monster.VectorOfReferrables(i)) self.vectorOfReferrables.append(referrable_) self.singleWeakReference = monster.SingleWeakReference() if not monster.VectorOfWeakReferencesIsNone(): if np is None: self.vectorOfWeakReferences = [] for i in range(monster.VectorOfWeakReferencesLength()): self.vectorOfWeakReferences.append(monster.VectorOfWeakReferences(i)) else: self.vectorOfWeakReferences = monster.VectorOfWeakReferencesAsNumpy() if not monster.VectorOfStrongReferrablesIsNone(): self.vectorOfStrongReferrables = [] for i in range(monster.VectorOfStrongReferrablesLength()): if monster.VectorOfStrongReferrables(i) is None: self.vectorOfStrongReferrables.append(None) else: referrable_ = MyGame.Example.Referrable.ReferrableT.InitFromObj(monster.VectorOfStrongReferrables(i)) self.vectorOfStrongReferrables.append(referrable_) self.coOwningReference = monster.CoOwningReference() if not monster.VectorOfCoOwningReferencesIsNone(): if np is None: self.vectorOfCoOwningReferences = [] for i in range(monster.VectorOfCoOwningReferencesLength()): self.vectorOfCoOwningReferences.append(monster.VectorOfCoOwningReferences(i)) else: self.vectorOfCoOwningReferences = monster.VectorOfCoOwningReferencesAsNumpy() self.nonOwningReference = monster.NonOwningReference() if not monster.VectorOfNonOwningReferencesIsNone(): if np is None: self.vectorOfNonOwningReferences = [] for i in range(monster.VectorOfNonOwningReferencesLength()): self.vectorOfNonOwningReferences.append(monster.VectorOfNonOwningReferences(i)) else: self.vectorOfNonOwningReferences = monster.VectorOfNonOwningReferencesAsNumpy() self.anyUniqueType = monster.AnyUniqueType() self.anyUnique = MyGame.Example.AnyUniqueAliases.AnyUniqueAliasesCreator(self.anyUniqueType, monster.AnyUnique()) self.anyAmbiguousType = monster.AnyAmbiguousType() self.anyAmbiguous = MyGame.Example.AnyAmbiguousAliases.AnyAmbiguousAliasesCreator(self.anyAmbiguousType, monster.AnyAmbiguous()) if not monster.VectorOfEnumsIsNone(): if np is None: self.vectorOfEnums = [] for i in range(monster.VectorOfEnumsLength()): self.vectorOfEnums.append(monster.VectorOfEnums(i)) else: self.vectorOfEnums = monster.VectorOfEnumsAsNumpy() self.signedEnum = monster.SignedEnum() # MonsterT def Pack(self, builder): if self.name is not None: name = builder.CreateString(self.name) if self.inventory is not None: if np is not None and type(self.inventory) is np.ndarray: inventory = builder.CreateNumpyVector(self.inventory) else: MonsterStartInventoryVector(builder, len(self.inventory)) for i in reversed(range(len(self.inventory))): builder.PrependUint8(self.inventory[i]) inventory = builder.EndVector(len(self.inventory)) if self.test is not None: test = self.test.Pack(builder) if self.test4 is not None: MonsterStartTest4Vector(builder, len(self.test4)) for i in reversed(range(len(self.test4))): self.test4[i].Pack(builder) test4 = builder.EndVector(len(self.test4)) if self.testarrayofstring is not None: testarrayofstringlist = [] for i in range(len(self.testarrayofstring)): testarrayofstringlist.append(builder.CreateString(self.testarrayofstring[i])) MonsterStartTestarrayofstringVector(builder, len(self.testarrayofstring)) for i in reversed(range(len(self.testarrayofstring))): builder.PrependUOffsetTRelative(testarrayofstringlist[i]) testarrayofstring = builder.EndVector(len(self.testarrayofstring)) if self.testarrayoftables is not None: testarrayoftableslist = [] for i in range(len(self.testarrayoftables)): testarrayoftableslist.append(self.testarrayoftables[i].Pack(builder)) MonsterStartTestarrayoftablesVector(builder, len(self.testarrayoftables)) for i in reversed(range(len(self.testarrayoftables))): builder.PrependUOffsetTRelative(testarrayoftableslist[i]) testarrayoftables = builder.EndVector(len(self.testarrayoftables)) if self.enemy is not None: enemy = self.enemy.Pack(builder) if self.testnestedflatbuffer is not None: if np is not None and type(self.testnestedflatbuffer) is np.ndarray: testnestedflatbuffer = builder.CreateNumpyVector(self.testnestedflatbuffer) else: MonsterStartTestnestedflatbufferVector(builder, len(self.testnestedflatbuffer)) for i in reversed(range(len(self.testnestedflatbuffer))): builder.PrependUint8(self.testnestedflatbuffer[i]) testnestedflatbuffer = builder.EndVector(len(self.testnestedflatbuffer)) if self.testempty is not None: testempty = self.testempty.Pack(builder) if self.testarrayofbools is not None: if np is not None and type(self.testarrayofbools) is np.ndarray: testarrayofbools = builder.CreateNumpyVector(self.testarrayofbools) else: MonsterStartTestarrayofboolsVector(builder, len(self.testarrayofbools)) for i in reversed(range(len(self.testarrayofbools))): builder.PrependBool(self.testarrayofbools[i]) testarrayofbools = builder.EndVector(len(self.testarrayofbools)) if self.testarrayofstring2 is not None: testarrayofstring2list = [] for i in range(len(self.testarrayofstring2)): testarrayofstring2list.append(builder.CreateString(self.testarrayofstring2[i])) MonsterStartTestarrayofstring2Vector(builder, len(self.testarrayofstring2)) for i in reversed(range(len(self.testarrayofstring2))): builder.PrependUOffsetTRelative(testarrayofstring2list[i]) testarrayofstring2 = builder.EndVector(len(self.testarrayofstring2)) if self.testarrayofsortedstruct is not None: MonsterStartTestarrayofsortedstructVector(builder, len(self.testarrayofsortedstruct)) for i in reversed(range(len(self.testarrayofsortedstruct))): self.testarrayofsortedstruct[i].Pack(builder) testarrayofsortedstruct = builder.EndVector(len(self.testarrayofsortedstruct)) if self.flex is not None: if np is not None and type(self.flex) is np.ndarray: flex = builder.CreateNumpyVector(self.flex) else: MonsterStartFlexVector(builder, len(self.flex)) for i in reversed(range(len(self.flex))): builder.PrependUint8(self.flex[i]) flex = builder.EndVector(len(self.flex)) if self.test5 is not None: MonsterStartTest5Vector(builder, len(self.test5)) for i in reversed(range(len(self.test5))): self.test5[i].Pack(builder) test5 = builder.EndVector(len(self.test5)) if self.vectorOfLongs is not None: if np is not None and type(self.vectorOfLongs) is np.ndarray: vectorOfLongs = builder.CreateNumpyVector(self.vectorOfLongs) else: MonsterStartVectorOfLongsVector(builder, len(self.vectorOfLongs)) for i in reversed(range(len(self.vectorOfLongs))): builder.PrependInt64(self.vectorOfLongs[i]) vectorOfLongs = builder.EndVector(len(self.vectorOfLongs)) if self.vectorOfDoubles is not None: if np is not None and type(self.vectorOfDoubles) is np.ndarray: vectorOfDoubles = builder.CreateNumpyVector(self.vectorOfDoubles) else: MonsterStartVectorOfDoublesVector(builder, len(self.vectorOfDoubles)) for i in reversed(range(len(self.vectorOfDoubles))): builder.PrependFloat64(self.vectorOfDoubles[i]) vectorOfDoubles = builder.EndVector(len(self.vectorOfDoubles)) if self.parentNamespaceTest is not None: parentNamespaceTest = self.parentNamespaceTest.Pack(builder) if self.vectorOfReferrables is not None: vectorOfReferrableslist = [] for i in range(len(self.vectorOfReferrables)): vectorOfReferrableslist.append(self.vectorOfReferrables[i].Pack(builder)) MonsterStartVectorOfReferrablesVector(builder, len(self.vectorOfReferrables)) for i in reversed(range(len(self.vectorOfReferrables))): builder.PrependUOffsetTRelative(vectorOfReferrableslist[i]) vectorOfReferrables = builder.EndVector(len(self.vectorOfReferrables)) if self.vectorOfWeakReferences is not None: if np is not None and type(self.vectorOfWeakReferences) is np.ndarray: vectorOfWeakReferences = builder.CreateNumpyVector(self.vectorOfWeakReferences) else: MonsterStartVectorOfWeakReferencesVector(builder, len(self.vectorOfWeakReferences)) for i in reversed(range(len(self.vectorOfWeakReferences))): builder.PrependUint64(self.vectorOfWeakReferences[i]) vectorOfWeakReferences = builder.EndVector(len(self.vectorOfWeakReferences)) if self.vectorOfStrongReferrables is not None: vectorOfStrongReferrableslist = [] for i in range(len(self.vectorOfStrongReferrables)): vectorOfStrongReferrableslist.append(self.vectorOfStrongReferrables[i].Pack(builder)) MonsterStartVectorOfStrongReferrablesVector(builder, len(self.vectorOfStrongReferrables)) for i in reversed(range(len(self.vectorOfStrongReferrables))): builder.PrependUOffsetTRelative(vectorOfStrongReferrableslist[i]) vectorOfStrongReferrables = builder.EndVector(len(self.vectorOfStrongReferrables)) if self.vectorOfCoOwningReferences is not None: if np is not None and type(self.vectorOfCoOwningReferences) is np.ndarray: vectorOfCoOwningReferences = builder.CreateNumpyVector(self.vectorOfCoOwningReferences) else: MonsterStartVectorOfCoOwningReferencesVector(builder, len(self.vectorOfCoOwningReferences)) for i in reversed(range(len(self.vectorOfCoOwningReferences))): builder.PrependUint64(self.vectorOfCoOwningReferences[i]) vectorOfCoOwningReferences = builder.EndVector(len(self.vectorOfCoOwningReferences)) if self.vectorOfNonOwningReferences is not None: if np is not None and type(self.vectorOfNonOwningReferences) is np.ndarray: vectorOfNonOwningReferences = builder.CreateNumpyVector(self.vectorOfNonOwningReferences) else: MonsterStartVectorOfNonOwningReferencesVector(builder, len(self.vectorOfNonOwningReferences)) for i in reversed(range(len(self.vectorOfNonOwningReferences))): builder.PrependUint64(self.vectorOfNonOwningReferences[i]) vectorOfNonOwningReferences = builder.EndVector(len(self.vectorOfNonOwningReferences)) if self.anyUnique is not None: anyUnique = self.anyUnique.Pack(builder) if self.anyAmbiguous is not None: anyAmbiguous = self.anyAmbiguous.Pack(builder) if self.vectorOfEnums is not None: if np is not None and type(self.vectorOfEnums) is np.ndarray: vectorOfEnums = builder.CreateNumpyVector(self.vectorOfEnums) else: MonsterStartVectorOfEnumsVector(builder, len(self.vectorOfEnums)) for i in reversed(range(len(self.vectorOfEnums))): builder.PrependUint8(self.vectorOfEnums[i]) vectorOfEnums = builder.EndVector(len(self.vectorOfEnums)) MonsterStart(builder) if self.pos is not None: pos = self.pos.Pack(builder) MonsterAddPos(builder, pos) MonsterAddMana(builder, self.mana) MonsterAddHp(builder, self.hp) if self.name is not None: MonsterAddName(builder, name) if self.inventory is not None: MonsterAddInventory(builder, inventory) MonsterAddColor(builder, self.color) MonsterAddTestType(builder, self.testType) if self.test is not None: MonsterAddTest(builder, test) if self.test4 is not None: MonsterAddTest4(builder, test4) if self.testarrayofstring is not None: MonsterAddTestarrayofstring(builder, testarrayofstring) if self.testarrayoftables is not None: MonsterAddTestarrayoftables(builder, testarrayoftables) if self.enemy is not None: MonsterAddEnemy(builder, enemy) if self.testnestedflatbuffer is not None: MonsterAddTestnestedflatbuffer(builder, testnestedflatbuffer) if self.testempty is not None: MonsterAddTestempty(builder, testempty) MonsterAddTestbool(builder, self.testbool) MonsterAddTesthashs32Fnv1(builder, self.testhashs32Fnv1) MonsterAddTesthashu32Fnv1(builder, self.testhashu32Fnv1) MonsterAddTesthashs64Fnv1(builder, self.testhashs64Fnv1) MonsterAddTesthashu64Fnv1(builder, self.testhashu64Fnv1) MonsterAddTesthashs32Fnv1a(builder, self.testhashs32Fnv1a) MonsterAddTesthashu32Fnv1a(builder, self.testhashu32Fnv1a) MonsterAddTesthashs64Fnv1a(builder, self.testhashs64Fnv1a) MonsterAddTesthashu64Fnv1a(builder, self.testhashu64Fnv1a) if self.testarrayofbools is not None: MonsterAddTestarrayofbools(builder, testarrayofbools) MonsterAddTestf(builder, self.testf) MonsterAddTestf2(builder, self.testf2) MonsterAddTestf3(builder, self.testf3) if self.testarrayofstring2 is not None: MonsterAddTestarrayofstring2(builder, testarrayofstring2) if self.testarrayofsortedstruct is not None: MonsterAddTestarrayofsortedstruct(builder, testarrayofsortedstruct) if self.flex is not None: MonsterAddFlex(builder, flex) if self.test5 is not None: MonsterAddTest5(builder, test5) if self.vectorOfLongs is not None: MonsterAddVectorOfLongs(builder, vectorOfLongs) if self.vectorOfDoubles is not None: MonsterAddVectorOfDoubles(builder, vectorOfDoubles) if self.parentNamespaceTest is not None: MonsterAddParentNamespaceTest(builder, parentNamespaceTest) if self.vectorOfReferrables is not None: MonsterAddVectorOfReferrables(builder, vectorOfReferrables) MonsterAddSingleWeakReference(builder, self.singleWeakReference) if self.vectorOfWeakReferences is not None: MonsterAddVectorOfWeakReferences(builder, vectorOfWeakReferences) if self.vectorOfStrongReferrables is not None: MonsterAddVectorOfStrongReferrables(builder, vectorOfStrongReferrables) MonsterAddCoOwningReference(builder, self.coOwningReference) if self.vectorOfCoOwningReferences is not None: MonsterAddVectorOfCoOwningReferences(builder, vectorOfCoOwningReferences) MonsterAddNonOwningReference(builder, self.nonOwningReference) if self.vectorOfNonOwningReferences is not None: MonsterAddVectorOfNonOwningReferences(builder, vectorOfNonOwningReferences) MonsterAddAnyUniqueType(builder, self.anyUniqueType) if self.anyUnique is not None: MonsterAddAnyUnique(builder, anyUnique) MonsterAddAnyAmbiguousType(builder, self.anyAmbiguousType) if self.anyAmbiguous is not None: MonsterAddAnyAmbiguous(builder, anyAmbiguous) if self.vectorOfEnums is not None: MonsterAddVectorOfEnums(builder, vectorOfEnums) MonsterAddSignedEnum(builder, self.signedEnum) monster = MonsterEnd(builder) return monster