25TypeHandle LoaderFileTypePandatool::_type_handle;
30LoaderFileTypePandatool::
33 _loader(loader), _saver(saver)
35 if (_loader !=
nullptr) {
36 _loader->set_merge_externals(
true);
43LoaderFileTypePandatool::
44~LoaderFileTypePandatool() {
50std::string LoaderFileTypePandatool::
52 if (_loader !=
nullptr) {
53 return _loader->get_name();
55 return _saver->get_name();
61std::string LoaderFileTypePandatool::
62get_extension()
const {
63 if (_loader !=
nullptr) {
64 return _loader->get_extension();
66 return _saver->get_extension();
75 if (_loader !=
nullptr) {
76 return _loader->get_additional_extensions();
78 return _saver->get_additional_extensions();
87 if (_loader !=
nullptr) {
88 return _loader->supports_compressed();
90 return _saver->supports_compressed();
100 return (_loader !=
nullptr);
110 return (_saver !=
nullptr);
128 if (_loader ==
nullptr) {
132 if (record !=
nullptr) {
136 PT(PandaNode) result;
138 SomethingToEggConverter *loader = _loader->make_copy();
140 DSearchPath file_path;
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()) {
173 PT(EggData) egg_data =
new EggData;
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);
205bool LoaderFileTypePandatool::
208 if (_saver ==
nullptr) {
212 PT(EggData) egg_data =
new EggData;
217 EggToSomethingConverter *saver = _saver->make_copy();
220 bool result = saver->write_file(path);
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...
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.
void append_directory(const Filename &directory)
Adds a new directory to the end of the search list.
This is a base class for a family of converter classes that manage a conversion from egg format to so...
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.
bool resolve_filename(const DSearchPath &searchpath, const std::string &default_extension=std::string())
Searches the given search path for the filename.
std::string get_dirname() const
Returns the directory part of the filename.
Specifies parameters that may be passed to the loader.
A basic node of the scene graph or data graph.
This is a base class for a family of converter classes that manage a conversion from some file type t...
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
string format_long_unit(DistanceUnit unit)
Returns the string representing the full name (plural) for the given unit.
double convert_units(DistanceUnit from, DistanceUnit to)
Returns the scaling factor that must be applied to convert from units of "from" to "to".
DistanceUnit
This enumerated type lists all the kinds of units we're likely to come across in model conversion pro...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool save_egg_data(EggData *data, PandaNode *node)
Another convenience function; works like save_egg_file() but populates an EggData instead of writing ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.