mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-05 11:28:17 -04:00
*** empty log message ***
This commit is contained in:
parent
885812729c
commit
355b730108
@ -73,11 +73,10 @@ class Actor(PandaObject, NodePath):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.__initialized
|
self.Actor_initialized
|
||||||
return
|
return
|
||||||
|
|
||||||
except:
|
except:
|
||||||
self.__initialized = 1
|
self.Actor_initialized = 1
|
||||||
|
|
||||||
# initialize our NodePath essence
|
# initialize our NodePath essence
|
||||||
NodePath.__init__(self)
|
NodePath.__init__(self)
|
||||||
@ -190,6 +189,13 @@ class Actor(PandaObject, NodePath):
|
|||||||
# copy the anim dictionary from other
|
# copy the anim dictionary from other
|
||||||
self.__copyAnimControls(other)
|
self.__copyAnimControls(other)
|
||||||
|
|
||||||
|
def delete(self):
|
||||||
|
try:
|
||||||
|
self.Actor_deleted
|
||||||
|
return
|
||||||
|
except:
|
||||||
|
self.Actor_deleted = 1
|
||||||
|
self.cleanup()
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""__str__(self)
|
"""__str__(self)
|
||||||
@ -252,7 +258,8 @@ class Actor(PandaObject, NodePath):
|
|||||||
self.__partBundleDict = None
|
self.__partBundleDict = None
|
||||||
del(self.__animControlDict)
|
del(self.__animControlDict)
|
||||||
self.__animControlDict = None
|
self.__animControlDict = None
|
||||||
self.removeNode()
|
if not self.isEmpty():
|
||||||
|
self.removeNode()
|
||||||
|
|
||||||
# accessing
|
# accessing
|
||||||
|
|
||||||
|
@ -21,5 +21,14 @@ class DistributedActor(DistributedNode.DistributedNode, Actor.Actor):
|
|||||||
|
|
||||||
def disable(self):
|
def disable(self):
|
||||||
# remove all anims, on all parts and all lods
|
# remove all anims, on all parts and all lods
|
||||||
Actor.Actor.unloadAnims(None, None, None)
|
Actor.Actor.unloadAnims(self, None, None, None)
|
||||||
DistributedNode.DistributedNode.disable(self)
|
DistributedNode.DistributedNode.disable(self)
|
||||||
|
|
||||||
|
def delete(self):
|
||||||
|
try:
|
||||||
|
self.DistributedActor_deleted
|
||||||
|
except:
|
||||||
|
self.DistributedActor_deleted = 1
|
||||||
|
DistributedNode.DistributedNode.delete(self)
|
||||||
|
Actor.Actor.delete(self)
|
||||||
|
|
||||||
|
@ -12,6 +12,17 @@ class CRCache:
|
|||||||
self.fifo = []
|
self.fifo = []
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def flush(self):
|
||||||
|
"""
|
||||||
|
Delete each item in the cache then clear all references to them
|
||||||
|
"""
|
||||||
|
CRCache.notify.debug("Flushing the cache")
|
||||||
|
for distObj in self.dict.values():
|
||||||
|
distObj.delete()
|
||||||
|
# Null out all references to the objects so they will get gc'd
|
||||||
|
self.dict = {}
|
||||||
|
self.fifo = []
|
||||||
|
|
||||||
def cache(self, distObj):
|
def cache(self, distObj):
|
||||||
# Only distributed objects are allowed in the cache
|
# Only distributed objects are allowed in the cache
|
||||||
assert(isinstance(distObj, DistributedObject.DistributedObject))
|
assert(isinstance(distObj, DistributedObject.DistributedObject))
|
||||||
|
@ -24,8 +24,13 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath.NodePath):
|
|||||||
DistributedObject.DistributedObject.disable(self)
|
DistributedObject.DistributedObject.disable(self)
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
self.removeNode()
|
try:
|
||||||
DistributedObject.DistributedObject.delete(self)
|
self.DistributedNode_deleted
|
||||||
|
except:
|
||||||
|
self.DistributedNode_deleted = 1
|
||||||
|
if not self.isEmpty():
|
||||||
|
self.removeNode()
|
||||||
|
DistributedObject.DistributedObject.delete(self)
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
# Turn on dead reckoning
|
# Turn on dead reckoning
|
||||||
|
@ -35,12 +35,13 @@ class DistributedObject(PandaObject):
|
|||||||
self.deleteImminent = 0
|
self.deleteImminent = 0
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __del__(self):
|
# def __del__(self):
|
||||||
"""
|
# """
|
||||||
For debugging purposes, this just prints out what got deleted
|
# For debugging purposes, this just prints out what got deleted
|
||||||
"""
|
# """
|
||||||
DistributedObject.notify.debug("Destructing: " + self.__class__.__name__ +
|
# DistributedObject.notify.debug("Destructing: " + self.__class__.__name__ +
|
||||||
" id: " + str(self.doId))
|
# " id: " + str(self.doId))
|
||||||
|
# PandaObject.__del__(self)
|
||||||
|
|
||||||
def setNeverDisable(self, bool):
|
def setNeverDisable(self, bool):
|
||||||
assert((bool == 1) or (bool == 0))
|
assert((bool == 1) or (bool == 0))
|
||||||
@ -112,7 +113,12 @@ class DistributedObject(PandaObject):
|
|||||||
"""delete(self)
|
"""delete(self)
|
||||||
Inheritors should redefine this to take appropriate action on delete
|
Inheritors should redefine this to take appropriate action on delete
|
||||||
"""
|
"""
|
||||||
pass
|
try:
|
||||||
|
self.DistributedObject_deleted
|
||||||
|
except:
|
||||||
|
self.DistributedObject_deleted = 1
|
||||||
|
del self.cr
|
||||||
|
return
|
||||||
|
|
||||||
def generate(self):
|
def generate(self):
|
||||||
"""generate(self)
|
"""generate(self)
|
||||||
|
@ -126,11 +126,11 @@ class Button(DirectObject):
|
|||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
if (self.managed):
|
if (self.managed):
|
||||||
self.unmanage()
|
self.unmanage()
|
||||||
self.lUp = None
|
del self.lUp
|
||||||
self.lLit = None
|
del self.lLit
|
||||||
self.lDown = None
|
del self.lDown
|
||||||
self.lInactive = None
|
del self.lInactive
|
||||||
self.button = None
|
del self.button
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -208,15 +208,6 @@ class OnscreenText(PandaObject, NodePath):
|
|||||||
|
|
||||||
# Set ourselves up as the NodePath that points to this node.
|
# Set ourselves up as the NodePath that points to this node.
|
||||||
self.assign(parent.attachNewNode(self.textNode))
|
self.assign(parent.attachNewNode(self.textNode))
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
# Make sure the node is removed when we delete the
|
|
||||||
# OnscreenText object. This means we don't have to explicitly
|
|
||||||
# remove an OnscreenText object; it can do it by itself.
|
|
||||||
# Maybe this will be too confusing because we *do* have to
|
|
||||||
# explicitly remove other kinds of onscreen objects.
|
|
||||||
self.cleanup()
|
|
||||||
NodePath.__del__(self)
|
|
||||||
|
|
||||||
def cleanup(self):
|
def cleanup(self):
|
||||||
"""cleanup(self)
|
"""cleanup(self)
|
||||||
|
@ -7,31 +7,24 @@ class DirectObject:
|
|||||||
This is the class that all Direct/SAL classes should inherit from
|
This is the class that all Direct/SAL classes should inherit from
|
||||||
"""
|
"""
|
||||||
#def __del__(self):
|
#def __del__(self):
|
||||||
# print "Destructing: ", self.__class__.__name__
|
# print "Destructing: ", self.__class__.__name__
|
||||||
|
|
||||||
# This is really old and we really should not be relying on it
|
|
||||||
# One day I'll see if anybody still needs this
|
|
||||||
#try:
|
|
||||||
# self.cleanup()
|
|
||||||
#except AttributeError:
|
|
||||||
# # No cleanup() method defined
|
|
||||||
# pass
|
|
||||||
|
|
||||||
# Event Handling
|
# Event Handling
|
||||||
|
|
||||||
# object.accept('mouse', object.handleMouse)
|
|
||||||
# object.accept('mouse', object.handleMouse, [1,2])
|
|
||||||
|
|
||||||
def accept(self, event, method, extraArgs=[]):
|
def accept(self, event, method, extraArgs=[]):
|
||||||
messenger.accept(event, self, method, extraArgs, 1)
|
messenger.accept(event, self, method, extraArgs, 1)
|
||||||
|
|
||||||
def acceptOnce(self, event, method, extraArgs=[]):
|
def acceptOnce(self, event, method, extraArgs=[]):
|
||||||
messenger.accept(event, self, method, extraArgs, 0)
|
messenger.accept(event, self, method, extraArgs, 0)
|
||||||
|
|
||||||
def ignore(self, event):
|
def ignore(self, event):
|
||||||
messenger.ignore(event, self)
|
messenger.ignore(event, self)
|
||||||
|
|
||||||
def ignoreAll(self):
|
def ignoreAll(self):
|
||||||
messenger.ignoreAll(self)
|
messenger.ignoreAll(self)
|
||||||
|
|
||||||
def isAccepting(self, event):
|
def isAccepting(self, event):
|
||||||
return messenger.isAccepting(event, self)
|
return messenger.isAccepting(event, self)
|
||||||
|
|
||||||
def isIgnoring(self, event):
|
def isIgnoring(self, event):
|
||||||
return messenger.isIgnoring(event, self)
|
return messenger.isIgnoring(event, self)
|
||||||
|
|
||||||
|
@ -261,18 +261,12 @@ class ShowBase:
|
|||||||
AudioManager.spawnUpdate()
|
AudioManager.spawnUpdate()
|
||||||
|
|
||||||
def loadSfx(self, name):
|
def loadSfx(self, name):
|
||||||
if name:
|
if (name and base.wantSfx):
|
||||||
if base.wantSfx:
|
return loader.loadSound(name)
|
||||||
s = loader.loadSound(name)
|
|
||||||
return s
|
|
||||||
return None
|
|
||||||
|
|
||||||
def loadMusic(self, name):
|
def loadMusic(self, name):
|
||||||
if name:
|
if (name and base.wantMusic):
|
||||||
if base.wantMusic:
|
return loader.loadSound(name)
|
||||||
m = loader.loadSound(name)
|
|
||||||
return m
|
|
||||||
return None
|
|
||||||
|
|
||||||
def unloadSfx(self, sfx):
|
def unloadSfx(self, sfx):
|
||||||
if sfx:
|
if sfx:
|
||||||
@ -284,45 +278,41 @@ class ShowBase:
|
|||||||
|
|
||||||
def playSfx(self, sfx, looping = None, interupt = 1, volume = None,
|
def playSfx(self, sfx, looping = None, interupt = 1, volume = None,
|
||||||
time = 0.):
|
time = 0.):
|
||||||
if sfx:
|
if (sfx and base.wantSfx):
|
||||||
if base.wantSfx:
|
if not interupt:
|
||||||
if not interupt:
|
if not (sfx.status() == AudioSound.PLAYING):
|
||||||
if not (sfx.status() == AudioSound.PLAYING):
|
|
||||||
AudioManager.play(sfx, time)
|
|
||||||
else:
|
|
||||||
AudioManager.play(sfx, time)
|
AudioManager.play(sfx, time)
|
||||||
if looping:
|
else:
|
||||||
AudioManager.setLoop(sfx, 1)
|
AudioManager.play(sfx, time)
|
||||||
if volume:
|
if looping:
|
||||||
AudioManager.setVolume(sfx, volume)
|
AudioManager.setLoop(sfx, 1)
|
||||||
|
if volume:
|
||||||
|
AudioManager.setVolume(sfx, volume)
|
||||||
|
|
||||||
def playMusic(self, music, looping = None, interupt = 1, volume = None,
|
def playMusic(self, music, looping = None, interupt = 1, volume = None,
|
||||||
restart = None, time = 0.):
|
restart = None, time = 0.):
|
||||||
if music:
|
if (music and base.wantMusic):
|
||||||
if base.wantMusic:
|
if not interupt:
|
||||||
if not interupt:
|
if not (music.status() == AudioSound.PLAYING):
|
||||||
if not (music.status() == AudioSound.PLAYING):
|
|
||||||
AudioManager.play(music, time)
|
|
||||||
else:
|
|
||||||
AudioManager.play(music, time)
|
AudioManager.play(music, time)
|
||||||
if looping:
|
else:
|
||||||
AudioManager.setLoop(music, 1)
|
AudioManager.play(music, time)
|
||||||
if volume:
|
if looping:
|
||||||
AudioManager.setVolume(music, volume)
|
AudioManager.setLoop(music, 1)
|
||||||
if restart:
|
if volume:
|
||||||
restart[0].accept("restart-music", restart[1])
|
AudioManager.setVolume(music, volume)
|
||||||
|
if restart:
|
||||||
|
restart[0].accept("restart-music", restart[1])
|
||||||
|
|
||||||
def stopSfx(self, sfx):
|
def stopSfx(self, sfx):
|
||||||
if sfx:
|
if (sfx and base.wantSfx):
|
||||||
if base.wantSfx:
|
AudioManager.stop(sfx)
|
||||||
AudioManager.stop(sfx)
|
|
||||||
|
|
||||||
def stopMusic(self, music, restart = None):
|
def stopMusic(self, music, restart = None):
|
||||||
if music:
|
if (music and base.wantMusic):
|
||||||
if base.wantMusic:
|
AudioManager.stop(music)
|
||||||
AudioManager.stop(music)
|
if restart:
|
||||||
if restart:
|
restart[0].ignore("restart-music")
|
||||||
restart[0].ignore("restart-music")
|
|
||||||
|
|
||||||
def dataloop(self, state):
|
def dataloop(self, state):
|
||||||
# traverse the data graph. This reads all the control
|
# traverse the data graph. This reads all the control
|
||||||
|
Loading…
x
Reference in New Issue
Block a user