Panda3D

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
MayaToEggConverter Class Reference

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"`

Inheritance diagram for MayaToEggConverter:

## Public Types
enum | TransformType { TT_invalid , TT_all , TT_model , TT_dcs , TT_none }

## Public Member Functions
| MayaToEggConverter (const MayaToEggConverter &copy)
| MayaToEggConverter (const std::string &program_name="")
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 std::string &name) const
| Returns true if the indicated name is on the list of DAG nodes to treat as a joint, false otherwise.
virtual std::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 std::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 std::string | get_name () const
| Returns the English name of the file type this converter supports.
bool | ignore_slider (const std::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.
Public Member Functions inherited from SomethingToEggConverter
| SomethingToEggConverter (const SomethingToEggConverter &copy)
void | clear_egg_data ()
| Sets the EggData to NULL and makes the converter invalid.
void | clear_end_frame ()
| Removes the value previously set by set_end_frame().
void | clear_error ()
| Resets the error flag to the no-error state.
void | clear_frame_inc ()
| Removes the value previously set by set_frame_inc().
void | clear_input_frame_rate ()
| Removes the value previously set by set_input_frame_rate().
void | clear_neutral_frame ()
| Removes the value previously set by set_neutral_frame().
void | clear_output_frame_rate ()
| Removes the value previously set by set_output_frame_rate().
void | clear_start_frame ()
| Removes the value previously set by set_start_frame().
Filename | convert_model_path (const Filename &orig_filename)
| Converts the indicated model filename to a relative or absolute or whatever filename, according to _path_replace.
AnimationConvert | get_animation_convert () const
| Returns how source animation will be converted into egg structures.
const std::string & | get_character_name () const
| Returns the name of the character generated.
EggData * | get_egg_data ()
| Returns the EggData structure.
double | get_end_frame () const
| Returns the value set by a previous call to set_end_frame().
double | get_frame_inc () const
| Returns the value set by a previous call to set_frame_inc().
double | get_input_frame_rate () const
| Returns the value set by a previous call to set_input_frame_rate().
bool | get_merge_externals () const
| Returns the current state of the merge_externals flag.
double | get_neutral_frame () const
| Returns the value set by a previous call to set_neutral_frame().
double | get_output_frame_rate () const
| Returns the value set by a previous call to set_output_frame_rate().
PathReplace * | get_path_replace ()
| Returns a pointer to the PathReplace object associated with this converter.
const PathReplace * | get_path_replace () const
| Returns a pointer to the PathReplace object associated with this converter.
double | get_start_frame () const
| Returns the value set by a previous call to set_start_frame().
bool | had_error () const
| Returns true if an error was detected during the conversion process (unless _allow_errors is true), false otherwise.
bool | handle_external_reference (EggGroupNode *egg_parent, const Filename &ref_filename)
| Handles an external reference in the source file.
bool | has_end_frame () const
| Returns true if the ending frame has been explicitly specified via set_end_frame(), or false if the ending frame should be implicit based on the source.
bool | has_frame_inc () const
| Returns true if the frame increment has been explicitly specified via set_frame_inc(), or false if the ending frame should be implicit based on the source.
bool | has_input_frame_rate () const
| Returns true if the frame rate has been explicitly specified via set_input_frame_rate(), or false otherwise.
bool | has_neutral_frame () const
| Returns true if the neutral frame has been explicitly specified via set_neutral_frame(), or false otherwise.
bool | has_output_frame_rate () const
| Returns true if the frame rate has been explicitly specified via set_output_frame_rate(), or false otherwise.
bool | has_start_frame () const
| Returns true if the starting frame has been explicitly specified via set_start_frame(), or false if the starting frame should be implicit based on the source.
virtual | PT (PandaNode) convert_to_node(const LoaderOptions &options
void | set_animation_convert (AnimationConvert animation_convert)
| Specifies how source animation will be converted into egg structures.
void | set_character_name (const std::string &character_name)
| Specifies the name of the character generated.
void | set_egg_data (EggData *egg_data)
| Sets the egg data that will be filled in when convert_file() is called.
void | set_end_frame (double end_frame)
| Specifies the ending frame of the animation to convert, in the units specified by set_input_frame_rate().
void | set_frame_inc (double frame_inc)
| Specifies the increment between frames to extract.
void | set_input_frame_rate (double input_frame_rate)
| Specifies the number of frames per second that is represented by the "frame" unit in the animation package.
void | set_merge_externals (bool merge_externals)
| Sets the merge_externals flag.
void | set_neutral_frame (double neutral_frame)
| Specifies the frame of animation to represent the neutral pose of the model.
void | set_output_frame_rate (double output_frame_rate)
| Specifies the number of frames per second that the resulting animation should be played at.
void | set_path_replace (PathReplace *path_replace)
| Replaces the PathReplace object (which specifies how to mangle paths from the source to the destination egg file) with a new one.
void | set_start_frame (double start_frame)
| Specifies the starting frame of the animation to convert, in the units specified by set_input_frame_rate().
virtual bool | supports_compressed () const
| Returns true if this file type can transparently load compressed files (with a .pz extension), false otherwise.
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 structures, given the indicated options, or false otherwise.

## Static Public Member Functions
static TransformType | string_transform_type (const std::string &arg)
| Returns the TransformType value corresponding to the indicated string, or TT_invalid.
Static Public Member Functions inherited from SomethingToEggConverter
static double | get_default_frame_rate ()
| Returns the default frame rate if nothing is specified for input_frame_rate or output_frame_rate, and the animation package does not have an implicit frame rate.

## Public Attributes
bool | _always_show_vertex_color
bool | _convert_cameras
bool | _convert_lights
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
Public Attributes inherited from SomethingToEggConverter
bool | _allow_errors
virtual const Filename & | filename

## Detailed Description

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 52 of file mayaToEggConverter.h.

## Member Enumeration Documentation

## ◆ TransformType

enum MayaToEggConverter::TransformType

Definition at line 190 of file mayaToEggConverter.h.

## Constructor & Destructor Documentation

## ◆ MayaToEggConverter() [1/2]

MayaToEggConverter::MayaToEggConverter | ( | const std::string & | program_name = "" | ) |

Definition at line 86 of file mayaToEggConverter.cxx.

## ◆ MayaToEggConverter() [2/2]

MayaToEggConverter::MayaToEggConverter | ( | const MayaToEggConverter & | copy | ) |

Definition at line 112 of file mayaToEggConverter.cxx.

## ◆ ~MayaToEggConverter()

MayaToEggConverter::~MayaToEggConverter | ( |  | ) |
| virtual

Definition at line 139 of file mayaToEggConverter.cxx.

## Member Function Documentation

## ◆ add_exclude()

void MayaToEggConverter::add_exclude | ( | const GlobPattern & | glob | ) |

Adds a name pattern to the list of excluded nodes.

Definition at line 261 of file mayaToEggConverter.cxx.

## ◆ add_force_joint()

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 321 of file mayaToEggConverter.cxx.

## ◆ add_ignore_slider()

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 282 of file mayaToEggConverter.cxx.

## ◆ add_subroot()

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 225 of file mayaToEggConverter.cxx.

## ◆ add_subset()

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 245 of file mayaToEggConverter.cxx.

## ◆ clear()

void MayaToEggConverter::clear | ( |  | ) |

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 566 of file mayaToEggConverter.cxx.

Referenced by close_api(), convert_file(), and convert_maya().

## ◆ clear_excludes()

void MayaToEggConverter::clear_excludes | ( |  | ) |

Empties the list of excluded nodes added via add_exclude().

Definition at line 253 of file mayaToEggConverter.cxx.

## ◆ clear_force_joints()

void MayaToEggConverter::clear_force_joints | ( |  | ) |

Empties the list of force_joints added via add_force_joint().

No joints will be forced.

Definition at line 307 of file mayaToEggConverter.cxx.

## ◆ clear_ignore_sliders()

void MayaToEggConverter::clear_ignore_sliders | ( |  | ) |

Empties the list of ignore_sliders added via add_ignore_slider().

No sliders will be ignored.

Definition at line 270 of file mayaToEggConverter.cxx.

## ◆ clear_subroots()

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 214 of file mayaToEggConverter.cxx.

## ◆ clear_subsets()

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 234 of file mayaToEggConverter.cxx.

## ◆ close_api()

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 555 of file mayaToEggConverter.cxx.

References clear().

## ◆ convert_file()

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 184 of file mayaToEggConverter.cxx.

References clear(), convert_maya(), and open_api().

## ◆ convert_maya()

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 368 of file mayaToEggConverter.cxx.

References 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(), and open_api().

Referenced by convert_file().

## ◆ force_joint()

bool MayaToEggConverter::force_joint | ( | const std::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 330 of file mayaToEggConverter.cxx.

Referenced by MayaNodeDesc::from_dag_path().

## ◆ get_additional_extensions()

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 172 of file mayaToEggConverter.cxx.

## ◆ get_extension()

string MayaToEggConverter::get_extension | ( |  | ) | const
| virtual

Returns the common extension of the file type this converter supports.

Implements SomethingToEggConverter.

Definition at line 163 of file mayaToEggConverter.cxx.

## ◆ get_input_units()

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 359 of file mayaToEggConverter.cxx.

## ◆ get_name()

string MayaToEggConverter::get_name | ( |  | ) | const
| virtual

Returns the English name of the file type this converter supports.

Implements SomethingToEggConverter.

Definition at line 155 of file mayaToEggConverter.cxx.

## ◆ ignore_slider()

bool MayaToEggConverter::ignore_slider | ( | const std::string & | name | ) | const

Returns true if the indicated name is on the list of sliders to ignore, false otherwise.

Definition at line 291 of file mayaToEggConverter.cxx.

## ◆ make_copy()

SomethingToEggConverter * MayaToEggConverter::make_copy | ( |  | ) |
| virtual

Allocates and returns a new copy of the converter.

Implements SomethingToEggConverter.

Definition at line 147 of file mayaToEggConverter.cxx.

## ◆ open_api()

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 540 of file mayaToEggConverter.cxx.

Referenced by convert_file(), and convert_maya().

## ◆ set_from_selection()

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 348 of file mayaToEggConverter.cxx.

## ◆ string_transform_type()

MayaToEggConverter::TransformType MayaToEggConverter::string_transform_type | ( | const std::string & | arg | ) |
| static

Returns the TransformType value corresponding to the indicated string, or TT_invalid.

Definition at line 3136 of file mayaToEggConverter.cxx.

## Member Data Documentation

## ◆ _always_show_vertex_color

bool MayaToEggConverter::_always_show_vertex_color

Definition at line 182 of file mayaToEggConverter.h.

## ◆ _convert_cameras

bool MayaToEggConverter::_convert_cameras

Definition at line 184 of file mayaToEggConverter.h.

## ◆ _convert_lights

bool MayaToEggConverter::_convert_lights

Definition at line 185 of file mayaToEggConverter.h.

## ◆ _keep_all_uvsets

bool MayaToEggConverter::_keep_all_uvsets

Definition at line 183 of file mayaToEggConverter.h.

## ◆ _legacy_shader

bool MayaToEggConverter::_legacy_shader

Definition at line 187 of file mayaToEggConverter.h.

## ◆ _polygon_output

bool MayaToEggConverter::_polygon_output

Definition at line 179 of file mayaToEggConverter.h.

## ◆ _polygon_tolerance

double MayaToEggConverter::_polygon_tolerance

Definition at line 180 of file mayaToEggConverter.h.

## ◆ _respect_maya_double_sided

bool MayaToEggConverter::_respect_maya_double_sided

Definition at line 181 of file mayaToEggConverter.h.

## ◆ _round_uvs

bool MayaToEggConverter::_round_uvs

Definition at line 186 of file mayaToEggConverter.h.

## ◆ _shaders

MayaShaders MayaToEggConverter::_shaders

Definition at line 175 of file mayaToEggConverter.h.

## ◆ _textures

EggTextureCollection MayaToEggConverter::_textures

Definition at line 176 of file mayaToEggConverter.h.

## ◆ _transform_type

TransformType MayaToEggConverter::_transform_type

Definition at line 197 of file mayaToEggConverter.h.

The documentation for this class was generated from the following files:

- pandatool/src/mayaegg/mayaToEggConverter.h
- pandatool/src/mayaegg/mayaToEggConverter.cxx