Panda3D
|
This class supervises the construction of an EggData structure from a single Maya file, or from the data already in the global Maya model space. More...
#include "mayaToEggConverter.h"
Public Types | |
enum | TransformType { TT_invalid, TT_all, TT_model, TT_dcs, TT_none } |
Public Member Functions | |
MayaToEggConverter (const string &program_name="") | |
MayaToEggConverter (const MayaToEggConverter ©) | |
void | add_exclude (const GlobPattern &glob) |
Adds a name pattern to the list of excluded nodes. | |
void | add_force_joint (const GlobPattern &glob) |
Adds a name pattern to the list of force_joints. | |
void | add_ignore_slider (const GlobPattern &glob) |
Adds a name pattern to the list of ignore_sliders. | |
void | add_subroot (const GlobPattern &glob) |
Adds a name pattern to the list of subroot nodes. | |
void | add_subset (const GlobPattern &glob) |
Adds a name pattern to the list of subset nodes. | |
void | clear () |
Frees all of the Maya pointers kept within this object, in preparation for loading a new scene or releasing the Maya API. | |
void | clear_excludes () |
Empties the list of excluded nodes added via add_exclude(). | |
void | clear_force_joints () |
Empties the list of force_joints added via add_force_joint(). | |
void | clear_ignore_sliders () |
Empties the list of ignore_sliders added via add_ignore_slider(). | |
void | clear_subroots () |
Empties the list of subroot nodes added via add_subroot(). | |
void | clear_subsets () |
Empties the list of subset nodes added via add_subset(). | |
void | close_api () |
Closes the Maya API, if it was previously opened. | |
virtual bool | convert_file (const Filename &filename) |
Handles the reading of the input file and converting it to egg. | |
bool | convert_maya () |
Fills up the egg_data structure according to the global maya model data. | |
bool | force_joint (const string &name) const |
Returns true if the indicated name is on the list of DAG nodes to treat as a joint, false otherwise. | |
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. | |
virtual string | get_extension () const |
Returns the common extension of the file type this converter supports. | |
virtual DistanceUnit | get_input_units () |
This may be called after convert_file() has been called and returned true, indicating a successful conversion. | |
virtual string | get_name () const |
Returns the English name of the file type this converter supports. | |
bool | ignore_slider (const string &name) const |
Returns true if the indicated name is on the list of sliders to ignore, false otherwise. | |
virtual SomethingToEggConverter * | make_copy () |
Allocates and returns a new copy of the converter. | |
bool | open_api (bool revert_directory=true) |
Attempts to open the Maya API if it was not already open, and returns true if successful, or false if there is an error. | |
PT (MayaApi) _maya | |
void | set_from_selection (bool from_selection) |
Sets the flag that indicates whether the currently selected Maya geometry will be converted. | |
Static Public Member Functions | |
static TransformType | string_transform_type (const string &arg) |
Returns the TransformType value corresponding to the indicated string, or TT_invalid. | |
Public Attributes | |
bool | _always_show_vertex_color |
bool | _keep_all_uvsets |
bool | _legacy_shader |
bool | _polygon_output |
double | _polygon_tolerance |
bool | _respect_maya_double_sided |
bool | _round_uvs |
MayaShaders | _shaders |
EggTextureCollection | _textures |
TransformType | _transform_type |
This class supervises the construction of an EggData structure from a single Maya file, or from the data already in the global Maya model space.
Note that since the Maya API presents just one global model space, it is not possible to simultaneously load two distinct Maya files.
Definition at line 65 of file mayaToEggConverter.h.
void MayaToEggConverter::add_exclude | ( | const GlobPattern & | glob | ) |
Adds a name pattern to the list of excluded nodes.
Definition at line 296 of file mayaToEggConverter.cxx.
void MayaToEggConverter::add_force_joint | ( | const GlobPattern & | glob | ) |
Adds a name pattern to the list of force_joints.
Any DAG node that matches a name on the list will be treated as if it were a joint during the conversion process; it will receive animation and position information. Normally, a true Maya joint, as well as any DAG nodes whose transforms are animated, will automatically be flagged as a Panda joint.
Definition at line 369 of file mayaToEggConverter.cxx.
void MayaToEggConverter::add_ignore_slider | ( | const GlobPattern & | glob | ) |
Adds a name pattern to the list of ignore_sliders.
Any slider (blend shape deformer) that matches a name on the list will not be converted or otherwise molested by the converter. This is occasionally necessary to filter out automatically-created sliders that are not intended to be used directly, but instead have an indirect effect on other sliders.
Definition at line 323 of file mayaToEggConverter.cxx.
void MayaToEggConverter::add_subroot | ( | const GlobPattern & | glob | ) |
Adds a name pattern to the list of subroot nodes.
If the list of subroot nodes is not empty, then only a subroot of the nodes in the maya file will be converted: those whose names match one of the patterns given on this list.
Definition at line 249 of file mayaToEggConverter.cxx.
void MayaToEggConverter::add_subset | ( | const GlobPattern & | glob | ) |
Adds a name pattern to the list of subset nodes.
If the list of subset nodes is not empty, then only a subset of the nodes in the maya file will be converted: those whose names match one of the patterns given on this list.
Definition at line 275 of file mayaToEggConverter.cxx.
void MayaToEggConverter::clear | ( | void | ) |
Frees all of the Maya pointers kept within this object, in preparation for loading a new scene or releasing the Maya API.
Definition at line 635 of file mayaToEggConverter.cxx.
References MayaShaders::clear(), EggTextureCollection::clear(), and MayaNodeTree::clear().
Referenced by close_api(), convert_file(), and convert_maya().
void MayaToEggConverter::clear_excludes | ( | ) |
Empties the list of excluded nodes added via add_exclude().
Definition at line 286 of file mayaToEggConverter.cxx.
void MayaToEggConverter::clear_force_joints | ( | ) |
Empties the list of force_joints added via add_force_joint().
No joints will be forced.
Definition at line 352 of file mayaToEggConverter.cxx.
void MayaToEggConverter::clear_ignore_sliders | ( | ) |
Empties the list of ignore_sliders added via add_ignore_slider().
No sliders will be ignored.
Definition at line 307 of file mayaToEggConverter.cxx.
void MayaToEggConverter::clear_subroots | ( | ) |
Empties the list of subroot nodes added via add_subroot().
The entire file will once again be converted.
Definition at line 235 of file mayaToEggConverter.cxx.
void MayaToEggConverter::clear_subsets | ( | ) |
Empties the list of subset nodes added via add_subset().
The entire file will once again be converted.
Definition at line 261 of file mayaToEggConverter.cxx.
void MayaToEggConverter::close_api | ( | ) |
Closes the Maya API, if it was previously opened.
Caution! Maya appears to call exit() when its API is closed.
Definition at line 620 of file mayaToEggConverter.cxx.
References clear().
bool MayaToEggConverter::convert_file | ( | const Filename & | filename | ) | [virtual] |
Handles the reading of the input file and converting it to egg.
Returns true if successful, false otherwise.
This is designed to be as generic as possible, generally in support of run-time loading. Also see convert_maya().
Implements SomethingToEggConverter.
Definition at line 201 of file mayaToEggConverter.cxx.
References clear(), convert_maya(), Filename::get_basename_wo_extension(), and open_api().
bool MayaToEggConverter::convert_maya | ( | ) |
Fills up the egg_data structure according to the global maya model data.
Returns true if successful, false if there is an error.
Definition at line 427 of file mayaToEggConverter.cxx.
References MayaNodeTree::build_hierarchy(), clear(), SomethingToEggConverter::clear_error(), SomethingToEggConverter::get_animation_convert(), SomethingToEggConverter::get_egg_data(), SomethingToEggConverter::get_end_frame(), SomethingToEggConverter::get_frame_inc(), SomethingToEggConverter::get_input_frame_rate(), SomethingToEggConverter::get_output_frame_rate(), SomethingToEggConverter::get_start_frame(), SomethingToEggConverter::had_error(), SomethingToEggConverter::has_end_frame(), SomethingToEggConverter::has_frame_inc(), SomethingToEggConverter::has_input_frame_rate(), SomethingToEggConverter::has_output_frame_rate(), SomethingToEggConverter::has_start_frame(), open_api(), MayaNodeTree::tag_all(), MayaNodeTree::tag_joint_all(), MayaNodeTree::tag_joint_named(), MayaNodeTree::tag_named(), MayaNodeTree::tag_selected(), and MayaNodeTree::untag_named().
Referenced by convert_file().
bool MayaToEggConverter::force_joint | ( | const string & | name | ) | const |
Returns true if the indicated name is on the list of DAG nodes to treat as a joint, false otherwise.
Definition at line 380 of file mayaToEggConverter.cxx.
Referenced by MayaNodeDesc::from_dag_path().
string MayaToEggConverter::get_additional_extensions | ( | ) | const [virtual] |
Returns a space-separated list of extension, in addition to the one returned by get_extension(), that are recognized by this converter.
Reimplemented from SomethingToEggConverter.
Definition at line 185 of file mayaToEggConverter.cxx.
string MayaToEggConverter::get_extension | ( | ) | const [virtual] |
Returns the common extension of the file type this converter supports.
Implements SomethingToEggConverter.
Definition at line 173 of file mayaToEggConverter.cxx.
DistanceUnit MayaToEggConverter::get_input_units | ( | ) | [virtual] |
This may be called after convert_file() has been called and returned true, indicating a successful conversion.
It will return the distance units represented by the converted egg file, if known, or DU_invalid if not known.
Reimplemented from SomethingToEggConverter.
Definition at line 415 of file mayaToEggConverter.cxx.
string MayaToEggConverter::get_name | ( | ) | const [virtual] |
Returns the English name of the file type this converter supports.
Implements SomethingToEggConverter.
Definition at line 162 of file mayaToEggConverter.cxx.
bool MayaToEggConverter::ignore_slider | ( | const string & | name | ) | const |
Returns true if the indicated name is on the list of sliders to ignore, false otherwise.
Definition at line 334 of file mayaToEggConverter.cxx.
Referenced by MayaNodeTree::ignore_slider().
SomethingToEggConverter * MayaToEggConverter::make_copy | ( | ) | [virtual] |
Allocates and returns a new copy of the converter.
Implements SomethingToEggConverter.
Definition at line 151 of file mayaToEggConverter.cxx.
bool MayaToEggConverter::open_api | ( | bool | revert_directory = true | ) |
Attempts to open the Maya API if it was not already open, and returns true if successful, or false if there is an error.
Definition at line 602 of file mayaToEggConverter.cxx.
Referenced by convert_file(), and convert_maya().
void MayaToEggConverter::set_from_selection | ( | bool | from_selection | ) |
Sets the flag that indicates whether the currently selected Maya geometry will be converted.
If this is true, and the selection is nonempty, then only the selected geometry will be converted. If this is false, the entire file will be converted.
Definition at line 401 of file mayaToEggConverter.cxx.
MayaToEggConverter::TransformType MayaToEggConverter::string_transform_type | ( | const string & | arg | ) | [static] |
Returns the TransformType value corresponding to the indicated string, or TT_invalid.
Definition at line 3080 of file mayaToEggConverter.cxx.
Referenced by MayaToEggServer::dispatch_transform_type(), and MayaToEgg::dispatch_transform_type().