Panda3D
maxNodeDesc.h
1 // Filename: maxNodeDesc.h
2 // Created by: crevilla
3 // from mayaNodeDesc.h created by: drose (06Jun03)
4 //
5 ////////////////////////////////////////////////////////////////////
6 //
7 // PANDA 3D SOFTWARE
8 // Copyright (c) Carnegie Mellon University. All rights reserved.
9 //
10 // All use of this software is subject to the terms of the revised BSD
11 // license. You should have received a copy of this license along
12 // with this source code in a file named "LICENSE."
13 //
14 ////////////////////////////////////////////////////////////////////
15 
16 #ifndef MAXNODEDESC_H
17 #define MAXNODEDESC_H
18 
19 ////////////////////////////////////////////////////////////////////
20 // Class : MaxNodeDesc
21 // Description : Describes a single instance of a node in the Max
22 // scene graph, relating it to the corresponding egg
23 // structures (e.g. node, group, or table entry) that
24 // will be created.
25 ////////////////////////////////////////////////////////////////////
26 class MaxNodeDesc : public ReferenceCount, public Namable {
27  public:
28  MaxNodeDesc(MaxNodeDesc *parent = NULL, INode *max_node = NULL);
29  ~MaxNodeDesc();
30 
31  void from_INode(INode *max_node);
32  bool has_max_node() const;
33  INode *get_max_node() const;
34 
35  void set_joint(bool onoff);
36  bool is_joint() const;
37  bool is_joint_parent() const;
38  bool is_node_joint() const;
39 
40  MaxNodeDesc *_parent;
41  MaxNodeDesc *_joint_entry;
43  Children _children;
44 
45  private:
46  void clear_egg();
47  void mark_joint_parent();
48  void check_pseudo_joints(bool joint_above);
49 
50  INode *_max_node;
51 
52  EggGroup *_egg_group;
53  EggTable *_egg_table;
54  EggXfmSAnim *_anim;
55 
56  enum JointType {
57  JT_none, // Not a joint.
58  JT_node_joint, // Node that represents a joint in the geometry
59  // but not the actual joint itself
60  JT_joint, // An actual joint in Max.
61  JT_pseudo_joint, // Not a joint in Max, but treated just like a
62  // joint for the purposes of the converter.
63  JT_joint_parent, // A parent or ancestor of a joint or pseudo joint.
64  };
65  JointType _joint_type;
66 
67 
68  public:
69  static TypeHandle get_class_type() {
70  return _type_handle;
71  }
72  static void init_type() {
73  ReferenceCount::init_type();
74  Namable::init_type();
75  register_type(_type_handle, "MaxNodeDesc",
76  ReferenceCount::get_class_type(),
77  Namable::get_class_type());
78  }
79 
80  private:
81  static TypeHandle _type_handle;
82 
83  friend class MaxNodeTree;
84 };
85 
86 #endif
bool is_joint() const
Returns true if the node should be treated as a joint by the converter.
bool is_node_joint() const
Returns true if the node is the parent or ancestor of a joint.
void from_INode(INode *max_node)
Indicates an associated between the MaxNodeDesc and some Max Node instance.
Definition: maxNodeDesc.cxx:71
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:36
bool is_joint_parent() const
Returns true if the node is the parent or ancestor of a joint.
A base class for all things which can have a name.
Definition: namable.h:29
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
Definition: eggXfmSAnim.h:33
Describes a single instance of a node in the Max scene graph, relating it to the corresponding egg st...
Definition: maxNodeDesc.h:26
MaxNodeDesc(MaxNodeDesc *parent=NULL, INode *max_node=NULL)
Creates a MaxNodeDesc.
Definition: maxNodeDesc.cxx:28
This corresponds to a.
Definition: eggTable.h:31
A base class for all things that want to be reference-counted.
INode * get_max_node() const
Returns the INode associated with this node.
bool has_max_node() const
Returns true if a Max INode has been associated with this node, false otherwise.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
Describes a complete tree of max nodes for conversion.
Definition: maxNodeTree.h:27