Panda3D
 All Classes Functions Variables Enumerations
mayaNodeDesc.h
1 // Filename: mayaNodeDesc.h
2 // Created by: drose (06Jun03)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef MAYANODEDESC_H
16 #define MAYANODEDESC_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "mayaBlendDesc.h"
21 #include "referenceCount.h"
22 #include "pointerTo.h"
23 #include "namable.h"
24 
25 #include "pre_maya_include.h"
26 #include <maya/MDagPath.h>
27 #include <maya/MFnDagNode.h>
28 #include "post_maya_include.h"
29 
30 class MayaToEggConverter;
31 class MayaNodeTree;
32 class EggGroup;
33 class EggTable;
34 class EggXfmSAnim;
35 
36 ////////////////////////////////////////////////////////////////////
37 // Class : MayaNodeDesc
38 // Description : Describes a single instance of a node in the Maya
39 // scene graph, relating it to the corresponding egg
40 // structures (e.g. node, group, or table entry) that
41 // will be created.
42 ////////////////////////////////////////////////////////////////////
43 class MayaNodeDesc : public ReferenceCount, public Namable {
44 public:
46  MayaNodeDesc *parent = NULL, const string &name = string());
47  ~MayaNodeDesc();
48 
49  void from_dag_path(const MDagPath &dag_path, MayaToEggConverter *converter);
50  bool has_dag_path() const;
51  const MDagPath &get_dag_path() const;
52 
53  int get_num_blend_descs() const;
54  MayaBlendDesc *get_blend_desc(int n) const;
55 
56  bool is_joint() const;
57  bool is_joint_parent() const;
58 
59  bool is_tagged() const;
60  bool is_joint_tagged() const;
61  bool has_object_type(string object_type) const;
62 
63  MayaNodeTree *_tree;
64  MayaNodeDesc *_parent;
66  Children _children;
67 
68 private:
69  void tag();
70  void untag();
71  void tag_recursively();
72  void untag_recursively();
73  void tag_joint();
74  void tag_joint_recursively();
75 
76  void clear_egg();
77  void mark_joint_parent();
78  void check_pseudo_joints(bool joint_above);
79  void check_blend_shapes(const MFnDagNode &node,
80  const string &attrib_name);
81  void check_lods();
82 
83  MDagPath *_dag_path;
84 
85  EggGroup *_egg_group;
86  EggTable *_egg_table;
87  EggXfmSAnim *_anim;
88 
90  BlendDescs _blend_descs;
91 
92  enum JointType {
93  JT_none, // Not a joint.
94  JT_joint, // An actual joint in Maya.
95  JT_pseudo_joint, // Not a joint in Maya, but treated just like a
96  // joint for the purposes of the converter.
97  JT_joint_parent, // A parent or ancestor of a joint or pseudo joint.
98  };
99  JointType _joint_type;
100 
101  bool _is_lod;
102  double _switch_in, _switch_out;
103 
104  bool _tagged;
105  bool _joint_tagged;
106 
107 public:
108  static TypeHandle get_class_type() {
109  return _type_handle;
110  }
111  static void init_type() {
112  ReferenceCount::init_type();
113  Namable::init_type();
114  register_type(_type_handle, "MayaNodeDesc",
115  ReferenceCount::get_class_type(),
116  Namable::get_class_type());
117  }
118 
119 private:
120  static TypeHandle _type_handle;
121 
122  friend class MayaNodeTree;
123 };
124 
125 #endif
A handle to a Maya blend shape description.
Definition: mayaBlendDesc.h:44
bool has_dag_path() const
Returns true if a Maya dag path has been associated with this node, false otherwise.
void from_dag_path(const MDagPath &dag_path, MayaToEggConverter *converter)
Indicates an association between the MayaNodeDesc and some Maya instance.
MayaBlendDesc * get_blend_desc(int n) const
Returns the nth MayaBlendDesc object that affects the geometry in this node.
bool is_joint_tagged() const
Returns true if the node has been joint_tagged to be converted, false otherwise.
bool has_object_type(string object_type) const
Returns true if this node or any of its parent has_object_type of object_type.
Describes a complete tree of maya nodes for conversion.
Definition: mayaNodeTree.h:40
bool is_tagged() const
Returns true if the node has been tagged to be converted, false otherwise.
The main glue of the egg hierarchy, this corresponds to the &lt;Group&gt;, &lt;Instance&gt;, and &lt;Joint&gt; type nod...
Definition: eggGroup.h:36
A base class for all things which can have a name.
Definition: namable.h:29
Describes a single instance of a node in the Maya scene graph, relating it to the corresponding egg s...
Definition: mayaNodeDesc.h:43
This corresponds to an &lt;Xfm$Anim_S$&gt; entry, which is a collection of up to nine &lt;S$Anim&gt; entries that...
Definition: eggXfmSAnim.h:33
This class supervises the construction of an EggData structure from a single Maya file...
bool is_joint_parent() const
Returns true if the node is the parent or ancestor of a joint.
This corresponds to a.
Definition: eggTable.h:31
A base class for all things that want to be reference-counted.
const MDagPath & get_dag_path() const
Returns the dag path associated with this node.
bool is_joint() const
Returns true if the node should be treated as a joint by the converter.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
int get_num_blend_descs() const
Returns the number of unique MayaBlendDesc objects (and hence the number of morph sliders) that affec...