From 38dfa82743e60087acd3f0df590813e44c45ea79 Mon Sep 17 00:00:00 2001 From: Jason Yeung Date: Wed, 13 Jun 2007 22:45:12 +0000 Subject: [PATCH] standardized loading of sound effects --- direct/src/showbase/Loader.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/direct/src/showbase/Loader.py b/direct/src/showbase/Loader.py index 3690cb913c..9e7807c776 100644 --- a/direct/src/showbase/Loader.py +++ b/direct/src/showbase/Loader.py @@ -392,7 +392,9 @@ class Loader(DirectObject): independently of the other group.""" # showbase-created sfxManager should always be at front of list - return self.loadSound(base.sfxManagerList[0], *args, **kw) + if(self.base.sfxManagerList): + return self.loadSound(self.base.sfxManagerList[0], *args, **kw) + return None def loadMusic(self, *args, **kw): """Loads one or more sound files, specifically designated as a @@ -402,9 +404,11 @@ class Loader(DirectObject): load the sound file, but this distinction allows the sound effects and/or the music files to be adjusted as a group, independently of the other group.""" - - return self.loadSound(base.musicManager, *args, **kw) - + if(self.base.musicManager): + return self.loadSound(self.base.musicManager, *args, **kw) + else: + return None + def loadSound(self, manager, soundPath, positional = False, callback = None, extraArgs = []): @@ -457,7 +461,8 @@ class Loader(DirectObject): def unloadSfx (self, sfx): if (sfx): - base.sfxManagerList[0].uncacheSound (sfx.getName()) + if(self.base.sfxManagerList): + self.base.sfxManagerList[0].uncacheSound (sfx.getName()) ## def makeNodeNamesUnique(self, nodePath, nodeCount): ## if nodeCount == 0: