Panda3D
maxNodeDesc.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 maxNodeDesc.h
10  * @author crevilla
11  * from mayaNodeDesc.h created by: drose (06Jun03)
12  */
13 
14 #ifndef MAXNODEDESC_H
15 #define MAXNODEDESC_H
16 
17 /**
18  * Describes a single instance of a node in the Max scene graph, relating it
19  * to the corresponding egg structures (e.g. node, group, or table entry)
20  * that will be created.
21  */
22 class MaxNodeDesc : public ReferenceCount, public Namable {
23  public:
24  MaxNodeDesc(MaxNodeDesc *parent = nullptr, INode *max_node = nullptr);
25  ~MaxNodeDesc();
26 
27  void from_INode(INode *max_node);
28  bool has_max_node() const;
29  INode *get_max_node() const;
30 
31  void set_joint(bool onoff);
32  bool is_joint() const;
33  bool is_joint_parent() const;
34  bool is_node_joint() const;
35 
36  MaxNodeDesc *_parent;
37  MaxNodeDesc *_joint_entry;
39  Children _children;
40 
41  private:
42  void clear_egg();
43  void mark_joint_parent();
44  void check_pseudo_joints(bool joint_above);
45 
46  INode *_max_node;
47 
48  EggGroup *_egg_group;
49  EggTable *_egg_table;
50  EggXfmSAnim *_anim;
51 
52  enum JointType {
53  JT_none, // Not a joint.
54  JT_node_joint, // Node that represents a joint in the geometry
55  // but not the actual joint itself
56  JT_joint, // An actual joint in Max.
57  JT_pseudo_joint, // Not a joint in Max, but treated just like a
58  // joint for the purposes of the converter.
59  JT_joint_parent, // A parent or ancestor of a joint or pseudo joint.
60  };
61  JointType _joint_type;
62 
63 
64  public:
65  static TypeHandle get_class_type() {
66  return _type_handle;
67  }
68  static void init_type() {
69  ReferenceCount::init_type();
70  Namable::init_type();
71  register_type(_type_handle, "MaxNodeDesc",
72  ReferenceCount::get_class_type(),
73  Namable::get_class_type());
74  }
75 
76  private:
77  static TypeHandle _type_handle;
78 
79  friend class MaxNodeTree;
80 };
81 
82 #endif
bool is_joint() const
Returns true if the node should be treated as a joint by the converter.
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
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:61
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:34
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:26
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
Definition: eggXfmSAnim.h:28
MaxNodeDesc(MaxNodeDesc *parent=nullptr, INode *max_node=nullptr)
Creates a MaxNodeDesc.
Definition: maxNodeDesc.cxx:23
Describes a single instance of a node in the Max scene graph, relating it to the corresponding egg st...
Definition: maxNodeDesc.h:22
This corresponds to a.
Definition: eggTable.h:27
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.
Definition: maxNodeDesc.cxx:93
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
Describes a complete tree of max nodes for conversion.
Definition: maxNodeTree.h:23