Panda3D
|
This class supervises the construction of an EggData structure from a single Softimage file, or from the data already in th cout << "egg name = " << eggFilename << endl;e global Softimage model space. More...
#include "softToEggConverter.h"
Public Types | |
typedef pvector< EggSAnimData * > | MorphTable |
enum | TransformType { TT_invalid, TT_all, TT_model, TT_dcs, TT_none } |
Public Member Functions | |
SoftToEggConverter (const string &program_name="") | |
SoftToEggConverter (const SoftToEggConverter ©) | |
void | close_api () |
Closes the Soft 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_soft (bool from_selection) |
Fills up the egg_data structure according to the global soft model data. | |
bool | DoGetopts (int &argc, char **&argv) |
Calls getopt() to parse the command-line switches. | |
EggSAnimData * | find_morph_table (char *name) |
Given a tablename, it either creates a new eggSAnimData structure (if doesn't exist) or locates it. | |
SoftNodeDesc * | find_node (string name) |
Returns the English name of the file type this converter supports. | |
int * | FindClosestTriVert (EggVertexPool *vpool, SAA_DVector *vertices, int numVert) |
Given an egg vertex pool, map each vertex therein to a vertex within an array of SAA model vertices of size numVert. | |
virtual string | get_extension () const |
Returns the common extension of the file type this converter supports. | |
virtual string | get_name () const |
Returns the English name of the file type this converter supports. | |
char * | GetTextureName (SAA_Scene *scene, SAA_Elem *texture) |
Given a texture element, return texture name with given tex_path. | |
bool | HandleGetopts (int &idx, int argc, char **argv) |
increment idx based on what kind of option parsed Supported options are as follows: r:d:s:m:t:P:b:e:f:T:S:M:A:N:v:o:FhknpaxiucCD | |
void | Help () |
Displays the "what is this program" message, along with the usage message. | |
virtual SomethingToEggConverter * | make_copy () |
Allocates and returns a new copy of the converter. | |
bool | open_api () |
Attempts to open the Soft API if it was not already open, and returns true if successful, or false if there is an error. | |
void | ShowOpts () |
Displays the valid options. | |
void | Usage () |
Displays the usage message. | |
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 | |
char | _commandLine [4096] |
const char * | _commandName |
char * | _getopts |
MorphTable | _morph_table |
bool | _polygon_output |
double | _polygon_tolerance |
EggTextureCollection | _textures |
TransformType | _transform_type |
SoftNodeTree | _tree |
int | anim_end |
int | anim_rate |
int | anim_start |
char * | animFileName |
char * | database_name |
char * | eggFileName |
char * | eggGroupName |
int | flatten |
bool | foundRoot |
bool | geom_as_joint |
bool | has_morph |
int | ignore_tex_offsets |
bool | make_anim |
bool | make_dart |
bool | make_duv |
bool | make_morph |
bool | make_nurbs |
bool | make_poly |
bool | make_pose |
bool | make_soft |
char * | model_name |
EggTable * | morph_node |
int | nurbs_step |
int | pose_frame |
char * | rsrc_path |
SAA_Scene | scene |
char * | scene_name |
char * | search_prefix |
int | shift_textures |
char * | tex_filename |
char * | tex_path |
int | use_prefix |
int | verbose |
This class supervises the construction of an EggData structure from a single Softimage file, or from the data already in th cout << "egg name = " << eggFilename << endl;e global Softimage model space.
Definition at line 53 of file softToEggConverter.h.
void SoftToEggConverter::close_api | ( | ) |
Closes the Soft API, if it was previously opened.
Caution! Soft appears to call exit() when its API is closed.
Definition at line 724 of file softToEggConverter.cxx.
bool SoftToEggConverter::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_soft().
Implements SomethingToEggConverter.
Definition at line 548 of file softToEggConverter.cxx.
References convert_soft(), Filename::get_basename_wo_extension(), and open_api().
bool SoftToEggConverter::convert_soft | ( | bool | from_selection | ) |
Fills up the egg_data structure according to the global soft model data.
Returns true if successful, false if there is an error. If from_selection is true, the converted geometry is based on that which is selected; otherwise, it is the entire Soft scene.
Definition at line 570 of file softToEggConverter.cxx.
References SoftNodeTree::build_complete_hierarchy(), EggTextureCollection::clear(), Filename::get_dirname(), SomethingToEggConverter::get_egg_data(), SoftNodeTree::GetRootName(), and SomethingToEggConverter::set_egg_data().
Referenced by convert_file().
bool SoftToEggConverter::DoGetopts | ( | int & | argc, |
char **& | argv | ||
) |
Calls getopt() to parse the command-line switches.
Calls HandleGetopts() to interpret each switch. Returns true if the parsing was successful; false if there was an error. Adjusts argc and argv to remove the switches from the parameter list.
Definition at line 217 of file softToEggConverter.cxx.
References HandleGetopts(), and Usage().
EggSAnimData * SoftToEggConverter::find_morph_table | ( | char * | name | ) |
Given a tablename, it either creates a new eggSAnimData structure (if doesn't exist) or locates it.
Definition at line 752 of file softToEggConverter.cxx.
References EggGroupNode::add_child().
Referenced by SoftNodeDesc::make_linear_morph_table(), and SoftNodeDesc::make_weighted_morph_table().
SoftNodeDesc * SoftToEggConverter::find_node | ( | string | name | ) |
Returns the English name of the file type this converter supports.
Definition at line 494 of file softToEggConverter.cxx.
References SoftNodeTree::get_node().
int * SoftToEggConverter::FindClosestTriVert | ( | EggVertexPool * | vpool, |
SAA_DVector * | vertices, | ||
int | numVert | ||
) |
Given an egg vertex pool, map each vertex therein to a vertex within an array of SAA model vertices of size numVert.
Mapping is done by closest proximity.
Definition at line 1579 of file softToEggConverter.cxx.
References EggVertexPool::begin(), EggVertexPool::end(), EggVertex::get_external_index(), EggVertex::get_pos3(), and EggVertexPool::size().
string SoftToEggConverter::get_extension | ( | ) | const [virtual] |
Returns the common extension of the file type this converter supports.
Implements SomethingToEggConverter.
Definition at line 483 of file softToEggConverter.cxx.
string SoftToEggConverter::get_name | ( | ) | const [virtual] |
Returns the English name of the file type this converter supports.
Implements SomethingToEggConverter.
Definition at line 472 of file softToEggConverter.cxx.
char * SoftToEggConverter::GetTextureName | ( | SAA_Scene * | scene, |
SAA_Elem * | texture | ||
) |
Given a texture element, return texture name with given tex_path.
Definition at line 505 of file softToEggConverter.cxx.
Referenced by SoftNodeDesc::load_nurbs_model(), and SoftNodeDesc::load_poly_model().
bool SoftToEggConverter::HandleGetopts | ( | int & | idx, |
int | argc, | ||
char ** | argv | ||
) |
increment idx based on what kind of option parsed Supported options are as follows: r:d:s:m:t:P:b:e:f:T:S:M:A:N:v:o:FhknpaxiucCD
Definition at line 248 of file softToEggConverter.cxx.
References Help().
Referenced by DoGetopts().
void SoftToEggConverter::Help | ( | ) |
Displays the "what is this program" message, along with the usage message.
Should be overridden in base classes to describe the current program.
Definition at line 138 of file softToEggConverter.cxx.
References Usage().
Referenced by HandleGetopts().
SomethingToEggConverter * SoftToEggConverter::make_copy | ( | ) | [virtual] |
Allocates and returns a new copy of the converter.
Implements SomethingToEggConverter.
Definition at line 461 of file softToEggConverter.cxx.
bool SoftToEggConverter::open_api | ( | ) |
Attempts to open the Soft API if it was not already open, and returns true if successful, or false if there is an error.
Definition at line 654 of file softToEggConverter.cxx.
References Usage().
Referenced by convert_file().
void SoftToEggConverter::ShowOpts | ( | ) |
Displays the valid options.
Should be extended in base classes to show additional options relevant to the current program.
Definition at line 172 of file softToEggConverter.cxx.
Referenced by Usage().
SoftToEggConverter::TransformType SoftToEggConverter::string_transform_type | ( | const string & | arg | ) | [static] |
Returns the TransformType value corresponding to the indicated string, or TT_invalid.
Definition at line 2200 of file softToEggConverter.cxx.
void SoftToEggConverter::Usage | ( | ) |
Displays the usage message.
Definition at line 153 of file softToEggConverter.cxx.
References ShowOpts().
Referenced by DoGetopts(), Help(), and open_api().