Fix Rope, fix some unnecessary reliances on base.config

This commit is contained in:
rdb 2015-11-01 15:53:02 +01:00
parent 63a9b5dfec
commit b1c7086cbc
5 changed files with 17 additions and 9 deletions

View File

@ -24,6 +24,8 @@ class Actor(DirectObject, NodePath):
LoaderOptions.LFConvertAnim)
validateSubparts = ConfigVariableBool('validate-subparts', True)
mergeLODBundles = ConfigVariableBool('merge-lod-bundles', True)
allowAsyncBind = ConfigVariableBool('allow-async-bind', True)
class PartDef:
@ -171,10 +173,10 @@ class Actor(DirectObject, NodePath):
# ['common']; when it is false, __animControlDict has one key
# per each LOD name.
if mergeLODBundles == None:
if mergeLODBundles is None:
# If this isn't specified, it comes from the Config.prc
# file.
self.mergeLODBundles = base.config.GetBool('merge-lod-bundles', True)
self.mergeLODBundles = Actor.mergeLODBundles.getValue()
else:
self.mergeLODBundles = mergeLODBundles
@ -182,8 +184,8 @@ class Actor(DirectObject, NodePath):
# asynchronous animation binding. This requires that you have
# run "egg-optchar -preload" on your animation and models to
# generate the appropriate AnimPreloadTable.
if allowAsyncBind == None:
self.allowAsyncBind = base.config.GetBool('allow-async-bind', True)
if allowAsyncBind is None:
self.allowAsyncBind = Actor.allowAsyncBind.getValue()
else:
self.allowAsyncBind = allowAsyncBind

View File

@ -1995,7 +1995,7 @@ def pstatcollect(scope, level = None):
try:
if not (__dev__ or config.GetBool('force-pstatcollect', 0)) or \
if not (__dev__ or ConfigVariableBool('force-pstatcollect', False)) or \
not scope:
return decorator

View File

@ -75,6 +75,8 @@ class ShowBase(DirectObject.DirectObject):
if logStackDump or uploadStackDump:
ExceptionVarDump.install(logStackDump, uploadStackDump)
self.__autoGarbageLogging = self.__dev__ and self.config.GetBool('auto-garbage-logging', False)
## The directory containing the main Python file of this application.
self.mainDir = ExecutionEnvironment.getEnvironmentVariable("MAIN_DIR")
@ -2665,7 +2667,7 @@ class ShowBase(DirectObject.DirectObject):
if not properties.getOpen():
# If the user closes the main window, we should exit.
self.notify.info("User closed main window.")
if __dev__ and config.GetBool('auto-garbage-logging', 0):
if self.__autoGarbageLogging:
GarbageReport.b_checkForGarbageLeaks()
self.userExit()
@ -2673,7 +2675,7 @@ class ShowBase(DirectObject.DirectObject):
self.mainWinForeground = 1
elif not properties.getForeground() and self.mainWinForeground:
self.mainWinForeground = 0
if __dev__ and config.GetBool('auto-garbage-logging', 0):
if self.__autoGarbageLogging:
GarbageReport.b_checkForGarbageLeaks()
if properties.getMinimized() and not self.mainWinMinimized:

View File

@ -168,7 +168,7 @@ class Transitions:
self.loadFade()
self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
self.fade.setColor(self.alphaOn)
elif base.config.GetBool('no-loading-screen',0):
elif ConfigVariableBool('no-loading-screen', False):
if finishIval:
self.transitionIval = finishIval
self.transitionIval.start()

View File

@ -10,7 +10,8 @@ class Rope(NodePath):
thick lines built from triangle strips.
"""
showRope = base.config.GetBool('show-rope', 1)
showRope = ConfigVariableBool('show-rope', True, \
"Set this to false to deactivate the display of ropes.")
def __init__(self, name = 'Rope'):
self.ropeNode = RopeNode(name)
@ -18,6 +19,9 @@ class Rope(NodePath):
self.ropeNode.setCurve(self.curve)
NodePath.__init__(self, self.ropeNode)
self.name = name
self.order = 0
self.verts = []
self.knots = None
def setup(self, order, verts, knots = None):
"""This must be called to define the shape of the curve