Browse Source

Fix Rope, fix some unnecessary reliances on base.config

rdb 10 years ago
parent
commit
b1c7086cbc

+ 6 - 4
direct/src/actor/Actor.py

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

+ 1 - 1
direct/src/showbase/PythonUtil.py

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

+ 4 - 2
direct/src/showbase/ShowBase.py

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

+ 1 - 1
direct/src/showbase/Transitions.py

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

+ 5 - 1
direct/src/showutil/Rope.py

@@ -10,7 +10,8 @@ class Rope(NodePath):
     thick lines built from triangle strips.
     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'):
     def __init__(self, name = 'Rope'):
         self.ropeNode = RopeNode(name)
         self.ropeNode = RopeNode(name)
@@ -18,6 +19,9 @@ class Rope(NodePath):
         self.ropeNode.setCurve(self.curve)
         self.ropeNode.setCurve(self.curve)
         NodePath.__init__(self, self.ropeNode)
         NodePath.__init__(self, self.ropeNode)
         self.name = name
         self.name = name
+        self.order = 0
+        self.verts = []
+        self.knots = None
         
         
     def setup(self, order, verts, knots = None):
     def setup(self, order, verts, knots = None):
         """This must be called to define the shape of the curve
         """This must be called to define the shape of the curve