15 #include "loaderFileTypePandatool.h" 16 #include "config_ptloader.h" 17 #include "somethingToEggConverter.h" 18 #include "eggToSomethingConverter.h" 19 #include "config_util.h" 20 #include "load_egg_file.h" 21 #include "save_egg_file.h" 23 #include "loaderOptions.h" 24 #include "bamCacheRecord.h" 26 TypeHandle LoaderFileTypePandatool::_type_handle;
33 LoaderFileTypePandatool::
36 _loader(loader), _saver(saver)
48 LoaderFileTypePandatool::
49 ~LoaderFileTypePandatool() {
57 string LoaderFileTypePandatool::
60 return _loader->get_name();
62 return _saver->get_name();
70 string LoaderFileTypePandatool::
71 get_extension()
const {
73 return _loader->get_extension();
75 return _saver->get_extension();
117 return (_loader != NULL);
129 return (_saver != NULL);
152 if (_loader == NULL) {
169 switch (options.get_flags() & LoaderOptions::LF_convert_anim) {
170 case LoaderOptions::LF_convert_anim:
174 case LoaderOptions::LF_convert_skeleton:
178 case LoaderOptions::LF_convert_channels:
189 result = loader->convert_to_node(options, path);
190 if (!result.is_null()) {
200 if (loader->convert_file(path)) {
202 if (input_units != DU_invalid && ptloader_units != DU_invalid &&
203 input_units != ptloader_units) {
207 <<
"Converting from " << format_long_unit(input_units)
208 <<
" to " << format_long_unit(ptloader_units) <<
"\n";
209 double scale = convert_units(input_units, ptloader_units);
213 if (!egg_data->has_primitives()) {
214 egg_data->make_point_primitives();
215 }
else if (!egg_data->has_normals()) {
216 egg_data->recompute_polygon_normals();
219 result = load_egg_data(egg_data);
231 bool LoaderFileTypePandatool::
234 if (_saver == NULL) {
239 if (!save_egg_data(egg_data, node)) {
246 bool result = saver->write_file(path);
string get_dirname() const
Returns the directory part of the filename.
A basic node of the scene graph or data graph.
virtual bool supports_convert_to_node(const LoaderOptions &options) const
Returns true if this converter can directly convert the model type to internal Panda memory structure...
virtual string get_additional_extensions() const
Returns a space-separated list of extension, in addition to the one returned by get_extension(), that are recognized by this converter.
Specifies parameters that may be passed to the loader.
static LMatrix4d scale_mat(const LVecBase3d &scale)
Returns a matrix that applies the indicated scale in each of the three axes.
void append_directory(const Filename &directory)
Adds a new directory to the end of the search list.
This is the primary interface into all the egg data, and the root of the egg file structure...
This is a base class for a family of converter classes that manage a conversion from egg format to so...
bool resolve_filename(const DSearchPath &searchpath, const string &default_extension=string())
Searches the given search path for the filename.
void set_egg_data(EggData *egg_data)
Sets the egg data that will be filled in when convert_file() is called.
The name of a file, such as a texture file or an Egg file.
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
virtual bool supports_compressed() const
Returns true if this file type can transparently save compressed files (with a .pz extension)...
void set_animation_convert(AnimationConvert animation_convert)
Specifies how source animation will be converted into egg structures.
void set_egg_data(EggData *egg_data)
Sets the egg data that will be filled in when convert_file() is called.
virtual string get_additional_extensions() const
Returns a space-separated list of extension, in addition to the one returned by get_extension(), that are recognized by this converter.
PathReplace * get_path_replace()
Returns a pointer to the PathReplace object associated with this converter.
void set_merge_externals(bool merge_externals)
Sets the merge_externals flag.
This class stores a list of directories that can be searched, in order, to locate a particular file...
void add_dependent_file(const Filename &pathname)
Adds the indicated file to the list of files that will be loaded to generate the data in this record...
TypeHandle is the identifier used to differentiate C++ class types.
virtual DistanceUnit get_input_units()
This may be called after convert_file() has been called and returned true, indicating a successful co...
This is a base class for a family of converter classes that manage a conversion from some file type t...
virtual bool supports_compressed() const
Returns true if this file type can transparently load compressed files (with a .pz extension)...