Panda3D

Loading...
Searching...
No Matches
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:
42 MayaNodeDesc(MayaNodeTree *tree,
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
EggGroup
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition eggGroup.h:34
EggTable
This corresponds to a a <Bundle> entry.
Definition eggTable.h:27
EggXfmSAnim
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine entries that specify...
Definition eggXfmSAnim.h:28
MayaBlendDesc
A handle to a Maya blend shape description.
Definition mayaBlendDesc.h:40
MayaNodeDesc::is_joint_tagged
bool is_joint_tagged() const
Returns true if the node has been joint_tagged to be converted, false otherwise.
Definition mayaNodeDesc.cxx:206
MayaNodeDesc::has_object_type
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.
Definition mayaNodeDesc.cxx:289
MayaNodeDesc::get_dag_path
const MDagPath & get_dag_path() const
Returns the dag path associated with this node.
Definition mayaNodeDesc.cxx:159
MayaNodeDesc::from_dag_path
void from_dag_path(const MDagPath &dag_path, MayaToEggConverter *converter)
Indicates an association between the MayaNodeDesc and some Maya instance.
Definition mayaNodeDesc.cxx:84
MayaNodeDesc::get_blend_desc
MayaBlendDesc * get_blend_desc(int n) const
Returns the nth MayaBlendDesc object that affects the geometry in this node.
Definition mayaNodeDesc.cxx:178
MayaNodeDesc::is_joint
bool is_joint() const
Returns true if the node should be treated as a joint by the converter.
Definition mayaNodeDesc.cxx:187
MayaNodeDesc::get_num_blend_descs
int get_num_blend_descs() const
Returns the number of unique MayaBlendDesc objects (and hence the number of morph sliders) that affec...
Definition mayaNodeDesc.cxx:169
MayaNodeDesc::has_dag_path
bool has_dag_path() const
Returns true if a Maya dag path has been associated with this node, false otherwise.
Definition mayaNodeDesc.cxx:150
MayaNodeDesc::is_joint_parent
bool is_joint_parent() const
Returns true if the node is the parent or ancestor of a joint.
Definition mayaNodeDesc.cxx:196
MayaNodeDesc::is_tagged
bool is_tagged() const
Returns true if the node has been tagged to be converted, false otherwise.
Definition mayaNodeDesc.cxx:236
MayaNodeTree
Describes a complete tree of maya nodes for conversion.
Definition mayaNodeTree.h:37
MayaToEggConverter
This class supervises the construction of an EggData structure from a single Maya file,...
Definition mayaToEggConverter.h:52
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
mayaBlendDesc.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
namable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandatoolbase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
post_maya_include.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pre_maya_include.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
referenceCount.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
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