mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
control manager now cleanly removes its controls during delete()
This commit is contained in:
parent
c373e91564
commit
c56249dd2f
@ -104,13 +104,12 @@ class ControlManager:
|
|||||||
See also: add().
|
See also: add().
|
||||||
"""
|
"""
|
||||||
assert self.notify.debugCall(id(self))
|
assert self.notify.debugCall(id(self))
|
||||||
oldControls = self.controls.get(name)
|
oldControls = self.controls.pop(name,None)
|
||||||
if oldControls is not None:
|
if oldControls is not None:
|
||||||
print "Removing controls:", name
|
print "Removing controls:", name
|
||||||
oldControls.disableAvatarControls()
|
oldControls.disableAvatarControls()
|
||||||
oldControls.setCollisionsActive(0)
|
oldControls.setCollisionsActive(0)
|
||||||
oldControls.delete()
|
oldControls.delete()
|
||||||
del self.controls[name]
|
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
def lockControls(self):
|
def lockControls(self):
|
||||||
@ -159,9 +158,11 @@ class ControlManager:
|
|||||||
forwardSpeed, jumpForce, reverseSpeed, rotateSpeed)
|
forwardSpeed, jumpForce, reverseSpeed, rotateSpeed)
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
|
import pdb;pdb.set_trace()
|
||||||
assert self.notify.debugCall(id(self))
|
assert self.notify.debugCall(id(self))
|
||||||
self.disable()
|
self.disable()
|
||||||
# TODO: put controls delete code in here
|
for controls in self.controls.keys():
|
||||||
|
self.remove(controls)
|
||||||
del self.controls
|
del self.controls
|
||||||
del self.currentControls
|
del self.currentControls
|
||||||
|
|
||||||
|
@ -30,8 +30,10 @@ class ShipPilot(PhysicsWalker):
|
|||||||
'want-avatar-physics-indicator', 0)
|
'want-avatar-physics-indicator', 0)
|
||||||
|
|
||||||
# special methods
|
# special methods
|
||||||
def __init__(self, gravity = -32.1740, standableGround=0.707,
|
def __init__(self,
|
||||||
hardLandingForce=16.0):
|
gravity = -32.1740,
|
||||||
|
standableGround=0.707,
|
||||||
|
hardLandingForce=16.0):
|
||||||
assert self.debugPrint(
|
assert self.debugPrint(
|
||||||
"PhysicsWalker(gravity=%s, standableGround=%s)"%(
|
"PhysicsWalker(gravity=%s, standableGround=%s)"%(
|
||||||
gravity, standableGround))
|
gravity, standableGround))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user