mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 10:54:24 -04:00
fixes for public net interface
This commit is contained in:
parent
9a0cea5d9f
commit
d8471bdf32
@ -22,6 +22,8 @@ class ClientRepository(ClientRepositoryBase):
|
|||||||
# used by this implementation.
|
# used by this implementation.
|
||||||
GameGlobalsId = 0
|
GameGlobalsId = 0
|
||||||
|
|
||||||
|
doNotDeallocateChannel = True
|
||||||
|
|
||||||
def __init__(self, dcFileNames = None, dcSuffix = ''):
|
def __init__(self, dcFileNames = None, dcSuffix = ''):
|
||||||
ClientRepositoryBase.__init__(self, dcFileNames = dcFileNames, dcSuffix = dcSuffix)
|
ClientRepositoryBase.__init__(self, dcFileNames = dcFileNames, dcSuffix = dcSuffix)
|
||||||
self.setHandleDatagramsInternally(False)
|
self.setHandleDatagramsInternally(False)
|
||||||
@ -42,6 +44,8 @@ class ClientRepository(ClientRepositoryBase):
|
|||||||
self.doIdLast = self.doIdBase + di.getUint32()
|
self.doIdLast = self.doIdBase + di.getUint32()
|
||||||
self.doIdAllocator = UniqueIdAllocator(self.doIdBase, self.doIdLast - 1)
|
self.doIdAllocator = UniqueIdAllocator(self.doIdBase, self.doIdLast - 1)
|
||||||
|
|
||||||
|
self.ourChannel = self.doIdBase
|
||||||
|
|
||||||
# Now that we've got a doId range, we can safely generate new
|
# Now that we've got a doId range, we can safely generate new
|
||||||
# distributed objects.
|
# distributed objects.
|
||||||
messenger.send('createReady')
|
messenger.send('createReady')
|
||||||
@ -370,6 +374,10 @@ class ClientRepository(ClientRepositoryBase):
|
|||||||
self.notify.warning(
|
self.notify.warning(
|
||||||
"Asked to delete non-existent DistObj " + str(doId))
|
"Asked to delete non-existent DistObj " + str(doId))
|
||||||
|
|
||||||
|
def stopTrackRequestDeletedDO(self, *args):
|
||||||
|
# No-op. Not entirely sure what this does on the VR Studio side.
|
||||||
|
pass
|
||||||
|
|
||||||
def sendUpdate(self, distObj, fieldName, args):
|
def sendUpdate(self, distObj, fieldName, args):
|
||||||
""" Sends a normal update for a single field. """
|
""" Sends a normal update for a single field. """
|
||||||
dg = distObj.dclass.clientFormatUpdate(
|
dg = distObj.dclass.clientFormatUpdate(
|
||||||
|
@ -221,9 +221,9 @@ class ConnectionRepository(
|
|||||||
"""
|
"""
|
||||||
Reads in the dc files listed in dcFileNames, or if
|
Reads in the dc files listed in dcFileNames, or if
|
||||||
dcFileNames is None, reads in all of the dc files listed in
|
dcFileNames is None, reads in all of the dc files listed in
|
||||||
the Configrc file.
|
the Config.prc file.
|
||||||
"""
|
"""
|
||||||
#import pdb; pdb.set_trace();
|
|
||||||
dcFile = self.getDcFile()
|
dcFile = self.getDcFile()
|
||||||
dcFile.clear()
|
dcFile.clear()
|
||||||
self.dclassesByName = {}
|
self.dclassesByName = {}
|
||||||
@ -240,10 +240,13 @@ class ConnectionRepository(
|
|||||||
if not readResult:
|
if not readResult:
|
||||||
self.notify.error("Could not read dc file.")
|
self.notify.error("Could not read dc file.")
|
||||||
else:
|
else:
|
||||||
|
searchPath = getModelPath().getValue()
|
||||||
for dcFileName in dcFileNames:
|
for dcFileName in dcFileNames:
|
||||||
readResult = dcFile.read(Filename(dcFileName))
|
pathname = Filename(dcFileName)
|
||||||
|
vfs.resolveFilename(pathname, searchPath)
|
||||||
|
readResult = dcFile.read(pathname)
|
||||||
if not readResult:
|
if not readResult:
|
||||||
self.notify.error("Could not read dc file: %s" % (dcFileName))
|
self.notify.error("Could not read dc file: %s" % (pathname))
|
||||||
|
|
||||||
#if not dcFile.allObjectsValid():
|
#if not dcFile.allObjectsValid():
|
||||||
# names = []
|
# names = []
|
||||||
|
@ -88,6 +88,12 @@ class DistributedObjectAI(DistributedObjectBase):
|
|||||||
if delEvent:
|
if delEvent:
|
||||||
messenger.send(delEvent)
|
messenger.send(delEvent)
|
||||||
|
|
||||||
|
def deleteOrDelay(self):
|
||||||
|
""" This method exists only to mirror the similar method on
|
||||||
|
DistributedObject. AI objects don't have delayDelete, they
|
||||||
|
just get deleted immediately. """
|
||||||
|
self.delete()
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
"""
|
"""
|
||||||
Inheritors should redefine this to take appropriate action on delete
|
Inheritors should redefine this to take appropriate action on delete
|
||||||
@ -142,7 +148,7 @@ class DistributedObjectAI(DistributedObjectBase):
|
|||||||
### this delete message or to handle this message better
|
### this delete message or to handle this message better
|
||||||
# TODO: do we still need this check?
|
# TODO: do we still need this check?
|
||||||
if not hasattr(self, "doNotDeallocateChannel"):
|
if not hasattr(self, "doNotDeallocateChannel"):
|
||||||
if self.air:
|
if self.air and not hasattr(self.air, "doNotDeallocateChannel"):
|
||||||
if self.air.minChannel <= self.doId <= self.air.maxChannel:
|
if self.air.minChannel <= self.doId <= self.air.maxChannel:
|
||||||
self.air.deallocateChannel(self.doId)
|
self.air.deallocateChannel(self.doId)
|
||||||
self.air = None
|
self.air = None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user