nodePathCollection.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Filename: nodePathCollection.h
  2. // Created by: drose (06Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef NODEPATHCOLLECTION_H
  19. #define NODEPATHCOLLECTION_H
  20. #include "pandabase.h"
  21. #include "nodePath.h"
  22. #include "pointerToArray.h"
  23. ////////////////////////////////////////////////////////////////////
  24. // Class : NodePathCollection
  25. // Description : This is a set of zero or more NodePaths. It's handy
  26. // for returning from functions that need to return
  27. // multiple NodePaths (for instance,
  28. // NodePaths::get_children).
  29. ////////////////////////////////////////////////////////////////////
  30. class EXPCL_PANDA NodePathCollection {
  31. PUBLISHED:
  32. NodePathCollection();
  33. NodePathCollection(const NodePathCollection &copy);
  34. void operator = (const NodePathCollection &copy);
  35. INLINE ~NodePathCollection();
  36. void add_path(const NodePath &node_path);
  37. bool remove_path(const NodePath &node_path);
  38. void add_paths_from(const NodePathCollection &other);
  39. void remove_paths_from(const NodePathCollection &other);
  40. void remove_duplicate_paths();
  41. bool has_path(const NodePath &path) const;
  42. void clear();
  43. bool is_empty() const;
  44. int get_num_paths() const;
  45. NodePath get_path(int index) const;
  46. NodePath operator [] (int index) const;
  47. // Handy operations on many NodePaths at once.
  48. INLINE void ls() const;
  49. void ls(ostream &out, int indent_level = 0) const;
  50. NodePathCollection find_all_matches(const string &path) const;
  51. void reparent_to(const NodePath &other);
  52. void wrt_reparent_to(const NodePath &other);
  53. void show();
  54. void hide();
  55. void stash();
  56. void unstash();
  57. void detach();
  58. CollideMask get_collide_mask() const;
  59. void set_collide_mask(CollideMask new_mask, CollideMask bits_to_change = CollideMask::all_on(),
  60. TypeHandle node_type = TypeHandle::none());
  61. void set_color(float r, float g, float b, float a = 1.0,
  62. int priority = 0);
  63. void set_color(const Colorf &color, int priority = 0);
  64. void output(ostream &out) const;
  65. void write(ostream &out, int indent_level = 0) const;
  66. private:
  67. typedef PTA(NodePath) NodePaths;
  68. NodePaths _node_paths;
  69. };
  70. INLINE ostream &operator << (ostream &out, const NodePathCollection &col) {
  71. col.output(out);
  72. return out;
  73. }
  74. #include "nodePathCollection.I"
  75. #endif