Panda3D
 All Classes Functions Variables Enumerations
mayaNodeTree.cxx
1 // Filename: mayaNodeTree.cxx
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 #include "mayaNodeTree.h"
16 #include "mayaBlendDesc.h"
17 #include "mayaEggGroupUserData.h"
18 #include "mayaToEggConverter.h"
19 #include "config_mayaegg.h"
20 #include "maya_funcs.h"
21 #include "eggGroup.h"
22 #include "eggTable.h"
23 #include "eggXfmSAnim.h"
24 #include "eggSAnimData.h"
25 #include "eggData.h"
26 #include "eggSwitchCondition.h"
27 #include "dcast.h"
28 
29 #include "pre_maya_include.h"
30 #include <maya/MString.h>
31 #include <maya/MItDag.h>
32 #include <maya/MSelectionList.h>
33 #include <maya/MGlobal.h>
34 #include "post_maya_include.h"
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: MayaNodeTree::Constructor
38 // Access: Public
39 // Description:
40 ////////////////////////////////////////////////////////////////////
41 MayaNodeTree::
42 MayaNodeTree(MayaToEggConverter *converter) :
43  _converter(converter)
44 {
45  _root = new MayaNodeDesc(this);
46  _fps = 0.0;
47  _egg_data = (EggData *)NULL;
48  _egg_root = (EggGroupNode *)NULL;
49  _skeleton_node = (EggGroupNode *)NULL;
50  _morph_node = (EggGroupNode *)NULL;
51 }
52 
53 ////////////////////////////////////////////////////////////////////
54 // Function: MayaNodeTree::build_node
55 // Access: Public
56 // Description: Returns a pointer to the node corresponding to the
57 // indicated dag_path object, creating it first if
58 // necessary.
59 ////////////////////////////////////////////////////////////////////
61 build_node(const MDagPath &dag_path) {
62  MayaNodeDesc *node_desc = r_build_node(dag_path.fullPathName().asChar());
63  node_desc->from_dag_path(dag_path, _converter);
64  return node_desc;
65 }
66 
67 ////////////////////////////////////////////////////////////////////
68 // Function: MayaNodeTree::build_hierarchy
69 // Access: Public
70 // Description: Walks through the complete Maya hierarchy but does
71 // not tag any nodes for conversion.
72 ////////////////////////////////////////////////////////////////////
73 bool MayaNodeTree::
75  MStatus status;
76 
77  MItDag dag_iterator(MItDag::kDepthFirst, MFn::kTransform, &status);
78  if (!status) {
79  status.perror("MItDag constructor");
80  return false;
81  }
82 
83  /*
84  // this is how you can reset the traverser to a specific node
85  status = dag_iterator.reset(dag_iterator.item(),MItDag::kDepthFirst, MFn::kTransform);
86  */
87  // Get the entire Maya scene.
88 
89  // This while loop walks through the entire Maya hierarchy, one
90  // node at a time. Maya's MItDag object automatically performs a
91  // depth-first traversal of its scene graph.
92 
93  bool all_ok = true;
94  while (!dag_iterator.isDone()) {
95  MDagPath dag_path;
96  status = dag_iterator.getPath(dag_path);
97  if (!status) {
98  status.perror("MItDag::getPath");
99  } else {
100  build_node(dag_path);
101  }
102 
103  dag_iterator.next();
104  }
105 
106  if (all_ok) {
107  _root->check_pseudo_joints(false);
108  _root->check_lods();
109  }
110 
111  return all_ok;
112 }
113 
114 ////////////////////////////////////////////////////////////////////
115 // Function: MayaNodeTree::tag_joint_all
116 // Access: Public
117 // Description: Tags the entire hierarchy for conversion. This is
118 // the normal behavior.
119 ////////////////////////////////////////////////////////////////////
120 void MayaNodeTree::
122  _root->tag_joint_recursively();
123 }
124 
125 ////////////////////////////////////////////////////////////////////
126 // Function: MayaNodeTree::tag_joint_named
127 // Access: Public
128 // Description: Tags nodes matching the indicated glob (and all of
129 // their children) for conversion. Returns true on
130 // success, false otherwise (e.g. the named node does
131 // not exist).
132 ////////////////////////////////////////////////////////////////////
133 bool MayaNodeTree::
135  // There might be multiple nodes matching the name; search for all
136  // of them.
137  bool found_any = false;
138 
139  Nodes::iterator ni;
140  for (ni = _nodes.begin(); ni != _nodes.end(); ++ni) {
141  MayaNodeDesc *node = (*ni);
142  if (glob.matches(node->get_name())) {
143  node->tag_joint_recursively();
144  found_any = true;
145  }
146  }
147 
148  return found_any;
149 }
150 
151 ////////////////////////////////////////////////////////////////////
152 // Function: MayaNodeTree::tag_all
153 // Access: Public
154 // Description: Tags the entire hierarchy for conversion. This is
155 // the normal behavior.
156 ////////////////////////////////////////////////////////////////////
157 void MayaNodeTree::
159  _root->tag_recursively();
160 }
161 
162 ////////////////////////////////////////////////////////////////////
163 // Function: MayaNodeTree::tag_named
164 // Access: Public
165 // Description: Tags nodes matching the indicated glob (and all of
166 // their children) for conversion. Returns true on
167 // success, false otherwise (e.g. the named node does
168 // not exist).
169 ////////////////////////////////////////////////////////////////////
170 bool MayaNodeTree::
171 tag_named(const GlobPattern &glob) {
172  // There might be multiple nodes matching the name; search for all
173  // of them.
174  bool found_any = false;
175 
176  Nodes::iterator ni;
177  for (ni = _nodes.begin(); ni != _nodes.end(); ++ni) {
178  MayaNodeDesc *node = (*ni);
179  if (glob.matches(node->get_name())) {
180  node->tag_recursively();
181  found_any = true;
182  }
183  }
184 
185  return found_any;
186 }
187 
188 ////////////////////////////////////////////////////////////////////
189 // Function: MayaNodeTree::untag_named
190 // Access: Public
191 // Description: Un-tags nodes matching the indicated glob (and all of
192 // their children) for conversion. Returns true on
193 // success, false otherwise (e.g. the named node does
194 // not exist).
195 ////////////////////////////////////////////////////////////////////
196 bool MayaNodeTree::
197 untag_named(const GlobPattern &glob) {
198  // There might be multiple nodes matching the name; search for all
199  // of them.
200  bool found_any = false;
201 
202  Nodes::iterator ni;
203  for (ni = _nodes.begin(); ni != _nodes.end(); ++ni) {
204  MayaNodeDesc *node = (*ni);
205  if (glob.matches(node->get_name())) {
206  node->untag_recursively();
207  found_any = true;
208  }
209  }
210 
211  return found_any;
212 }
213 
214 ////////////////////////////////////////////////////////////////////
215 // Function: MayaNodeTree::tag_selected
216 // Access: Public
217 // Description: Tags the just the selected hierarchy for conversion,
218 // or the entire hierarchy if nothing is selected.
219 // Returns true on success, false on failure.
220 ////////////////////////////////////////////////////////////////////
221 bool MayaNodeTree::
223  MStatus status;
224 
225  MItDag dag_iterator(MItDag::kDepthFirst, MFn::kTransform, &status);
226  if (!status) {
227  status.perror("MItDag constructor");
228  return false;
229  }
230 
231  MSelectionList selection;
232  status = MGlobal::getActiveSelectionList(selection);
233  if (!status) {
234  status.perror("MGlobal::getActiveSelectionList");
235  return false;
236  }
237 
238  if (selection.isEmpty()) {
239  mayaegg_cat.info()
240  << "Selection list is empty.\n";
241  tag_all();
242  return true;
243  }
244 
245  bool all_ok = true;
246  unsigned int length = selection.length();
247  for (unsigned int i = 0; i < length; i++) {
248  MDagPath root_path;
249  status = selection.getDagPath(i, root_path);
250  if (!status) {
251  status.perror("MSelectionList::getDagPath");
252  } else {
253  // Now traverse through the selected dag path and all nested
254  // dag paths.
255  dag_iterator.reset(root_path);
256  while (!dag_iterator.isDone()) {
257  MDagPath dag_path;
258  status = dag_iterator.getPath(dag_path);
259  if (!status) {
260  status.perror("MItDag::getPath");
261  } else {
262  build_node(dag_path)->tag();
263  }
264 
265  dag_iterator.next();
266  }
267  }
268  }
269 
270  if (all_ok) {
271  _root->check_pseudo_joints(false);
272  }
273 
274  return all_ok;
275 }
276 
277 ////////////////////////////////////////////////////////////////////
278 // Function: MayaNodeTree::get_num_nodes
279 // Access: Public
280 // Description: Returns the total number of nodes in the hierarchy,
281 // not counting the root node.
282 ////////////////////////////////////////////////////////////////////
283 int MayaNodeTree::
284 get_num_nodes() const {
285  return _nodes.size();
286 }
287 
288 ////////////////////////////////////////////////////////////////////
289 // Function: MayaNodeTree::get_node
290 // Access: Public
291 // Description: Returns the nth node in the hierarchy, in an
292 // arbitrary ordering.
293 ////////////////////////////////////////////////////////////////////
295 get_node(int n) const {
296  nassertr(n >= 0 && n < (int)_nodes.size(), NULL);
297  return _nodes[n];
298 }
299 
300 ////////////////////////////////////////////////////////////////////
301 // Function: MayaNodeTree::clear
302 // Access: Public
303 // Description: Resets the entire tree in preparation for
304 // repopulating with a new scene.
305 ////////////////////////////////////////////////////////////////////
306 void MayaNodeTree::
307 clear() {
308  _root = new MayaNodeDesc(this);
309  _fps = 0.0;
310  _egg_data = (EggData *)NULL;
311  _egg_root = (EggGroupNode *)NULL;
312  _skeleton_node = (EggGroupNode *)NULL;
313  _morph_node = (EggGroupNode *)NULL;
314  _nodes_by_path.clear();
315  _nodes.clear();
316 }
317 
318 ////////////////////////////////////////////////////////////////////
319 // Function: MayaNodeTree::clear_egg
320 // Access: Public
321 // Description: Removes all of the references to generated egg
322 // structures from the tree, and prepares the tree for
323 // generating new egg structures.
324 ////////////////////////////////////////////////////////////////////
325 void MayaNodeTree::
326 clear_egg(EggData *egg_data, EggGroupNode *egg_root,
327  EggGroupNode *skeleton_node, EggGroupNode *morph_node) {
328  _root->clear_egg();
329  BlendDescs::iterator bi;
330  for (bi = _blend_descs.begin(); bi != _blend_descs.end(); ++bi) {
331  (*bi)->clear_egg();
332  }
333 
334  _egg_data = egg_data;
335  _egg_root = egg_root;
336  _skeleton_node = skeleton_node;
337  _morph_node = morph_node;
338 }
339 
340 ////////////////////////////////////////////////////////////////////
341 // Function: MayaNodeTree::get_egg_group
342 // Access: Public
343 // Description: Returns the EggGroupNode corresponding to the group
344 // or joint for the indicated node. Creates the group
345 // node if it has not already been created.
346 ////////////////////////////////////////////////////////////////////
349  nassertr(_egg_root != (EggGroupNode *)NULL, NULL);
350 
351  if (node_desc->_egg_group == (EggGroup *)NULL) {
352  // We need to make a new group node.
353  EggGroup *egg_group;
354 
355  nassertr(node_desc->_parent != (MayaNodeDesc *)NULL, NULL);
356  egg_group = new EggGroup(node_desc->get_name());
357  if (node_desc->is_joint()) {
358  if (_converter->get_animation_convert() == AC_model ||
359  _converter->get_animation_convert() == AC_both) {
360  egg_group->set_group_type(EggGroup::GT_joint);
361  }
362  }
363 
364  MayaEggGroupUserData *parent_user_data = NULL;
365 
366  if (node_desc->_parent == _root) {
367  // The parent is the root.
368  _egg_root->add_child(egg_group);
369 
370  } else {
371  // The parent is another node.
372  EggGroup *parent_egg_group = get_egg_group(node_desc->_parent);
373  parent_egg_group->add_child(egg_group);
374 
375  if (parent_egg_group->has_user_data()) {
376  DCAST_INTO_R(parent_user_data, parent_egg_group->get_user_data(), NULL);
377  }
378  }
379 
380  if (node_desc->has_dag_path()) {
381  // Check for an object type setting, from Oliver's plug-in.
382  MObject dag_object = node_desc->get_dag_path().node();
383  string object_type;
384  LVector3d value;
385  if (get_enum_attribute(dag_object, "eggObjectTypes1", object_type)) {
386  egg_group->add_object_type(object_type);
387  }
388  if (get_enum_attribute(dag_object, "eggObjectTypes2", object_type)) {
389  egg_group->add_object_type(object_type);
390  }
391  if (get_enum_attribute(dag_object, "eggObjectTypes3", object_type)) {
392  egg_group->add_object_type(object_type);
393  }
394 
395  if(has_attribute(dag_object, "scrollUV")) {
396  if(get_vec3d_attribute(dag_object, "scrollUV", value)) {
397  egg_group->set_scroll_u(value[0]);
398  egg_group->set_scroll_v(value[1]);
399  egg_group->set_scroll_r(value[2]);
400  }
401  }
402 
403  pvector<string> tag_attribute_names;
404  get_tag_attribute_names(dag_object, tag_attribute_names);
405  for (uint ti=0; ti < tag_attribute_names.size(); ti++) {
406  if (get_enum_attribute(dag_object, tag_attribute_names[ti], object_type)) {
407  egg_group->set_tag(tag_attribute_names[ti].substr(3), object_type);
408  }
409  }
410 
411  // Is the node flagged to be invisible? If it is, it is tagged
412  // with the "hidden" visibility flag, so it won't get converted
413  // in the normal case (unless it represents a collision solid or
414  // something).
415  bool visible = true;
416  get_bool_attribute(dag_object, "visibility", visible);
417  if (!visible && egg_group->get_num_object_types() == 0) {
418  egg_group->set_visibility_mode(EggGroup::VM_hidden);
419  }
420 
421  // We treat the object type "billboard" as a special case: we
422  // apply this one right away and also flag the group as an
423  // instance.
424  if (egg_group->has_object_type("billboard")) {
425  egg_group->remove_object_type("billboard");
426  egg_group->set_group_type(EggGroup::GT_instance);
427  egg_group->set_billboard_type(EggGroup::BT_axis);
428 
429  } else if (egg_group->has_object_type("billboard-point")) {
430  egg_group->remove_object_type("billboard-point");
431  egg_group->set_group_type(EggGroup::GT_instance);
432  egg_group->set_billboard_type(EggGroup::BT_point_camera_relative);
433 
434  } else if (egg_group->has_object_type("bbpoint")) {
435  egg_group->remove_object_type("bbpoint");
436  egg_group->set_group_type(EggGroup::GT_instance);
437  egg_group->set_billboard_type(EggGroup::BT_point_camera_relative);
438  }
439 
440  // We also treat the object type "dcs" and "model" as a special
441  // case, so we can test for these flags later.
442  if (egg_group->has_object_type("dcs")) {
443  egg_group->remove_object_type("dcs");
444  egg_group->set_dcs_type(EggGroup::DC_default);
445  }
446  if (egg_group->has_object_type("model")) {
447  egg_group->remove_object_type("model");
448  egg_group->set_model_flag(true);
449  }
450 
451  // And "vertex-color" and "double-sided" have meaning only to
452  // this converter.
453  MayaEggGroupUserData *user_data;
454  if (parent_user_data == (MayaEggGroupUserData *)NULL) {
455  user_data = new MayaEggGroupUserData;
456  } else {
457  // Inherit the flags from above.
458  user_data = new MayaEggGroupUserData(*parent_user_data);
459  }
460 
461  if (egg_group->has_object_type("vertex-color")) {
462  egg_group->remove_object_type("vertex-color");
463  user_data->_vertex_color = true;
464  }
465  if (egg_group->has_object_type("double-sided")) {
466  egg_group->remove_object_type("double-sided");
467  user_data->_double_sided = true;
468  }
469  egg_group->set_user_data(user_data);
470  }
471 
472  if (node_desc->_is_lod) {
473  // Create an LOD specification.
474  egg_group->set_lod(EggSwitchConditionDistance(node_desc->_switch_in,
475  node_desc->_switch_out,
476  LPoint3d::zero()));
477  }
478 
479  node_desc->_egg_group = egg_group;
480  }
481 
482  return node_desc->_egg_group;
483 }
484 
485 ////////////////////////////////////////////////////////////////////
486 // Function: MayaNodeTree::get_egg_table
487 // Access: Public
488 // Description: Returns the EggTable corresponding to the joint
489 // for the indicated node. Creates the table node if it
490 // has not already been created.
491 ////////////////////////////////////////////////////////////////////
494  nassertr(_skeleton_node != (EggGroupNode *)NULL, NULL);
495  nassertr(node_desc->is_joint(), NULL);
496 
497  if (node_desc->_egg_table == (EggTable *)NULL) {
498  // We need to make a new table node.
499  nassertr(node_desc->_parent != (MayaNodeDesc *)NULL, NULL);
500 
501  EggTable *egg_table = new EggTable(node_desc->get_name());
502  node_desc->_anim = new EggXfmSAnim("xform", _egg_data->get_coordinate_system());
503  node_desc->_anim->set_fps(_fps);
504  egg_table->add_child(node_desc->_anim);
505 
506  if (!node_desc->_parent->is_joint()) {
507  // The parent is not a joint; put it at the top.
508  _skeleton_node->add_child(egg_table);
509 
510  } else {
511  // The parent is another joint.
512  EggTable *parent_egg_table = get_egg_table(node_desc->_parent);
513  parent_egg_table->add_child(egg_table);
514  }
515 
516  node_desc->_egg_table = egg_table;
517  }
518 
519  return node_desc->_egg_table;
520 }
521 
522 ////////////////////////////////////////////////////////////////////
523 // Function: MayaNodeTree::get_egg_anim
524 // Access: Public
525 // Description: Returns the anim table corresponding to the joint
526 // for the indicated node. Creates the table node if it
527 // has not already been created.
528 ////////////////////////////////////////////////////////////////////
531  get_egg_table(node_desc);
532  return node_desc->_anim;
533 }
534 
535 ////////////////////////////////////////////////////////////////////
536 // Function: MayaNodeTree::get_egg_slider
537 // Access: Public
538 // Description: Returns the anim table corresponding to the slider
539 // for the indicated blend. Creates the table node if it
540 // has not already been created.
541 ////////////////////////////////////////////////////////////////////
544  nassertr(_morph_node != (EggGroupNode *)NULL, NULL);
545 
546  if (blend_desc->_anim == (EggSAnimData *)NULL) {
547  // We need to make a new anim table.
548  EggSAnimData *egg_anim = new EggSAnimData(blend_desc->get_name());
549  egg_anim->set_fps(_fps);
550  _morph_node->add_child(egg_anim);
551 
552  blend_desc->_anim = egg_anim;
553  }
554 
555  return blend_desc->_anim;
556 }
557 
558 ////////////////////////////////////////////////////////////////////
559 // Function: MayaNodeTree::ignore_slider
560 // Access: Public
561 // Description: Returns true if the indicated name is on the list of
562 // sliders to ignore, false otherwise.
563 ////////////////////////////////////////////////////////////////////
564 bool MayaNodeTree::
565 ignore_slider(const string &name) const {
566  return _converter->ignore_slider(name);
567 }
568 
569 ////////////////////////////////////////////////////////////////////
570 // Function: MayaNodeTree::report_ignored_slider
571 // Access: Public
572 // Description: Outputs a message to the user reporting that a slider
573 // was ignored. Each slider is only reported once.
574 ////////////////////////////////////////////////////////////////////
575 void MayaNodeTree::
576 report_ignored_slider(const string &name) {
577  if (_ignored_slider_names.insert(name).second) {
578  mayaegg_cat.info()
579  << "Ignoring slider " << name << "\n";
580  }
581 }
582 
583 ////////////////////////////////////////////////////////////////////
584 // Function: MayaNodeTree::add_blend_desc
585 // Access: Public
586 // Description: Adds the indicated MayaBlendDesc object to the list
587 // of blends collected so far. If a MayaBlendDesc
588 // object with the same name is already part of the
589 // tree, the supplied object is discarded and the
590 // previously-added object is returned; otherwise, the
591 // supplied object is added to the tree and the same
592 // object is returned.
593 //
594 // In either case, the return value is the MayaBlendDesc
595 // that should be used henceforth.
596 ////////////////////////////////////////////////////////////////////
599  BlendDescs::iterator bi = _blend_descs.insert(blend_desc).first;
600 
601  return (*bi);
602 }
603 
604 ////////////////////////////////////////////////////////////////////
605 // Function: MayaNodeTree::get_num_blend_descs
606 // Access: Public
607 // Description: Returns the number of unique MayaBlendDesc objects
608 // (and hence the number of morph sliders) discovered in
609 // the tree.
610 ////////////////////////////////////////////////////////////////////
611 int MayaNodeTree::
613  return _blend_descs.size();
614 }
615 
616 ////////////////////////////////////////////////////////////////////
617 // Function: MayaNodeTree::get_blend_desc
618 // Access: Public
619 // Description: Returns the nth MayaBlendDesc object discovered in
620 // the tree.
621 ////////////////////////////////////////////////////////////////////
623 get_blend_desc(int n) const {
624  nassertr(n >= 0 && n < (int)_blend_descs.size(), NULL);
625  return _blend_descs[n];
626 }
627 
628 ////////////////////////////////////////////////////////////////////
629 // Function: MayaNodeTree::reset_sliders
630 // Access: Public
631 // Description: Resets all of the sliders associated with all blend
632 // shapes down to 0.
633 ////////////////////////////////////////////////////////////////////
634 void MayaNodeTree::
636  BlendDescs::iterator bi;
637  for (bi = _blend_descs.begin(); bi != _blend_descs.end(); ++bi) {
638  (*bi)->set_slider(0.0);
639  }
640 }
641 
642 
643 ////////////////////////////////////////////////////////////////////
644 // Function: MayaNodeTree::r_build_node
645 // Access: Private
646 // Description: The recursive implementation of build_node().
647 ////////////////////////////////////////////////////////////////////
648 MayaNodeDesc *MayaNodeTree::
649 r_build_node(const string &path) {
650  // If we have already encountered this pathname, return the
651  // corresponding MayaNodeDesc immediately.
652  NodesByPath::const_iterator ni = _nodes_by_path.find(path);
653  if (ni != _nodes_by_path.end()) {
654  return (*ni).second;
655  }
656 
657  // Otherwise, we have to create it. Do this recursively, so we
658  // create each node along the path.
659  MayaNodeDesc *node_desc = NULL;
660 
661  //mayaegg_cat.info() << "path: " << path << endl;
662  if (path.empty()) {
663  // This is the top.
664  //mayaegg_cat.info() << "found empty path: " << path << endl;
665  node_desc = _root;
666 
667  } else {
668  // Maya uses vertical bars to separate path components. Remove
669  // everything from the rightmost bar on; this will give us the
670  // parent's path name.
671  size_t bar = path.rfind("|");
672  string parent_path, local_name;
673  if (bar != string::npos) {
674  parent_path = path.substr(0, bar);
675  //mayaegg_cat.info() << "parent_path: " << parent_path << endl;
676  local_name = path.substr(bar + 1);
677  if (local_name == _subroot_parent_name) {
678  node_desc = _root;
679  }
680  } else {
681  local_name = path;
682  }
683  //mayaegg_cat.info() << "local_name: " << local_name << endl;
684 
685  if (node_desc != _root) {
686  MayaNodeDesc *parent_node_desc = r_build_node(parent_path);
687  if (parent_node_desc == (MayaNodeDesc *)NULL)
688  mayaegg_cat.info() << "empty parent: " << local_name << endl;
689  node_desc = new MayaNodeDesc(this, parent_node_desc, local_name);
690  _nodes.push_back(node_desc);
691  }
692  }
693 
694  _nodes_by_path.insert(NodesByPath::value_type(path, node_desc));
695  return node_desc;
696 }
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
bool has_dag_path() const
Returns true if a Maya dag path has been associated with this node, false otherwise.
EggUserData * get_user_data() const
Returns the user data pointer most recently stored on this object, or NULL if nothing was previously ...
Definition: eggObject.cxx:102
bool has_user_data() const
Returns true if a generic user data pointer has recently been set and not yet cleared, false otherwise.
Definition: eggObject.cxx:130
void from_dag_path(const MDagPath &dag_path, MayaToEggConverter *converter)
Indicates an association between the MayaNodeDesc and some Maya instance.
void tag_all()
Tags the entire hierarchy for conversion.
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.
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.
iterator_0 begin()
Returns the iterator that marks the first element in the ordered vector.
MayaNodeDesc * get_node(int n) const
Returns the nth node in the hierarchy, in an arbitrary ordering.
Corresponding to an &lt;S$Anim&gt; entry, this stores a single column of numbers, for instance for a morph ...
Definition: eggSAnimData.h:28
bool matches(const string &candidate) const
Returns true if the candidate string matches the pattern, false otherwise.
Definition: globPattern.I:157
iterator_0 end()
Returns the iterator that marks the end of the ordered vector.
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.
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...
bool remove_object_type(const string &object_type)
Removes the first instance of the indicated object type from the group if it is present.
Definition: eggGroup.cxx:176
The main glue of the egg hierarchy, this corresponds to the &lt;Group&gt;, &lt;Instance&gt;, and &lt;Joint&gt; type nod...
Definition: eggGroup.h:36
void reset_sliders()
Resets all of the sliders associated with all blend shapes down to 0.
CoordinateSystem get_coordinate_system() const
Returns the coordinate system in which the egg file is defined.
Definition: eggData.I:111
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
This corresponds to an &lt;Xfm$Anim_S$&gt; entry, which is a collection of up to nine &lt;S$Anim&gt; entries that...
Definition: eggXfmSAnim.h:33
bool ignore_slider(const string &name) const
Returns true if the indicated name is on the list of sliders to ignore, false otherwise.
static const LPoint3d & zero()
Returns a zero-length point.
Definition: lpoint3.h:690
bool tag_joint_named(const GlobPattern &glob)
Tags nodes matching the indicated glob (and all of their children) for conversion.
AnimationConvert get_animation_convert() const
Returns how source animation will be converted into egg structures.
void set_visibility_mode(VisibilityMode mode)
Specifies whether this geometry is to be considered normally visible, or hidden.
Definition: eggRenderMode.I:87
bool has_object_type(const string &object_type) const
Returns true if the indicated object type has been added to the group, or false otherwise.
Definition: eggGroup.cxx:157
bool build_hierarchy()
Walks through the complete Maya hierarchy but does not tag any nodes for conversion.
void set_tag(const string &key, const string &value)
Associates a user-defined value with a user-defined key which is stored on the node.
Definition: eggGroup.I:883
This class supervises the construction of an EggData structure from a single Maya file...
void set_user_data(EggUserData *user_data)
Sets the user data associated with this object.
Definition: eggObject.cxx:89
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.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:746
EggNode * add_child(EggNode *node)
Adds the indicated child to the group and returns it.
const MDagPath & get_dag_path() const
Returns the dag path associated with this node.
bool is_joint() const
Returns true if the node should be treated as a joint by the converter.
MayaBlendDesc * get_blend_desc(int n) const
Returns the nth MayaBlendDesc object discovered in the tree.
EggTable * get_egg_table(MayaNodeDesc *node_desc)
Returns the EggTable corresponding to the joint for the indicated node.
int get_num_blend_descs() const
Returns the number of unique MayaBlendDesc objects (and hence the number of morph sliders) discovered...
EggSAnimData * get_egg_slider(MayaBlendDesc *blend_desc)
Returns the anim table corresponding to the slider for the indicated blend.
size_type_0 size() const
Returns the number of elements in the ordered vector.
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.
A SwitchCondition that switches the levels-of-detail based on distance from the camera&#39;s eyepoint...
This class contains extra user data which is piggybacked onto EggGroup objects for the purpose of the...
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