From 1462bee771cea127c07a36a576c0ff5b175f04fd Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 11 Nov 2008 23:28:14 +0000 Subject: [PATCH] better Filename usage --- dtool/src/dtoolutil/filename.I | 28 +++++++ dtool/src/dtoolutil/filename.cxx | 4 +- dtool/src/dtoolutil/filename.h | 2 + .../interfaceMakerPythonNative.cxx | 6 +- panda/src/downloader/virtualFileMountHTTP.cxx | 2 +- panda/src/downloader/virtualFileMountHTTP.h | 2 +- panda/src/egg/eggData.h | 2 +- panda/src/egg/eggTexture.cxx | 2 +- panda/src/egg/eggTexture.h | 2 +- panda/src/egg/eggTextureCollection.I | 31 ++++++++ panda/src/egg/eggTextureCollection.h | 4 +- panda/src/egg2pg/load_egg_file.cxx | 5 +- panda/src/egg2pg/load_egg_file.h | 2 +- panda/src/express/virtualFileList.I | 23 ++++++ panda/src/express/virtualFileList.h | 2 + panda/src/express/virtualFileMount.cxx | 2 +- panda/src/express/virtualFileMount.h | 2 +- panda/src/express/virtualFileSystem.I | 31 ++++++-- panda/src/express/virtualFileSystem.cxx | 27 +++---- panda/src/express/virtualFileSystem.h | 23 +++--- panda/src/gobj/texture.cxx | 4 +- panda/src/gobj/texturePool.I | 16 ++-- panda/src/gobj/texturePool.cxx | 6 +- panda/src/gobj/texturePool.h | 23 +++--- panda/src/pgraph/modelPool.I | 10 +-- panda/src/pgraph/modelPool.cxx | 8 +- panda/src/pgraph/modelPool.h | 20 ++--- panda/src/pgraph/shaderPool.I | 10 +-- panda/src/pgraph/shaderPool.cxx | 79 ++++++------------- panda/src/pgraph/shaderPool.h | 26 +++--- panda/src/putil/bamCache.cxx | 5 +- panda/src/putil/bamReader.h | 1 + panda/src/putil/bamTextureMode.h | 3 + panda/src/putil/bamWriter.h | 4 +- panda/src/putil/load_prc_file.cxx | 2 +- panda/src/putil/load_prc_file.h | 3 +- panda/src/text/fontPool.h | 5 +- 37 files changed, 251 insertions(+), 176 deletions(-) diff --git a/dtool/src/dtoolutil/filename.I b/dtool/src/dtoolutil/filename.I index dc36755569..a12e8bc5cd 100644 --- a/dtool/src/dtoolutil/filename.I +++ b/dtool/src/dtoolutil/filename.I @@ -230,6 +230,34 @@ substr(size_t begin, size_t end) const { return _filename.substr(begin, end); } +//////////////////////////////////////////////////////////////////// +// Function: Filename::operator += +// Access: Published +// Description: Appends the other filename onto the end of this one. +// This does not introduce an intervening slash, but see +// the Filename constructor that takes two parameters. +//////////////////////////////////////////////////////////////////// +INLINE void Filename:: +operator += (const string &other) { + _filename += other; + locate_basename(); + locate_extension(); + locate_hash(); +} + +//////////////////////////////////////////////////////////////////// +// Function: Filename::operator + +// Access: Published +// Description: Returns a new Filename representing the concatenation +// of the two filenames. +//////////////////////////////////////////////////////////////////// +INLINE Filename Filename:: +operator + (const string &other) const { + Filename a(*this); + a += other; + return a; +} + //////////////////////////////////////////////////////////////////// // Function: Filename::get_fullpath diff --git a/dtool/src/dtoolutil/filename.cxx b/dtool/src/dtoolutil/filename.cxx index 5746fde694..6e9914f1fb 100644 --- a/dtool/src/dtoolutil/filename.cxx +++ b/dtool/src/dtoolutil/filename.cxx @@ -1666,7 +1666,9 @@ scan_directory(vector_string &contents) const { } DIR *root = opendir(dirname.c_str()); if (root == (DIR *)NULL) { - perror(dirname.c_str()); + if (errno != ENOTDIR) { + perror(dirname.c_str()); + } return false; } diff --git a/dtool/src/dtoolutil/filename.h b/dtool/src/dtoolutil/filename.h index 73759945b1..b48a4c6022 100644 --- a/dtool/src/dtoolutil/filename.h +++ b/dtool/src/dtoolutil/filename.h @@ -101,6 +101,8 @@ PUBLISHED: INLINE char operator [] (int n) const; INLINE string substr(size_t begin, size_t end = string::npos) const; + INLINE void operator += (const string &other); + INLINE Filename operator + (const string &other) const; // Or, you can use any of these. INLINE string get_fullpath() const; diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 548a805398..0e2346337f 100755 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -2658,8 +2658,10 @@ write_function_instance(ostream &out, InterfaceMaker::Object *obj, if (!extra_cleanup.empty()) { indent(out,extra_indent_level) << extra_cleanup << "\n"; } - - return_expr = manage_return_value(out, extra_indent_level, remap, "return_value"); + + if (!is_inplace) { + return_expr = manage_return_value(out, extra_indent_level, remap, "return_value"); + } do_assert_init(out, extra_indent_level,is_constructor); pack_return_value(out, extra_indent_level, remap, remap->_return_type->temporary_to_return(return_expr),ForwardDeclrs,is_inplace); } diff --git a/panda/src/downloader/virtualFileMountHTTP.cxx b/panda/src/downloader/virtualFileMountHTTP.cxx index 7ae992f8e9..bf17e0f14f 100644 --- a/panda/src/downloader/virtualFileMountHTTP.cxx +++ b/panda/src/downloader/virtualFileMountHTTP.cxx @@ -180,7 +180,7 @@ is_regular_file(const Filename &) const { // used to read it. //////////////////////////////////////////////////////////////////// PT(VirtualFile) VirtualFileMountHTTP:: -make_virtual_file(const string &local_filename, +make_virtual_file(const Filename &local_filename, const Filename &original_filename, bool implicit_pz_file, bool status_only) { PT(VirtualFileHTTP) vfile = diff --git a/panda/src/downloader/virtualFileMountHTTP.h b/panda/src/downloader/virtualFileMountHTTP.h index 3a8cda52af..5b0e84da70 100644 --- a/panda/src/downloader/virtualFileMountHTTP.h +++ b/panda/src/downloader/virtualFileMountHTTP.h @@ -42,7 +42,7 @@ PUBLISHED: static void reload_vfs_mount_url(); public: - virtual PT(VirtualFile) make_virtual_file(const string &local_filename, + virtual PT(VirtualFile) make_virtual_file(const Filename &local_filename, const Filename &original_filename, bool implicit_pz_file, bool status_only); diff --git a/panda/src/egg/eggData.h b/panda/src/egg/eggData.h index 4d7e1a7c71..05d783bcd7 100644 --- a/panda/src/egg/eggData.h +++ b/panda/src/egg/eggData.h @@ -66,7 +66,7 @@ PUBLISHED: void set_coordinate_system(CoordinateSystem coordsys); INLINE CoordinateSystem get_coordinate_system() const; - INLINE void set_egg_filename(const Filename &egg_filenamea); + INLINE void set_egg_filename(const Filename &egg_filename); INLINE const Filename &get_egg_filename() const; INLINE void recompute_vertex_normals(double threshold); diff --git a/panda/src/egg/eggTexture.cxx b/panda/src/egg/eggTexture.cxx index 54357ed51a..73fbbd7e14 100644 --- a/panda/src/egg/eggTexture.cxx +++ b/panda/src/egg/eggTexture.cxx @@ -28,7 +28,7 @@ TypeHandle EggTexture::_type_handle; // Description: //////////////////////////////////////////////////////////////////// EggTexture:: -EggTexture(const string &tref_name, const string &filename) +EggTexture(const string &tref_name, const Filename &filename) : EggFilenameNode(tref_name, filename) { _texture_type = TT_unspecified; diff --git a/panda/src/egg/eggTexture.h b/panda/src/egg/eggTexture.h index 5b19c7911e..6b448ba84c 100644 --- a/panda/src/egg/eggTexture.h +++ b/panda/src/egg/eggTexture.h @@ -32,7 +32,7 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDAEGG EggTexture : public EggFilenameNode, public EggRenderMode, public EggTransform { PUBLISHED: - EggTexture(const string &tref_name, const string &filename); + EggTexture(const string &tref_name, const Filename &filename); EggTexture(const EggTexture ©); EggTexture &operator = (const EggTexture ©); virtual ~EggTexture(); diff --git a/panda/src/egg/eggTextureCollection.I b/panda/src/egg/eggTextureCollection.I index af662571c4..f6526032ae 100644 --- a/panda/src/egg/eggTextureCollection.I +++ b/panda/src/egg/eggTextureCollection.I @@ -12,6 +12,12 @@ // //////////////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////////////// +// Function: EggTextureCollection::begin +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// INLINE EggTextureCollection::iterator EggTextureCollection:: begin() const { nassertr(_ordered_textures.size() == _textures.size(), @@ -19,16 +25,41 @@ begin() const { return _ordered_textures.begin(); } +//////////////////////////////////////////////////////////////////// +// Function: EggTextureCollection::end +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// INLINE EggTextureCollection::iterator EggTextureCollection:: end() const { return _ordered_textures.end(); } +//////////////////////////////////////////////////////////////////// +// Function: EggTextureCollection::empty +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// INLINE bool EggTextureCollection:: empty() const { return _ordered_textures.empty(); } +//////////////////////////////////////////////////////////////////// +// Function: EggTextureCollection::operator [] +// Access: Published +// Description: Returns the nth EggTexture in the collection. +//////////////////////////////////////////////////////////////////// +EggTexture *EggTextureCollection:: +operator [] (size_type n) const { + return get_texture(n); +} + +//////////////////////////////////////////////////////////////////// +// Function: EggTextureCollection::size +// Access: Published +// Description: Returns the number of EggTextures in the collection. +//////////////////////////////////////////////////////////////////// INLINE EggTextureCollection::size_type EggTextureCollection:: size() const { nassertr(_ordered_textures.size() == _textures.size(), 0); diff --git a/panda/src/egg/eggTextureCollection.h b/panda/src/egg/eggTextureCollection.h index f210b05ef0..b097aead36 100644 --- a/panda/src/egg/eggTextureCollection.h +++ b/panda/src/egg/eggTextureCollection.h @@ -88,9 +88,11 @@ public: INLINE iterator begin() const; INLINE iterator end() const; INLINE bool empty() const; - INLINE size_type size() const; PUBLISHED: + INLINE EggTexture *operator [](size_type n) const; + INLINE size_type size() const; + bool add_texture(EggTexture *texture); bool remove_texture(EggTexture *texture); diff --git a/panda/src/egg2pg/load_egg_file.cxx b/panda/src/egg2pg/load_egg_file.cxx index 7b767d8cd2..b2682a3607 100644 --- a/panda/src/egg2pg/load_egg_file.cxx +++ b/panda/src/egg2pg/load_egg_file.cxx @@ -68,9 +68,10 @@ load_from_loader(EggLoader &loader) { // required. //////////////////////////////////////////////////////////////////// PT(PandaNode) -load_egg_file(const string &filename, CoordinateSystem cs, +load_egg_file(const Filename &filename, CoordinateSystem cs, BamCacheRecord *record) { - Filename egg_filename = Filename::text_filename(filename); + Filename egg_filename = filename; + egg_filename.set_text(); VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); if (record != (BamCacheRecord *)NULL) { diff --git a/panda/src/egg2pg/load_egg_file.h b/panda/src/egg2pg/load_egg_file.h index de2ff8bee1..379b9f449f 100644 --- a/panda/src/egg2pg/load_egg_file.h +++ b/panda/src/egg2pg/load_egg_file.h @@ -35,7 +35,7 @@ BEGIN_PUBLISH // bit more manual control over the loading process. //////////////////////////////////////////////////////////////////// EXPCL_PANDAEGG PT(PandaNode) -load_egg_file(const string &filename, CoordinateSystem cs = CS_default, +load_egg_file(const Filename &filename, CoordinateSystem cs = CS_default, BamCacheRecord *record = NULL); //////////////////////////////////////////////////////////////////// diff --git a/panda/src/express/virtualFileList.I b/panda/src/express/virtualFileList.I index e14a06cd67..f66e4fa01d 100644 --- a/panda/src/express/virtualFileList.I +++ b/panda/src/express/virtualFileList.I @@ -82,3 +82,26 @@ INLINE int VirtualFileList:: size() const { return _files.size(); } + +//////////////////////////////////////////////////////////////////// +// Function: VirtualFileList::operator += +// Access: Published +// Description: Appends the other list onto the end of this one. +//////////////////////////////////////////////////////////////////// +INLINE void VirtualFileList:: +operator += (const VirtualFileList &other) { + _files.insert(_files.end(), other._files.begin(), other._files.end()); +} + +//////////////////////////////////////////////////////////////////// +// Function: VirtualFileList::operator + +// Access: Published +// Description: Returns a VirtualFileList representing the +// concatenation of the two lists. +//////////////////////////////////////////////////////////////////// +INLINE VirtualFileList VirtualFileList:: +operator + (const VirtualFileList &other) const { + VirtualFileList a(*this); + a += other; + return a; +} diff --git a/panda/src/express/virtualFileList.h b/panda/src/express/virtualFileList.h index 37f7f9822f..d81ee7838d 100644 --- a/panda/src/express/virtualFileList.h +++ b/panda/src/express/virtualFileList.h @@ -42,6 +42,8 @@ PUBLISHED: INLINE VirtualFile *operator [](int n) const; INLINE int size() const; + INLINE void operator += (const VirtualFileList &other); + INLINE VirtualFileList operator + (const VirtualFileList &other) const; private: typedef pvector< PT(VirtualFile) > Files; diff --git a/panda/src/express/virtualFileMount.cxx b/panda/src/express/virtualFileMount.cxx index 7d4eda99b3..e0cf7daa5a 100644 --- a/panda/src/express/virtualFileMount.cxx +++ b/panda/src/express/virtualFileMount.cxx @@ -39,7 +39,7 @@ VirtualFileMount:: // used to read it. //////////////////////////////////////////////////////////////////// PT(VirtualFile) VirtualFileMount:: -make_virtual_file(const string &local_filename, +make_virtual_file(const Filename &local_filename, const Filename &original_filename, bool implicit_pz_file, bool) { Filename local(local_filename); diff --git a/panda/src/express/virtualFileMount.h b/panda/src/express/virtualFileMount.h index 0cb4ec0261..bcb84cfbbc 100644 --- a/panda/src/express/virtualFileMount.h +++ b/panda/src/express/virtualFileMount.h @@ -40,7 +40,7 @@ PUBLISHED: INLINE int get_mount_flags() const; public: - virtual PT(VirtualFile) make_virtual_file(const string &local_filename, + virtual PT(VirtualFile) make_virtual_file(const Filename &local_filename, const Filename &original_filename, bool implicit_pz_file, bool status_only); diff --git a/panda/src/express/virtualFileSystem.I b/panda/src/express/virtualFileSystem.I index cd40a31b36..cefc0ec352 100644 --- a/panda/src/express/virtualFileSystem.I +++ b/panda/src/express/virtualFileSystem.I @@ -48,16 +48,33 @@ is_regular_file(const Filename &filename) const { return (file != (VirtualFile *)NULL && file->is_regular_file()); } +//////////////////////////////////////////////////////////////////// +// Function: VirtualFileSystem::scan_directory +// Access: Published +// Description: If the file represents a directory (that is, +// is_directory() returns true), this returns the list +// of files within the directory at the current time. +// Returns NULL if the file is not a directory or if the +// directory cannot be read. +//////////////////////////////////////////////////////////////////// +INLINE PT(VirtualFileList) VirtualFileSystem:: +scan_directory(const Filename &filename) const { + PT(VirtualFile) file = get_file(filename, true); + if (file == (VirtualFile *)NULL) { + return NULL; + } + + return file->scan_directory(); +} + //////////////////////////////////////////////////////////////////// // Function: VirtualFileSystem::ls // Access: Published // Description: Convenience function; lists the files within the -// indicated directory. This accepts a string instead -// of a Filename purely for programmer convenience at -// the Python prompt. +// indicated directory. //////////////////////////////////////////////////////////////////// INLINE void VirtualFileSystem:: -ls(const string &filename) const { +ls(const Filename &filename) const { PT(VirtualFile) file = get_file(filename, true); if (file == (VirtualFile *)NULL) { express_cat.info() @@ -72,12 +89,10 @@ ls(const string &filename) const { // Access: Published // Description: Convenience function; lists the files within the // indicated directory, and all files below, -// recursively. This accepts a string instead of a -// Filename purely for programmer convenience at the -// Python prompt. +// recursively. //////////////////////////////////////////////////////////////////// INLINE void VirtualFileSystem:: -ls_all(const string &filename) const { +ls_all(const Filename &filename) const { PT(VirtualFile) file = get_file(filename, true); if (file == (VirtualFile *)NULL) { express_cat.info() diff --git a/panda/src/express/virtualFileSystem.cxx b/panda/src/express/virtualFileSystem.cxx index 89d6a544c7..50ff3e9818 100644 --- a/panda/src/express/virtualFileSystem.cxx +++ b/panda/src/express/virtualFileSystem.cxx @@ -80,7 +80,7 @@ VirtualFileSystem:: // point. //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: -mount(Multifile *multifile, const string &mount_point, int flags) { +mount(Multifile *multifile, const Filename &mount_point, int flags) { PT(VirtualFileMountMultifile) new_mount = new VirtualFileMountMultifile(multifile); return mount(new_mount, mount_point, flags); @@ -108,7 +108,7 @@ mount(Multifile *multifile, const string &mount_point, int flags) { // file system with exactly the right case. //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: -mount(const Filename &physical_filename, const string &mount_point, +mount(const Filename &physical_filename, const Filename &mount_point, int flags, const string &password) { if (!physical_filename.exists()) { express_cat.warning() @@ -145,7 +145,7 @@ mount(const Filename &physical_filename, const string &mount_point, // VirtualFileMount object specifically. //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: -mount(VirtualFileMount *mount, const string &mount_point, int flags) { +mount(VirtualFileMount *mount, const Filename &mount_point, int flags) { _lock.acquire(); bool result = do_mount(mount, mount_point, flags); _lock.release(); @@ -287,7 +287,7 @@ unmount(VirtualFileMount *mount) { // appearances unmounted. //////////////////////////////////////////////////////////////////// int VirtualFileSystem:: -unmount_point(const string &mount_point) { +unmount_point(const Filename &mount_point) { _lock.acquire(); Filename nmp = normalize_mount_point(mount_point); Mounts::iterator ri, wi; @@ -373,12 +373,9 @@ get_mount(int n) const { // resolve relative pathnames in get_file() and/or // find_file(). Returns true if successful, false // otherwise. -// -// This accepts a string rather than a Filename simply -// for programmer convenience from the Python prompt. //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: -chdir(const string &new_directory) { +chdir(const Filename &new_directory) { _lock.acquire(); if (new_directory == "/") { // We can always return to the root. @@ -803,7 +800,7 @@ parse_option(const string &option, int &flags, string &password) { // Assumes the lock is already held. //////////////////////////////////////////////////////////////////// Filename VirtualFileSystem:: -normalize_mount_point(const string &mount_point) const { +normalize_mount_point(const Filename &mount_point) const { Filename nmp = mount_point; if (nmp.is_local()) { nmp = Filename(_cwd, mount_point); @@ -820,7 +817,7 @@ normalize_mount_point(const string &mount_point) const { // lock is already held. //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: -do_mount(VirtualFileMount *mount, const string &mount_point, int flags) { +do_mount(VirtualFileMount *mount, const Filename &mount_point, int flags) { nassertr(mount->_file_system == NULL, false); mount->_file_system = this; mount->_mount_point = normalize_mount_point(mount_point); @@ -847,9 +844,9 @@ do_get_file(const Filename &filename, bool status_only) const { } } pathname.standardize(); - string strpath = pathname.get_filename_index(0).get_fullpath().substr(1); + Filename strpath = pathname.get_filename_index(0).get_fullpath().substr(1); // Also transparently look for a regular file suffixed .pz. - string strpath_pz = strpath + ".pz"; + Filename strpath_pz = strpath + ".pz"; // Now scan all the mount points, from the back (since later mounts // override more recent ones), until a match is found. @@ -864,7 +861,7 @@ do_get_file(const Filename &filename, bool status_only) const { while (i > 0) { --i; VirtualFileMount *mount = _mounts[i]; - string mount_point = mount->get_mount_point(); + Filename mount_point = mount->get_mount_point(); if (strpath == mount_point) { // Here's an exact match on the mount point. This filename is // the root directory of this mount object. @@ -888,7 +885,7 @@ do_get_file(const Filename &filename, bool status_only) const { #endif // HAVE_ZLIB } else if (strpath.length() > mount_point.length() && - strpath.substr(0, mount_point.length()) == mount_point && + mount_point == strpath.substr(0, mount_point.length()) && strpath[mount_point.length()] == '/') { // This pathname falls within this mount system. Filename local_filename = strpath.substr(mount_point.length() + 1); @@ -947,7 +944,7 @@ do_get_file(const Filename &filename, bool status_only) const { //////////////////////////////////////////////////////////////////// bool VirtualFileSystem:: consider_match(PT(VirtualFile) &found_file, VirtualFileComposite *&composite_file, - VirtualFileMount *mount, const string &local_filename, + VirtualFileMount *mount, const Filename &local_filename, const Filename &original_filename, bool implicit_pz_file, bool status_only) const { PT(VirtualFile) vfile = diff --git a/panda/src/express/virtualFileSystem.h b/panda/src/express/virtualFileSystem.h index 7b579d488d..e991d38bff 100644 --- a/panda/src/express/virtualFileSystem.h +++ b/panda/src/express/virtualFileSystem.h @@ -19,6 +19,7 @@ #include "virtualFile.h" #include "virtualFileMount.h" +#include "virtualFileList.h" #include "filename.h" #include "dSearchPath.h" #include "pointerTo.h" @@ -49,20 +50,20 @@ PUBLISHED: MF_read_only = 0x0002, }; - BLOCKING bool mount(Multifile *multifile, const string &mount_point, int flags); - BLOCKING bool mount(const Filename &physical_filename, const string &mount_point, + BLOCKING bool mount(Multifile *multifile, const Filename &mount_point, int flags); + BLOCKING bool mount(const Filename &physical_filename, const Filename &mount_point, int flags, const string &password = ""); - bool mount(VirtualFileMount *mount, const string &mount_point, int flags); + bool mount(VirtualFileMount *mount, const Filename &mount_point, int flags); BLOCKING int unmount(Multifile *multifile); BLOCKING int unmount(const Filename &physical_filename); int unmount(VirtualFileMount *mount); - BLOCKING int unmount_point(const string &mount_point); + BLOCKING int unmount_point(const Filename &mount_point); BLOCKING int unmount_all(); int get_num_mounts() const; PT(VirtualFileMount) get_mount(int n) const; - BLOCKING bool chdir(const string &new_directory); + BLOCKING bool chdir(const Filename &new_directory); BLOCKING Filename get_cwd() const; BLOCKING PT(VirtualFile) get_file(const Filename &filename, bool status_only = false) const; @@ -78,8 +79,10 @@ PUBLISHED: BLOCKING INLINE bool is_directory(const Filename &filename) const; BLOCKING INLINE bool is_regular_file(const Filename &filename) const; - INLINE void ls(const string &filename) const; - INLINE void ls_all(const string &filename) const; + BLOCKING INLINE PT(VirtualFileList) scan_directory(const Filename &filename) const; + + INLINE void ls(const Filename &filename) const; + INLINE void ls_all(const Filename &filename) const; void write(ostream &out) const; @@ -107,11 +110,11 @@ public: ConfigVariableBool vfs_implicit_mf; private: - Filename normalize_mount_point(const string &mount_point) const; - bool do_mount(VirtualFileMount *mount, const string &mount_point, int flags); + Filename normalize_mount_point(const Filename &mount_point) const; + bool do_mount(VirtualFileMount *mount, const Filename &mount_point, int flags); PT(VirtualFile) do_get_file(const Filename &filename, bool status_only) const; bool consider_match(PT(VirtualFile) &found_file, VirtualFileComposite *&composite_file, - VirtualFileMount *mount, const string &local_filename, + VirtualFileMount *mount, const Filename &local_filename, const Filename &original_filename, bool implicit_pz_file, bool status_only) const; bool consider_mount_mf(const Filename &filename); diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 620e11171f..aa2a73e3d7 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -5208,6 +5208,8 @@ write_datagram(BamWriter *manager, Datagram &me) { Filename filename = _filename; Filename alpha_filename = _alpha_filename; + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); + switch (file_texture_mode) { case BTM_unchanged: case BTM_rawdata: @@ -5221,7 +5223,7 @@ write_datagram(BamWriter *manager, Datagram &me) { case BTM_relative: filename = _fullpath; alpha_filename = _alpha_fullpath; - bam_dir.make_absolute(); + bam_dir.make_absolute(vfs->get_cwd()); if (!has_bam_dir || !filename.make_relative_to(bam_dir, true)) { filename.find_on_searchpath(get_model_path()); } diff --git a/panda/src/gobj/texturePool.I b/panda/src/gobj/texturePool.I index f7b6e30e0f..c91d658fb1 100644 --- a/panda/src/gobj/texturePool.I +++ b/panda/src/gobj/texturePool.I @@ -20,7 +20,7 @@ // false otherwise. //////////////////////////////////////////////////////////////////// INLINE bool TexturePool:: -has_texture(const string &filename) { +has_texture(const Filename &filename) { return get_global_ptr()->ns_has_texture(filename); } @@ -35,7 +35,7 @@ has_texture(const string &filename) { // return a valid Texture pointer. //////////////////////////////////////////////////////////////////// INLINE bool TexturePool:: -verify_texture(const string &filename) { +verify_texture(const Filename &filename) { return load_texture(filename) != (Texture *)NULL; } @@ -54,7 +54,7 @@ verify_texture(const string &filename) { // with a series of images, one for each mipmap level. //////////////////////////////////////////////////////////////////// INLINE Texture *TexturePool:: -load_texture(const string &filename, int primary_file_num_channels, +load_texture(const Filename &filename, int primary_file_num_channels, bool read_mipmaps, const LoaderOptions &options) { return get_global_ptr()->ns_load_texture(filename, primary_file_num_channels, read_mipmaps, options); @@ -76,7 +76,7 @@ load_texture(const string &filename, int primary_file_num_channels, // level. //////////////////////////////////////////////////////////////////// INLINE Texture *TexturePool:: -load_texture(const string &filename, const string &alpha_filename, +load_texture(const Filename &filename, const Filename &alpha_filename, int primary_file_num_channels, int alpha_file_channel, bool read_mipmaps, const LoaderOptions &options) { return get_global_ptr()->ns_load_texture(filename, alpha_filename, @@ -100,7 +100,7 @@ load_texture(const string &filename, const string &alpha_filename, // second with the index number of each 3-d level. //////////////////////////////////////////////////////////////////// INLINE Texture *TexturePool:: -load_3d_texture(const string &filename_pattern, bool read_mipmaps, +load_3d_texture(const Filename &filename_pattern, bool read_mipmaps, const LoaderOptions &options) { return get_global_ptr()->ns_load_3d_texture(filename_pattern, read_mipmaps, options); @@ -121,7 +121,7 @@ load_3d_texture(const string &filename_pattern, bool read_mipmaps, // second with the face number, 0 through 5. //////////////////////////////////////////////////////////////////// INLINE Texture *TexturePool:: -load_cube_map(const string &filename_pattern, bool read_mipmaps, +load_cube_map(const Filename &filename_pattern, bool read_mipmaps, const LoaderOptions &options) { return get_global_ptr()->ns_load_cube_map(filename_pattern, read_mipmaps, options); @@ -255,7 +255,7 @@ list_contents() { // any textures requested from this point on. //////////////////////////////////////////////////////////////////// INLINE void TexturePool:: -set_fake_texture_image(const string &filename) { +set_fake_texture_image(const Filename &filename) { get_global_ptr()->_fake_texture_image = filename; } @@ -287,7 +287,7 @@ has_fake_texture_image() { // Description: Returns the filename that was specified with a // previous call to set_fake_texture_image(). //////////////////////////////////////////////////////////////////// -INLINE const string &TexturePool:: +INLINE const Filename &TexturePool:: get_fake_texture_image() { return get_global_ptr()->_fake_texture_image; } diff --git a/panda/src/gobj/texturePool.cxx b/panda/src/gobj/texturePool.cxx index 60e388cc4e..9eeeaccc91 100644 --- a/panda/src/gobj/texturePool.cxx +++ b/panda/src/gobj/texturePool.cxx @@ -189,7 +189,7 @@ get_global_ptr() { //////////////////////////////////////////////////////////////////// TexturePool:: TexturePool() { - ConfigVariableString fake_texture_image + ConfigVariableFilename fake_texture_image ("fake-texture-image", "", PRC_DESC("Set this to enable a speedy-load mode in which you don't care " "what the world looks like, you just want it to load in minimal " @@ -830,8 +830,8 @@ ns_list_contents(ostream &out) const { //////////////////////////////////////////////////////////////////// // Function: TexturePool::resolve_filename // Access: Private -// Description: Searches for the indicated filename along the texture -// and model path. If the filename was previously +// Description: Searches for the indicated filename along the +// model path. If the filename was previously // searched for, doesn't search again, as an // optimization. Assumes _lock is held. //////////////////////////////////////////////////////////////////// diff --git a/panda/src/gobj/texturePool.h b/panda/src/gobj/texturePool.h index 6ebe62565d..c83d3e742e 100644 --- a/panda/src/gobj/texturePool.h +++ b/panda/src/gobj/texturePool.h @@ -37,25 +37,22 @@ class BamCacheRecord; //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_GOBJ TexturePool { PUBLISHED: - // These functions take string parameters instead of Filenames - // because that's somewhat more convenient to the scripting - // language. - INLINE static bool has_texture(const string &filename); - INLINE static bool verify_texture(const string &filename); - INLINE static Texture *load_texture(const string &filename, + INLINE static bool has_texture(const Filename &filename); + INLINE static bool verify_texture(const Filename &filename); + INLINE static Texture *load_texture(const Filename &filename, int primary_file_num_channels = 0, bool read_mipmaps = false, const LoaderOptions &options = LoaderOptions()); - INLINE static Texture *load_texture(const string &filename, - const string &alpha_filename, + INLINE static Texture *load_texture(const Filename &filename, + const Filename &alpha_filename, int primary_file_num_channels = 0, int alpha_file_channel = 0, bool read_mipmaps = false, const LoaderOptions &options = LoaderOptions()); - INLINE static Texture *load_3d_texture(const string &filename_pattern, + INLINE static Texture *load_3d_texture(const Filename &filename_pattern, bool read_mipmaps = false, const LoaderOptions &options = LoaderOptions()); - INLINE static Texture *load_cube_map(const string &filename_pattern, + INLINE static Texture *load_cube_map(const Filename &filename_pattern, bool read_mipmaps = false, const LoaderOptions &options = LoaderOptions()); @@ -72,10 +69,10 @@ PUBLISHED: INLINE static void list_contents(ostream &out); INLINE static void list_contents(); - INLINE static void set_fake_texture_image(const string &filename); + INLINE static void set_fake_texture_image(const Filename &filename); INLINE static void clear_fake_texture_image(); INLINE static bool has_fake_texture_image(); - INLINE static const string &get_fake_texture_image(); + INLINE static const Filename &get_fake_texture_image(); static void write(ostream &out); @@ -145,7 +142,7 @@ private: typedef pmap RelpathLookup; RelpathLookup _relpath_lookup; - string _fake_texture_image; + Filename _fake_texture_image; PT(Texture) _normalization_cube_map; PT(Texture) _alpha_scale_map; diff --git a/panda/src/pgraph/modelPool.I b/panda/src/pgraph/modelPool.I index 06c4fe43cb..f0b80ea2d7 100644 --- a/panda/src/pgraph/modelPool.I +++ b/panda/src/pgraph/modelPool.I @@ -20,7 +20,7 @@ // false otherwise. //////////////////////////////////////////////////////////////////// INLINE bool ModelPool:: -has_model(const string &filename) { +has_model(const Filename &filename) { return get_ptr()->ns_has_model(filename); } @@ -35,7 +35,7 @@ has_model(const string &filename) { // return a valid Node pointer. //////////////////////////////////////////////////////////////////// INLINE bool ModelPool:: -verify_model(const string &filename) { +verify_model(const Filename &filename) { return load_model(filename) != (ModelRoot *)NULL; } @@ -49,7 +49,7 @@ verify_model(const string &filename) { // file cannot be found, returns NULL. //////////////////////////////////////////////////////////////////// INLINE ModelRoot *ModelPool:: -load_model(const string &filename, const LoaderOptions &options) { +load_model(const Filename &filename, const LoaderOptions &options) { return get_ptr()->ns_load_model(filename, options); } @@ -66,7 +66,7 @@ load_model(const string &filename, const LoaderOptions &options) { // instead. //////////////////////////////////////////////////////////////////// INLINE void ModelPool:: -add_model(const string &filename, ModelRoot *model) { +add_model(const Filename &filename, ModelRoot *model) { get_ptr()->ns_add_model(filename, model); } @@ -83,7 +83,7 @@ add_model(const string &filename, ModelRoot *model) { // release_model(model) instead. //////////////////////////////////////////////////////////////////// INLINE void ModelPool:: -release_model(const string &filename) { +release_model(const Filename &filename) { get_ptr()->ns_release_model(filename); } diff --git a/panda/src/pgraph/modelPool.cxx b/panda/src/pgraph/modelPool.cxx index 62df8f3ad1..64009e1f6b 100644 --- a/panda/src/pgraph/modelPool.cxx +++ b/panda/src/pgraph/modelPool.cxx @@ -38,7 +38,7 @@ write(ostream &out) { // Description: The nonstatic implementation of has_model(). //////////////////////////////////////////////////////////////////// bool ModelPool:: -ns_has_model(const string &filename) { +ns_has_model(const Filename &filename) { LightMutexHolder holder(_lock); Models::const_iterator ti; ti = _models.find(filename); @@ -56,7 +56,7 @@ ns_has_model(const string &filename) { // Description: The nonstatic implementation of load_model(). //////////////////////////////////////////////////////////////////// ModelRoot *ModelPool:: -ns_load_model(const string &filename, const LoaderOptions &options) { +ns_load_model(const Filename &filename, const LoaderOptions &options) { { LightMutexHolder holder(_lock); Models::const_iterator ti; @@ -114,7 +114,7 @@ ns_load_model(const string &filename, const LoaderOptions &options) { // Description: The nonstatic implementation of add_model(). //////////////////////////////////////////////////////////////////// void ModelPool:: -ns_add_model(const string &filename, ModelRoot *model) { +ns_add_model(const Filename &filename, ModelRoot *model) { LightMutexHolder holder(_lock); // We blow away whatever model was there previously, if any. _models[filename] = model; @@ -126,7 +126,7 @@ ns_add_model(const string &filename, ModelRoot *model) { // Description: The nonstatic implementation of release_model(). //////////////////////////////////////////////////////////////////// void ModelPool:: -ns_release_model(const string &filename) { +ns_release_model(const Filename &filename) { LightMutexHolder holder(_lock); Models::iterator ti; ti = _models.find(filename); diff --git a/panda/src/pgraph/modelPool.h b/panda/src/pgraph/modelPool.h index 0c12479484..3ab7ace640 100644 --- a/panda/src/pgraph/modelPool.h +++ b/panda/src/pgraph/modelPool.h @@ -47,13 +47,13 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_PGRAPH ModelPool { PUBLISHED: - INLINE static bool has_model(const string &filename); - INLINE static bool verify_model(const string &filename); - INLINE static ModelRoot *load_model(const string &filename, + INLINE static bool has_model(const Filename &filename); + INLINE static bool verify_model(const Filename &filename); + INLINE static ModelRoot *load_model(const Filename &filename, const LoaderOptions &options = LoaderOptions()); - INLINE static void add_model(const string &filename, ModelRoot *model); - INLINE static void release_model(const string &filename); + INLINE static void add_model(const Filename &filename, ModelRoot *model); + INLINE static void release_model(const Filename &filename); INLINE static void add_model(ModelRoot *model); INLINE static void release_model(ModelRoot *model); @@ -69,11 +69,11 @@ PUBLISHED: private: INLINE ModelPool(); - bool ns_has_model(const string &filename); - ModelRoot *ns_load_model(const string &filename, + bool ns_has_model(const Filename &filename); + ModelRoot *ns_load_model(const Filename &filename, const LoaderOptions &options); - void ns_add_model(const string &filename, ModelRoot *model); - void ns_release_model(const string &filename); + void ns_add_model(const Filename &filename, ModelRoot *model); + void ns_release_model(const Filename &filename); void ns_add_model(ModelRoot *model); void ns_release_model(ModelRoot *model); @@ -87,7 +87,7 @@ private: static ModelPool *_global_ptr; LightMutex _lock; - typedef pmap Models; + typedef pmap Models; Models _models; }; diff --git a/panda/src/pgraph/shaderPool.I b/panda/src/pgraph/shaderPool.I index 82b69e8375..c63e0c0a5f 100644 --- a/panda/src/pgraph/shaderPool.I +++ b/panda/src/pgraph/shaderPool.I @@ -20,7 +20,7 @@ // false otherwise. //////////////////////////////////////////////////////////////////// INLINE bool ShaderPool:: -has_shader(const string &filename) { +has_shader(const Filename &filename) { return get_ptr()->ns_has_shader(filename); } @@ -35,7 +35,7 @@ has_shader(const string &filename) { // return a valid Shader pointer. //////////////////////////////////////////////////////////////////// INLINE bool ShaderPool:: -verify_shader(const string &filename) { +verify_shader(const Filename &filename) { return load_shader(filename) != (Shader *)NULL; } @@ -49,7 +49,7 @@ verify_shader(const string &filename) { // file cannot be found, returns NULL. //////////////////////////////////////////////////////////////////// INLINE CPT(Shader) ShaderPool:: -load_shader(const string &filename) { +load_shader(const Filename &filename) { return get_ptr()->ns_load_shader(filename); } @@ -62,7 +62,7 @@ load_shader(const string &filename) { // same filename. //////////////////////////////////////////////////////////////////// INLINE void ShaderPool:: -add_shader(const string &filename, Shader *shader) { +add_shader(const Filename &filename, Shader *shader) { get_ptr()->ns_add_shader(filename, shader); } @@ -76,7 +76,7 @@ add_shader(const string &filename, Shader *shader) { // every loaded, and shaders will never be freed. //////////////////////////////////////////////////////////////////// INLINE void ShaderPool:: -release_shader(const string &filename) { +release_shader(const Filename &filename) { get_ptr()->ns_release_shader(filename); } diff --git a/panda/src/pgraph/shaderPool.cxx b/panda/src/pgraph/shaderPool.cxx index d8acc737eb..59fe4ac61b 100644 --- a/panda/src/pgraph/shaderPool.cxx +++ b/panda/src/pgraph/shaderPool.cxx @@ -38,16 +38,13 @@ write(ostream &out) { // Description: The nonstatic implementation of has_shader(). //////////////////////////////////////////////////////////////////// bool ShaderPool:: -ns_has_shader(const string &str) { - LightMutexHolder holder(_lock); - - string index_str; +ns_has_shader(const Filename &orig_filename) { Filename filename; - int face_index; - lookup_filename(str, index_str, filename, face_index); + resolve_filename(filename, orig_filename); + LightMutexHolder holder(_lock); Shaders::const_iterator ti; - ti = _shaders.find(index_str); + ti = _shaders.find(filename); if (ti != _shaders.end()) { // This shader was previously loaded. return true; @@ -62,17 +59,15 @@ ns_has_shader(const string &str) { // Description: The nonstatic implementation of load_shader(). //////////////////////////////////////////////////////////////////// CPT(Shader) ShaderPool:: -ns_load_shader(const string &str) { - string index_str; +ns_load_shader(const Filename &orig_filename) { Filename filename; - int face_index; - lookup_filename(str, index_str, filename, face_index); + resolve_filename(filename, orig_filename); { LightMutexHolder holder(_lock); Shaders::const_iterator ti; - ti = _shaders.find(index_str); + ti = _shaders.find(filename); if (ti != _shaders.end()) { // This shader was previously loaded. return (*ti).second; @@ -93,8 +88,6 @@ ns_load_shader(const string &str) { // this does nothing for now } -// ***** face_index ??? - if (shader == (CPT(Shader)) NULL) { shader = Shader::load (filename); } @@ -110,13 +103,13 @@ ns_load_shader(const string &str) { // Now try again. Someone may have loaded the shader in another // thread. Shaders::const_iterator ti; - ti = _shaders.find(index_str); + ti = _shaders.find(filename); if (ti != _shaders.end()) { // This shader was previously loaded. return (*ti).second; } - _shaders[index_str] = shader; + _shaders[filename] = shader; } return shader; @@ -128,16 +121,13 @@ ns_load_shader(const string &str) { // Description: The nonstatic implementation of add_shader(). //////////////////////////////////////////////////////////////////// void ShaderPool:: -ns_add_shader(const string &str, Shader *shader) { - LightMutexHolder holder(_lock); - - string index_str; +ns_add_shader(const Filename &orig_filename, Shader *shader) { Filename filename; - int face_index; - lookup_filename(str, index_str, filename, face_index); + resolve_filename(filename, orig_filename); + LightMutexHolder holder(_lock); // We blow away whatever shader was there previously, if any. - _shaders[index_str] = shader; + _shaders[filename] = shader; } //////////////////////////////////////////////////////////////////// @@ -146,7 +136,7 @@ ns_add_shader(const string &str, Shader *shader) { // Description: The nonstatic implementation of release_shader(). //////////////////////////////////////////////////////////////////// void ShaderPool:: -ns_release_shader(const string &filename) { +ns_release_shader(const Filename &filename) { LightMutexHolder holder(_lock); Shaders::iterator ti; @@ -218,43 +208,18 @@ ns_list_contents(ostream &out) const { } } + //////////////////////////////////////////////////////////////////// -// Function: ShaderPool::lookup_filename -// Access: Private, Static -// Description: Accepts a shader "filename", which might consist of a -// filename followed by an optional colon and a face -// index, and splits it out into its two components. -// Then it looks up the filename on the model path. -// Sets the filename and face index accordingly. Also -// sets index_str to be the concatenation of the -// found filename with the face index, thus restoring -// the original input (but normalized to contain the -// full path.) +// Function: ShaderPool::resolve_filename +// Access: Private +// Description: Searches for the indicated filename along the +// model path. //////////////////////////////////////////////////////////////////// void ShaderPool:: -lookup_filename(const string &str, string &index_str, - Filename &filename, int &face_index) { - int colon = (int)str.length() - 1; - // Scan backwards over digits for a colon. - while (colon >= 0 && isdigit(str[colon])) { - --colon; - } - if (colon >= 0 && str[colon] == ':') { - string digits = str.substr(colon + 1); - filename = str.substr(0, colon); - face_index = atoi(digits.c_str()); - } else { - filename = str; - face_index = 0; - } - - // Now look up the filename on the model path. +resolve_filename(Filename &new_filename, const Filename &orig_filename) { + new_filename = orig_filename; VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - vfs->resolve_filename(filename, get_model_path()); - - ostringstream strm; - strm << filename << ":" << face_index; - index_str = strm.str(); + vfs->resolve_filename(new_filename, get_model_path()); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/pgraph/shaderPool.h b/panda/src/pgraph/shaderPool.h index fe0fa1ff1c..e1d5b48e6a 100644 --- a/panda/src/pgraph/shaderPool.h +++ b/panda/src/pgraph/shaderPool.h @@ -30,14 +30,11 @@ //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_PGRAPH ShaderPool { PUBLISHED: - // These functions take string parameters instead of Filenames - // because that's somewhat more convenient to the scripting - // language. - INLINE static bool has_shader(const string &filename); - INLINE static bool verify_shader(const string &filename); - INLINE static CPT(Shader) load_shader(const string &filename); - INLINE static void add_shader(const string &filename, Shader *shader); - INLINE static void release_shader(const string &filename); + INLINE static bool has_shader(const Filename &filename); + INLINE static bool verify_shader(const Filename &filename); + INLINE static CPT(Shader) load_shader(const Filename &filename); + INLINE static void add_shader(const Filename &filename, Shader *shader); + INLINE static void release_shader(const Filename &filename); INLINE static void release_all_shaders(); INLINE static int garbage_collect(); @@ -48,22 +45,21 @@ PUBLISHED: private: INLINE ShaderPool(); - bool ns_has_shader(const string &str); - CPT(Shader) ns_load_shader(const string &str); - void ns_add_shader(const string &str, Shader *shader); - void ns_release_shader(const string &filename); + bool ns_has_shader(const Filename &orig_filename); + CPT(Shader) ns_load_shader(const Filename &orig_filename); + void ns_add_shader(const Filename &orig_filename, Shader *shader); + void ns_release_shader(const Filename &orig_filename); void ns_release_all_shaders(); int ns_garbage_collect(); void ns_list_contents(ostream &out) const; - static void lookup_filename(const string &str, string &index_str, - Filename &filename, int &face_index); + void resolve_filename(Filename &new_filename, const Filename &orig_filename); static ShaderPool *get_ptr(); static ShaderPool *_global_ptr; LightMutex _lock; - typedef pmap Shaders; + typedef pmap Shaders; Shaders _shaders; }; diff --git a/panda/src/putil/bamCache.cxx b/panda/src/putil/bamCache.cxx index 8dea053bfe..4854f44e03 100644 --- a/panda/src/putil/bamCache.cxx +++ b/panda/src/putil/bamCache.cxx @@ -24,6 +24,7 @@ #include "configVariableInt.h" #include "configVariableString.h" #include "configVariableFilename.h" +#include "virtualFileSystem.h" BamCache *BamCache::_global_ptr = NULL; @@ -159,9 +160,11 @@ set_root(const Filename &root) { PT(BamCacheRecord) BamCache:: lookup(const Filename &source_filename, const string &cache_extension) { consider_flush_index(); + + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); Filename source_pathname(source_filename); - source_pathname.make_absolute(); + source_pathname.make_absolute(vfs->get_cwd()); Filename rel_pathname(source_pathname); rel_pathname.make_relative_to(_root, false); diff --git a/panda/src/putil/bamReader.h b/panda/src/putil/bamReader.h index 634c41706b..388d3a9987 100644 --- a/panda/src/putil/bamReader.h +++ b/panda/src/putil/bamReader.h @@ -89,6 +89,7 @@ public: static BamReader *const Null; static WritableFactory *const NullFactory; +PUBLISHED: // The primary interface for a caller. BamReader(DatagramGenerator *generator, const Filename &name = ""); ~BamReader(); diff --git a/panda/src/putil/bamTextureMode.h b/panda/src/putil/bamTextureMode.h index 54f31f0cbe..823d166967 100644 --- a/panda/src/putil/bamTextureMode.h +++ b/panda/src/putil/bamTextureMode.h @@ -17,6 +17,7 @@ #include "pandabase.h" +BEGIN_PUBLISH // This enum is used to control how textures are written to a bam // stream. enum BamTextureMode { @@ -26,6 +27,8 @@ enum BamTextureMode { BTM_basename, BTM_rawdata }; +END_PUBLISH + EXPCL_PANDA_PUTIL ostream &operator << (ostream &out, BamTextureMode btm); EXPCL_PANDA_PUTIL istream &operator >> (istream &in, BamTextureMode &btm); diff --git a/panda/src/putil/bamWriter.h b/panda/src/putil/bamWriter.h index 214fff5d2b..726c85dc7f 100644 --- a/panda/src/putil/bamWriter.h +++ b/panda/src/putil/bamWriter.h @@ -72,12 +72,10 @@ // interface to read and write Bam files on disk. //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_PUTIL BamWriter { -public: +PUBLISHED: BamWriter(DatagramSink *sink, const Filename &name = ""); ~BamWriter(); - // The primary interface for a caller. - bool init(); INLINE const Filename &get_filename() const; bool write_object(const TypedWritable *obj); diff --git a/panda/src/putil/load_prc_file.cxx b/panda/src/putil/load_prc_file.cxx index 521596cb48..37774039ac 100644 --- a/panda/src/putil/load_prc_file.cxx +++ b/panda/src/putil/load_prc_file.cxx @@ -39,7 +39,7 @@ // putil). //////////////////////////////////////////////////////////////////// ConfigPage * -load_prc_file(const string &filename) { +load_prc_file(const Filename &filename) { Filename path = filename; path.set_text(); diff --git a/panda/src/putil/load_prc_file.h b/panda/src/putil/load_prc_file.h index 4b41778844..4989de0081 100644 --- a/panda/src/putil/load_prc_file.h +++ b/panda/src/putil/load_prc_file.h @@ -16,6 +16,7 @@ #define LOAD_PRC_FILE_H #include "pandabase.h" +#include "filename.h" class ConfigPage; class HashVal; @@ -40,7 +41,7 @@ BEGIN_PUBLISH // putil). //////////////////////////////////////////////////////////////////// EXPCL_PANDA_PUTIL ConfigPage * -load_prc_file(const string &filename); +load_prc_file(const Filename &filename); //////////////////////////////////////////////////////////////////// // Function: load_prc_file_data diff --git a/panda/src/text/fontPool.h b/panda/src/text/fontPool.h index 430e9166ad..f02b895c91 100644 --- a/panda/src/text/fontPool.h +++ b/panda/src/text/fontPool.h @@ -33,8 +33,9 @@ class EXPCL_PANDA_TEXT FontPool { PUBLISHED: // These functions take string parameters instead of Filenames - // because that's somewhat more convenient to the scripting - // language. + // because the parameters may not be entirely an actual filename: + // they may be a filename followed by a face index. + INLINE static bool has_font(const string &filename); INLINE static bool verify_font(const string &filename); INLINE static TextFont *load_font(const string &filename);