re-create C++ objects on disable/generate

This commit is contained in:
Darren Ranalli 2007-09-06 04:12:33 +00:00
parent 3804f89682
commit d838c73a91
3 changed files with 33 additions and 11 deletions

View File

@ -66,21 +66,29 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
self.DistributedSmoothNode_initialized = 1
DistributedNode.DistributedNode.__init__(self, cr)
DistributedSmoothNodeBase.DistributedSmoothNodeBase.__init__(self)
self.cnode.setRepository(cr, 0, 0)
self.smoother = SmoothMover()
self.smoothStarted = 0
self.lastSuggestResync = 0
self._smoothWrtReparents = False
def generate(self):
self.smoother = SmoothMover()
self.smoothStarted = 0
self.lastSuggestResync = 0
self._smoothWrtReparents = False
DistributedNode.DistributedNode.generate(self)
DistributedSmoothNodeBase.DistributedSmoothNodeBase.generate(self)
self.cnode.setRepository(self.cr, 0, 0)
self.activateSmoothing(GlobalSmoothing, GlobalPrediction)
def disable(self):
DistributedSmoothNodeBase.DistributedSmoothNodeBase.disable(self)
DistributedNode.DistributedNode.disable(self)
del self.smoother
def delete(self):
DistributedSmoothNodeBase.DistributedSmoothNodeBase.delete(self)
DistributedNode.DistributedNode.delete(self)
def generate(self):
DistributedNode.DistributedNode.generate(self)
self.activateSmoothing(GlobalSmoothing, GlobalPrediction)
### Methods to handle computing and updating of the smoothed
### position.

View File

@ -9,7 +9,14 @@ class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
DistributedNodeAI.DistributedNodeAI.__init__(self, air, name)
DistributedSmoothNodeBase.DistributedSmoothNodeBase.__init__(self)
self.cnode.setRepository(air, 1, air.ourChannel)
def generate(self):
DistributedNodeAI.DistributedNodeAI.generate(self)
DistributedSmoothNodeBase.DistributedSmoothNodeBase.generate(self)
self.cnode.setRepository(self.air, 1, self.air.ourChannel)
def disable(self):
DistributedSmoothNodeBase.DistributedSmoothNodeBase.disable(self)
DistributedNodeAI.DistributedNodeAI.disable(self)
def delete(self):
DistributedSmoothNodeBase.DistributedSmoothNodeBase.delete(self)

View File

@ -10,14 +10,21 @@ class DistributedSmoothNodeBase:
BroadcastTypes = Enum('FULL, XYH, XY')
def __init__(self):
pass
def generate(self):
self.cnode = CDistributedSmoothNodeBase()
self.cnode.setClockDelta(globalClockDelta)
self.d_broadcastPosHpr = None
def delete(self):
def disable(self):
del self.cnode
# make sure our task is gone
self.stopPosHprBroadcast()
def delete(self):
pass
def b_clearSmoothing(self):
self.d_clearSmoothing()
self.clearSmoothing()