PageRenderTime 60ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llviewermenu.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 2927 lines | 2081 code | 493 blank | 353 comment | 345 complexity | beec3453b3db3ea8229dfc546893ecaa MD5 | raw file
Possible License(s): LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. /**
  2. * @file llviewermenu.cpp
  3. * @brief Builds menus out of items.
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "llviewerprecompiledheaders.h"
  27. #include "llviewermenu.h"
  28. // linden library includes
  29. #include "llavatarnamecache.h" // IDEVO
  30. #include "llfloaterreg.h"
  31. #include "llfloatersidepanelcontainer.h"
  32. #include "llcombobox.h"
  33. #include "llinventorypanel.h"
  34. #include "llnotifications.h"
  35. #include "llnotificationsutil.h"
  36. // newview includes
  37. #include "llagent.h"
  38. #include "llagentaccess.h"
  39. #include "llagentcamera.h"
  40. #include "llagentwearables.h"
  41. #include "llagentpilot.h"
  42. #include "llcompilequeue.h"
  43. #include "llconsole.h"
  44. #include "lldaycyclemanager.h"
  45. #include "lldebugview.h"
  46. #include "llenvmanager.h"
  47. #include "llfilepicker.h"
  48. #include "llfirstuse.h"
  49. #include "llfloaterbuy.h"
  50. #include "llfloaterbuycontents.h"
  51. #include "llbuycurrencyhtml.h"
  52. #include "llfloatergodtools.h"
  53. #include "llfloaterinventory.h"
  54. #include "llfloaterland.h"
  55. #include "llfloaterpay.h"
  56. #include "llfloaterreporter.h"
  57. #include "llfloatersearch.h"
  58. #include "llfloaterscriptdebug.h"
  59. #include "llfloatersnapshot.h"
  60. #include "llfloatertools.h"
  61. #include "llfloaterworldmap.h"
  62. #include "llfloaterbuildoptions.h"
  63. #include "llavataractions.h"
  64. #include "lllandmarkactions.h"
  65. #include "llgroupmgr.h"
  66. #include "lltooltip.h"
  67. #include "llhints.h"
  68. #include "llhudeffecttrail.h"
  69. #include "llhudmanager.h"
  70. #include "llimview.h"
  71. #include "llinventorybridge.h"
  72. #include "llinventorydefines.h"
  73. #include "llinventoryfunctions.h"
  74. #include "llpanellogin.h"
  75. #include "llpanelblockedlist.h"
  76. #include "llmoveview.h"
  77. #include "llparcel.h"
  78. #include "llrootview.h"
  79. #include "llsceneview.h"
  80. #include "llselectmgr.h"
  81. #include "llstatusbar.h"
  82. #include "lltextureview.h"
  83. #include "lltoolcomp.h"
  84. #include "lltoolmgr.h"
  85. #include "lltoolpie.h"
  86. #include "lltoolselectland.h"
  87. #include "lltrans.h"
  88. #include "llviewergenericmessage.h"
  89. #include "llviewerhelp.h"
  90. #include "llviewermenufile.h" // init_menu_file()
  91. #include "llviewermessage.h"
  92. #include "llviewernetwork.h"
  93. #include "llviewerobjectlist.h"
  94. #include "llviewerparcelmgr.h"
  95. #include "llviewerstats.h"
  96. #include "llvoavatarself.h"
  97. #include "llworldmap.h"
  98. #include "pipeline.h"
  99. #include "llviewerjoystick.h"
  100. #include "llwaterparammanager.h"
  101. #include "llwlanimator.h"
  102. #include "llwlparammanager.h"
  103. #include "llfloatercamera.h"
  104. #include "lluilistener.h"
  105. #include "llappearancemgr.h"
  106. #include "lltrans.h"
  107. #include "lleconomy.h"
  108. #include "lltoolgrab.h"
  109. #include "llwindow.h"
  110. #include "boost/unordered_map.hpp"
  111. using namespace LLVOAvatarDefines;
  112. typedef LLPointer<LLViewerObject> LLViewerObjectPtr;
  113. static boost::unordered_map<std::string, LLStringExplicit> sDefaultItemLabels;
  114. BOOL enable_land_build(void*);
  115. BOOL enable_object_build(void*);
  116. LLVOAvatar* find_avatar_from_object( LLViewerObject* object );
  117. LLVOAvatar* find_avatar_from_object( const LLUUID& object_id );
  118. void handle_test_load_url(void*);
  119. //
  120. // Evil hackish imported globals
  121. //extern BOOL gHideSelectedObjects;
  122. //extern BOOL gAllowSelectAvatar;
  123. //extern BOOL gDebugAvatarRotation;
  124. extern BOOL gDebugClicks;
  125. extern BOOL gDebugWindowProc;
  126. //extern BOOL gDebugTextEditorTips;
  127. //extern BOOL gDebugSelectMgr;
  128. //
  129. // Globals
  130. //
  131. LLMenuBarGL *gMenuBarView = NULL;
  132. LLViewerMenuHolderGL *gMenuHolder = NULL;
  133. LLMenuGL *gPopupMenuView = NULL;
  134. LLMenuGL *gEditMenu = NULL;
  135. LLMenuBarGL *gLoginMenuBarView = NULL;
  136. // Pie menus
  137. LLContextMenu *gMenuAvatarSelf = NULL;
  138. LLContextMenu *gMenuAvatarOther = NULL;
  139. LLContextMenu *gMenuObject = NULL;
  140. LLContextMenu *gMenuAttachmentSelf = NULL;
  141. LLContextMenu *gMenuAttachmentOther = NULL;
  142. LLContextMenu *gMenuLand = NULL;
  143. const std::string SAVE_INTO_INVENTORY("Save Object Back to My Inventory");
  144. const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents");
  145. LLMenuGL* gAttachSubMenu = NULL;
  146. LLMenuGL* gDetachSubMenu = NULL;
  147. LLMenuGL* gTakeOffClothes = NULL;
  148. LLContextMenu* gAttachScreenPieMenu = NULL;
  149. LLContextMenu* gAttachPieMenu = NULL;
  150. LLContextMenu* gAttachBodyPartPieMenus[8];
  151. LLContextMenu* gDetachPieMenu = NULL;
  152. LLContextMenu* gDetachScreenPieMenu = NULL;
  153. LLContextMenu* gDetachBodyPartPieMenus[8];
  154. LLMenuItemCallGL* gAFKMenu = NULL;
  155. LLMenuItemCallGL* gBusyMenu = NULL;
  156. //
  157. // Local prototypes
  158. // File Menu
  159. void handle_compress_image(void*);
  160. // Edit menu
  161. void handle_dump_group_info(void *);
  162. void handle_dump_capabilities_info(void *);
  163. // Advanced->Consoles menu
  164. void handle_region_dump_settings(void*);
  165. void handle_region_dump_temp_asset_data(void*);
  166. void handle_region_clear_temp_asset_data(void*);
  167. // Object pie menu
  168. BOOL sitting_on_selection();
  169. void near_sit_object();
  170. //void label_sit_or_stand(std::string& label, void*);
  171. // buy and take alias into the same UI positions, so these
  172. // declarations handle this mess.
  173. BOOL is_selection_buy_not_take();
  174. S32 selection_price();
  175. BOOL enable_take();
  176. void handle_take();
  177. void handle_object_show_inspector();
  178. void handle_avatar_show_inspector();
  179. bool confirm_take(const LLSD& notification, const LLSD& response);
  180. void handle_buy_object(LLSaleInfo sale_info);
  181. void handle_buy_contents(LLSaleInfo sale_info);
  182. // Land pie menu
  183. void near_sit_down_point(BOOL success, void *);
  184. // Avatar pie menu
  185. // Debug menu
  186. void velocity_interpolate( void* );
  187. void handle_rebake_textures(void*);
  188. BOOL check_admin_override(void*);
  189. void handle_admin_override_toggle(void*);
  190. #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
  191. void handle_toggle_hacked_godmode(void*);
  192. BOOL check_toggle_hacked_godmode(void*);
  193. bool enable_toggle_hacked_godmode(void*);
  194. #endif
  195. void toggle_show_xui_names(void *);
  196. BOOL check_show_xui_names(void *);
  197. // Debug UI
  198. void handle_buy_currency_test(void*);
  199. void handle_god_mode(void*);
  200. // God menu
  201. void handle_leave_god_mode(void*);
  202. void handle_reset_view();
  203. void handle_duplicate_in_place(void*);
  204. void handle_object_owner_self(void*);
  205. void handle_object_owner_permissive(void*);
  206. void handle_object_lock(void*);
  207. void handle_object_asset_ids(void*);
  208. void force_take_copy(void*);
  209. #ifdef _CORY_TESTING
  210. void force_export_copy(void*);
  211. void force_import_geometry(void*);
  212. #endif
  213. void handle_force_parcel_owner_to_me(void*);
  214. void handle_force_parcel_to_content(void*);
  215. void handle_claim_public_land(void*);
  216. void handle_god_request_avatar_geometry(void *); // Hack for easy testing of new avatar geometry
  217. void reload_vertex_shader(void *);
  218. void handle_disconnect_viewer(void *);
  219. void force_error_breakpoint(void *);
  220. void force_error_llerror(void *);
  221. void force_error_bad_memory_access(void *);
  222. void force_error_infinite_loop(void *);
  223. void force_error_software_exception(void *);
  224. void force_error_driver_crash(void *);
  225. void handle_force_delete(void*);
  226. void print_object_info(void*);
  227. void print_agent_nvpairs(void*);
  228. void toggle_debug_menus(void*);
  229. void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status);
  230. void dump_select_mgr(void*);
  231. void dump_inventory(void*);
  232. void toggle_visibility(void*);
  233. BOOL get_visibility(void*);
  234. // Avatar Pie menu
  235. void request_friendship(const LLUUID& agent_id);
  236. // Tools menu
  237. void handle_selected_texture_info(void*);
  238. void handle_dump_followcam(void*);
  239. void handle_viewer_enable_message_log(void*);
  240. void handle_viewer_disable_message_log(void*);
  241. BOOL enable_buy_land(void*);
  242. // Help menu
  243. void handle_test_male(void *);
  244. void handle_test_female(void *);
  245. void handle_toggle_pg(void*);
  246. void handle_dump_attachments(void *);
  247. void handle_dump_avatar_local_textures(void*);
  248. void handle_debug_avatar_textures(void*);
  249. void handle_grab_baked_texture(void*);
  250. BOOL enable_grab_baked_texture(void*);
  251. void handle_dump_region_object_cache(void*);
  252. BOOL enable_save_into_inventory(void*);
  253. BOOL enable_save_into_task_inventory(void*);
  254. BOOL enable_detach(const LLSD& = LLSD());
  255. void menu_toggle_attached_lights(void* user_data);
  256. void menu_toggle_attached_particles(void* user_data);
  257. class LLMenuParcelObserver : public LLParcelObserver
  258. {
  259. public:
  260. LLMenuParcelObserver();
  261. ~LLMenuParcelObserver();
  262. virtual void changed();
  263. };
  264. static LLMenuParcelObserver* gMenuParcelObserver = NULL;
  265. static LLUIListener sUIListener;
  266. LLMenuParcelObserver::LLMenuParcelObserver()
  267. {
  268. LLViewerParcelMgr::getInstance()->addObserver(this);
  269. }
  270. LLMenuParcelObserver::~LLMenuParcelObserver()
  271. {
  272. LLViewerParcelMgr::getInstance()->removeObserver(this);
  273. }
  274. void LLMenuParcelObserver::changed()
  275. {
  276. gMenuHolder->childSetEnabled("Land Buy Pass", LLPanelLandGeneral::enableBuyPass(NULL));
  277. BOOL buyable = enable_buy_land(NULL);
  278. gMenuHolder->childSetEnabled("Land Buy", buyable);
  279. gMenuHolder->childSetEnabled("Buy Land...", buyable);
  280. }
  281. void initialize_menus();
  282. //-----------------------------------------------------------------------------
  283. // Initialize main menus
  284. //
  285. // HOW TO NAME MENUS:
  286. //
  287. // First Letter Of Each Word Is Capitalized, Even At Or And
  288. //
  289. // Items that lead to dialog boxes end in "..."
  290. //
  291. // Break up groups of more than 6 items with separators
  292. //-----------------------------------------------------------------------------
  293. void set_underclothes_menu_options()
  294. {
  295. if (gMenuHolder && gAgent.isTeen())
  296. {
  297. gMenuHolder->getChild<LLView>("Self Underpants")->setVisible(FALSE);
  298. gMenuHolder->getChild<LLView>("Self Undershirt")->setVisible(FALSE);
  299. }
  300. if (gMenuBarView && gAgent.isTeen())
  301. {
  302. gMenuBarView->getChild<LLView>("Menu Underpants")->setVisible(FALSE);
  303. gMenuBarView->getChild<LLView>("Menu Undershirt")->setVisible(FALSE);
  304. }
  305. }
  306. void init_menus()
  307. {
  308. // Initialize actions
  309. initialize_menus();
  310. ///
  311. /// Popup menu
  312. ///
  313. /// The popup menu is now populated by the show_context_menu()
  314. /// method.
  315. LLMenuGL::Params menu_params;
  316. menu_params.name = "Popup";
  317. menu_params.visible = false;
  318. gPopupMenuView = LLUICtrlFactory::create<LLMenuGL>(menu_params);
  319. gMenuHolder->addChild( gPopupMenuView );
  320. ///
  321. /// Context menus
  322. ///
  323. const widget_registry_t& registry =
  324. LLViewerMenuHolderGL::child_registry_t::instance();
  325. gEditMenu = LLUICtrlFactory::createFromFile<LLMenuGL>("menu_edit.xml", gMenuHolder, registry);
  326. gMenuAvatarSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
  327. "menu_avatar_self.xml", gMenuHolder, registry);
  328. gMenuAvatarOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
  329. "menu_avatar_other.xml", gMenuHolder, registry);
  330. gDetachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach HUD", true);
  331. gDetachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach", true);
  332. gMenuObject = LLUICtrlFactory::createFromFile<LLContextMenu>(
  333. "menu_object.xml", gMenuHolder, registry);
  334. gAttachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach HUD");
  335. gAttachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach");
  336. gMenuAttachmentSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
  337. "menu_attachment_self.xml", gMenuHolder, registry);
  338. gMenuAttachmentOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
  339. "menu_attachment_other.xml", gMenuHolder, registry);
  340. gMenuLand = LLUICtrlFactory::createFromFile<LLContextMenu>(
  341. "menu_land.xml", gMenuHolder, registry);
  342. ///
  343. /// set up the colors
  344. ///
  345. LLColor4 color;
  346. LLColor4 context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor");
  347. gMenuAvatarSelf->setBackgroundColor( context_menu_color );
  348. gMenuAvatarOther->setBackgroundColor( context_menu_color );
  349. gMenuObject->setBackgroundColor( context_menu_color );
  350. gMenuAttachmentSelf->setBackgroundColor( context_menu_color );
  351. gMenuAttachmentOther->setBackgroundColor( context_menu_color );
  352. gMenuLand->setBackgroundColor( context_menu_color );
  353. color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" );
  354. gPopupMenuView->setBackgroundColor( color );
  355. // If we are not in production, use a different color to make it apparent.
  356. if (LLGridManager::getInstance()->isInProductionGrid())
  357. {
  358. color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
  359. }
  360. else
  361. {
  362. color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
  363. }
  364. LLView* menu_bar_holder = gViewerWindow->getRootView()->getChildView("menu_bar_holder");
  365. gMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_viewer.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
  366. gMenuBarView->setRect(LLRect(0, menu_bar_holder->getRect().mTop, 0, menu_bar_holder->getRect().mTop - MENU_BAR_HEIGHT));
  367. gMenuBarView->setBackgroundColor( color );
  368. menu_bar_holder->addChild(gMenuBarView);
  369. gViewerWindow->setMenuBackgroundColor(false,
  370. LLGridManager::getInstance()->isInProductionGrid());
  371. // Assume L$10 for now, the server will tell us the real cost at login
  372. // *TODO:Also fix cost in llfolderview.cpp for Inventory menus
  373. const std::string upload_cost("10");
  374. gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost);
  375. gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost);
  376. gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost);
  377. gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost);
  378. gAFKMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Away", TRUE);
  379. gBusyMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Busy", TRUE);
  380. gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE);
  381. gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE);
  382. #if !MEM_TRACK_MEM
  383. // Don't display the Memory console menu if the feature is turned off
  384. LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", TRUE);
  385. if (memoryMenu)
  386. {
  387. memoryMenu->setVisible(FALSE);
  388. }
  389. #endif
  390. gMenuBarView->createJumpKeys();
  391. // Let land based option enable when parcel changes
  392. gMenuParcelObserver = new LLMenuParcelObserver();
  393. gLoginMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_login.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
  394. gLoginMenuBarView->arrangeAndClear();
  395. LLRect menuBarRect = gLoginMenuBarView->getRect();
  396. menuBarRect.setLeftTopAndSize(0, menu_bar_holder->getRect().getHeight(), menuBarRect.getWidth(), menuBarRect.getHeight());
  397. gLoginMenuBarView->setRect(menuBarRect);
  398. gLoginMenuBarView->setBackgroundColor( color );
  399. menu_bar_holder->addChild(gLoginMenuBarView);
  400. // tooltips are on top of EVERYTHING, including menus
  401. gViewerWindow->getRootView()->sendChildToFront(gToolTipView);
  402. }
  403. ///////////////////
  404. // SHOW CONSOLES //
  405. ///////////////////
  406. class LLAdvancedToggleConsole : public view_listener_t
  407. {
  408. bool handleEvent(const LLSD& userdata)
  409. {
  410. std::string console_type = userdata.asString();
  411. if ("texture" == console_type)
  412. {
  413. toggle_visibility( (void*)gTextureView );
  414. }
  415. else if ("debug" == console_type)
  416. {
  417. toggle_visibility( (void*)static_cast<LLUICtrl*>(gDebugView->mDebugConsolep));
  418. }
  419. else if (gTextureSizeView && "texture size" == console_type)
  420. {
  421. toggle_visibility( (void*)gTextureSizeView );
  422. }
  423. else if (gTextureCategoryView && "texture category" == console_type)
  424. {
  425. toggle_visibility( (void*)gTextureCategoryView );
  426. }
  427. else if ("fast timers" == console_type)
  428. {
  429. LLFloaterReg::toggleInstance("fast_timers");
  430. }
  431. else if ("scene view" == console_type)
  432. {
  433. toggle_visibility( (void*)gSceneView);
  434. }
  435. #if MEM_TRACK_MEM
  436. else if ("memory view" == console_type)
  437. {
  438. toggle_visibility( (void*)gDebugView->mMemoryView );
  439. }
  440. #endif
  441. return true;
  442. }
  443. };
  444. class LLAdvancedCheckConsole : public view_listener_t
  445. {
  446. bool handleEvent(const LLSD& userdata)
  447. {
  448. std::string console_type = userdata.asString();
  449. bool new_value = false;
  450. if ("texture" == console_type)
  451. {
  452. new_value = get_visibility( (void*)gTextureView );
  453. }
  454. else if ("debug" == console_type)
  455. {
  456. new_value = get_visibility( (void*)((LLView*)gDebugView->mDebugConsolep) );
  457. }
  458. else if (gTextureSizeView && "texture size" == console_type)
  459. {
  460. new_value = get_visibility( (void*)gTextureSizeView );
  461. }
  462. else if (gTextureCategoryView && "texture category" == console_type)
  463. {
  464. new_value = get_visibility( (void*)gTextureCategoryView );
  465. }
  466. else if ("fast timers" == console_type)
  467. {
  468. new_value = LLFloaterReg::instanceVisible("fast_timers");
  469. }
  470. else if ("scene view" == console_type)
  471. {
  472. new_value = get_visibility( (void*) gSceneView);
  473. }
  474. #if MEM_TRACK_MEM
  475. else if ("memory view" == console_type)
  476. {
  477. new_value = get_visibility( (void*)gDebugView->mMemoryView );
  478. }
  479. #endif
  480. return new_value;
  481. }
  482. };
  483. //////////////////////////
  484. // DUMP INFO TO CONSOLE //
  485. //////////////////////////
  486. class LLAdvancedDumpInfoToConsole : public view_listener_t
  487. {
  488. bool handleEvent(const LLSD& userdata)
  489. {
  490. std::string info_type = userdata.asString();
  491. if ("region" == info_type)
  492. {
  493. handle_region_dump_settings(NULL);
  494. }
  495. else if ("group" == info_type)
  496. {
  497. handle_dump_group_info(NULL);
  498. }
  499. else if ("capabilities" == info_type)
  500. {
  501. handle_dump_capabilities_info(NULL);
  502. }
  503. return true;
  504. }
  505. };
  506. //////////////
  507. // HUD INFO //
  508. //////////////
  509. class LLAdvancedToggleHUDInfo : public view_listener_t
  510. {
  511. bool handleEvent(const LLSD& userdata)
  512. {
  513. std::string info_type = userdata.asString();
  514. if ("camera" == info_type)
  515. {
  516. gDisplayCameraPos = !(gDisplayCameraPos);
  517. }
  518. else if ("wind" == info_type)
  519. {
  520. gDisplayWindInfo = !(gDisplayWindInfo);
  521. }
  522. else if ("fov" == info_type)
  523. {
  524. gDisplayFOV = !(gDisplayFOV);
  525. }
  526. else if ("badge" == info_type)
  527. {
  528. gDisplayBadge = !(gDisplayBadge);
  529. }
  530. return true;
  531. }
  532. };
  533. class LLAdvancedCheckHUDInfo : public view_listener_t
  534. {
  535. bool handleEvent(const LLSD& userdata)
  536. {
  537. std::string info_type = userdata.asString();
  538. bool new_value = false;
  539. if ("camera" == info_type)
  540. {
  541. new_value = gDisplayCameraPos;
  542. }
  543. else if ("wind" == info_type)
  544. {
  545. new_value = gDisplayWindInfo;
  546. }
  547. else if ("fov" == info_type)
  548. {
  549. new_value = gDisplayFOV;
  550. }
  551. else if ("badge" == info_type)
  552. {
  553. new_value = gDisplayBadge;
  554. }
  555. return new_value;
  556. }
  557. };
  558. //////////////
  559. // FLYING //
  560. //////////////
  561. class LLAdvancedAgentFlyingInfo : public view_listener_t
  562. {
  563. bool handleEvent(const LLSD&)
  564. {
  565. return gAgent.getFlying();
  566. }
  567. };
  568. ///////////////////////
  569. // CLEAR GROUP CACHE //
  570. ///////////////////////
  571. class LLAdvancedClearGroupCache : public view_listener_t
  572. {
  573. bool handleEvent(const LLSD& userdata)
  574. {
  575. LLGroupMgr::debugClearAllGroups(NULL);
  576. return true;
  577. }
  578. };
  579. /////////////////
  580. // RENDER TYPE //
  581. /////////////////
  582. U32 render_type_from_string(std::string render_type)
  583. {
  584. if ("simple" == render_type)
  585. {
  586. return LLPipeline::RENDER_TYPE_SIMPLE;
  587. }
  588. else if ("alpha" == render_type)
  589. {
  590. return LLPipeline::RENDER_TYPE_ALPHA;
  591. }
  592. else if ("tree" == render_type)
  593. {
  594. return LLPipeline::RENDER_TYPE_TREE;
  595. }
  596. else if ("character" == render_type)
  597. {
  598. return LLPipeline::RENDER_TYPE_AVATAR;
  599. }
  600. else if ("surfacePatch" == render_type)
  601. {
  602. return LLPipeline::RENDER_TYPE_TERRAIN;
  603. }
  604. else if ("sky" == render_type)
  605. {
  606. return LLPipeline::RENDER_TYPE_SKY;
  607. }
  608. else if ("water" == render_type)
  609. {
  610. return LLPipeline::RENDER_TYPE_WATER;
  611. }
  612. else if ("ground" == render_type)
  613. {
  614. return LLPipeline::RENDER_TYPE_GROUND;
  615. }
  616. else if ("volume" == render_type)
  617. {
  618. return LLPipeline::RENDER_TYPE_VOLUME;
  619. }
  620. else if ("grass" == render_type)
  621. {
  622. return LLPipeline::RENDER_TYPE_GRASS;
  623. }
  624. else if ("clouds" == render_type)
  625. {
  626. return LLPipeline::RENDER_TYPE_CLOUDS;
  627. }
  628. else if ("particles" == render_type)
  629. {
  630. return LLPipeline::RENDER_TYPE_PARTICLES;
  631. }
  632. else if ("bump" == render_type)
  633. {
  634. return LLPipeline::RENDER_TYPE_BUMP;
  635. }
  636. else
  637. {
  638. return 0;
  639. }
  640. }
  641. class LLAdvancedToggleRenderType : public view_listener_t
  642. {
  643. bool handleEvent(const LLSD& userdata)
  644. {
  645. U32 render_type = render_type_from_string( userdata.asString() );
  646. if ( render_type != 0 )
  647. {
  648. LLPipeline::toggleRenderTypeControl( (void*)render_type );
  649. }
  650. return true;
  651. }
  652. };
  653. class LLAdvancedCheckRenderType : public view_listener_t
  654. {
  655. bool handleEvent(const LLSD& userdata)
  656. {
  657. U32 render_type = render_type_from_string( userdata.asString() );
  658. bool new_value = false;
  659. if ( render_type != 0 )
  660. {
  661. new_value = LLPipeline::hasRenderTypeControl( (void*)render_type );
  662. }
  663. return new_value;
  664. }
  665. };
  666. /////////////
  667. // FEATURE //
  668. /////////////
  669. U32 feature_from_string(std::string feature)
  670. {
  671. if ("ui" == feature)
  672. {
  673. return LLPipeline::RENDER_DEBUG_FEATURE_UI;
  674. }
  675. else if ("selected" == feature)
  676. {
  677. return LLPipeline::RENDER_DEBUG_FEATURE_SELECTED;
  678. }
  679. else if ("highlighted" == feature)
  680. {
  681. return LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED;
  682. }
  683. else if ("dynamic textures" == feature)
  684. {
  685. return LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES;
  686. }
  687. else if ("foot shadows" == feature)
  688. {
  689. return LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS;
  690. }
  691. else if ("fog" == feature)
  692. {
  693. return LLPipeline::RENDER_DEBUG_FEATURE_FOG;
  694. }
  695. else if ("fr info" == feature)
  696. {
  697. return LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO;
  698. }
  699. else if ("flexible" == feature)
  700. {
  701. return LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE;
  702. }
  703. else
  704. {
  705. return 0;
  706. }
  707. };
  708. class LLAdvancedToggleFeature : public view_listener_t
  709. {
  710. bool handleEvent(const LLSD& userdata)
  711. {
  712. U32 feature = feature_from_string( userdata.asString() );
  713. if ( feature != 0 )
  714. {
  715. LLPipeline::toggleRenderDebugFeature( (void*)feature );
  716. }
  717. return true;
  718. }
  719. };
  720. class LLAdvancedCheckFeature : public view_listener_t
  721. {
  722. bool handleEvent(const LLSD& userdata)
  723. {
  724. U32 feature = feature_from_string( userdata.asString() );
  725. bool new_value = false;
  726. if ( feature != 0 )
  727. {
  728. new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature );
  729. }
  730. return new_value;
  731. }
  732. };
  733. //////////////////
  734. // INFO DISPLAY //
  735. //////////////////
  736. U32 info_display_from_string(std::string info_display)
  737. {
  738. if ("verify" == info_display)
  739. {
  740. return LLPipeline::RENDER_DEBUG_VERIFY;
  741. }
  742. else if ("bboxes" == info_display)
  743. {
  744. return LLPipeline::RENDER_DEBUG_BBOXES;
  745. }
  746. else if ("normals" == info_display)
  747. {
  748. return LLPipeline::RENDER_DEBUG_NORMALS;
  749. }
  750. else if ("points" == info_display)
  751. {
  752. return LLPipeline::RENDER_DEBUG_POINTS;
  753. }
  754. else if ("octree" == info_display)
  755. {
  756. return LLPipeline::RENDER_DEBUG_OCTREE;
  757. }
  758. else if ("shadow frusta" == info_display)
  759. {
  760. return LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA;
  761. }
  762. else if ("physics shapes" == info_display)
  763. {
  764. return LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES;
  765. }
  766. else if ("occlusion" == info_display)
  767. {
  768. return LLPipeline::RENDER_DEBUG_OCCLUSION;
  769. }
  770. else if ("render batches" == info_display)
  771. {
  772. return LLPipeline::RENDER_DEBUG_BATCH_SIZE;
  773. }
  774. else if ("update type" == info_display)
  775. {
  776. return LLPipeline::RENDER_DEBUG_UPDATE_TYPE;
  777. }
  778. else if ("texture anim" == info_display)
  779. {
  780. return LLPipeline::RENDER_DEBUG_TEXTURE_ANIM;
  781. }
  782. else if ("texture priority" == info_display)
  783. {
  784. return LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY;
  785. }
  786. else if ("shame" == info_display)
  787. {
  788. return LLPipeline::RENDER_DEBUG_SHAME;
  789. }
  790. else if ("texture area" == info_display)
  791. {
  792. return LLPipeline::RENDER_DEBUG_TEXTURE_AREA;
  793. }
  794. else if ("face area" == info_display)
  795. {
  796. return LLPipeline::RENDER_DEBUG_FACE_AREA;
  797. }
  798. else if ("lod info" == info_display)
  799. {
  800. return LLPipeline::RENDER_DEBUG_LOD_INFO;
  801. }
  802. else if ("build queue" == info_display)
  803. {
  804. return LLPipeline::RENDER_DEBUG_BUILD_QUEUE;
  805. }
  806. else if ("lights" == info_display)
  807. {
  808. return LLPipeline::RENDER_DEBUG_LIGHTS;
  809. }
  810. else if ("particles" == info_display)
  811. {
  812. return LLPipeline::RENDER_DEBUG_PARTICLES;
  813. }
  814. else if ("composition" == info_display)
  815. {
  816. return LLPipeline::RENDER_DEBUG_COMPOSITION;
  817. }
  818. else if ("glow" == info_display)
  819. {
  820. return LLPipeline::RENDER_DEBUG_GLOW;
  821. }
  822. else if ("collision skeleton" == info_display)
  823. {
  824. return LLPipeline::RENDER_DEBUG_AVATAR_VOLUME;
  825. }
  826. else if ("raycast" == info_display)
  827. {
  828. return LLPipeline::RENDER_DEBUG_RAYCAST;
  829. }
  830. else if ("agent target" == info_display)
  831. {
  832. return LLPipeline::RENDER_DEBUG_AGENT_TARGET;
  833. }
  834. else if ("sculpt" == info_display)
  835. {
  836. return LLPipeline::RENDER_DEBUG_SCULPTED;
  837. }
  838. else if ("wind vectors" == info_display)
  839. {
  840. return LLPipeline::RENDER_DEBUG_WIND_VECTORS;
  841. }
  842. else
  843. {
  844. return 0;
  845. }
  846. };
  847. class LLAdvancedToggleInfoDisplay : public view_listener_t
  848. {
  849. bool handleEvent(const LLSD& userdata)
  850. {
  851. U32 info_display = info_display_from_string( userdata.asString() );
  852. LL_INFOS("ViewerMenu") << "toggle " << userdata.asString() << LL_ENDL;
  853. if ( info_display != 0 )
  854. {
  855. LLPipeline::toggleRenderDebug( (void*)info_display );
  856. }
  857. return true;
  858. }
  859. };
  860. class LLAdvancedCheckInfoDisplay : public view_listener_t
  861. {
  862. bool handleEvent(const LLSD& userdata)
  863. {
  864. U32 info_display = info_display_from_string( userdata.asString() );
  865. bool new_value = false;
  866. LL_INFOS("ViewerMenu") << "check " << userdata.asString() << LL_ENDL;
  867. if ( info_display != 0 )
  868. {
  869. new_value = LLPipeline::toggleRenderDebugControl( (void*)info_display );
  870. }
  871. return new_value;
  872. }
  873. };
  874. ///////////////////////////
  875. //// RANDOMIZE FRAMERATE //
  876. ///////////////////////////
  877. class LLAdvancedToggleRandomizeFramerate : public view_listener_t
  878. {
  879. bool handleEvent(const LLSD& userdata)
  880. {
  881. gRandomizeFramerate = !(gRandomizeFramerate);
  882. return true;
  883. }
  884. };
  885. class LLAdvancedCheckRandomizeFramerate : public view_listener_t
  886. {
  887. bool handleEvent(const LLSD& userdata)
  888. {
  889. bool new_value = gRandomizeFramerate;
  890. return new_value;
  891. }
  892. };
  893. ///////////////////////////
  894. //// PERIODIC SLOW FRAME //
  895. ///////////////////////////
  896. class LLAdvancedTogglePeriodicSlowFrame : public view_listener_t
  897. {
  898. bool handleEvent(const LLSD& userdata)
  899. {
  900. gPeriodicSlowFrame = !(gPeriodicSlowFrame);
  901. return true;
  902. }
  903. };
  904. class LLAdvancedCheckPeriodicSlowFrame : public view_listener_t
  905. {
  906. bool handleEvent(const LLSD& userdata)
  907. {
  908. bool new_value = gPeriodicSlowFrame;
  909. return new_value;
  910. }
  911. };
  912. ////////////////
  913. // FRAME TEST //
  914. ////////////////
  915. class LLAdvancedToggleFrameTest : public view_listener_t
  916. {
  917. bool handleEvent(const LLSD& userdata)
  918. {
  919. LLPipeline::sRenderFrameTest = !(LLPipeline::sRenderFrameTest);
  920. return true;
  921. }
  922. };
  923. class LLAdvancedCheckFrameTest : public view_listener_t
  924. {
  925. bool handleEvent(const LLSD& userdata)
  926. {
  927. bool new_value = LLPipeline::sRenderFrameTest;
  928. return new_value;
  929. }
  930. };
  931. ///////////////////////////
  932. // SELECTED TEXTURE INFO //
  933. ///////////////////////////
  934. class LLAdvancedSelectedTextureInfo : public view_listener_t
  935. {
  936. bool handleEvent(const LLSD& userdata)
  937. {
  938. handle_selected_texture_info(NULL);
  939. return true;
  940. }
  941. };
  942. //////////////////////
  943. // TOGGLE WIREFRAME //
  944. //////////////////////
  945. class LLAdvancedToggleWireframe : public view_listener_t
  946. {
  947. bool handleEvent(const LLSD& userdata)
  948. {
  949. gUseWireframe = !(gUseWireframe);
  950. LLPipeline::updateRenderDeferred();
  951. gPipeline.resetVertexBuffers();
  952. return true;
  953. }
  954. };
  955. class LLAdvancedCheckWireframe : public view_listener_t
  956. {
  957. bool handleEvent(const LLSD& userdata)
  958. {
  959. bool new_value = gUseWireframe;
  960. return new_value;
  961. }
  962. };
  963. //////////////////////
  964. // TEXTURE ATLAS //
  965. //////////////////////
  966. class LLAdvancedToggleTextureAtlas : public view_listener_t
  967. {
  968. bool handleEvent(const LLSD& userdata)
  969. {
  970. LLViewerTexture::sUseTextureAtlas = !LLViewerTexture::sUseTextureAtlas;
  971. gSavedSettings.setBOOL("EnableTextureAtlas", LLViewerTexture::sUseTextureAtlas) ;
  972. return true;
  973. }
  974. };
  975. class LLAdvancedCheckTextureAtlas : public view_listener_t
  976. {
  977. bool handleEvent(const LLSD& userdata)
  978. {
  979. bool new_value = LLViewerTexture::sUseTextureAtlas; // <-- make this using LLCacheControl
  980. return new_value;
  981. }
  982. };
  983. //////////////////////////
  984. // DUMP SCRIPTED CAMERA //
  985. //////////////////////////
  986. class LLAdvancedDumpScriptedCamera : public view_listener_t
  987. {
  988. bool handleEvent(const LLSD& userdata)
  989. {
  990. handle_dump_followcam(NULL);
  991. return true;
  992. }
  993. };
  994. //////////////////////////////
  995. // DUMP REGION OBJECT CACHE //
  996. //////////////////////////////
  997. class LLAdvancedDumpRegionObjectCache : public view_listener_t
  998. {
  999. bool handleEvent(const LLSD& userdata)
  1000. {
  1001. handle_dump_region_object_cache(NULL);
  1002. return true;
  1003. }
  1004. };
  1005. class LLAdvancedBuyCurrencyTest : public view_listener_t
  1006. {
  1007. bool handleEvent(const LLSD& userdata)
  1008. {
  1009. handle_buy_currency_test(NULL);
  1010. return true;
  1011. }
  1012. };
  1013. /////////////////////
  1014. // DUMP SELECT MGR //
  1015. /////////////////////
  1016. class LLAdvancedDumpSelectMgr : public view_listener_t
  1017. {
  1018. bool handleEvent(const LLSD& userdata)
  1019. {
  1020. dump_select_mgr(NULL);
  1021. return true;
  1022. }
  1023. };
  1024. ////////////////////
  1025. // DUMP INVENTORY //
  1026. ////////////////////
  1027. class LLAdvancedDumpInventory : public view_listener_t
  1028. {
  1029. bool handleEvent(const LLSD& userdata)
  1030. {
  1031. dump_inventory(NULL);
  1032. return true;
  1033. }
  1034. };
  1035. ////////////////////////////////
  1036. // PRINT SELECTED OBJECT INFO //
  1037. ////////////////////////////////
  1038. class LLAdvancedPrintSelectedObjectInfo : public view_listener_t
  1039. {
  1040. bool handleEvent(const LLSD& userdata)
  1041. {
  1042. print_object_info(NULL);
  1043. return true;
  1044. }
  1045. };
  1046. //////////////////////
  1047. // PRINT AGENT INFO //
  1048. //////////////////////
  1049. class LLAdvancedPrintAgentInfo : public view_listener_t
  1050. {
  1051. bool handleEvent(const LLSD& userdata)
  1052. {
  1053. print_agent_nvpairs(NULL);
  1054. return true;
  1055. }
  1056. };
  1057. ////////////////////////////////
  1058. // PRINT TEXTURE MEMORY STATS //
  1059. ////////////////////////////////
  1060. class LLAdvancedPrintTextureMemoryStats : public view_listener_t
  1061. {
  1062. bool handleEvent(const LLSD& userdata)
  1063. {
  1064. output_statistics(NULL);
  1065. return true;
  1066. }
  1067. };
  1068. //////////////////
  1069. // DEBUG CLICKS //
  1070. //////////////////
  1071. class LLAdvancedToggleDebugClicks : public view_listener_t
  1072. {
  1073. bool handleEvent(const LLSD& userdata)
  1074. {
  1075. gDebugClicks = !(gDebugClicks);
  1076. return true;
  1077. }
  1078. };
  1079. class LLAdvancedCheckDebugClicks : public view_listener_t
  1080. {
  1081. bool handleEvent(const LLSD& userdata)
  1082. {
  1083. bool new_value = gDebugClicks;
  1084. return new_value;
  1085. }
  1086. };
  1087. /////////////////
  1088. // DEBUG VIEWS //
  1089. /////////////////
  1090. class LLAdvancedToggleDebugViews : public view_listener_t
  1091. {
  1092. bool handleEvent(const LLSD& userdata)
  1093. {
  1094. LLView::sDebugRects = !(LLView::sDebugRects);
  1095. return true;
  1096. }
  1097. };
  1098. class LLAdvancedCheckDebugViews : public view_listener_t
  1099. {
  1100. bool handleEvent(const LLSD& userdata)
  1101. {
  1102. bool new_value = LLView::sDebugRects;
  1103. return new_value;
  1104. }
  1105. };
  1106. ///////////////////////
  1107. // XUI NAME TOOLTIPS //
  1108. ///////////////////////
  1109. class LLAdvancedToggleXUINameTooltips : public view_listener_t
  1110. {
  1111. bool handleEvent(const LLSD& userdata)
  1112. {
  1113. toggle_show_xui_names(NULL);
  1114. return true;
  1115. }
  1116. };
  1117. class LLAdvancedCheckXUINameTooltips : public view_listener_t
  1118. {
  1119. bool handleEvent(const LLSD& userdata)
  1120. {
  1121. bool new_value = check_show_xui_names(NULL);
  1122. return new_value;
  1123. }
  1124. };
  1125. ////////////////////////
  1126. // DEBUG MOUSE EVENTS //
  1127. ////////////////////////
  1128. class LLAdvancedToggleDebugMouseEvents : public view_listener_t
  1129. {
  1130. bool handleEvent(const LLSD& userdata)
  1131. {
  1132. LLView::sDebugMouseHandling = !(LLView::sDebugMouseHandling);
  1133. return true;
  1134. }
  1135. };
  1136. class LLAdvancedCheckDebugMouseEvents : public view_listener_t
  1137. {
  1138. bool handleEvent(const LLSD& userdata)
  1139. {
  1140. bool new_value = LLView::sDebugMouseHandling;
  1141. return new_value;
  1142. }
  1143. };
  1144. ////////////////
  1145. // DEBUG KEYS //
  1146. ////////////////
  1147. class LLAdvancedToggleDebugKeys : public view_listener_t
  1148. {
  1149. bool handleEvent(const LLSD& userdata)
  1150. {
  1151. LLView::sDebugKeys = !(LLView::sDebugKeys);
  1152. return true;
  1153. }
  1154. };
  1155. class LLAdvancedCheckDebugKeys : public view_listener_t
  1156. {
  1157. bool handleEvent(const LLSD& userdata)
  1158. {
  1159. bool new_value = LLView::sDebugKeys;
  1160. return new_value;
  1161. }
  1162. };
  1163. ///////////////////////
  1164. // DEBUG WINDOW PROC //
  1165. ///////////////////////
  1166. class LLAdvancedToggleDebugWindowProc : public view_listener_t
  1167. {
  1168. bool handleEvent(const LLSD& userdata)
  1169. {
  1170. gDebugWindowProc = !(gDebugWindowProc);
  1171. return true;
  1172. }
  1173. };
  1174. class LLAdvancedCheckDebugWindowProc : public view_listener_t
  1175. {
  1176. bool handleEvent(const LLSD& userdata)
  1177. {
  1178. bool new_value = gDebugWindowProc;
  1179. return new_value;
  1180. }
  1181. };
  1182. // ------------------------------XUI MENU ---------------------------
  1183. class LLAdvancedSendTestIms : public view_listener_t
  1184. {
  1185. bool handleEvent(const LLSD& userdata)
  1186. {
  1187. LLIMModel::instance().testMessages();
  1188. return true;
  1189. }
  1190. };
  1191. ///////////////
  1192. // XUI NAMES //
  1193. ///////////////
  1194. class LLAdvancedToggleXUINames : public view_listener_t
  1195. {
  1196. bool handleEvent(const LLSD& userdata)
  1197. {
  1198. toggle_show_xui_names(NULL);
  1199. return true;
  1200. }
  1201. };
  1202. class LLAdvancedCheckXUINames : public view_listener_t
  1203. {
  1204. bool handleEvent(const LLSD& userdata)
  1205. {
  1206. bool new_value = check_show_xui_names(NULL);
  1207. return new_value;
  1208. }
  1209. };
  1210. ////////////////////////
  1211. // GRAB BAKED TEXTURE //
  1212. ////////////////////////
  1213. class LLAdvancedGrabBakedTexture : public view_listener_t
  1214. {
  1215. bool handleEvent(const LLSD& userdata)
  1216. {
  1217. std::string texture_type = userdata.asString();
  1218. if ("iris" == texture_type)
  1219. {
  1220. handle_grab_baked_texture( (void*)BAKED_EYES );
  1221. }
  1222. else if ("head" == texture_type)
  1223. {
  1224. handle_grab_baked_texture( (void*)BAKED_HEAD );
  1225. }
  1226. else if ("upper" == texture_type)
  1227. {
  1228. handle_grab_baked_texture( (void*)BAKED_UPPER );
  1229. }
  1230. else if ("lower" == texture_type)
  1231. {
  1232. handle_grab_baked_texture( (void*)BAKED_LOWER );
  1233. }
  1234. else if ("skirt" == texture_type)
  1235. {
  1236. handle_grab_baked_texture( (void*)BAKED_SKIRT );
  1237. }
  1238. else if ("hair" == texture_type)
  1239. {
  1240. handle_grab_baked_texture( (void*)BAKED_HAIR );
  1241. }
  1242. return true;
  1243. }
  1244. };
  1245. class LLAdvancedEnableGrabBakedTexture : public view_listener_t
  1246. {
  1247. bool handleEvent(const LLSD& userdata)
  1248. {
  1249. std::string texture_type = userdata.asString();
  1250. bool new_value = false;
  1251. if ("iris" == texture_type)
  1252. {
  1253. new_value = enable_grab_baked_texture( (void*)BAKED_EYES );
  1254. }
  1255. else if ("head" == texture_type)
  1256. {
  1257. new_value = enable_grab_baked_texture( (void*)BAKED_HEAD );
  1258. }
  1259. else if ("upper" == texture_type)
  1260. {
  1261. new_value = enable_grab_baked_texture( (void*)BAKED_UPPER );
  1262. }
  1263. else if ("lower" == texture_type)
  1264. {
  1265. new_value = enable_grab_baked_texture( (void*)BAKED_LOWER );
  1266. }
  1267. else if ("skirt" == texture_type)
  1268. {
  1269. new_value = enable_grab_baked_texture( (void*)BAKED_SKIRT );
  1270. }
  1271. else if ("hair" == texture_type)
  1272. {
  1273. new_value = enable_grab_baked_texture( (void*)BAKED_HAIR );
  1274. }
  1275. return new_value;
  1276. }
  1277. };
  1278. ///////////////////////
  1279. // APPEARANCE TO XML //
  1280. ///////////////////////
  1281. class LLAdvancedAppearanceToXML : public view_listener_t
  1282. {
  1283. bool handleEvent(const LLSD& userdata)
  1284. {
  1285. LLVOAvatar::dumpArchetypeXML(NULL);
  1286. return true;
  1287. }
  1288. };
  1289. ///////////////////////////////
  1290. // TOGGLE CHARACTER GEOMETRY //
  1291. ///////////////////////////////
  1292. class LLAdvancedToggleCharacterGeometry : public view_listener_t
  1293. {
  1294. bool handleEvent(const LLSD& userdata)
  1295. {
  1296. handle_god_request_avatar_geometry(NULL);
  1297. return true;
  1298. }
  1299. };
  1300. /////////////////////////////
  1301. // TEST MALE / TEST FEMALE //
  1302. /////////////////////////////
  1303. class LLAdvancedTestMale : public view_listener_t
  1304. {
  1305. bool handleEvent(const LLSD& userdata)
  1306. {
  1307. handle_test_male(NULL);
  1308. return true;
  1309. }
  1310. };
  1311. class LLAdvancedTestFemale : public view_listener_t
  1312. {
  1313. bool handleEvent(const LLSD& userdata)
  1314. {
  1315. handle_test_female(NULL);
  1316. return true;
  1317. }
  1318. };
  1319. ///////////////
  1320. // TOGGLE PG //
  1321. ///////////////
  1322. class LLAdvancedTogglePG : public view_listener_t
  1323. {
  1324. bool handleEvent(const LLSD& userdata)
  1325. {
  1326. handle_toggle_pg(NULL);
  1327. return true;
  1328. }
  1329. };
  1330. class LLAdvancedForceParamsToDefault : public view_listener_t
  1331. {
  1332. bool handleEvent(const LLSD& userdata)
  1333. {
  1334. LLAgent::clearVisualParams(NULL);
  1335. return true;
  1336. }
  1337. };
  1338. //////////////////////////
  1339. // RELOAD VERTEX SHADER //
  1340. //////////////////////////
  1341. class LLAdvancedReloadVertexShader : public view_listener_t
  1342. {
  1343. bool handleEvent(const LLSD& userdata)
  1344. {
  1345. reload_vertex_shader(NULL);
  1346. return true;
  1347. }
  1348. };
  1349. ////////////////////
  1350. // ANIMATION INFO //
  1351. ////////////////////
  1352. class LLAdvancedToggleAnimationInfo : public view_listener_t
  1353. {
  1354. bool handleEvent(const LLSD& userdata)
  1355. {
  1356. LLVOAvatar::sShowAnimationDebug = !(LLVOAvatar::sShowAnimationDebug);
  1357. return true;
  1358. }
  1359. };
  1360. class LLAdvancedCheckAnimationInfo : public view_listener_t
  1361. {
  1362. bool handleEvent(const LLSD& userdata)
  1363. {
  1364. bool new_value = LLVOAvatar::sShowAnimationDebug;
  1365. return new_value;
  1366. }
  1367. };
  1368. //////////////////
  1369. // SHOW LOOK AT //
  1370. //////////////////
  1371. class LLAdvancedToggleShowLookAt : public view_listener_t
  1372. {
  1373. bool handleEvent(const LLSD& userdata)
  1374. {
  1375. LLHUDEffectLookAt::sDebugLookAt = !(LLHUDEffectLookAt::sDebugLookAt);
  1376. return true;
  1377. }
  1378. };
  1379. class LLAdvancedCheckShowLookAt : public view_listener_t
  1380. {
  1381. bool handleEvent(const LLSD& userdata)
  1382. {
  1383. bool new_value = LLHUDEffectLookAt::sDebugLookAt;
  1384. return new_value;
  1385. }
  1386. };
  1387. ///////////////////
  1388. // SHOW POINT AT //
  1389. ///////////////////
  1390. class LLAdvancedToggleShowPointAt : public view_listener_t
  1391. {
  1392. bool handleEvent(const LLSD& userdata)
  1393. {
  1394. LLHUDEffectPointAt::sDebugPointAt = !(LLHUDEffectPointAt::sDebugPointAt);
  1395. return true;
  1396. }
  1397. };
  1398. class LLAdvancedCheckShowPointAt : public view_listener_t
  1399. {
  1400. bool handleEvent(const LLSD& userdata)
  1401. {
  1402. bool new_value = LLHUDEffectPointAt::sDebugPointAt;
  1403. return new_value;
  1404. }
  1405. };
  1406. /////////////////////////
  1407. // DEBUG JOINT UPDATES //
  1408. /////////////////////////
  1409. class LLAdvancedToggleDebugJointUpdates : public view_listener_t
  1410. {
  1411. bool handleEvent(const LLSD& userdata)
  1412. {
  1413. LLVOAvatar::sJointDebug = !(LLVOAvatar::sJointDebug);
  1414. return true;
  1415. }
  1416. };
  1417. class LLAdvancedCheckDebugJointUpdates : public view_listener_t
  1418. {
  1419. bool handleEvent(const LLSD& userdata)
  1420. {
  1421. bool new_value = LLVOAvatar::sJointDebug;
  1422. return new_value;
  1423. }
  1424. };
  1425. /////////////////
  1426. // DISABLE LOD //
  1427. /////////////////
  1428. class LLAdvancedToggleDisableLOD : public view_listener_t
  1429. {
  1430. bool handleEvent(const LLSD& userdata)
  1431. {
  1432. LLViewerJoint::sDisableLOD = !(LLViewerJoint::sDisableLOD);
  1433. return true;
  1434. }
  1435. };
  1436. class LLAdvancedCheckDisableLOD : public view_listener_t
  1437. {
  1438. bool handleEvent(const LLSD& userdata)
  1439. {
  1440. bool new_value = LLViewerJoint::sDisableLOD;
  1441. return new_value;
  1442. }
  1443. };
  1444. /////////////////////////
  1445. // DEBUG CHARACTER VIS //
  1446. /////////////////////////
  1447. class LLAdvancedToggleDebugCharacterVis : public view_listener_t
  1448. {
  1449. bool handleEvent(const LLSD& userdata)
  1450. {
  1451. LLVOAvatar::sDebugInvisible = !(LLVOAvatar::sDebugInvisible);
  1452. return true;
  1453. }
  1454. };
  1455. class LLAdvancedCheckDebugCharacterVis : public view_listener_t
  1456. {
  1457. bool handleEvent(const LLSD& userdata)
  1458. {
  1459. bool new_value = LLVOAvatar::sDebugInvisible;
  1460. return new_value;
  1461. }
  1462. };
  1463. //////////////////////
  1464. // DUMP ATTACHMENTS //
  1465. //////////////////////
  1466. class LLAdvancedDumpAttachments : public view_listener_t
  1467. {
  1468. bool handleEvent(const LLSD& userdata)
  1469. {
  1470. handle_dump_attachments(NULL);
  1471. return true;
  1472. }
  1473. };
  1474. /////////////////////
  1475. // REBAKE TEXTURES //
  1476. /////////////////////
  1477. class LLAdvancedRebakeTextures : public view_listener_t
  1478. {
  1479. bool handleEvent(const LLSD& userdata)
  1480. {
  1481. handle_rebake_textures(NULL);
  1482. return true;
  1483. }
  1484. };
  1485. #if 1 //ndef LL_RELEASE_FOR_DOWNLOAD
  1486. ///////////////////////////
  1487. // DEBUG AVATAR TEXTURES //
  1488. ///////////////////////////
  1489. class LLAdvancedDebugAvatarTextures : public view_listener_t
  1490. {
  1491. bool handleEvent(const LLSD& userdata)
  1492. {
  1493. if (gAgent.isGodlike())
  1494. {
  1495. handle_debug_avatar_textures(NULL);
  1496. }
  1497. return true;
  1498. }
  1499. };
  1500. ////////////////////////////////
  1501. // DUMP AVATAR LOCAL TEXTURES //
  1502. ////////////////////////////////
  1503. class LLAdvancedDumpAvatarLocalTextures : public view_listener_t
  1504. {
  1505. bool handleEvent(const LLSD& userdata)
  1506. {
  1507. #ifndef LL_RELEASE_FOR_DOWNLOAD
  1508. handle_dump_avatar_local_textures(NULL);
  1509. #endif
  1510. return true;
  1511. }
  1512. };
  1513. #endif
  1514. /////////////////
  1515. // MESSAGE LOG //
  1516. /////////////////
  1517. class LLAdvancedEnableMessageLog : public view_listener_t
  1518. {
  1519. bool handleEvent(const LLSD& userdata)
  1520. {
  1521. handle_viewer_enable_message_log(NULL);
  1522. return true;
  1523. }
  1524. };
  1525. class LLAdvancedDisableMessageLog : public view_listener_t
  1526. {
  1527. bool handleEvent(const LLSD& userdata)
  1528. {
  1529. handle_viewer_disable_message_log(NULL);
  1530. return true;
  1531. }
  1532. };
  1533. /////////////////
  1534. // DROP PACKET //
  1535. /////////////////
  1536. class LLAdvancedDropPacket : public view_listener_t
  1537. {
  1538. bool handleEvent(const LLSD& userdata)
  1539. {
  1540. gMessageSystem->mPacketRing.dropPackets(1);
  1541. return true;
  1542. }
  1543. };
  1544. /////////////////
  1545. // AGENT PILOT //
  1546. /////////////////
  1547. class LLAdvancedAgentPilot : public view_listener_t
  1548. {
  1549. bool handleEvent(const LLSD& userdata)
  1550. {
  1551. std::string command = userdata.asString();
  1552. if ("start playback" == command)
  1553. {
  1554. gAgentPilot.setNumRuns(-1);
  1555. gAgentPilot.startPlayback();
  1556. }
  1557. else if ("stop playback" == command)
  1558. {
  1559. gAgentPilot.stopPlayback();
  1560. }
  1561. else if ("start record" == command)
  1562. {
  1563. gAgentPilot.startRecord();
  1564. }
  1565. else if ("stop record" == command)
  1566. {
  1567. gAgentPilot.stopRecord();
  1568. }
  1569. return true;
  1570. }
  1571. };
  1572. //////////////////////
  1573. // AGENT PILOT LOOP //
  1574. //////////////////////
  1575. class LLAdvancedToggleAgentPilotLoop : public view_listener_t
  1576. {
  1577. bool handleEvent(const LLSD& userdata)
  1578. {
  1579. gAgentPilot.setLoop(!gAgentPilot.getLoop());
  1580. return true;
  1581. }
  1582. };
  1583. class LLAdvancedCheckAgentPilotLoop : public view_listener_t
  1584. {
  1585. bool handleEvent(const LLSD& userdata)
  1586. {
  1587. bool new_value = gAgentPilot.getLoop();
  1588. return new_value;
  1589. }
  1590. };
  1591. /////////////////////////
  1592. // SHOW OBJECT UPDATES //
  1593. /////////////////////////
  1594. class LLAdvancedToggleShowObjectUpdates : public view_listener_t
  1595. {
  1596. bool handleEvent(const LLSD& userdata)
  1597. {
  1598. gShowObjectUpdates = !(gShowObjectUpdates);
  1599. return true;
  1600. }
  1601. };
  1602. class LLAdvancedCheckShowObjectUpdates : public view_listener_t
  1603. {
  1604. bool handleEvent(const LLSD& userdata)
  1605. {
  1606. bool new_value = gShowObjectUpdates;
  1607. return new_value;
  1608. }
  1609. };
  1610. ////////////////////
  1611. // COMPRESS IMAGE //
  1612. ////////////////////
  1613. class LLAdvancedCompressImage : public view_listener_t
  1614. {
  1615. bool handleEvent(const LLSD& userdata)
  1616. {
  1617. handle_compress_image(NULL);
  1618. return true;
  1619. }
  1620. };
  1621. /////////////////////////
  1622. // SHOW DEBUG SETTINGS //
  1623. /////////////////////////
  1624. class LLAdvancedShowDebugSettings : public view_listener_t
  1625. {
  1626. bool handleEvent(const LLSD& userdata)
  1627. {
  1628. LLFloaterReg::showInstance("settings_debug",userdata);
  1629. return true;
  1630. }
  1631. };
  1632. ////////////////////////
  1633. // VIEW ADMIN OPTIONS //
  1634. ////////////////////////
  1635. class LLAdvancedEnableViewAdminOptions : public view_listener_t
  1636. {
  1637. bool handleEvent(const LLSD& userdata)
  1638. {
  1639. // Don't enable in god mode since the admin menu is shown anyway.
  1640. // Only enable if the user has set the appropriate debug setting.
  1641. bool new_value = !gAgent.getAgentAccess().isGodlikeWithoutAdminMenuFakery() && gSavedSettings.getBOOL("AdminMenu");
  1642. return new_value;
  1643. }
  1644. };
  1645. class LLAdvancedToggleViewAdminOptions : public view_listener_t
  1646. {
  1647. bool handleEvent(const LLSD& userdata)
  1648. {
  1649. handle_admin_override_toggle(NULL);
  1650. return true;
  1651. }
  1652. };
  1653. class LLAdvancedCheckViewAdminOptions : public view_listener_t
  1654. {
  1655. bool handleEvent(const LLSD& userdata)
  1656. {
  1657. bool new_value = check_admin_override(NULL) || gAgent.isGodlike();
  1658. return new_value;
  1659. }
  1660. };
  1661. /////////////////////////////////////
  1662. // Enable Object Object Occlusion ///
  1663. /////////////////////////////////////
  1664. class LLAdvancedEnableObjectObjectOcclusion: public view_listener_t
  1665. {
  1666. bool handleEvent(const LLSD& userdata)
  1667. {
  1668. bool new_value = gGLManager.mHasOcclusionQuery; // && LLFeatureManager::getInstance()->isFeatureAvailable(userdata.asString());
  1669. return new_value;
  1670. }
  1671. };
  1672. /////////////////////////////////////
  1673. // Enable Framebuffer Objects ///
  1674. /////////////////////////////////////
  1675. class LLAdvancedEnableRenderFBO: public view_listener_t
  1676. {
  1677. bool handleEvent(const LLSD& userdata)
  1678. {
  1679. bool new_value = gGLManager.mHasFramebufferObject;
  1680. return new_value;
  1681. }
  1682. };
  1683. /////////////////////////////////////
  1684. // Enable Deferred Rendering ///
  1685. /////////////////////////////////////
  1686. class LLAdvancedEnableRenderDeferred: public view_listener_t
  1687. {
  1688. bool handleEvent(const LLSD& userdata)
  1689. {
  1690. bool new_value = gGLManager.mHasFramebufferObject && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1 &&
  1691. LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0;
  1692. return new_value;
  1693. }
  1694. };
  1695. /////////////////////////////////////
  1696. // Enable Deferred Rendering sub-options
  1697. /////////////////////////////////////
  1698. class LLAdvancedEnableRenderDeferredOptions: public view_listener_t
  1699. {
  1700. bool handleEvent(const LLSD& userdata)
  1701. {
  1702. bool new_value = gGLManager.mHasFramebufferObject && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT) > 1 &&
  1703. LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0 && gSavedSettings.getBOOL("RenderDeferred");
  1704. return new_value;
  1705. }
  1706. };
  1707. //////////////////
  1708. // ADMIN STATUS //
  1709. //////////////////
  1710. class LLAdvancedRequestAdminStatus : public view_listener_t
  1711. {
  1712. bool handleEvent(const LLSD& userdata)
  1713. {
  1714. handle_god_mode(NULL);
  1715. return true;
  1716. }
  1717. };
  1718. class LLAdvancedLeaveAdminStatus : public view_listener_t
  1719. {
  1720. bool handleEvent(const LLSD& userdata)
  1721. {
  1722. handle_leave_god_mode(NULL);
  1723. return true;
  1724. }
  1725. };
  1726. //////////////////////////
  1727. // Advanced > Debugging //
  1728. //////////////////////////
  1729. class LLAdvancedForceErrorBreakpoint : public view_listener_t
  1730. {
  1731. bool handleEvent(const LLSD& userdata)
  1732. {
  1733. force_error_breakpoint(NULL);
  1734. return true;
  1735. }
  1736. };
  1737. class LLAdvancedForceErrorLlerror : public view_listener_t
  1738. {
  1739. bool handleEvent(const LLSD& userdata)
  1740. {
  1741. force_error_llerror(NULL);
  1742. return true;
  1743. }
  1744. };
  1745. class LLAdvancedForceErrorBadMemoryAccess : public view_listener_t
  1746. {
  1747. bool handleEvent(const LLSD& userdata)
  1748. {
  1749. force_error_bad_memory_access(NULL);
  1750. return true;
  1751. }
  1752. };
  1753. class LLAdvancedForceErrorInfiniteLoop : public view_listener_t
  1754. {
  1755. bool handleEvent(const LLSD& userdata)
  1756. {
  1757. force_error_infinite_loop(NULL);
  1758. return true;
  1759. }
  1760. };
  1761. class LLAdvancedForceErrorSoftwareException : public view_listener_t
  1762. {
  1763. bool handleEvent(const LLSD& userdata)
  1764. {
  1765. force_error_software_exception(NULL);
  1766. return true;
  1767. }
  1768. };
  1769. class LLAdvancedForceErrorDriverCrash : public view_listener_t
  1770. {
  1771. bool handleEvent(const LLSD& userdata)
  1772. {
  1773. force_error_driver_crash(NULL);
  1774. return true;
  1775. }
  1776. };
  1777. class LLAdvancedForceErrorDisconnectViewer : public view_listener_t
  1778. {
  1779. bool handleEvent(const LLSD& userdata)
  1780. {
  1781. handle_disconnect_viewer(NULL);
  1782. return true;
  1783. }
  1784. };
  1785. #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
  1786. class LLAdvancedHandleToggleHackedGodmode : public view_listener_t
  1787. {
  1788. bool handleEvent(const LLSD& userdata)
  1789. {
  1790. handle_toggle_hacked_godmode(NULL);
  1791. return true;
  1792. }
  1793. };
  1794. class LLAdvancedCheckToggleHackedGodmode : public view_listener_t
  1795. {
  1796. bool handleEvent(const LLSD& userdata)
  1797. {
  1798. check_toggle_hacked_godmode(NULL);
  1799. return true;
  1800. }
  1801. };
  1802. class LLAdvancedEnableToggleHackedGodmode : public view_listener_t
  1803. {
  1804. bool handleEvent(const LLSD& userdata)
  1805. {
  1806. bool new_value = enable_toggle_hacked_godmode(NULL);
  1807. return new_value;
  1808. }
  1809. };
  1810. #endif
  1811. //
  1812. ////-------------------------------------------------------------------
  1813. //// Advanced menu
  1814. ////-------------------------------------------------------------------
  1815. //////////////////
  1816. // DEVELOP MENU //
  1817. //////////////////
  1818. class LLDevelopCheckLoggingLevel : public view_listener_t
  1819. {
  1820. bool handleEvent(const LLSD& userdata)
  1821. {
  1822. U32 level = userdata.asInteger();
  1823. return (static_cast<LLError::ELevel>(level) == LLError::getDefaultLevel());
  1824. }
  1825. };
  1826. class LLDevelopSetLoggingLevel : public view_listener_t
  1827. {
  1828. bool handleEvent(const LLSD& userdata)
  1829. {
  1830. U32 level = userdata.asInteger();
  1831. LLError::setDefaultLevel(static_cast<LLError::ELevel>(level));
  1832. return true;
  1833. }
  1834. };
  1835. //////////////////
  1836. // ADMIN MENU //
  1837. //////////////////
  1838. // Admin > Object
  1839. class LLAdminForceTakeCopy : public view_listener_t
  1840. {
  1841. bool handleEvent(const LLSD& userdata)
  1842. {
  1843. force_take_copy(NULL);
  1844. return true;
  1845. }
  1846. };
  1847. class LLAdminHandleObjectOwnerSelf : public view_listener_t
  1848. {
  1849. bool handleEvent(const LLSD& userdata)
  1850. {
  1851. handle_object_owner_self(NULL);
  1852. return true;
  1853. }
  1854. };
  1855. class LLAdminHandleObjectOwnerPermissive : public view_listener_t
  1856. {
  1857. bool handleEvent(const LLSD& userdata)
  1858. {
  1859. handle_object_owner_permissive(NULL);
  1860. return true;
  1861. }
  1862. };
  1863. class LLAdminHandleForceDelete : public view_listener_t
  1864. {
  1865. bool handleEvent(const LLSD& userdata)
  1866. {
  1867. handle_force_delete(NULL);
  1868. return true;
  1869. }
  1870. };
  1871. class LLAdminHandleObjectLock : public view_listener_t
  1872. {
  1873. bool handleEvent(const LLSD& userdata)
  1874. {
  1875. handle_object_lock(NULL);
  1876. return true;
  1877. }
  1878. };
  1879. class LLAdminHandleObjectAssetIDs: public view_listener_t
  1880. {
  1881. bool handleEvent(const LLSD& userdata)
  1882. {
  1883. handle_object_asset_ids(NULL);
  1884. return true;
  1885. }
  1886. };
  1887. //Admin >Parcel
  1888. class LLAdminHandleForceParcelOwnerToMe: public view_listener_t
  1889. {
  1890. bool handleEvent(const LLSD& userdata)
  1891. {
  1892. handle_force_parcel_owner_to_me(NULL);
  1893. return true;
  1894. }
  1895. };
  1896. class LLAdminHandleForceParcelToContent: public view_listener_t
  1897. {
  1898. bool handleEvent(const LLSD& userdata)
  1899. {
  1900. handle_force_parcel_to_content(NULL);
  1901. return true;
  1902. }
  1903. };
  1904. class LLAdminHandleClaimPublicLand: public view_listener_t
  1905. {
  1906. bool handleEvent(const LLSD& userdata)
  1907. {
  1908. handle_claim_public_land(NULL);
  1909. return true;
  1910. }
  1911. };
  1912. // Admin > Region
  1913. class LLAdminHandleRegionDumpTempAssetData: public view_listener_t
  1914. {
  1915. bool handleEvent(const LLSD& userdata)
  1916. {
  1917. handle_region_dump_temp_asset_data(NULL);
  1918. return true;
  1919. }
  1920. };
  1921. //Admin (Top Level)
  1922. class LLAdminOnSaveState: public view_listener_t
  1923. {
  1924. bool handleEvent(const LLSD& userdata)
  1925. {
  1926. LLPanelRegionTools::onSaveState(NULL);
  1927. return true;
  1928. }
  1929. };
  1930. //…

Large files files are truncated, but you can click here to view the full file