diff --git a/direct/src/showbase/ShowBase.py b/direct/src/showbase/ShowBase.py index 1a77056538..140cc0795d 100644 --- a/direct/src/showbase/ShowBase.py +++ b/direct/src/showbase/ShowBase.py @@ -235,6 +235,7 @@ class ShowBase(DirectObject.DirectObject): __builtins__["vfs"] = vfs __builtins__["cpMgr"] = ConfigPageManager.getGlobalPtr() __builtins__["cvMgr"] = ConfigVariableManager.getGlobalPtr() + __builtins__["pandaSystem"] = PandaSystem.getGlobalPtr() __builtins__["__dev__"] = base.config.GetBool('want-dev', 0) __builtins__["wantOtpServer"] = base.config.GetBool('want-otp-server', 0) if __debug__: diff --git a/dtool/src/dtoolutil/pandaSystem.cxx b/dtool/src/dtoolutil/pandaSystem.cxx index ba1f30b4ab..0e6e0ed491 100644 --- a/dtool/src/dtoolutil/pandaSystem.cxx +++ b/dtool/src/dtoolutil/pandaSystem.cxx @@ -169,7 +169,7 @@ get_num_systems() const { //////////////////////////////////////////////////////////////////// string PandaSystem:: get_system(int n) const { - if (n < 0 || n >= (int)_system_names.size()) { + if (n < 0 || n >= (int)_systems.size()) { return string(); } @@ -241,6 +241,38 @@ set_system_tag(const string &system, const string &tag, SystemTags &tags = (*result.first).second; tags[tag] = value; } + +//////////////////////////////////////////////////////////////////// +// Function: PandaSystem::output +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void PandaSystem:: +output(ostream &out) const { + out << "Panda version " << get_version_string(); +} + +//////////////////////////////////////////////////////////////////// +// Function: PandaSystem::write +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +void PandaSystem:: +write(ostream &out) const { + out << *this << ":\n"; + + for (Systems::const_iterator si = _systems.begin(); + si != _systems.end(); + ++si) { + out << " " << (*si).first << "\n"; + const SystemTags &tags = (*si).second; + SystemTags::const_iterator ti; + for (ti = tags.begin(); ti != tags.end(); ++ti) { + out << " " << (*ti).first << " " << (*ti).second << "\n"; + } + } +} + //////////////////////////////////////////////////////////////////// // Function: PandaSystem::get_global_ptr diff --git a/dtool/src/dtoolutil/pandaSystem.h b/dtool/src/dtoolutil/pandaSystem.h index 58bd64a1bb..c5ef31c837 100644 --- a/dtool/src/dtoolutil/pandaSystem.h +++ b/dtool/src/dtoolutil/pandaSystem.h @@ -54,6 +54,9 @@ PUBLISHED: void set_system_tag(const string &system, const string &tag, const string &value); + void output(ostream &out) const; + void write(ostream &out) const; + static PandaSystem *get_global_ptr(); private: @@ -70,6 +73,11 @@ private: static PandaSystem *_global_ptr; }; +inline ostream &operator << (ostream &out, const PandaSystem &ps) { + ps.output(out); + return out; +} + #endif diff --git a/panda/metalibs/pandagl/pandagl.cxx b/panda/metalibs/pandagl/pandagl.cxx index 6eb99b4e57..12df9bf159 100644 --- a/panda/metalibs/pandagl/pandagl.cxx +++ b/panda/metalibs/pandagl/pandagl.cxx @@ -6,14 +6,12 @@ #include "pandagl.h" #ifndef LINK_IN_GL -#include -// Temporarily commented out for development on wgldisplay -/* +#include "config_glgsg.h" #ifdef HAVE_WGL -#include -#endif -*/ -#endif +#include "config_wgldisplay.h" +#endif // HAVE_WGL + +#endif // LINK_IN_GL // By including checkPandaVersion.h, we guarantee that runtime // attempts to load libpandagl.so/.dll will fail if they inadvertently @@ -33,11 +31,8 @@ void init_libpandagl() { #ifndef LINK_IN_GL init_libglgsg(); -// Temporarily commented out for development on wgldisplay - /* #ifdef HAVE_WGL init_libwgldisplay(); -#endif - */ -#endif +#endif // HAVE_GL +#endif // LINK_IN_GL } diff --git a/panda/src/audiotraits/config_fmodAudio.cxx b/panda/src/audiotraits/config_fmodAudio.cxx index 2df8d50f86..3d5f54fe30 100644 --- a/panda/src/audiotraits/config_fmodAudio.cxx +++ b/panda/src/audiotraits/config_fmodAudio.cxx @@ -23,6 +23,7 @@ #include "config_fmodAudio.h" #include "fmodAudioManager.h" #include "fmodAudioSound.h" +#include "pandaSystem.h" #include "dconfig.h" ConfigureDef(config_fmodAudio); @@ -50,6 +51,11 @@ init_libFmodAudio() { initialized = true; AudioManager::register_AudioManager_creator(Create_AudioManager); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("FMOD"); + ps->add_system("audio"); + ps->set_system_tag("audio", "implementation", "FMOD"); } #endif //] diff --git a/panda/src/audiotraits/config_milesAudio.cxx b/panda/src/audiotraits/config_milesAudio.cxx index 3f144fbc66..202da1e8c6 100644 --- a/panda/src/audiotraits/config_milesAudio.cxx +++ b/panda/src/audiotraits/config_milesAudio.cxx @@ -22,6 +22,7 @@ #include "config_milesAudio.h" #include "milesAudioManager.h" #include "milesAudioSound.h" +#include "pandaSystem.h" #include "dconfig.h" ConfigureDef(config_milesAudio); @@ -72,6 +73,11 @@ init_libMilesAudio() { MilesAudioManager::init_type(); MilesAudioSound::init_type(); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("Miles"); + ps->add_system("audio"); + ps->set_system_tag("audio", "implementation", "Miles"); } #endif //] diff --git a/panda/src/downloader/config_downloader.cxx b/panda/src/downloader/config_downloader.cxx index 2eed68d715..8fd7129998 100644 --- a/panda/src/downloader/config_downloader.cxx +++ b/panda/src/downloader/config_downloader.cxx @@ -19,6 +19,7 @@ #include "dconfig.h" #include "config_downloader.h" #include "httpChannel.h" +#include "pandaSystem.h" ConfigureDef(config_downloader); @@ -157,5 +158,8 @@ ConfigVariableList http_username ConfigureFn(config_downloader) { #ifdef HAVE_SSL HTTPChannel::init_type(); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("OpenSSL"); #endif } diff --git a/panda/src/dxgsg7/config_dxgsg7.cxx b/panda/src/dxgsg7/config_dxgsg7.cxx index dd85cdd243..c0771c8548 100644 --- a/panda/src/dxgsg7/config_dxgsg7.cxx +++ b/panda/src/dxgsg7/config_dxgsg7.cxx @@ -23,6 +23,7 @@ #include "wdxGraphicsPipe7.h" #include "wdxGraphicsWindow7.h" #include "graphicsPipeSelection.h" +#include "pandaSystem.h" #include "dconfig.h" @@ -126,4 +127,7 @@ init_libdxgsg7() { GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr(); selection->add_pipe_type(wdxGraphicsPipe7::get_class_type(), wdxGraphicsPipe7::pipe_constructor); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("DirectX7"); } diff --git a/panda/src/dxgsg8/config_dxgsg8.cxx b/panda/src/dxgsg8/config_dxgsg8.cxx index 5f30ea9f4d..02f893929c 100644 --- a/panda/src/dxgsg8/config_dxgsg8.cxx +++ b/panda/src/dxgsg8/config_dxgsg8.cxx @@ -23,6 +23,7 @@ #include "graphicsPipeSelection.h" #include "wdxGraphicsWindow8.h" #include "wdxGraphicsPipe8.h" +#include "pandaSystem.h" #include "dconfig.h" @@ -152,4 +153,6 @@ init_libdxgsg8() { selection->add_pipe_type(wdxGraphicsPipe8::get_class_type(), wdxGraphicsPipe8::pipe_constructor); + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("DirectX8"); } diff --git a/panda/src/dxgsg9/config_dxgsg9.cxx b/panda/src/dxgsg9/config_dxgsg9.cxx index 08268b66f3..ca8b98961b 100755 --- a/panda/src/dxgsg9/config_dxgsg9.cxx +++ b/panda/src/dxgsg9/config_dxgsg9.cxx @@ -23,6 +23,7 @@ #include "graphicsPipeSelection.h" #include "wdxGraphicsWindow9.h" #include "wdxGraphicsPipe9.h" +#include "pandaSystem.h" #include "dconfig.h" @@ -152,4 +153,6 @@ init_libdxgsg9() { selection->add_pipe_type(wdxGraphicsPipe9::get_class_type(), wdxGraphicsPipe9::pipe_constructor); + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("DirectX9"); } diff --git a/panda/src/effects/config_effects.cxx b/panda/src/effects/config_effects.cxx index 05b617b4de..9f75cc45df 100644 --- a/panda/src/effects/config_effects.cxx +++ b/panda/src/effects/config_effects.cxx @@ -21,6 +21,7 @@ #include "cgShaderAttrib.h" #include "cgShaderContext.h" #include "lensFlareNode.h" +#include "pandaSystem.h" #include "dconfig.h" @@ -46,6 +47,9 @@ init_libeffects() { CgShader::init_type(); CgShaderAttrib::init_type(); CgShaderContext::init_type(); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("Cg"); #endif #if 0 // temporarily disabled until we can port to new scene graph. LensFlareNode::init_type(); diff --git a/panda/src/egg2pg/config_egg2pg.cxx b/panda/src/egg2pg/config_egg2pg.cxx index 4c4281ee8e..f257c406aa 100644 --- a/panda/src/egg2pg/config_egg2pg.cxx +++ b/panda/src/egg2pg/config_egg2pg.cxx @@ -155,7 +155,7 @@ init_libegg2pg() { LoaderFileTypeEgg::init_type(); - LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr(); + LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); reg->register_type(new LoaderFileTypeEgg); } diff --git a/panda/src/framework/windowFramework.cxx b/panda/src/framework/windowFramework.cxx index e5ddcf55df..b60b7db98f 100644 --- a/panda/src/framework/windowFramework.cxx +++ b/panda/src/framework/windowFramework.cxx @@ -561,13 +561,13 @@ load_model(const NodePath &parent, Filename filename) { bool is_image = false; string extension = filename.get_extension(); if (!extension.empty()) { - LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr(); + LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); LoaderFileType *model_type = reg->get_type_from_extension(extension); if (model_type == (LoaderFileType *)NULL) { // The extension isn't a known model file type, is it a known // image extension? - PNMFileTypeRegistry *reg = PNMFileTypeRegistry::get_ptr(); + PNMFileTypeRegistry *reg = PNMFileTypeRegistry::get_global_ptr(); PNMFileType *image_type = reg->get_type_from_extension(extension); if (image_type != (PNMFileType *)NULL) { diff --git a/panda/src/glgsg/glgsg.h b/panda/src/glgsg/glgsg.h index 7ef0d8bd16..d1b3a304bd 100644 --- a/panda/src/glgsg/glgsg.h +++ b/panda/src/glgsg/glgsg.h @@ -31,6 +31,7 @@ #define CLP(name) GL##name #define GLPREFIX_QUOTED "gl" #define CLASSPREFIX_QUOTED "GL" +#define GLSYSTEM_NAME "OpenGL" #define CONFIGOBJ config_glgsg #define GLCAT glgsg_cat #define EXPCL_GL EXPCL_PANDAGL diff --git a/panda/src/glstuff/glmisc_src.cxx b/panda/src/glstuff/glmisc_src.cxx index c61d588efd..be8e406464 100644 --- a/panda/src/glstuff/glmisc_src.cxx +++ b/panda/src/glstuff/glmisc_src.cxx @@ -16,6 +16,7 @@ // //////////////////////////////////////////////////////////////////// +#include "pandaSystem.h" ConfigVariableBool CLP(cheap_textures) ("gl-cheap-textures", false, @@ -63,5 +64,12 @@ void CLP(init_classes)() { CLP(SavedFrameBuffer)::init_type(); CLP(TextureContext)::init_type(); CLP(GeomContext)::init_type(); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system(GLSYSTEM_NAME); + + // We can't add any tags defining the available OpenGL capabilities, + // since we won't know those until we create a graphics context (and + // the answer may be different for different contexts). } diff --git a/panda/src/glxdisplay/config_glxdisplay.cxx b/panda/src/glxdisplay/config_glxdisplay.cxx index 99a3b02b6f..252b8339b9 100644 --- a/panda/src/glxdisplay/config_glxdisplay.cxx +++ b/panda/src/glxdisplay/config_glxdisplay.cxx @@ -23,6 +23,7 @@ #include "glxGraphicsStateGuardian.h" #include "graphicsPipeSelection.h" #include "dconfig.h" +#include "pandaSystem.h" Configure(config_glxdisplay); NotifyCategoryDef(glxdisplay, "display"); @@ -63,4 +64,7 @@ init_libglxdisplay() { GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr(); selection->add_pipe_type(glxGraphicsPipe::get_class_type(), glxGraphicsPipe::pipe_constructor); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->set_system_tag("OpenGL", "window_system", "GLX"); } diff --git a/panda/src/linmath/config_linmath.cxx b/panda/src/linmath/config_linmath.cxx index ab077088ee..dcea724e8c 100644 --- a/panda/src/linmath/config_linmath.cxx +++ b/panda/src/linmath/config_linmath.cxx @@ -31,16 +31,16 @@ ConfigureFn(config_linmath) { ConfigVariableBool paranoid_hpr_quat ("paranoid-hpr-quat", false, - "Set this true to doublecheck the quaternion-hpr compose and " - "decompose operations against the quaternion-matrix and matrix-hpr " - "operations. This only has effect if NDEBUG is not defined."); + PRC_DESC("Set this true to doublecheck the quaternion-hpr compose and " + "decompose operations against the quaternion-matrix and matrix-hpr " + "operations. This only has effect if NDEBUG is not defined.")); ConfigVariableBool temp_hpr_fix ("temp-hpr-fix", true, - "Set this true to compute hpr's correctly. Historically, Panda has " - "applied these in the wrong order, and roll was backwards relative " - "to the other two. Set this false if you need compatibility with " - "Panda's old hpr calculations."); + PRC_DESC("Set this true to compute hpr's correctly. Historically, Panda has " + "applied these in the wrong order, and roll was backwards relative " + "to the other two. Set this false if you need compatibility with " + "Panda's old hpr calculations.")); //////////////////////////////////////////////////////////////////// // Function: init_liblinmath diff --git a/panda/src/mathutil/config_mathutil.cxx b/panda/src/mathutil/config_mathutil.cxx index 592ed4e288..b9d301b4d0 100644 --- a/panda/src/mathutil/config_mathutil.cxx +++ b/panda/src/mathutil/config_mathutil.cxx @@ -26,6 +26,7 @@ #include "boundingLine.h" #include "linmath_events.h" #include "dconfig.h" +#include "pandaSystem.h" Configure(config_mathutil); NotifyCategoryDef(mathutil, ""); @@ -57,5 +58,10 @@ ConfigureFn(config_mathutil) { EventStoreVec2::register_with_read_factory(); EventStoreVec3::register_with_read_factory(); EventStoreMat4::register_with_read_factory(); + +#ifdef HAVE_FFTW + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("fftw"); +#endif // FFTW } diff --git a/panda/src/mesadisplay/mesagsg.h b/panda/src/mesadisplay/mesagsg.h index 364c380dd1..12f3bc1a0c 100644 --- a/panda/src/mesadisplay/mesagsg.h +++ b/panda/src/mesadisplay/mesagsg.h @@ -38,6 +38,7 @@ #endif #define CLP(name) Mesa##name #define CLASSPREFIX_QUOTED "Mesa" +#define GLSYSTEM_NAME "Mesa" #define CONFIGOBJ config_mesadisplay #define GLCAT mesadisplay_cat #define EXPCL_GL EXPCL_PANDAMESA diff --git a/panda/src/net/config_net.cxx b/panda/src/net/config_net.cxx index 5ca4234936..6dc06d285f 100644 --- a/panda/src/net/config_net.cxx +++ b/panda/src/net/config_net.cxx @@ -19,6 +19,7 @@ #include "config_net.h" #include "netDatagram.h" +#include "pandaSystem.h" #include "dconfig.h" @@ -47,9 +48,13 @@ init_libnet() { initialized = true; NetDatagram::init_type(); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("NSPR"); } + // The following two maximum queue sizes are totally arbitrary and // serve only to provide sanity caps on the various queues in the net // package. You can set them to any sane values you like. Also see diff --git a/panda/src/pgraph/config_pgraph.cxx b/panda/src/pgraph/config_pgraph.cxx index e6e2dbf906..34be844a88 100644 --- a/panda/src/pgraph/config_pgraph.cxx +++ b/panda/src/pgraph/config_pgraph.cxx @@ -343,6 +343,6 @@ init_libpgraph() { TransformState::register_with_read_factory(); TransparencyAttrib::register_with_read_factory(); - LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr(); + LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); reg->register_type(new LoaderFileTypeBam); } diff --git a/panda/src/pgraph/loader.cxx b/panda/src/pgraph/loader.cxx index c3cda74323..4c07705c38 100644 --- a/panda/src/pgraph/loader.cxx +++ b/panda/src/pgraph/loader.cxx @@ -104,7 +104,7 @@ find_all_files(const Filename &filename, const DSearchPath &search_path, if (!extension.empty()) { // If the extension is not empty, it specifies a single file type. - LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr(); + LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); LoaderFileType *requested_type = reg->get_type_from_extension(extension); @@ -132,7 +132,7 @@ find_all_files(const Filename &filename, const DSearchPath &search_path, } else { // If the extension *is* empty, we have to search for all possible // file types. - LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr(); + LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); int num_types = reg->get_num_types(); if (!filename.is_local()) { @@ -332,7 +332,7 @@ load_file_types() { // Multiple words: the first n words are filename extensions, // and the last word is the name of the library to load should // any of those filename extensions be encountered. - LoaderFileTypeRegistry *registry = LoaderFileTypeRegistry::get_ptr(); + LoaderFileTypeRegistry *registry = LoaderFileTypeRegistry::get_global_ptr(); size_t num_extensions = words.size() - 1; string library_name = words[num_extensions]; @@ -424,7 +424,7 @@ load_file(const Filename &filename, bool search) const { // unknown file type. Report a useful message either way. string extension = filename.get_extension(); if (!extension.empty()) { - LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr(); + LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); LoaderFileType *requested_type = reg->get_type_from_extension(extension); if (requested_type == (LoaderFileType *)NULL) { @@ -433,7 +433,7 @@ load_file(const Filename &filename, bool search) const { << " is unrecognized; cannot load.\n"; loader_cat.error(false) << "Currently known scene file types are:\n"; - reg->write_types(loader_cat.error(false), 2); + reg->write(loader_cat.error(false), 2); return NULL; } } diff --git a/panda/src/pgraph/loaderFileType.cxx b/panda/src/pgraph/loaderFileType.cxx index f1886113b6..2a12e972be 100644 --- a/panda/src/pgraph/loaderFileType.cxx +++ b/panda/src/pgraph/loaderFileType.cxx @@ -41,7 +41,7 @@ LoaderFileType:: //////////////////////////////////////////////////////////////////// // Function: LoaderFileType::get_additional_extensions -// Access: Public, Virtual +// Access: Published, Virtual // Description: Returns a space-separated list of extension, in // addition to the one returned by get_extension(), that // are recognized by this loader. diff --git a/panda/src/pgraph/loaderFileType.h b/panda/src/pgraph/loaderFileType.h index b20d22b990..24c389a4e0 100644 --- a/panda/src/pgraph/loaderFileType.h +++ b/panda/src/pgraph/loaderFileType.h @@ -41,10 +41,12 @@ protected: public: virtual ~LoaderFileType(); +PUBLISHED: virtual string get_name() const=0; virtual string get_extension() const=0; virtual string get_additional_extensions() const; +public: virtual PT(PandaNode) load_file(const Filename &path, bool report_errors) const; public: diff --git a/panda/src/pgraph/loaderFileTypeRegistry.cxx b/panda/src/pgraph/loaderFileTypeRegistry.cxx index 2297b8d0bd..5b19ecdd2b 100644 --- a/panda/src/pgraph/loaderFileTypeRegistry.cxx +++ b/panda/src/pgraph/loaderFileTypeRegistry.cxx @@ -46,124 +46,6 @@ LoaderFileTypeRegistry:: ~LoaderFileTypeRegistry() { } -//////////////////////////////////////////////////////////////////// -// Function: LoaderFileTypeRegistry::get_ptr -// Access: Public, Static -// Description: Returns a pointer to the global LoaderFileTypeRegistry -// object. -//////////////////////////////////////////////////////////////////// -LoaderFileTypeRegistry *LoaderFileTypeRegistry:: -get_ptr() { - if (_global_ptr == (LoaderFileTypeRegistry *)NULL) { - _global_ptr = new LoaderFileTypeRegistry; - } - return _global_ptr; -} - -//////////////////////////////////////////////////////////////////// -// Function: LoaderFileTypeRegistry::get_num_types -// Access: Public -// Description: Returns the total number of types registered. -//////////////////////////////////////////////////////////////////// -int LoaderFileTypeRegistry:: -get_num_types() const { - return _types.size(); -} - -//////////////////////////////////////////////////////////////////// -// Function: LoaderFileTypeRegistry::get_type -// Access: Public -// Description: Returns the nth type registered. -//////////////////////////////////////////////////////////////////// -LoaderFileType *LoaderFileTypeRegistry:: -get_type(int n) const { - nassertr(n >= 0 && n < (int)_types.size(), NULL); - return _types[n]; -} - -//////////////////////////////////////////////////////////////////// -// Function: LoaderFileTypeRegistry::get_type_from_extension -// Access: Public -// Description: Determines the type of the file based on the indicated -// extension (without a leading dot). Returns NULL if -// the extension matches no known file types. -//////////////////////////////////////////////////////////////////// -LoaderFileType *LoaderFileTypeRegistry:: -get_type_from_extension(const string &extension) { - string dcextension = downcase(extension); - - Extensions::const_iterator ei; - ei = _extensions.find(dcextension); - if (ei == _extensions.end()) { - // Nothing matches that extension. Do we have a deferred type? - - DeferredTypes::iterator di; - di = _deferred_types.find(dcextension); - if (di != _deferred_types.end()) { - // We do! Try to load the deferred library on-the-fly. Note - // that this is a race condition if we support threaded loading; - // this whole function needs to be protected from multiple - // entry. - string name = (*di).second; - Filename dlname = Filename::dso_filename("lib" + name + ".so"); - _deferred_types.erase(di); - - loader_cat->info() - << "loading file type module: " << name << endl; - void *tmp = load_dso(dlname); - if (tmp == (void *)NULL) { - loader_cat->warning() - << "Unable to load " << dlname.to_os_specific() << ": " - << load_dso_error() << endl; - return NULL; - } - - // Now try again to find the LoaderFileType. - ei = _extensions.find(dcextension); - } - } - - if (ei == _extensions.end()) { - // Nothing matches that extension, even after we've checked for a - // deferred type description. - return NULL; - } - - return (*ei).second; -} - -//////////////////////////////////////////////////////////////////// -// Function: LoaderFileTypeRegistry::write_types -// Access: Public -// Description: Writes a list of supported file types to the -// indicated output stream, one per line. -//////////////////////////////////////////////////////////////////// -void LoaderFileTypeRegistry:: -write_types(ostream &out, int indent_level) const { - if (_types.empty()) { - indent(out, indent_level) << "(No file types are known).\n"; - } else { - Types::const_iterator ti; - for (ti = _types.begin(); ti != _types.end(); ++ti) { - LoaderFileType *type = (*ti); - string name = type->get_name(); - indent(out, indent_level) << name; - indent(out, max(30 - (int)name.length(), 0)) - << " ." << type->get_extension() << "\n"; - } - } - - if (!_deferred_types.empty()) { - indent(out, indent_level) << "Also available:"; - DeferredTypes::const_iterator di; - for (di = _deferred_types.begin(); di != _deferred_types.end(); ++di) { - const string &extension = (*di).first; - out << " ." << extension; - } - out << "\n"; - } -} - //////////////////////////////////////////////////////////////////// // Function: LoaderFileTypeRegistry::register_type // Access: Public @@ -234,6 +116,124 @@ register_deferred_type(const string &extension, const string &library) { _deferred_types[dcextension] = library; } +//////////////////////////////////////////////////////////////////// +// Function: LoaderFileTypeRegistry::get_num_types +// Access: Published +// Description: Returns the total number of types registered. +//////////////////////////////////////////////////////////////////// +int LoaderFileTypeRegistry:: +get_num_types() const { + return _types.size(); +} + +//////////////////////////////////////////////////////////////////// +// Function: LoaderFileTypeRegistry::get_type +// Access: Published +// Description: Returns the nth type registered. +//////////////////////////////////////////////////////////////////// +LoaderFileType *LoaderFileTypeRegistry:: +get_type(int n) const { + nassertr(n >= 0 && n < (int)_types.size(), NULL); + return _types[n]; +} + +//////////////////////////////////////////////////////////////////// +// Function: LoaderFileTypeRegistry::get_type_from_extension +// Access: Published +// Description: Determines the type of the file based on the indicated +// extension (without a leading dot). Returns NULL if +// the extension matches no known file types. +//////////////////////////////////////////////////////////////////// +LoaderFileType *LoaderFileTypeRegistry:: +get_type_from_extension(const string &extension) { + string dcextension = downcase(extension); + + Extensions::const_iterator ei; + ei = _extensions.find(dcextension); + if (ei == _extensions.end()) { + // Nothing matches that extension. Do we have a deferred type? + + DeferredTypes::iterator di; + di = _deferred_types.find(dcextension); + if (di != _deferred_types.end()) { + // We do! Try to load the deferred library on-the-fly. Note + // that this is a race condition if we support threaded loading; + // this whole function needs to be protected from multiple + // entry. + string name = (*di).second; + Filename dlname = Filename::dso_filename("lib" + name + ".so"); + _deferred_types.erase(di); + + loader_cat->info() + << "loading file type module: " << name << endl; + void *tmp = load_dso(dlname); + if (tmp == (void *)NULL) { + loader_cat->warning() + << "Unable to load " << dlname.to_os_specific() << ": " + << load_dso_error() << endl; + return NULL; + } + + // Now try again to find the LoaderFileType. + ei = _extensions.find(dcextension); + } + } + + if (ei == _extensions.end()) { + // Nothing matches that extension, even after we've checked for a + // deferred type description. + return NULL; + } + + return (*ei).second; +} + +//////////////////////////////////////////////////////////////////// +// Function: LoaderFileTypeRegistry::write +// Access: Published +// Description: Writes a list of supported file types to the +// indicated output stream, one per line. +//////////////////////////////////////////////////////////////////// +void LoaderFileTypeRegistry:: +write(ostream &out, int indent_level) const { + if (_types.empty()) { + indent(out, indent_level) << "(No file types are known).\n"; + } else { + Types::const_iterator ti; + for (ti = _types.begin(); ti != _types.end(); ++ti) { + LoaderFileType *type = (*ti); + string name = type->get_name(); + indent(out, indent_level) << name; + indent(out, max(30 - (int)name.length(), 0)) + << " ." << type->get_extension() << "\n"; + } + } + + if (!_deferred_types.empty()) { + indent(out, indent_level) << "Also available:"; + DeferredTypes::const_iterator di; + for (di = _deferred_types.begin(); di != _deferred_types.end(); ++di) { + const string &extension = (*di).first; + out << " ." << extension; + } + out << "\n"; + } +} + +//////////////////////////////////////////////////////////////////// +// Function: LoaderFileTypeRegistry::get_global_ptr +// Access: Published, Static +// Description: Returns a pointer to the global LoaderFileTypeRegistry +// object. +//////////////////////////////////////////////////////////////////// +LoaderFileTypeRegistry *LoaderFileTypeRegistry:: +get_global_ptr() { + if (_global_ptr == (LoaderFileTypeRegistry *)NULL) { + _global_ptr = new LoaderFileTypeRegistry; + } + return _global_ptr; +} + //////////////////////////////////////////////////////////////////// // Function: LoaderFileTypeRegistry::record_extension // Access: Private diff --git a/panda/src/pgraph/loaderFileTypeRegistry.h b/panda/src/pgraph/loaderFileTypeRegistry.h index b5a42cdc44..41a6b4ddf9 100644 --- a/panda/src/pgraph/loaderFileTypeRegistry.h +++ b/panda/src/pgraph/loaderFileTypeRegistry.h @@ -39,18 +39,18 @@ protected: public: ~LoaderFileTypeRegistry(); - static LoaderFileTypeRegistry *get_ptr(); - - int get_num_types() const; - LoaderFileType *get_type(int n) const; - - LoaderFileType *get_type_from_extension(const string &extension); - - void write_types(ostream &out, int indent_level = 0) const; - void register_type(LoaderFileType *type); void register_deferred_type(const string &extension, const string &library); +PUBLISHED: + int get_num_types() const; + LoaderFileType *get_type(int n) const; + LoaderFileType *get_type_from_extension(const string &extension); + + void write(ostream &out, int indent_level = 0) const; + + static LoaderFileTypeRegistry *get_global_ptr(); + private: void record_extension(const string &extension, LoaderFileType *type); diff --git a/panda/src/pnmimage/pnmFileType.cxx b/panda/src/pnmimage/pnmFileType.cxx index ab15ee9a8b..cada9175e0 100644 --- a/panda/src/pnmimage/pnmFileType.cxx +++ b/panda/src/pnmimage/pnmFileType.cxx @@ -46,7 +46,7 @@ PNMFileType:: //////////////////////////////////////////////////////////////////// // Function: PNMFileType::get_num_extensions -// Access: Public, Virtual +// Access: Published, Virtual // Description: Returns the number of different possible filename // extensions associated with this particular file type. //////////////////////////////////////////////////////////////////// @@ -57,7 +57,7 @@ get_num_extensions() const { //////////////////////////////////////////////////////////////////// // Function: PNMFileType::get_extension -// Access: Public, Virtual +// Access: Published, Virtual // Description: Returns the nth possible filename extension // associated with this particular file type, without a // leading dot. @@ -70,7 +70,7 @@ get_extension(int) const { //////////////////////////////////////////////////////////////////// // Function: PNMFileType::get_suggested_extension -// Access: Public, Virtual +// Access: Published, Virtual // Description: Returns a suitable filename extension (without a // leading dot) to suggest for files of this type, or // empty string if no suggestions are available. diff --git a/panda/src/pnmimage/pnmFileType.h b/panda/src/pnmimage/pnmFileType.h index e77238cc1a..2e0f8de211 100644 --- a/panda/src/pnmimage/pnmFileType.h +++ b/panda/src/pnmimage/pnmFileType.h @@ -43,12 +43,14 @@ protected: public: virtual ~PNMFileType(); +PUBLISHED: virtual string get_name() const=0; virtual int get_num_extensions() const; virtual string get_extension(int n) const; virtual string get_suggested_extension() const; +public: virtual bool has_magic_number() const; virtual bool matches_magic_number(const string &magic_number) const; diff --git a/panda/src/pnmimage/pnmFileTypeRegistry.cxx b/panda/src/pnmimage/pnmFileTypeRegistry.cxx index b22166f2d0..7488acfa0f 100644 --- a/panda/src/pnmimage/pnmFileTypeRegistry.cxx +++ b/panda/src/pnmimage/pnmFileTypeRegistry.cxx @@ -48,22 +48,49 @@ PNMFileTypeRegistry:: } //////////////////////////////////////////////////////////////////// -// Function: PNMFileTypeRegistry::get_ptr -// Access: Public, Static -// Description: Returns a pointer to the global PNMFileTypeRegistry -// object. +// Function: PNMFileTypeRegistry::register_type +// Access: Public +// Description: Defines a new PNMFileType in the universe. //////////////////////////////////////////////////////////////////// -PNMFileTypeRegistry *PNMFileTypeRegistry:: -get_ptr() { - if (_global_ptr == (PNMFileTypeRegistry *)NULL) { - _global_ptr = new PNMFileTypeRegistry; +void PNMFileTypeRegistry:: +register_type(PNMFileType *type) { + // Make sure we haven't already registered this type. + Handles::iterator hi = _handles.find(type->get_type()); + if (hi != _handles.end()) { + pnmimage_cat.warning() + << "Attempt to register PNMFileType " << type->get_name() + << " (" << type->get_type() << ") more than once.\n"; + return; } - return _global_ptr; + + _types.push_back(type); + _handles.insert(Handles::value_type(type->get_type(), type)); + + // Collect the unique extensions associated with the type. + pset unique_extensions; + int num_extensions = type->get_num_extensions(); + for (int i = 0; i < num_extensions; i++) { + string extension = downcase(type->get_extension(i)); + + if (!unique_extensions.insert(extension).second) { + pnmimage_cat.warning() + << "PNMFileType " << type->get_name() + << " (" << type->get_type() << ") defined extension " + << extension << " more than once.\n"; + } + } + + pset::iterator ui; + for (ui = unique_extensions.begin(); ui != unique_extensions.end(); ++ui) { + _extensions[*ui].push_back(type); + } + + _requires_sort = true; } //////////////////////////////////////////////////////////////////// // Function: PNMFileTypeRegistry::get_num_types -// Access: Public +// Access: Published // Description: Returns the total number of types registered. //////////////////////////////////////////////////////////////////// int PNMFileTypeRegistry:: @@ -76,7 +103,7 @@ get_num_types() const { //////////////////////////////////////////////////////////////////// // Function: PNMFileTypeRegistry::get_type -// Access: Public +// Access: Published // Description: Returns the nth type registered. //////////////////////////////////////////////////////////////////// PNMFileType *PNMFileTypeRegistry:: @@ -87,7 +114,7 @@ get_type(int n) const { //////////////////////////////////////////////////////////////////// // Function: PNMFileTypeRegistry::get_type_from_extension -// Access: Public +// Access: Published // Description: Tries to determine what the PNMFileType is likely to // be for a particular image file based on its // extension. Returns a suitable PNMFileType pointer, @@ -132,7 +159,7 @@ get_type_from_extension(const string &filename) const { //////////////////////////////////////////////////////////////////// // Function: PNMFileTypeRegistry::get_type_from_magic_number -// Access: Public +// Access: Published // Description: Tries to determine what the PNMFileType is likely to // be for a particular image file based on its // magic number, the first two bytes read from the @@ -159,7 +186,7 @@ get_type_from_magic_number(const string &magic_number) const { //////////////////////////////////////////////////////////////////// // Function: PNMFileTypeRegistry::get_type_by_handle -// Access: Public +// Access: Published // Description: Returns the PNMFileType instance stored in the // registry for the given TypeHandle, e.g. as retrieved // by a previous call to get_type() on the type @@ -177,13 +204,13 @@ get_type_by_handle(TypeHandle handle) const { } //////////////////////////////////////////////////////////////////// -// Function: PNMFileTypeRegistry::write_types -// Access: Public +// Function: PNMFileTypeRegistry::write +// Access: Published // Description: Writes a list of supported image file types to the // indicated output stream, one per line. //////////////////////////////////////////////////////////////////// void PNMFileTypeRegistry:: -write_types(ostream &out, int indent_level) const { +write(ostream &out, int indent_level) const { if (_types.empty()) { indent(out, indent_level) << "(No image types are known).\n"; } else { @@ -209,44 +236,17 @@ write_types(ostream &out, int indent_level) const { } //////////////////////////////////////////////////////////////////// -// Function: PNMFileTypeRegistry::register_type -// Access: Public -// Description: Defines a new PNMFileType in the universe. +// Function: PNMFileTypeRegistry::get_global_ptr +// Access: Published, Static +// Description: Returns a pointer to the global PNMFileTypeRegistry +// object. //////////////////////////////////////////////////////////////////// -void PNMFileTypeRegistry:: -register_type(PNMFileType *type) { - // Make sure we haven't already registered this type. - Handles::iterator hi = _handles.find(type->get_type()); - if (hi != _handles.end()) { - pnmimage_cat.warning() - << "Attempt to register PNMFileType " << type->get_name() - << " (" << type->get_type() << ") more than once.\n"; - return; +PNMFileTypeRegistry *PNMFileTypeRegistry:: +get_global_ptr() { + if (_global_ptr == (PNMFileTypeRegistry *)NULL) { + _global_ptr = new PNMFileTypeRegistry; } - - _types.push_back(type); - _handles.insert(Handles::value_type(type->get_type(), type)); - - // Collect the unique extensions associated with the type. - pset unique_extensions; - int num_extensions = type->get_num_extensions(); - for (int i = 0; i < num_extensions; i++) { - string extension = downcase(type->get_extension(i)); - - if (!unique_extensions.insert(extension).second) { - pnmimage_cat.warning() - << "PNMFileType " << type->get_name() - << " (" << type->get_type() << ") defined extension " - << extension << " more than once.\n"; - } - } - - pset::iterator ui; - for (ui = unique_extensions.begin(); ui != unique_extensions.end(); ++ui) { - _extensions[*ui].push_back(type); - } - - _requires_sort = true; + return _global_ptr; } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimage/pnmFileTypeRegistry.h b/panda/src/pnmimage/pnmFileTypeRegistry.h index b350ffbabd..44cc5b90b5 100644 --- a/panda/src/pnmimage/pnmFileTypeRegistry.h +++ b/panda/src/pnmimage/pnmFileTypeRegistry.h @@ -37,8 +37,9 @@ protected: public: ~PNMFileTypeRegistry(); - static PNMFileTypeRegistry *get_ptr(); + void register_type(PNMFileType *type); +PUBLISHED: int get_num_types() const; PNMFileType *get_type(int n) const; @@ -46,9 +47,9 @@ public: PNMFileType *get_type_from_magic_number(const string &magic_number) const; PNMFileType *get_type_by_handle(TypeHandle handle) const; - void write_types(ostream &out, int indent_level = 0) const; + void write(ostream &out, int indent_level = 0) const; - void register_type(PNMFileType *type); + static PNMFileTypeRegistry *get_global_ptr(); private: void sort_preferences(); diff --git a/panda/src/pnmimage/pnmImageHeader.cxx b/panda/src/pnmimage/pnmImageHeader.cxx index b707a7dbf2..a80c7a5b08 100644 --- a/panda/src/pnmimage/pnmImageHeader.cxx +++ b/panda/src/pnmimage/pnmImageHeader.cxx @@ -144,7 +144,7 @@ make_reader(istream *file, bool owns_file, const Filename &filename, return NULL; } - type = PNMFileTypeRegistry::get_ptr()-> + type = PNMFileTypeRegistry::get_global_ptr()-> get_type_from_magic_number(magic_number); if (pnmimage_cat.is_debug()) { @@ -162,7 +162,7 @@ make_reader(istream *file, bool owns_file, const Filename &filename, if (type == (PNMFileType *)NULL && !filename.empty()) { // We still don't know the type; attempt to guess it from the // filename extension. - type = PNMFileTypeRegistry::get_ptr()->get_type_from_extension(filename); + type = PNMFileTypeRegistry::get_global_ptr()->get_type_from_extension(filename); if (pnmimage_cat.is_debug()) { if (type != (PNMFileType *)NULL) { @@ -192,8 +192,8 @@ make_reader(istream *file, bool owns_file, const Filename &filename, pnmimage_cat.error() << "Cannot determine type of image file " << filename << ".\n" << "Currently supported image types:\n"; - PNMFileTypeRegistry::get_ptr()-> - write_types(pnmimage_cat.error(false), 2); + PNMFileTypeRegistry::get_global_ptr()-> + write(pnmimage_cat.error(false), 2); } if (owns_file) { VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); @@ -306,7 +306,7 @@ make_writer(ostream *file, bool owns_file, const Filename &filename, if (type == (PNMFileType *)NULL && !filename.empty()) { // We don't know the type; attempt to guess it from the filename // extension. - type = PNMFileTypeRegistry::get_ptr()->get_type_from_extension(filename); + type = PNMFileTypeRegistry::get_global_ptr()->get_type_from_extension(filename); if (pnmimage_cat.is_debug()) { if (type != (PNMFileType *)NULL) { diff --git a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx index 9b618b5b56..e4ddb4a6dc 100644 --- a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx +++ b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx @@ -32,6 +32,7 @@ #include "pnmFileTypeRegistry.h" #include "string_utils.h" #include "dconfig.h" +#include "pandaSystem.h" Configure(config_pnmimagetypes); NotifyCategoryDefName(pnmimage_sgi, "sgi", pnmimage_cat); @@ -209,7 +210,7 @@ init_libpnmimagetypes() { #endif // Register each type with the PNMFileTypeRegistry. - PNMFileTypeRegistry *tr = PNMFileTypeRegistry::get_ptr(); + PNMFileTypeRegistry *tr = PNMFileTypeRegistry::get_global_ptr(); tr->register_type(new PNMFileTypeSGI); tr->register_type(new PNMFileTypeAlias); @@ -243,4 +244,17 @@ init_libpnmimagetypes() { #ifdef HAVE_TIFF PNMFileTypeTIFF::register_with_read_factory(); #endif + + // And register with the PandaSystem. + PandaSystem *ps = PandaSystem::get_global_ptr(); + +#ifdef HAVE_JPEG + ps->add_system("libjpeg"); +#endif +#ifdef HAVE_PNG + ps->add_system("libpng"); +#endif +#ifdef HAVE_TIFF + ps->add_system("libtiff"); +#endif } diff --git a/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx b/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx index d2da48cc4f..9bc0e913ef 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeAlias.cxx @@ -416,5 +416,5 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable *PNMFileTypeAlias:: make_PNMFileTypeAlias(const FactoryParams ¶ms) { - return PNMFileTypeRegistry::get_ptr()->get_type_by_handle(get_class_type()); + return PNMFileTypeRegistry::get_global_ptr()->get_type_by_handle(get_class_type()); } diff --git a/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx b/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx index 718c15bf2c..a18882ef0b 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeBMP.cxx @@ -161,5 +161,5 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable *PNMFileTypeBMP:: make_PNMFileTypeBMP(const FactoryParams ¶ms) { - return PNMFileTypeRegistry::get_ptr()->get_type_by_handle(get_class_type()); + return PNMFileTypeRegistry::get_global_ptr()->get_type_by_handle(get_class_type()); } diff --git a/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx b/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx index 7a6b59bd4c..2cbf49c635 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeIMG.cxx @@ -375,5 +375,5 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable *PNMFileTypeIMG:: make_PNMFileTypeIMG(const FactoryParams ¶ms) { - return PNMFileTypeRegistry::get_ptr()->get_type_by_handle(get_class_type()); + return PNMFileTypeRegistry::get_global_ptr()->get_type_by_handle(get_class_type()); } diff --git a/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx b/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx index 7c1e6b6f9a..d086dad505 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeJPG.cxx @@ -165,7 +165,7 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable *PNMFileTypeJPG:: make_PNMFileTypeJPG(const FactoryParams ¶ms) { - return PNMFileTypeRegistry::get_ptr()->get_type_by_handle(get_class_type()); + return PNMFileTypeRegistry::get_global_ptr()->get_type_by_handle(get_class_type()); } #endif // HAVE_JPEG diff --git a/panda/src/pnmimagetypes/pnmFileTypePNG.cxx b/panda/src/pnmimagetypes/pnmFileTypePNG.cxx index 01bbee89c9..78c83ec09a 100755 --- a/panda/src/pnmimagetypes/pnmFileTypePNG.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypePNG.cxx @@ -183,7 +183,7 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable *PNMFileTypePNG:: make_PNMFileTypePNG(const FactoryParams ¶ms) { - return PNMFileTypeRegistry::get_ptr()->get_type_by_handle(get_class_type()); + return PNMFileTypeRegistry::get_global_ptr()->get_type_by_handle(get_class_type()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx b/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx index 489af44ef1..670ff833db 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSGI.cxx @@ -165,5 +165,5 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable *PNMFileTypeSGI:: make_PNMFileTypeSGI(const FactoryParams ¶ms) { - return PNMFileTypeRegistry::get_ptr()->get_type_by_handle(get_class_type()); + return PNMFileTypeRegistry::get_global_ptr()->get_type_by_handle(get_class_type()); } diff --git a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx index 1ca8bb7041..22eb55dd2a 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeSoftImage.cxx @@ -789,5 +789,5 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable *PNMFileTypeSoftImage:: make_PNMFileTypeSoftImage(const FactoryParams ¶ms) { - return PNMFileTypeRegistry::get_ptr()->get_type_by_handle(get_class_type()); + return PNMFileTypeRegistry::get_global_ptr()->get_type_by_handle(get_class_type()); } diff --git a/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx b/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx index 63ee5960c9..1fb02bfc03 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTGA.cxx @@ -593,7 +593,7 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable *PNMFileTypeTGA:: make_PNMFileTypeTGA(const FactoryParams ¶ms) { - return PNMFileTypeRegistry::get_ptr()->get_type_by_handle(get_class_type()); + return PNMFileTypeRegistry::get_global_ptr()->get_type_by_handle(get_class_type()); } void PNMFileTypeTGA::Reader:: diff --git a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx index 195416e225..43c6d87272 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeTIFF.cxx @@ -1091,7 +1091,7 @@ register_with_read_factory() { //////////////////////////////////////////////////////////////////// TypedWritable *PNMFileTypeTIFF:: make_PNMFileTypeTIFF(const FactoryParams ¶ms) { - return PNMFileTypeRegistry::get_ptr()->get_type_by_handle(get_class_type()); + return PNMFileTypeRegistry::get_global_ptr()->get_type_by_handle(get_class_type()); } #endif // HAVE_TIFF diff --git a/panda/src/text/config_text.cxx b/panda/src/text/config_text.cxx index d89e549a28..91eac2d4f3 100644 --- a/panda/src/text/config_text.cxx +++ b/panda/src/text/config_text.cxx @@ -25,6 +25,7 @@ #include "dynamicTextPage.h" #include "geomTextGlyph.h" #include "unicodeLatinMap.h" +#include "pandaSystem.h" #include "dconfig.h" #include "config_express.h" @@ -167,5 +168,8 @@ init_libtext() { DynamicTextPage::init_type(); GeomTextGlyph::init_type(); GeomTextGlyph::register_with_read_factory(); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->add_system("Freetype"); #endif } diff --git a/panda/src/wgldisplay/config_wgldisplay.cxx b/panda/src/wgldisplay/config_wgldisplay.cxx index 73f6c83378..c0c0df5b78 100644 --- a/panda/src/wgldisplay/config_wgldisplay.cxx +++ b/panda/src/wgldisplay/config_wgldisplay.cxx @@ -23,6 +23,7 @@ #include "wglGraphicsWindow.h" #include "graphicsPipeSelection.h" #include "dconfig.h" +#include "pandaSystem.h" Configure(config_wgldisplay); NotifyCategoryDef(wgldisplay, "windisplay"); @@ -70,4 +71,7 @@ init_libwgldisplay() { GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr(); selection->add_pipe_type(wglGraphicsPipe::get_class_type(), wglGraphicsPipe::pipe_constructor); + + PandaSystem *ps = PandaSystem::get_global_ptr(); + ps->set_system_tag("OpenGL", "window_system", "WGL"); } diff --git a/pandatool/src/mayaprogs/config_mayaloader.cxx b/pandatool/src/mayaprogs/config_mayaloader.cxx index e33088d05c..2df2a93f08 100644 --- a/pandatool/src/mayaprogs/config_mayaloader.cxx +++ b/pandatool/src/mayaprogs/config_mayaloader.cxx @@ -50,7 +50,7 @@ init_libmayaloader() { LoaderFileTypePandatool::init_type(); - LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr(); + LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); init_libmayaegg(); MayaToEggConverter *maya = new MayaToEggConverter; diff --git a/pandatool/src/palettizer/pal_string_utils.cxx b/pandatool/src/palettizer/pal_string_utils.cxx index f72d8e2051..4d9d86ce14 100644 --- a/pandatool/src/palettizer/pal_string_utils.cxx +++ b/pandatool/src/palettizer/pal_string_utils.cxx @@ -55,7 +55,7 @@ extract_param_value(const string &str, string ¶m, string &value) { bool parse_image_type_request(const string &word, PNMFileType *&color_type, PNMFileType *&alpha_type) { - PNMFileTypeRegistry *registry = PNMFileTypeRegistry::get_ptr(); + PNMFileTypeRegistry *registry = PNMFileTypeRegistry::get_global_ptr(); color_type = (PNMFileType *)NULL; alpha_type = (PNMFileType *)NULL; diff --git a/pandatool/src/palettizer/palettizer.cxx b/pandatool/src/palettizer/palettizer.cxx index fa5c9d8f81..db27adc2b9 100644 --- a/pandatool/src/palettizer/palettizer.cxx +++ b/pandatool/src/palettizer/palettizer.cxx @@ -112,7 +112,7 @@ Palettizer() { _coverage_threshold = 2.5; _aggressively_clean_mapdir = true; _force_power_2 = true; - _color_type = PNMFileTypeRegistry::get_ptr()->get_type_from_extension("rgb"); + _color_type = PNMFileTypeRegistry::get_global_ptr()->get_type_from_extension("rgb"); _alpha_type = (PNMFileType *)NULL; _shadow_color_type = (PNMFileType *)NULL; _shadow_alpha_type = (PNMFileType *)NULL; diff --git a/pandatool/src/palettizer/txaFile.cxx b/pandatool/src/palettizer/txaFile.cxx index d509e779d8..7f09aac271 100644 --- a/pandatool/src/palettizer/txaFile.cxx +++ b/pandatool/src/palettizer/txaFile.cxx @@ -413,7 +413,7 @@ parse_imagetype_line(const vector_string &words) { const string &imagetype = words[1]; if (!parse_image_type_request(imagetype, pal->_color_type, pal->_alpha_type)) { nout << "\nKnown image types are:\n"; - PNMFileTypeRegistry::get_ptr()->write_types(nout, 2); + PNMFileTypeRegistry::get_global_ptr()->write(nout, 2); nout << "\n"; return false; } @@ -439,7 +439,7 @@ parse_shadowtype_line(const vector_string &words) { if (!parse_image_type_request(shadowtype, pal->_shadow_color_type, pal->_shadow_alpha_type)) { nout << "\nKnown image types are:\n"; - PNMFileTypeRegistry::get_ptr()->write_types(nout, 2); + PNMFileTypeRegistry::get_global_ptr()->write(nout, 2); nout << "\n"; return false; } diff --git a/pandatool/src/progbase/programBase.cxx b/pandatool/src/progbase/programBase.cxx index ebd9f839b0..32876e41f2 100644 --- a/pandatool/src/progbase/programBase.cxx +++ b/pandatool/src/progbase/programBase.cxx @@ -1168,14 +1168,14 @@ bool ProgramBase:: dispatch_image_type(const string &opt, const string &arg, void *var) { PNMFileType **ip = (PNMFileType **)var; - PNMFileTypeRegistry *reg = PNMFileTypeRegistry::get_ptr(); + PNMFileTypeRegistry *reg = PNMFileTypeRegistry::get_global_ptr(); (*ip) = reg->get_type_from_extension(arg); if ((*ip) == (PNMFileType *)NULL) { nout << "Invalid image type for -" << opt << ": " << arg << "\n" << "The following image types are known:\n"; - reg->write_types(nout, 2); + reg->write(nout, 2); return false; } diff --git a/pandatool/src/ptloader/config_ptloader.cxx b/pandatool/src/ptloader/config_ptloader.cxx index 7144562a98..00aac80407 100644 --- a/pandatool/src/ptloader/config_ptloader.cxx +++ b/pandatool/src/ptloader/config_ptloader.cxx @@ -68,7 +68,7 @@ init_libptloader() { LoaderFileTypePandatool::init_type(); - LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_ptr(); + LoaderFileTypeRegistry *reg = LoaderFileTypeRegistry::get_global_ptr(); init_liblwo(); FltToEggConverter *flt = new FltToEggConverter;