diff --git a/pandatool/src/converter/somethingToEggConverter.I b/pandatool/src/converter/somethingToEggConverter.I index 55940a0440..49062741a6 100644 --- a/pandatool/src/converter/somethingToEggConverter.I +++ b/pandatool/src/converter/somethingToEggConverter.I @@ -480,8 +480,8 @@ get_egg_data() { // Function: SomethingToEggConverter::convert_texture_path // Access: Public // Description: Converts the indicated texture filename to a relative -// or absolute or whatever filename, according to _tpc -// and _tpc_directory. See convert_path(). +// or absolute or whatever filename, according to +// _path_replace. //////////////////////////////////////////////////////////////////// INLINE Filename SomethingToEggConverter:: convert_texture_path(const Filename &orig_filename) { @@ -492,8 +492,8 @@ convert_texture_path(const Filename &orig_filename) { // Function: SomethingToEggConverter::convert_model_path // Access: Public // Description: Converts the indicated model filename to a relative -// or absolute or whatever filename, according to _mpc -// and _mpc_directory. See convert_path(). +// or absolute or whatever filename, according to +// _path_replace. //////////////////////////////////////////////////////////////////// INLINE Filename SomethingToEggConverter:: convert_model_path(const Filename &orig_filename) { diff --git a/pandatool/src/converter/somethingToEggConverter.cxx b/pandatool/src/converter/somethingToEggConverter.cxx index 1e077f7fed..5486c63c2c 100644 --- a/pandatool/src/converter/somethingToEggConverter.cxx +++ b/pandatool/src/converter/somethingToEggConverter.cxx @@ -108,21 +108,16 @@ set_egg_data(EggData *egg_data, bool owns_egg_data) { //////////////////////////////////////////////////////////////////// bool SomethingToEggConverter:: handle_external_reference(EggGroupNode *egg_parent, - const Filename &orig_filename, - const DSearchPath &searchpath) { + const Filename &ref_filename) { if (_merge_externals) { SomethingToEggConverter *ext = make_copy(); EggData egg_data; egg_data.set_coordinate_system(get_egg_data().get_coordinate_system()); ext->set_egg_data(&egg_data, false); - // If we're reading references directly, we don't need to convert - // the pathname to something appropriate for storing, but we do - // need to hunt for it. - Filename as_found = _path_replace->match_path(orig_filename, searchpath); - if (!ext->convert_file(as_found)) { + if (!ext->convert_file(ref_filename)) { delete ext; - nout << "Unable to read external reference: " << orig_filename << "\n"; + nout << "Unable to read external reference: " << ref_filename << "\n"; if (!_allow_errors) { _error = true; } @@ -135,8 +130,8 @@ handle_external_reference(EggGroupNode *egg_parent, } else { // If we're installing external references instead of reading - // them, we should massage the filename as specified. - Filename filename = _path_replace->convert_path(orig_filename, searchpath); + // them, we should make it into an egg filename. + Filename filename = ref_filename; filename.set_extension("egg"); EggExternalReference *egg_ref = new EggExternalReference("", filename); diff --git a/pandatool/src/converter/somethingToEggConverter.h b/pandatool/src/converter/somethingToEggConverter.h index 4fabf33f09..93829a2aaf 100644 --- a/pandatool/src/converter/somethingToEggConverter.h +++ b/pandatool/src/converter/somethingToEggConverter.h @@ -105,8 +105,7 @@ public: virtual bool convert_file(const Filename &filename)=0; bool handle_external_reference(EggGroupNode *egg_parent, - const Filename &orig_filename, - const DSearchPath &searchpath = DSearchPath()); + const Filename &ref_filename); INLINE Filename convert_texture_path(const Filename &orig_filename); INLINE Filename convert_model_path(const Filename &orig_filename); diff --git a/pandatool/src/flt/fltExternalReference.cxx b/pandatool/src/flt/fltExternalReference.cxx index 8f15273a71..f69ec5a8ac 100644 --- a/pandatool/src/flt/fltExternalReference.cxx +++ b/pandatool/src/flt/fltExternalReference.cxx @@ -35,27 +35,18 @@ FltExternalReference(FltHeader *header) : FltBead(header) { } //////////////////////////////////////////////////////////////////// -// Function: FltExternalReference::convert_paths +// Function: FltExternalReference::apply_converted_filenames // Access: Public, Virtual -// Description: Converts all of the paths referenced by this record -// and below according to the indicated path replace -// parameters. If the resulting paths are absolute -// (beginning with a slash), they are converted to -// os-specific form before writing them out; otherwise, -// if they are relative, they are left in panda-specific -// form (under the assumption that a slash-delimited set -// of directory names is universally understood). +// Description: Walks the hierarchy at this record and below and +// copies the _converted_filename record into the +// _orig_filename record, so the flt file will be +// written out with the converted filename instead of +// what was originally read in. //////////////////////////////////////////////////////////////////// void FltExternalReference:: -convert_paths(PathReplace *path_replace) { - Filename new_filename = path_replace->convert_path(get_ref_filename()); - if (new_filename.is_local()) { - _filename = new_filename; - } else { - _filename = new_filename.to_os_specific(); - } - - FltRecord::convert_paths(path_replace); +apply_converted_filenames() { + _orig_filename = _converted_filename.to_os_generic(); + FltBead::apply_converted_filenames(); } //////////////////////////////////////////////////////////////////// @@ -68,20 +59,31 @@ convert_paths(PathReplace *path_replace) { //////////////////////////////////////////////////////////////////// void FltExternalReference:: output(ostream &out) const { - out << "External " << _filename; + out << "External " << get_ref_filename(); if (!_bead_id.empty()) { out << " (" << _bead_id << ")"; } } //////////////////////////////////////////////////////////////////// -// Function: FltTexture::get_ref_filename +// Function: FltExternalReference::get_ref_filename // Access: Public // Description: Returns the name of the referenced file. //////////////////////////////////////////////////////////////////// Filename FltExternalReference:: get_ref_filename() const { - return Filename::from_os_specific(_filename); + return _converted_filename; +} + +//////////////////////////////////////////////////////////////////// +// Function: FltExternalReference::set_ref_filename +// Access: Public +// Description: Changes the name of the referenced file. +//////////////////////////////////////////////////////////////////// +void FltExternalReference:: +set_ref_filename(const Filename &filename) { + _converted_filename = filename; + _orig_filename = _converted_filename.to_os_generic(); } //////////////////////////////////////////////////////////////////// @@ -108,16 +110,17 @@ extract_record(FltRecordReader &reader) { iterator.skip_bytes(2); iterator.skip_bytes(2); // Undocumented additional padding. - _filename = name; + _orig_filename = name; if (!name.empty() && name[name.length() - 1] == '>') { // Extract out the bead name. size_t open = name.rfind('<'); if (open != string::npos) { - _filename = name.substr(0, open); + _orig_filename = name.substr(0, open); _bead_id = name.substr(open + 1, name.length() - open - 2); } } + _converted_filename = _header->convert_path(_orig_filename); check_remaining_size(iterator); return true; @@ -140,7 +143,7 @@ build_record(FltRecordWriter &writer) const { writer.set_opcode(FO_external_ref); Datagram &datagram = writer.update_datagram(); - string name = _filename; + string name = _orig_filename; if (!_bead_id.empty()) { name += "<" + _bead_id + ">"; } diff --git a/pandatool/src/flt/fltExternalReference.h b/pandatool/src/flt/fltExternalReference.h index fdd426d8fa..da2e509e11 100644 --- a/pandatool/src/flt/fltExternalReference.h +++ b/pandatool/src/flt/fltExternalReference.h @@ -34,7 +34,7 @@ class FltExternalReference : public FltBead { public: FltExternalReference(FltHeader *header); - virtual void convert_paths(PathReplace *path_replace); + virtual void apply_converted_filenames(); virtual void output(ostream &out) const; enum Flags { @@ -46,11 +46,13 @@ public: F_light_palette_override = 0x04000000 }; - Filename _filename; + string _orig_filename; + Filename _converted_filename; string _bead_id; int _flags; Filename get_ref_filename() const; + void set_ref_filename(const Filename &filename); protected: virtual bool extract_record(FltRecordReader &reader); diff --git a/pandatool/src/flt/fltHeader.cxx b/pandatool/src/flt/fltHeader.cxx index 029553343e..699887203f 100644 --- a/pandatool/src/flt/fltHeader.cxx +++ b/pandatool/src/flt/fltHeader.cxx @@ -22,7 +22,7 @@ #include "fltUnsupportedRecord.h" #include "config_flt.h" -#include +#include "nearly_zero.h" #include #include @@ -32,10 +32,27 @@ TypeHandle FltHeader::_type_handle; //////////////////////////////////////////////////////////////////// // Function: FltHeader::Constructor // Access: Public -// Description: +// Description: The FltHeader constructor accepts a PathReplace +// pointer; it uses this object to automatically convert +// all external filename and texture references. (This +// is necessary because the FltHeader has to look in the +// same directory as the texture to find the .attr file, +// so it must pre-convert at least the texture +// references.) +// +// Most of the other file converters do not have this +// requirement, so they do not need to pre-convert any +// pathname references. //////////////////////////////////////////////////////////////////// FltHeader:: -FltHeader() : FltBeadID(this) { +FltHeader(PathReplace *path_replace) : FltBeadID(this) { + if (path_replace == (PathReplace *)NULL) { + _path_replace = new PathReplace; + _path_replace->_path_store = PS_absolute; + } else { + _path_replace = path_replace; + } + _format_revision_level = 1570; _edit_revision_level = 1570; _next_group_id = 1; @@ -91,7 +108,104 @@ FltHeader() : FltBeadID(this) { _got_eyepoint_trackplane_palette = false; _auto_attr_update = AU_if_missing; +} +//////////////////////////////////////////////////////////////////// +// Function: FltHeader::apply_converted_filenames +// Access: Public, Virtual +// Description: Walks the hierarchy at this record and below and +// copies the _converted_filename record into the +// _orig_filename record, so the flt file will be +// written out with the converted filename instead of +// what was originally read in. +//////////////////////////////////////////////////////////////////// +void FltHeader:: +apply_converted_filenames() { + Textures::const_iterator ti; + for (ti = _textures.begin(); ti != _textures.end(); ++ti) { + FltTexture *texture = (*ti).second; + texture->apply_converted_filenames(); + } + + FltBeadID::apply_converted_filenames(); +} + +//////////////////////////////////////////////////////////////////// +// Function: FltHeader::set_path_replace +// Access: Public +// Description: Replaces the PathReplace object (which specifies how +// to mangle paths from the source to the destination +// file) with a new one. +//////////////////////////////////////////////////////////////////// +void FltHeader:: +set_path_replace(PathReplace *path_replace) { + _path_replace = path_replace; +} + +//////////////////////////////////////////////////////////////////// +// Function: FltHeader::get_path_replace +// Access: Public +// Description: Returns a pointer to the PathReplace object +// associated with this converter. If the converter is +// non-const, this returns a non-const pointer, which +// can be adjusted. +//////////////////////////////////////////////////////////////////// +PathReplace *FltHeader:: +get_path_replace() { + return _path_replace; +} + +//////////////////////////////////////////////////////////////////// +// Function: FltHeader::get_path_replace +// Access: Public +// Description: Returns a pointer to the PathReplace object +// associated with this converter. If the converter is +// non-const, this returns a non-const pointer, which +// can be adjusted. +//////////////////////////////////////////////////////////////////// +const PathReplace *FltHeader:: +get_path_replace() const { + return _path_replace; +} + +//////////////////////////////////////////////////////////////////// +// Function: FltHeader::convert_path +// Access: Public +// Description: Uses the PathReplace object to convert the named +// filename as read from the flt record to its actual +// name. +//////////////////////////////////////////////////////////////////// +Filename FltHeader:: +convert_path(const Filename &orig_filename, const DSearchPath &additional_path) { + DSearchPath file_path; + if (!_flt_filename.empty()) { + file_path.append_directory(_flt_filename.get_dirname()); + } + file_path.append_path(additional_path); + return _path_replace->convert_path(orig_filename, file_path); +} + +//////////////////////////////////////////////////////////////////// +// Function: FltHeader::set_flt_filename +// Access: Public +// Description: Sets the filename--especially the directory part--in +// which the flt file is considered to reside. This is +// also implicitly set by read_flt(). +//////////////////////////////////////////////////////////////////// +void FltHeader:: +set_flt_filename(const Filename &flt_filename) { + _flt_filename = flt_filename; +} + +//////////////////////////////////////////////////////////////////// +// Function: FltHeader::get_flt_filename +// Access: Public +// Description: Returns the directory in which the flt file is +// considered to reside. +//////////////////////////////////////////////////////////////////// +const Filename &FltHeader:: +get_flt_filename() const { + return _flt_filename; } //////////////////////////////////////////////////////////////////// @@ -104,6 +218,7 @@ FltHeader() : FltBeadID(this) { FltError FltHeader:: read_flt(Filename filename) { filename.set_binary(); + _flt_filename = filename; ifstream in; if (!filename.open_read(in)) { diff --git a/pandatool/src/flt/fltHeader.h b/pandatool/src/flt/fltHeader.h index 0c9f26c52a..aa44f421fc 100644 --- a/pandatool/src/flt/fltHeader.h +++ b/pandatool/src/flt/fltHeader.h @@ -30,6 +30,8 @@ #include "fltTrackplane.h" #include "fltInstanceDefinition.h" +#include "pathReplace.h" +#include "pointerTo.h" #include "filename.h" #include "dSearchPath.h" #include "distanceUnit.h" @@ -49,7 +51,18 @@ //////////////////////////////////////////////////////////////////// class FltHeader : public FltBeadID { public: - FltHeader(); + FltHeader(PathReplace *path_replace); + + virtual void apply_converted_filenames(); + + void set_path_replace(PathReplace *path_replace); + PathReplace *get_path_replace(); + const PathReplace *get_path_replace() const; + Filename convert_path(const Filename &orig_filename, + const DSearchPath &additional_path = DSearchPath()); + + void set_flt_filename(const Filename &flt_filename); + const Filename &get_flt_filename() const; FltError read_flt(Filename filename); FltError read_flt(istream &in); @@ -284,6 +297,9 @@ private: FltEyepoint _eyepoints[10]; FltTrackplane _trackplanes[10]; + // This pointer is used to resolve references in the flt file. + PT(PathReplace) _path_replace; + Filename _flt_filename; protected: virtual bool extract_record(FltRecordReader &reader); diff --git a/pandatool/src/flt/fltRecord.cxx b/pandatool/src/flt/fltRecord.cxx index a5880ff37b..39d241e03c 100644 --- a/pandatool/src/flt/fltRecord.cxx +++ b/pandatool/src/flt/fltRecord.cxx @@ -331,25 +331,22 @@ check_remaining_size(const DatagramIterator &di, const string &name) const { } //////////////////////////////////////////////////////////////////// -// Function: FltRecord::convert_paths +// Function: FltRecord::apply_converted_filenames // Access: Public, Virtual -// Description: Converts all of the paths referenced by this record -// and below according to the indicated path replace -// parameters. If the resulting paths are absolute -// (beginning with a slash), they are converted to -// os-specific form before writing them out; otherwise, -// if they are relative, they are left in panda-specific -// form (under the assumption that a slash-delimited set -// of directory names is universally understood). +// Description: Walks the hierarchy at this record and below and +// copies the _converted_filename record into the +// _orig_filename record, so the flt file will be +// written out with the converted filename instead of +// what was originally read in. //////////////////////////////////////////////////////////////////// void FltRecord:: -convert_paths(PathReplace *path_replace) { +apply_converted_filenames() { Records::const_iterator ci; for (ci = _subfaces.begin(); ci != _subfaces.end(); ++ci) { - (*ci)->convert_paths(path_replace); + (*ci)->apply_converted_filenames(); } for (ci = _children.begin(); ci != _children.end(); ++ci) { - (*ci)->convert_paths(path_replace); + (*ci)->apply_converted_filenames(); } } diff --git a/pandatool/src/flt/fltRecord.h b/pandatool/src/flt/fltRecord.h index 947e85f33e..a6fee4baeb 100644 --- a/pandatool/src/flt/fltRecord.h +++ b/pandatool/src/flt/fltRecord.h @@ -32,7 +32,6 @@ class FltHeader; class FltRecordReader; class FltRecordWriter; class DatagramIterator; -class PathReplace; //////////////////////////////////////////////////////////////////// // Class : FltRecord @@ -75,7 +74,7 @@ public: void check_remaining_size(const DatagramIterator &di, const string &name = string()) const; - virtual void convert_paths(PathReplace *path_replace); + virtual void apply_converted_filenames(); virtual void output(ostream &out) const; virtual void write(ostream &out, int indent_level = 0) const; diff --git a/pandatool/src/flt/fltTexture.cxx b/pandatool/src/flt/fltTexture.cxx index c91b8261ca..2fc6fd14fc 100644 --- a/pandatool/src/flt/fltTexture.cxx +++ b/pandatool/src/flt/fltTexture.cxx @@ -21,6 +21,7 @@ #include "fltRecordWriter.h" #include "fltHeader.h" #include "pathReplace.h" +#include "config_util.h" TypeHandle FltTexture::_type_handle; @@ -89,27 +90,18 @@ FltTexture(FltHeader *header) : FltRecord(header) { } //////////////////////////////////////////////////////////////////// -// Function: FltTexture::convert_paths +// Function: FltTexture::apply_converted_filenames // Access: Public, Virtual -// Description: Converts all of the paths referenced by this record -// and below according to the indicated path replace -// parameters. If the resulting paths are absolute -// (beginning with a slash), they are converted to -// os-specific form before writing them out; otherwise, -// if they are relative, they are left in panda-specific -// form (under the assumption that a slash-delimited set -// of directory names is universally understood). +// Description: Walks the hierarchy at this record and below and +// copies the _converted_filename record into the +// _orig_filename record, so the flt file will be +// written out with the converted filename instead of +// what was originally read in. //////////////////////////////////////////////////////////////////// void FltTexture:: -convert_paths(PathReplace *path_replace) { - Filename new_filename = path_replace->convert_path(get_texture_filename()); - if (new_filename.is_local()) { - _filename = new_filename; - } else { - _filename = new_filename.to_os_specific(); - } - - FltRecord::convert_paths(path_replace); +apply_converted_filenames() { + _orig_filename = _converted_filename.to_os_generic(); + FltRecord::apply_converted_filenames(); } //////////////////////////////////////////////////////////////////// @@ -119,7 +111,18 @@ convert_paths(PathReplace *path_replace) { //////////////////////////////////////////////////////////////////// Filename FltTexture:: get_texture_filename() const { - return Filename::from_os_specific(_filename); + return _converted_filename; +} + +//////////////////////////////////////////////////////////////////// +// Function: FltTexture::set_texture_filename +// Access: Public +// Description: Changes the name of the texture image file. +//////////////////////////////////////////////////////////////////// +void FltTexture:: +set_texture_filename(const Filename &filename) { + _converted_filename = filename; + _orig_filename = _converted_filename.to_os_generic(); } //////////////////////////////////////////////////////////////////// @@ -239,10 +242,11 @@ extract_record(FltRecordReader &reader) { DatagramIterator &iterator = reader.get_iterator(); if (_header->get_flt_version() < 1420) { - _filename = iterator.get_fixed_string(80); + _orig_filename = iterator.get_fixed_string(80); } else { - _filename = iterator.get_fixed_string(200); + _orig_filename = iterator.get_fixed_string(200); } + _converted_filename = _header->convert_path(_orig_filename, get_texture_path()); _pattern_index = iterator.get_be_int32(); _x_location = iterator.get_be_int32(); _y_location = iterator.get_be_int32(); @@ -272,7 +276,7 @@ build_record(FltRecordWriter &writer) const { writer.set_opcode(FO_texture); Datagram &datagram = writer.update_datagram(); - datagram.add_fixed_string(_filename, 200); + datagram.add_fixed_string(_orig_filename, 200); datagram.add_be_int32(_pattern_index); datagram.add_be_int32(_x_location); datagram.add_be_int32(_y_location); diff --git a/pandatool/src/flt/fltTexture.h b/pandatool/src/flt/fltTexture.h index 8c963fb25b..898df12dcd 100644 --- a/pandatool/src/flt/fltTexture.h +++ b/pandatool/src/flt/fltTexture.h @@ -19,12 +19,12 @@ #ifndef FLTTEXTURE_H #define FLTTEXTURE_H -#include +#include "pandatoolbase.h" #include "fltRecord.h" -#include -#include +#include "filename.h" +#include "luse.h" //////////////////////////////////////////////////////////////////// // Class : FltTexture @@ -34,14 +34,16 @@ class FltTexture : public FltRecord { public: FltTexture(FltHeader *header); - virtual void convert_paths(PathReplace *path_replace); + virtual void apply_converted_filenames(); - string _filename; + string _orig_filename; + Filename _converted_filename; int _pattern_index; int _x_location; int _y_location; Filename get_texture_filename() const; + void set_texture_filename(const Filename &filename); Filename get_attr_filename() const; FltError read_attr_data(); FltError write_attr_data() const; diff --git a/pandatool/src/fltegg/fltToEggConverter.cxx b/pandatool/src/fltegg/fltToEggConverter.cxx index e6aad60a55..6aaf9007ed 100644 --- a/pandatool/src/fltegg/fltToEggConverter.cxx +++ b/pandatool/src/fltegg/fltToEggConverter.cxx @@ -120,7 +120,7 @@ get_extension() const { //////////////////////////////////////////////////////////////////// bool FltToEggConverter:: convert_file(const Filename &filename) { - PT(FltHeader) header = new FltHeader; + PT(FltHeader) header = new FltHeader(_path_replace); nout << "Reading " << filename << "\n"; FltError result = header->read_flt(filename); @@ -619,7 +619,8 @@ parse_comment(const FltBead *flt_bead, EggNode *egg_node) { //////////////////////////////////////////////////////////////////// bool FltToEggConverter:: parse_comment(const FltTexture *flt_texture, EggNode *egg_node) { - return parse_comment(flt_texture->_comment, flt_texture->_filename, egg_node); + return parse_comment(flt_texture->get_comment(), + flt_texture->get_texture_filename(), egg_node); } //////////////////////////////////////////////////////////////////// @@ -744,7 +745,7 @@ make_egg_texture(const FltTexture *flt_texture) { // Create a new one. string tref_name = format_string(flt_texture->_pattern_index); - Filename filename = convert_texture_path(flt_texture->get_texture_filename()); + Filename filename = flt_texture->get_texture_filename(); PT_EggTexture egg_texture = new EggTexture(tref_name, filename); diff --git a/pandatool/src/fltprogs/fltCopy.cxx b/pandatool/src/fltprogs/fltCopy.cxx index e6a572cf2c..894e127ce9 100644 --- a/pandatool/src/fltprogs/fltCopy.cxx +++ b/pandatool/src/fltprogs/fltCopy.cxx @@ -110,7 +110,7 @@ copy_file(const Filename &source, const Filename &dest, bool FltCopy:: copy_flt_file(const Filename &source, const Filename &dest, CVSSourceDirectory *dir) { - PT(FltHeader) header = new FltHeader; + PT(FltHeader) header = new FltHeader(_path_replace); // We don't want to automatically generate .attr files--we'd rather // write them out explicitly. @@ -132,8 +132,7 @@ copy_flt_file(const Filename &source, const Filename &dest, Refs::const_iterator ri; for (ri = refs.begin(); ri != refs.end(); ++ri) { FltExternalReference *ref = (*ri); - Filename ref_filename = - _path_replace->convert_path(ref->get_ref_filename()); + Filename ref_filename = ref->get_ref_filename(); if (!ref_filename.exists()) { nout << "*** Warning: external reference " << ref_filename @@ -150,8 +149,8 @@ copy_flt_file(const Filename &source, const Filename &dest, // Update the reference to point to the new flt filename, relative // to the base flt file. - ref->_filename = dir->get_rel_to(ref_dir) + "/" + - ref_filename.get_basename(); + ref->set_ref_filename(dir->get_rel_to(ref_dir) + "/" + + ref_filename.get_basename()); } } @@ -163,8 +162,7 @@ copy_flt_file(const Filename &source, const Filename &dest, Textures::const_iterator ti; for (ti = textures.begin(); ti != textures.end(); ++ti) { FltTexture *tex = (*ti); - Filename texture_filename = - _path_replace->convert_path(tex->get_texture_filename()); + Filename texture_filename = tex->get_texture_filename(); if (!texture_filename.exists()) { nout << "*** Warning: texture " << texture_filename @@ -182,8 +180,8 @@ copy_flt_file(const Filename &source, const Filename &dest, // Update the texture reference to point to the new texture // filename, relative to the flt file. - tex->_filename = dir->get_rel_to(texture_dir) + "/" + - texture_filename.get_basename(); + tex->set_texture_filename(dir->get_rel_to(texture_dir) + "/" + + texture_filename.get_basename()); header->add_texture(tex); } } diff --git a/pandatool/src/fltprogs/fltInfo.cxx b/pandatool/src/fltprogs/fltInfo.cxx index 2a9f8b1d97..ee0aabdd05 100644 --- a/pandatool/src/fltprogs/fltInfo.cxx +++ b/pandatool/src/fltprogs/fltInfo.cxx @@ -49,7 +49,7 @@ FltInfo() { //////////////////////////////////////////////////////////////////// void FltInfo:: run() { - PT(FltHeader) header = new FltHeader; + PT(FltHeader) header = new FltHeader(_path_replace); nout << "Reading " << _input_filename << "\n"; FltError result = header->read_flt(_input_filename); diff --git a/pandatool/src/fltprogs/fltToEgg.cxx b/pandatool/src/fltprogs/fltToEgg.cxx index e729b55a74..c014f3f5e8 100644 --- a/pandatool/src/fltprogs/fltToEgg.cxx +++ b/pandatool/src/fltprogs/fltToEgg.cxx @@ -68,7 +68,7 @@ FltToEgg() : //////////////////////////////////////////////////////////////////// void FltToEgg:: run() { - PT(FltHeader) header = new FltHeader; + PT(FltHeader) header = new FltHeader(_path_replace); nout << "Reading " << _input_filename << "\n"; FltError result = header->read_flt(_input_filename); diff --git a/pandatool/src/fltprogs/fltTrans.cxx b/pandatool/src/fltprogs/fltTrans.cxx index cd36b5b1f7..ed3f2c90a0 100644 --- a/pandatool/src/fltprogs/fltTrans.cxx +++ b/pandatool/src/fltprogs/fltTrans.cxx @@ -79,7 +79,7 @@ run() { } } - PT(FltHeader) header = new FltHeader; + PT(FltHeader) header = new FltHeader(_path_replace); nout << "Reading " << _input_filename << "\n"; FltError result = header->read_flt(_input_filename); @@ -97,7 +97,7 @@ run() { header->set_flt_version(new_version); } - header->convert_paths(_path_replace); + header->apply_converted_filenames(); result = header->write_flt(get_output()); if (result != FE_ok) {