# automatically generated by the FlatBuffers compiler, do not modify

# namespace: foxglove

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

# An update to the entities displayed in a 3D scene
class SceneUpdate(object):
    __slots__ = ['_tab']

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

    @classmethod
    def GetRootAsSceneUpdate(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # SceneUpdate
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # Scene entities to delete
    # SceneUpdate
    def Deletions(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .SceneEntityDeletion import SceneEntityDeletion
            obj = SceneEntityDeletion()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

    # SceneUpdate
    def DeletionsLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # SceneUpdate
    def DeletionsIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        return o == 0

    # Scene entities to add or replace
    # SceneUpdate
    def Entities(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            x = self._tab.Vector(o)
            x += flatbuffers.number_types.UOffsetTFlags.py_type(j) * 4
            x = self._tab.Indirect(x)
            from .SceneEntity import SceneEntity
            obj = SceneEntity()
            obj.Init(self._tab.Bytes, x)
            return obj
        return None

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

    # SceneUpdate
    def EntitiesIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        return o == 0

def SceneUpdateStart(builder): builder.StartObject(2)
def Start(builder):
    return SceneUpdateStart(builder)
def SceneUpdateAddDeletions(builder, deletions): builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(deletions), 0)
def AddDeletions(builder, deletions):
    return SceneUpdateAddDeletions(builder, deletions)
def SceneUpdateStartDeletionsVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartDeletionsVector(builder, numElems):
    return SceneUpdateStartDeletionsVector(builder, numElems)
def SceneUpdateAddEntities(builder, entities): builder.PrependUOffsetTRelativeSlot(1, flatbuffers.number_types.UOffsetTFlags.py_type(entities), 0)
def AddEntities(builder, entities):
    return SceneUpdateAddEntities(builder, entities)
def SceneUpdateStartEntitiesVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartEntitiesVector(builder, numElems):
    return SceneUpdateStartEntitiesVector(builder, numElems)
def SceneUpdateEnd(builder): return builder.EndObject()
def End(builder):
    return SceneUpdateEnd(builder)