Panda3D
mayaNodeTree.h
1 // Filename: mayaNodeTree.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 MAYANODETREE_H
16 #define MAYANODETREE_H
17 
18 #include "pandatoolbase.h"
19 
20 #include "mayaNodeDesc.h"
21 #include "mayaBlendDesc.h"
22 #include "globPattern.h"
23 #include "indirectCompareNames.h"
24 #include "ordered_vector.h"
25 #include "pset.h"
26 #include "pmap.h"
27 
28 class MayaToEggConverter;
29 class EggData;
30 class EggGroupNode;
31 class EggTable;
32 class EggXfmSAnim;
33 class EggSAnimData;
34 
35 ////////////////////////////////////////////////////////////////////
36 // Class : MayaNodeTree
37 // Description : Describes a complete tree of maya nodes for
38 // conversion.
39 ////////////////////////////////////////////////////////////////////
40 class MayaNodeTree {
41 public:
42  MayaNodeTree(MayaToEggConverter *converter);
43  MayaNodeDesc *build_node(const MDagPath &dag_path);
44  bool build_hierarchy();
45 
46  void tag_joint_all();
47  // bool tag_joint_selected();
48  bool tag_joint_named(const GlobPattern &glob);
49 
50  void tag_all();
51  bool tag_selected();
52  bool tag_named(const GlobPattern &glob);
53  bool untag_named(const GlobPattern &glob);
54 
55  int get_num_nodes() const;
56  MayaNodeDesc *get_node(int n) const;
57 
58  void clear();
59  void clear_egg(EggData *egg_data, EggGroupNode *egg_root,
60  EggGroupNode *skeleton_node, EggGroupNode *morph_node);
61  EggGroup *get_egg_group(MayaNodeDesc *node_desc);
62  EggTable *get_egg_table(MayaNodeDesc *node_desc);
65 
66  bool ignore_slider(const string &name) const;
67  void report_ignored_slider(const string &name);
68 
70  int get_num_blend_descs() const;
71  MayaBlendDesc *get_blend_desc(int n) const;
72 
73  void reset_sliders();
74 
75 public:
76  string _subroot_parent_name;
77  PT(MayaNodeDesc) _root;
78  PN_stdfloat _fps;
79 
80 private:
81  MayaNodeDesc *r_build_node(const string &path);
82 
83  MayaToEggConverter *_converter;
84 
85  EggData *_egg_data;
86  EggGroupNode *_egg_root;
87  EggGroupNode *_skeleton_node;
88  EggGroupNode *_morph_node;
89 
91  NodesByPath _nodes_by_path;
92 
94  Nodes _nodes;
95 
97  BlendDescs _blend_descs;
98 
99  typedef pset<string> Strings;
100  Strings _ignored_slider_names;
101 };
102 
103 #endif
EggXfmSAnim * get_egg_anim(MayaNodeDesc *node_desc)
Returns the anim table corresponding to the joint for the indicated node.
A handle to a Maya blend shape description.
Definition: mayaBlendDesc.h:44
void tag_all()
Tags the entire hierarchy for conversion.
int get_num_nodes() const
Returns the total number of nodes in the hierarchy, not counting the root node.
bool ignore_slider(const string &name) const
Returns true if the indicated name is on the list of sliders to ignore, false otherwise.
Describes a complete tree of maya nodes for conversion.
Definition: mayaNodeTree.h:40
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:51
void clear()
Resets the entire tree in preparation for repopulating with a new scene.
Corresponding to an <S$Anim> entry, this stores a single column of numbers, for instance for a morph ...
Definition: eggSAnimData.h:28
EggGroup * get_egg_group(MayaNodeDesc *node_desc)
Returns the EggGroupNode corresponding to the group or joint for the indicated node.
This is the primary interface into all the egg data, and the root of the egg file structure...
Definition: eggData.h:41
void clear_egg(EggData *egg_data, EggGroupNode *egg_root, EggGroupNode *skeleton_node, EggGroupNode *morph_node)
Removes all of the references to generated egg structures from the tree, and prepares the tree for ge...
bool tag_named(const GlobPattern &glob)
Tags nodes matching the indicated glob (and all of their children) for conversion.
A specialization of ordered_vector that emulates a standard STL set: one copy of each element is allo...
MayaNodeDesc * build_node(const MDagPath &dag_path)
Returns a pointer to the node corresponding to the indicated dag_path object, creating it first if ne...
MayaBlendDesc * get_blend_desc(int n) const
Returns the nth MayaBlendDesc object discovered in the tree.
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition: eggGroup.h:36
void reset_sliders()
Resets all of the sliders associated with all blend shapes down to 0.
MayaBlendDesc * add_blend_desc(MayaBlendDesc *blend_desc)
Adds the indicated MayaBlendDesc object to the list of blends collected so far.
Describes a single instance of a node in the Maya scene graph, relating it to the corresponding egg s...
Definition: mayaNodeDesc.h:43
int get_num_blend_descs() const
Returns the number of unique MayaBlendDesc objects (and hence the number of morph sliders) discovered...
This corresponds to an <Xfm$Anim_S$> entry, which is a collection of up to nine <S$Anim> entries that...
Definition: eggXfmSAnim.h:33
MayaNodeDesc * get_node(int n) const
Returns the nth node in the hierarchy, in an arbitrary ordering.
bool tag_joint_named(const GlobPattern &glob)
Tags nodes matching the indicated glob (and all of their children) for conversion.
bool build_hierarchy()
Walks through the complete Maya hierarchy but does not tag any nodes for conversion.
This class supervises the construction of an EggData structure from a single Maya file...
This corresponds to a.
Definition: eggTable.h:31
bool untag_named(const GlobPattern &glob)
Un-tags nodes matching the indicated glob (and all of their children) for conversion.
EggTable * get_egg_table(MayaNodeDesc *node_desc)
Returns the EggTable corresponding to the joint for the indicated node.
EggSAnimData * get_egg_slider(MayaBlendDesc *blend_desc)
Returns the anim table corresponding to the slider for the indicated blend.
void tag_joint_all()
Tags the entire hierarchy for conversion.
void report_ignored_slider(const string &name)
Outputs a message to the user reporting that a slider was ignored.
bool tag_selected()
Tags the just the selected hierarchy for conversion, or the entire hierarchy if nothing is selected...
This class can be used to test for string matches against standard Unix-shell filename globbing conve...
Definition: globPattern.h:37