25 TypeHandle LoaderFileTypePandatool::_type_handle;
30 LoaderFileTypePandatool::
33 _loader(loader), _saver(saver)
35 if (_loader !=
nullptr) {
36 _loader->set_merge_externals(
true);
43 LoaderFileTypePandatool::
44 ~LoaderFileTypePandatool() {
50 std::string LoaderFileTypePandatool::
52 if (_loader !=
nullptr) {
53 return _loader->get_name();
55 return _saver->get_name();
61 std::string LoaderFileTypePandatool::
62 get_extension()
const {
63 if (_loader !=
nullptr) {
64 return _loader->get_extension();
66 return _saver->get_extension();
75 if (_loader !=
nullptr) {
87 if (_loader !=
nullptr) {
100 return (_loader !=
nullptr);
110 return (_saver !=
nullptr);
128 if (_loader ==
nullptr) {
132 if (record !=
nullptr) {
142 loader->get_path_replace()->_path = file_path;
145 switch (options.get_flags() & LoaderOptions::LF_convert_anim) {
146 case LoaderOptions::LF_convert_anim:
147 loader->set_animation_convert(AC_both);
150 case LoaderOptions::LF_convert_skeleton:
151 loader->set_animation_convert(AC_model);
154 case LoaderOptions::LF_convert_channels:
155 loader->set_animation_convert(AC_chan);
164 if (ptloader_load_node && loader->supports_convert_to_node(options)) {
165 result = loader->convert_to_node(options, path);
166 if (!result.is_null()) {
174 loader->set_egg_data(egg_data);
176 if (loader->convert_file(path)) {
178 if (input_units != DU_invalid && ptloader_units != DU_invalid &&
179 input_units != ptloader_units) {
186 egg_data->transform(LMatrix4d::scale_mat(scale));
189 if (!egg_data->has_primitives()) {
190 egg_data->make_point_primitives();
191 }
else if (!egg_data->has_normals()) {
192 egg_data->recompute_polygon_normals();
195 result = load_egg_data(egg_data);
205 bool LoaderFileTypePandatool::
208 if (_saver ==
nullptr) {
220 bool result = saver->write_file(path);
std::string get_dirname() const
Returns the directory part of the filename.
A basic node of the scene graph or data graph.
string format_long_unit(DistanceUnit unit)
Returns the string representing the full name (plural) for the given unit.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Specifies parameters that may be passed to the loader.
double convert_units(DistanceUnit from, DistanceUnit to)
Returns the scaling factor that must be applied to convert from units of "from" to "to".
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool resolve_filename(const DSearchPath &searchpath, const std::string &default_extension=std::string())
Searches the given search path for the filename.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a base class for a family of converter classes that manage a conversion from egg format to so...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
void set_egg_data(EggData *egg_data)
Sets the egg data that will be filled in when convert_file() is called.
bool save_egg_data(EggData *data, PandaNode *node)
Another convenience function; works like save_egg_file() but populates an EggData instead of writing ...
The name of a file, such as a texture file or an Egg file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
An instance of this class is written to the front of a Bam or Txo file to make the file a cached inst...
virtual std::string get_additional_extensions() const
Returns a space-separated list of extension, in addition to the one returned by get_extension(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool supports_compressed() const
Returns true if this file type can transparently save compressed files (with a .pz extension),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
virtual std::string get_additional_extensions() const
Returns a space-separated list of extension, in addition to the one returned by get_extension(),...
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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),...