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