diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index ae55e76d33..39158377b8 100644 --- a/direct/src/actor/Actor.py +++ b/direct/src/actor/Actor.py @@ -23,6 +23,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: @@ -170,10 +172,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 @@ -181,8 +183,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 diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index 8b8d59394d..bb1d1e6758 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -1993,7 +1993,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 diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 0ecee86e6a..23b1554ecd 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -72,6 +72,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") @@ -291,7 +293,6 @@ class ShowBase(DirectObject.DirectObject): self.physicsMgrEnabled = 0 self.physicsMgrAngular = 0 - self.createBaseAudioManagers() self.createStats() self.AppHasAudioFocus = 1 @@ -379,6 +380,8 @@ class ShowBase(DirectObject.DirectObject): else: ShowBase.notify.info('__dev__ == %s' % __dev__) + self.createBaseAudioManagers() + # set up recording of Functor creation stacks in __dev__ PythonUtil.recordFunctorCreationStacks() @@ -2659,7 +2662,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() @@ -2667,7 +2670,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: diff --git a/direct/src/showbase/Transitions.py b/direct/src/showbase/Transitions.py index 86f5ee70fd..349a4106c5 100644 --- a/direct/src/showbase/Transitions.py +++ b/direct/src/showbase/Transitions.py @@ -166,7 +166,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() diff --git a/direct/src/showutil/Rope.py b/direct/src/showutil/Rope.py index 5bbda785ed..9b804cf0d8 100644 --- a/direct/src/showutil/Rope.py +++ b/direct/src/showutil/Rope.py @@ -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 diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 3c74c066bb..2edc8c657d 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -6352,7 +6352,7 @@ write_make_seq(ostream &out, Object *obj, const std::string &ClassName, << "\n" << " PyObject *getter = PyDict_GetItemString(Dtool_" << ClassName << "._PyType.tp_dict, \"" << element_name << "\");\n" << " if (getter == (PyObject *)NULL) {\n" - << " return NULL;\n" + << " return Dtool_Raise_AttributeError(self, \"" << element_name << "\");\n" << " }\n" << "\n" << " Py_ssize_t count = (Py_ssize_t)local_this->" << make_seq->_num_name << "();\n" diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 892d70361d..c7fd463e76 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -629,8 +629,7 @@ remove_all_windows() { // a hack, since it's not really related to removing windows, this // would nevertheless be a fine time to ensure the model cache (if // 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. VertexDataPage::stop_threads(); @@ -715,8 +714,7 @@ render_frame() { // Since this gets called every frame, we should take advantage of // 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() // is deemed to be App. diff --git a/panda/src/putil/bamCache.I b/panda/src/putil/bamCache.I index 3d2906e36c..9527bd0a83 100644 --- a/panda/src/putil/bamCache.I +++ b/panda/src/putil/bamCache.I @@ -257,6 +257,32 @@ get_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 // Access: Private diff --git a/panda/src/putil/bamCache.h b/panda/src/putil/bamCache.h index beab547935..f0615111a1 100644 --- a/panda/src/putil/bamCache.h +++ b/panda/src/putil/bamCache.h @@ -83,6 +83,8 @@ PUBLISHED: void list_index(ostream &out, int indent_level = 0) const; INLINE static BamCache *get_global_ptr(); + INLINE static void consider_flush_global_index(); + INLINE static void flush_global_index(); private: void read_index(); diff --git a/panda/src/tform/mouseWatcherBase.cxx b/panda/src/tform/mouseWatcherBase.cxx index 6a5a92aa4c..559508029d 100644 --- a/panda/src/tform/mouseWatcherBase.cxx +++ b/panda/src/tform/mouseWatcherBase.cxx @@ -218,7 +218,7 @@ get_region(int n) const { //////////////////////////////////////////////////////////////////// void MouseWatcherBase:: output(ostream &out) const { - out << "MouseWatcherBase (" << _regions.size() << " regions)"; + out << "MouseWatcherGroup (" << _regions.size() << " regions)"; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/tform/mouseWatcherGroup.h b/panda/src/tform/mouseWatcherGroup.h index d07994581d..bab2b497e1 100644 --- a/panda/src/tform/mouseWatcherGroup.h +++ b/panda/src/tform/mouseWatcherGroup.h @@ -31,13 +31,17 @@ class EXPCL_PANDA_TFORM MouseWatcherGroup : public MouseWatcherBase, public: INLINE MouseWatcherGroup() {}; -public: +PUBLISHED: static TypeHandle get_class_type() { - ReferenceCount::init_type(); return _type_handle; } + +public: static void init_type() { + MouseWatcherBase::init_type(); + ReferenceCount::init_type(); register_type(_type_handle, "MouseWatcherGroup", + MouseWatcherBase::get_class_type(), ReferenceCount::get_class_type()); }