rcmenu.cpp 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /*
  2. ** Command & Conquer Generals Zero Hour(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/max2w3d/rcmenu.cpp 6 4/19/00 12:24p Greg_h $ */
  19. /***********************************************************************************************
  20. *** Confidential - Westwood Studios ***
  21. ***********************************************************************************************
  22. * *
  23. * Project Name : Commando Tools - W3D export *
  24. * *
  25. * $Archive:: /Commando/Code/Tools/max2w3d/rcmenu.cpp $*
  26. * *
  27. * $Author:: Greg_h $*
  28. * *
  29. * $Modtime:: 4/18/00 8:26p $*
  30. * *
  31. * $Revision:: 6 $*
  32. * *
  33. *---------------------------------------------------------------------------------------------*
  34. * Functions: *
  35. * RCMenuClass::Init -- initialize the "right-click" menu *
  36. * RCMenuClass::Selected -- menu selection callback *
  37. * RCMenuClass::Toggle_Hierarchy -- toggle the "export hierarchy" option *
  38. * RCMenuClass::Toggle_Geometry -- toggle the "export geometry" option *
  39. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  40. #include "rcmenu.h"
  41. #include "w3dutil.h"
  42. #include "util.h"
  43. RCMenuClass TheRCMenu;
  44. /***********************************************************************************************
  45. * RCMenuClass::Init -- initialize the "right-click" menu *
  46. * *
  47. * INPUT: *
  48. * *
  49. * OUTPUT: *
  50. * *
  51. * WARNINGS: *
  52. * *
  53. * HISTORY: *
  54. * 10/26/1997 GH : Created. *
  55. *=============================================================================================*/
  56. void RCMenuClass::Init(RightClickMenuManager* manager, HWND hWnd, IPoint2 m)
  57. {
  58. Installed=TRUE;
  59. SelNode = InterfacePtr->PickNode(hWnd,m);
  60. if (SelNode) {
  61. UINT menuflags;
  62. W3DAppData2Struct * wdata = W3DAppData2Struct::Get_App_Data(SelNode);
  63. /*
  64. ** Add the menu separator
  65. */
  66. manager->AddMenu(this, MF_SEPARATOR, MENU_SEPARATOR, NULL);
  67. /*
  68. ** Add the Name of the object
  69. */
  70. char string[64];
  71. sprintf(string,"%s:",SelNode->GetName());
  72. manager->AddMenu(this, MF_STRING | MF_DISABLED, MENU_NODE_NAME, string);
  73. /*
  74. ** Add the pointer
  75. */
  76. // sprintf(string,"0x%X",(unsigned long)SelNode);
  77. // manager->AddMenu(this, MF_STRING | MF_GRAYED, MENU_NODE_POINTER, string);
  78. /*
  79. ** Add the hierarchy menu option
  80. */
  81. if (wdata->Is_Bone()) {
  82. menuflags = MF_STRING | MF_CHECKED;
  83. } else {
  84. menuflags = MF_STRING;
  85. }
  86. manager->AddMenu(this, menuflags, MENU_TOGGLE_HIERARCHY, "W3D: Export Hierarchy");
  87. /*
  88. ** Add the geometry menu option
  89. */
  90. if (wdata->Is_Geometry()) {
  91. menuflags = MF_STRING | MF_CHECKED;
  92. } else {
  93. menuflags = MF_STRING;
  94. }
  95. manager->AddMenu(this, menuflags, MENU_TOGGLE_GEOMETRY, "W3D: Export Geometry");
  96. }
  97. }
  98. /***********************************************************************************************
  99. * RCMenuClass::Selected -- menu selection callback *
  100. * *
  101. * INPUT: *
  102. * *
  103. * OUTPUT: *
  104. * *
  105. * WARNINGS: *
  106. * *
  107. * HISTORY: *
  108. * 10/26/1997 GH : Created. *
  109. *=============================================================================================*/
  110. void RCMenuClass::Selected(UINT id)
  111. {
  112. switch (id) {
  113. case MENU_TOGGLE_HIERARCHY:
  114. Toggle_Hierarchy(SelNode);
  115. break;
  116. case MENU_TOGGLE_GEOMETRY:
  117. Toggle_Geometry(SelNode);
  118. break;
  119. }
  120. }
  121. /***********************************************************************************************
  122. * RCMenuClass::Toggle_Hierarchy -- toggle the "export hierarchy" option *
  123. * *
  124. * INPUT: *
  125. * *
  126. * OUTPUT: *
  127. * *
  128. * WARNINGS: *
  129. * *
  130. * HISTORY: *
  131. * 10/26/1997 GH : Created. *
  132. *=============================================================================================*/
  133. void RCMenuClass::Toggle_Hierarchy(INode * node)
  134. {
  135. W3DAppData2Struct * wdata = W3DAppData2Struct::Get_App_Data(SelNode);
  136. assert(wdata);
  137. if (wdata->Is_Bone()) {
  138. wdata->Enable_Export_Transform(false);
  139. } else {
  140. wdata->Enable_Export_Transform(true);
  141. }
  142. }
  143. /***********************************************************************************************
  144. * RCMenuClass::Toggle_Geometry -- toggle the "export geometry" option *
  145. * *
  146. * INPUT: *
  147. * *
  148. * OUTPUT: *
  149. * *
  150. * WARNINGS: *
  151. * *
  152. * HISTORY: *
  153. * 10/26/1997 GH : Created. *
  154. *=============================================================================================*/
  155. void RCMenuClass::Toggle_Geometry(INode * node)
  156. {
  157. W3DAppData2Struct * wdata = W3DAppData2Struct::Get_App_Data(SelNode);
  158. assert(wdata);
  159. if (wdata->Is_Geometry()) {
  160. wdata->Enable_Export_Geometry(false);
  161. } else {
  162. wdata->Enable_Export_Geometry(true);
  163. }
  164. }