Browse Source

Merge branch 'release/1.9.x'

rdb 10 years ago
parent
commit
0ae2df7e02

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

@@ -23,6 +23,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:
 
 
@@ -170,10 +172,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
 
 
@@ -181,8 +183,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

@@ -1993,7 +1993,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
 
 

+ 6 - 3
direct/src/showbase/ShowBase.py

@@ -72,6 +72,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")
 
 
@@ -291,7 +293,6 @@ class ShowBase(DirectObject.DirectObject):
         self.physicsMgrEnabled = 0
         self.physicsMgrEnabled = 0
         self.physicsMgrAngular = 0
         self.physicsMgrAngular = 0
 
 
-        self.createBaseAudioManagers()
         self.createStats()
         self.createStats()
 
 
         self.AppHasAudioFocus = 1
         self.AppHasAudioFocus = 1
@@ -379,6 +380,8 @@ class ShowBase(DirectObject.DirectObject):
         else:
         else:
             ShowBase.notify.info('__dev__ == %s' % __dev__)
             ShowBase.notify.info('__dev__ == %s' % __dev__)
 
 
+        self.createBaseAudioManagers()
+
         # set up recording of Functor creation stacks in __dev__
         # set up recording of Functor creation stacks in __dev__
         PythonUtil.recordFunctorCreationStacks()
         PythonUtil.recordFunctorCreationStacks()
 
 
@@ -2659,7 +2662,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()
 
 
@@ -2667,7 +2670,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

@@ -166,7 +166,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

+ 1 - 1
dtool/src/interrogate/interfaceMakerPythonNative.cxx

@@ -6352,7 +6352,7 @@ write_make_seq(ostream &out, Object *obj, const std::string &ClassName,
       << "\n"
       << "\n"
       << "  PyObject *getter = PyDict_GetItemString(Dtool_" << ClassName << "._PyType.tp_dict, \"" << element_name << "\");\n"
       << "  PyObject *getter = PyDict_GetItemString(Dtool_" << ClassName << "._PyType.tp_dict, \"" << element_name << "\");\n"
       << "  if (getter == (PyObject *)NULL) {\n"
       << "  if (getter == (PyObject *)NULL) {\n"
-      << "    return NULL;\n"
+      << "    return Dtool_Raise_AttributeError(self, \"" << element_name << "\");\n"
       << "  }\n"
       << "  }\n"
       << "\n"
       << "\n"
       << "  Py_ssize_t count = (Py_ssize_t)local_this->" << make_seq->_num_name << "();\n"
       << "  Py_ssize_t count = (Py_ssize_t)local_this->" << make_seq->_num_name << "();\n"

+ 2 - 4
panda/src/display/graphicsEngine.cxx

@@ -629,8 +629,7 @@ remove_all_windows() {
   // a hack, since it's not really related to removing windows, this
   // a hack, since it's not really related to removing windows, this
   // would nevertheless be a fine time to ensure the model cache (if
   // would nevertheless be a fine time to ensure the model cache (if
   // any) has been flushed to disk.
   // any) has been flushed to disk.
-  BamCache *cache = BamCache::get_global_ptr();
-  cache->flush_index();
+  BamCache::flush_global_index();
 
 
   // And, hey, let's stop the vertex paging threads, if any.
   // And, hey, let's stop the vertex paging threads, if any.
   VertexDataPage::stop_threads();
   VertexDataPage::stop_threads();
@@ -715,8 +714,7 @@ render_frame() {
 
 
   // Since this gets called every frame, we should take advantage of
   // Since this gets called every frame, we should take advantage of
   // the opportunity to flush the cache if necessary.
   // the opportunity to flush the cache if necessary.
-  BamCache *cache = BamCache::get_global_ptr();
-  cache->consider_flush_index();
+  BamCache::consider_flush_global_index();
 
 
   // Anything that happens outside of GraphicsEngine::render_frame()
   // Anything that happens outside of GraphicsEngine::render_frame()
   // is deemed to be App.
   // is deemed to be App.

+ 26 - 0
panda/src/putil/bamCache.I

@@ -257,6 +257,32 @@ get_global_ptr() {
   return _global_ptr;
   return _global_ptr;
 }
 }
 
 
+////////////////////////////////////////////////////////////////////
+//     Function: BamCache::consider_flush_global_index
+//       Access: Published, Static
+//  Description: If there is a global BamCache object, calls
+//               consider_flush_index() on it.
+////////////////////////////////////////////////////////////////////
+INLINE void BamCache::
+consider_flush_global_index() {
+  if (_global_ptr != (BamCache *)NULL) {
+    _global_ptr->consider_flush_index();
+  }
+}
+
+////////////////////////////////////////////////////////////////////
+//     Function: BamCache::flush_global_index
+//       Access: Published, Static
+//  Description: If there is a global BamCache object, calls
+//               flush_index() on it.
+////////////////////////////////////////////////////////////////////
+INLINE void BamCache::
+flush_global_index() {
+  if (_global_ptr != (BamCache *)NULL) {
+    _global_ptr->flush_index();
+  }
+}
+
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 //     Function: BamCache::mark_index_stale
 //     Function: BamCache::mark_index_stale
 //       Access: Private
 //       Access: Private

+ 2 - 0
panda/src/putil/bamCache.h

@@ -83,6 +83,8 @@ PUBLISHED:
   void list_index(ostream &out, int indent_level = 0) const;
   void list_index(ostream &out, int indent_level = 0) const;
 
 
   INLINE static BamCache *get_global_ptr();
   INLINE static BamCache *get_global_ptr();
+  INLINE static void consider_flush_global_index();
+  INLINE static void flush_global_index();
 
 
 private:
 private:
   void read_index();
   void read_index();

+ 1 - 1
panda/src/tform/mouseWatcherBase.cxx

@@ -218,7 +218,7 @@ get_region(int n) const {
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////
 void MouseWatcherBase::
 void MouseWatcherBase::
 output(ostream &out) const {
 output(ostream &out) const {
-  out << "MouseWatcherBase (" << _regions.size() << " regions)";
+  out << "MouseWatcherGroup (" << _regions.size() << " regions)";
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////

+ 6 - 2
panda/src/tform/mouseWatcherGroup.h

@@ -31,13 +31,17 @@ class EXPCL_PANDA_TFORM MouseWatcherGroup : public MouseWatcherBase,
 public:
 public:
   INLINE MouseWatcherGroup() {};
   INLINE MouseWatcherGroup() {};
 
 
-public:
+PUBLISHED:
   static TypeHandle get_class_type() {
   static TypeHandle get_class_type() {
-    ReferenceCount::init_type();
     return _type_handle;
     return _type_handle;
   }
   }
+
+public:
   static void init_type() {
   static void init_type() {
+    MouseWatcherBase::init_type();
+    ReferenceCount::init_type();
     register_type(_type_handle, "MouseWatcherGroup",
     register_type(_type_handle, "MouseWatcherGroup",
+                  MouseWatcherBase::get_class_type(),
                   ReferenceCount::get_class_type());
                   ReferenceCount::get_class_type());
   }
   }