mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
guarantee that announceGenerate is called before non-required fields are received.
This commit is contained in:
parent
0b96f7c651
commit
923bf3f465
@ -120,7 +120,7 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
distObj = self.doId2do[doId]
|
distObj = self.doId2do[doId]
|
||||||
distObj.generate()
|
distObj.generate()
|
||||||
distObj.updateRequiredFields(cdc, di)
|
distObj.updateRequiredFields(cdc, di)
|
||||||
distObj.announceGenerate()
|
# updateRequiredFields calls announceGenerate
|
||||||
|
|
||||||
# Is it in the cache? If so, pull it out, put it in the dictionaries,
|
# Is it in the cache? If so, pull it out, put it in the dictionaries,
|
||||||
# and update it.
|
# and update it.
|
||||||
@ -133,7 +133,7 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
# and update it.
|
# and update it.
|
||||||
distObj.generate()
|
distObj.generate()
|
||||||
distObj.updateRequiredFields(cdc, di)
|
distObj.updateRequiredFields(cdc, di)
|
||||||
distObj.announceGenerate()
|
# updateRequiredFields calls announceGenerate
|
||||||
|
|
||||||
# If it is not in the dictionary or the cache, then...
|
# If it is not in the dictionary or the cache, then...
|
||||||
else:
|
else:
|
||||||
@ -148,7 +148,7 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
distObj.generateInit() # Only called when constructed
|
distObj.generateInit() # Only called when constructed
|
||||||
distObj.generate()
|
distObj.generate()
|
||||||
distObj.updateRequiredFields(cdc, di)
|
distObj.updateRequiredFields(cdc, di)
|
||||||
distObj.announceGenerate()
|
# updateRequiredFields calls announceGenerate
|
||||||
|
|
||||||
return distObj
|
return distObj
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
distObj = self.doId2do[doId]
|
distObj = self.doId2do[doId]
|
||||||
distObj.generate()
|
distObj.generate()
|
||||||
distObj.updateRequiredOtherFields(cdc, di)
|
distObj.updateRequiredOtherFields(cdc, di)
|
||||||
distObj.announceGenerate()
|
# updateRequiredOtherFields calls announceGenerate
|
||||||
|
|
||||||
# Is it in the cache? If so, pull it out, put it in the dictionaries,
|
# Is it in the cache? If so, pull it out, put it in the dictionaries,
|
||||||
# and update it.
|
# and update it.
|
||||||
@ -172,7 +172,7 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
# and update it.
|
# and update it.
|
||||||
distObj.generate()
|
distObj.generate()
|
||||||
distObj.updateRequiredOtherFields(cdc, di)
|
distObj.updateRequiredOtherFields(cdc, di)
|
||||||
distObj.announceGenerate()
|
# updateRequiredOtherFields calls announceGenerate
|
||||||
|
|
||||||
# If it is not in the dictionary or the cache, then...
|
# If it is not in the dictionary or the cache, then...
|
||||||
else:
|
else:
|
||||||
@ -189,7 +189,7 @@ class ClientRepository(ConnectionRepository.ConnectionRepository):
|
|||||||
distObj.generateInit() # Only called when constructed
|
distObj.generateInit() # Only called when constructed
|
||||||
distObj.generate()
|
distObj.generate()
|
||||||
distObj.updateRequiredOtherFields(cdc, di)
|
distObj.updateRequiredOtherFields(cdc, di)
|
||||||
distObj.announceGenerate()
|
# updateRequiredOtherFields calls announceGenerate
|
||||||
|
|
||||||
return distObj
|
return distObj
|
||||||
|
|
||||||
|
@ -188,21 +188,27 @@ class DistributedObject(PandaObject):
|
|||||||
def updateRequiredFields(self, cdc, di):
|
def updateRequiredFields(self, cdc, di):
|
||||||
for i in cdc.broadcastRequiredCDU:
|
for i in cdc.broadcastRequiredCDU:
|
||||||
i.updateField(cdc, self, di)
|
i.updateField(cdc, self, di)
|
||||||
|
self.announceGenerate()
|
||||||
|
|
||||||
def updateAllRequiredFields(self, cdc, di):
|
def updateAllRequiredFields(self, cdc, di):
|
||||||
for i in cdc.allRequiredCDU:
|
for i in cdc.allRequiredCDU:
|
||||||
i.updateField(cdc, self, di)
|
i.updateField(cdc, self, di)
|
||||||
|
self.announceGenerate()
|
||||||
|
|
||||||
def updateRequiredOtherFields(self, cdc, di):
|
def updateRequiredOtherFields(self, cdc, di):
|
||||||
# First, update the required fields
|
# First, update the required fields
|
||||||
for i in cdc.broadcastRequiredCDU:
|
for i in cdc.broadcastRequiredCDU:
|
||||||
i.updateField(cdc, self, di)
|
i.updateField(cdc, self, di)
|
||||||
|
|
||||||
|
# Announce generate after updating all the required fields,
|
||||||
|
# but before we update the non-required fields.
|
||||||
|
self.announceGenerate()
|
||||||
|
|
||||||
# Determine how many other fields there are
|
# Determine how many other fields there are
|
||||||
numberOfOtherFields = di.getArg(STUint16)
|
numberOfOtherFields = di.getArg(STUint16)
|
||||||
# Update each of the other fields
|
# Update each of the other fields
|
||||||
for i in range(numberOfOtherFields):
|
for i in range(numberOfOtherFields):
|
||||||
cdc.updateField(self, di)
|
cdc.updateField(self, di)
|
||||||
return None
|
|
||||||
|
|
||||||
def sendUpdate(self, fieldName, args = [], sendToId = None):
|
def sendUpdate(self, fieldName, args = [], sendToId = None):
|
||||||
self.cr.sendUpdate(self, fieldName, args, sendToId)
|
self.cr.sendUpdate(self, fieldName, args, sendToId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user