nodelist.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /*
  2. ** Command & Conquer Generals(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /* $Header: /Commando/Code/Tools/pluglib/nodelist.h 7 1/02/01 6:31p Greg_h $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando / G *
  24. * *
  25. * File Name : NODELIST.H *
  26. * *
  27. * Programmer : Greg Hjelstrom *
  28. * *
  29. * Start Date : 06/09/97 *
  30. * *
  31. * Last Update : June 9, 1997 [GH] *
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #ifndef NODELIST_H
  37. #define NODELIST_H
  38. #include "always.h"
  39. #include <Max.h>
  40. #ifndef NODEFILT_H
  41. #include "nodefilt.h"
  42. #endif
  43. class INodeListEntryClass;
  44. class INodeCompareClass;
  45. /*******************************************************************************
  46. * INodeListClass
  47. *
  48. * This is a class that can enumerate a 3dsMax scene and build a list of
  49. * all of the INodes that meet your desired criteria.
  50. *
  51. *******************************************************************************/
  52. class INodeListClass : public ITreeEnumProc
  53. {
  54. public:
  55. INodeListClass(TimeValue time,INodeFilterClass * nodefilter = NULL);
  56. INodeListClass(IScene * scene,TimeValue time,INodeFilterClass * nodefilter = NULL);
  57. INodeListClass(INode * root,TimeValue time,INodeFilterClass * nodefilter = NULL);
  58. INodeListClass(INodeListClass & copyfrom,TimeValue time,INodeFilterClass * inodefilter = NULL);
  59. ~INodeListClass();
  60. void Set_Filter(INodeFilterClass * inodefilter) { INodeFilter = inodefilter; }
  61. void Insert(INodeListClass & insertlist);
  62. void Insert(INode * node);
  63. void Remove(int i);
  64. unsigned Num_Nodes(void) const { return NumNodes; }
  65. INode * operator[] (int index) const;
  66. void Sort(const INodeCompareClass & node_compare);
  67. void Add_Tree(INode * root);
  68. private:
  69. unsigned NumNodes;
  70. TimeValue Time;
  71. INodeListEntryClass * ListHead;
  72. INodeFilterClass * INodeFilter;
  73. INodeListEntryClass * get_nth_item(int index);
  74. int callback(INode * node);
  75. };
  76. class INodeCompareClass
  77. {
  78. public:
  79. // returns <0 if nodea < node b.
  80. // returns =0 if nodea = node b.
  81. // returns >0 if nodea > node b.
  82. virtual int operator() (INode * nodea,INode * nodeb) const = 0;
  83. };
  84. #endif /*NODELIST_H*/