From 55a769760dde2cd511ca7ce1a1219e245997b941 Mon Sep 17 00:00:00 2001 From: David Rose Date: Mon, 6 Aug 2007 20:41:20 +0000 Subject: [PATCH] attempt to work around showbase startup order issue --- direct/src/showbase/PythonUtil.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index 37584ab773..15b8e9d411 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -45,6 +45,7 @@ import gc import traceback from direct.directutil import Verify +from pandac.libpandaexpressModules import ConfigVariableBool ScalarTypes = (types.FloatType, types.IntType, types.LongType) @@ -804,14 +805,11 @@ def profiled(category=None, terse=False): def profileDecorator(f): def _profiled(*args, **kArgs): - # must do this in here because we don't have base/simbase - # at the time that PythonUtil is loaded name = '(%s) %s from %s' % (category, f.func_name, f.__module__) - try: - _base = base - except: - _base = simbase - if (category is None) or _base.config.GetBool('want-profile-%s' % category, 0): + + # showbase might not be loaded yet, so don't use + # base.config. Instead, query the ConfigVariableBool. + if (category is None) or ConfigVariableBool('want-profile-%s' % category, 0).getValue(): return profile(Functor(f, *args, **kArgs), name, terse) else: return f(*args, **kArgs)