00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef MAYANODEDESC_H
00016 #define MAYANODEDESC_H
00017
00018 #include "pandatoolbase.h"
00019
00020 #include "mayaBlendDesc.h"
00021 #include "referenceCount.h"
00022 #include "pointerTo.h"
00023 #include "namable.h"
00024
00025 #include "pre_maya_include.h"
00026 #include <maya/MDagPath.h>
00027 #include <maya/MFnDagNode.h>
00028 #include "post_maya_include.h"
00029
00030 class MayaToEggConverter;
00031 class MayaNodeTree;
00032 class EggGroup;
00033 class EggTable;
00034 class EggXfmSAnim;
00035
00036
00037
00038
00039
00040
00041
00042
00043 class MayaNodeDesc : public ReferenceCount, public Namable {
00044 public:
00045 MayaNodeDesc(MayaNodeTree *tree,
00046 MayaNodeDesc *parent = NULL, const string &name = string());
00047 ~MayaNodeDesc();
00048
00049 void from_dag_path(const MDagPath &dag_path, MayaToEggConverter *converter);
00050 bool has_dag_path() const;
00051 const MDagPath &get_dag_path() const;
00052
00053 int get_num_blend_descs() const;
00054 MayaBlendDesc *get_blend_desc(int n) const;
00055
00056 bool is_joint() const;
00057 bool is_joint_parent() const;
00058
00059 bool is_tagged() const;
00060 bool is_joint_tagged() const;
00061 bool has_object_type(string object_type) const;
00062
00063 MayaNodeTree *_tree;
00064 MayaNodeDesc *_parent;
00065 typedef pvector< PT(MayaNodeDesc) > Children;
00066 Children _children;
00067
00068 private:
00069 void tag();
00070 void untag();
00071 void tag_recursively();
00072 void untag_recursively();
00073 void tag_joint();
00074 void tag_joint_recursively();
00075
00076 void clear_egg();
00077 void mark_joint_parent();
00078 void check_pseudo_joints(bool joint_above);
00079 void check_blend_shapes(const MFnDagNode &node,
00080 const string &attrib_name);
00081 void check_lods();
00082
00083 MDagPath *_dag_path;
00084
00085 EggGroup *_egg_group;
00086 EggTable *_egg_table;
00087 EggXfmSAnim *_anim;
00088
00089 typedef pvector< PT(MayaBlendDesc) > BlendDescs;
00090 BlendDescs _blend_descs;
00091
00092 enum JointType {
00093 JT_none,
00094 JT_joint,
00095 JT_pseudo_joint,
00096
00097 JT_joint_parent,
00098 };
00099 JointType _joint_type;
00100
00101 bool _is_lod;
00102 double _switch_in, _switch_out;
00103
00104 bool _tagged;
00105 bool _joint_tagged;
00106
00107 public:
00108 static TypeHandle get_class_type() {
00109 return _type_handle;
00110 }
00111 static void init_type() {
00112 ReferenceCount::init_type();
00113 Namable::init_type();
00114 register_type(_type_handle, "MayaNodeDesc",
00115 ReferenceCount::get_class_type(),
00116 Namable::get_class_type());
00117 }
00118
00119 private:
00120 static TypeHandle _type_handle;
00121
00122 friend class MayaNodeTree;
00123 };
00124
00125 #endif