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