PageRenderTime 152ms CodeModel.GetById 16ms app.highlight 124ms RepoModel.GetById 1ms app.codeStats 1ms

/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

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

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