llviewermenu.cpp
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:209k
- /**
- * @file llviewermenu.cpp
- * @brief Builds menus out of items.
- *
- * $LicenseInfo:firstyear=2002&license=viewergpl$
- *
- * Copyright (c) 2002-2010, Linden Research, Inc.
- *
- * Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- *
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- *
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
- *
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
- * $/LicenseInfo$
- */
- #include "llviewerprecompiledheaders.h"
- #include "llviewermenu.h"
- // linden library includes
- #include "llfloaterreg.h"
- #include "llcombobox.h"
- #include "llinventorypanel.h"
- #include "llnotifications.h"
- #include "llnotificationsutil.h"
- // newview includes
- #include "llagent.h"
- #include "llagentwearables.h"
- #include "llagentpilot.h"
- #include "llbottomtray.h"
- #include "llcompilequeue.h"
- #include "llconsole.h"
- #include "lldebugview.h"
- #include "llfilepicker.h"
- //#include "llfirstuse.h"
- #include "llfloaterbuy.h"
- #include "llfloaterbuycontents.h"
- #include "llfloaterbuycurrency.h"
- #include "llfloatercustomize.h"
- #include "llfloatergodtools.h"
- #include "llfloaterinventory.h"
- #include "llfloaterland.h"
- #include "llfloaterpay.h"
- #include "llfloaterreporter.h"
- #include "llfloatersearch.h"
- #include "llfloaterscriptdebug.h"
- #include "llfloatersnapshot.h"
- #include "llfloatertools.h"
- #include "llfloaterworldmap.h"
- #include "llavataractions.h"
- #include "lllandmarkactions.h"
- #include "llgroupmgr.h"
- #include "lltooltip.h"
- #include "llhudeffecttrail.h"
- #include "llhudmanager.h"
- #include "llimview.h"
- #include "llinventorybridge.h"
- #include "llpanellogin.h"
- #include "llpanelblockedlist.h"
- #include "llmenucommands.h"
- #include "llmoveview.h"
- #include "llparcel.h"
- #include "llrootview.h"
- #include "llselectmgr.h"
- #include "llsidetray.h"
- #include "llstatusbar.h"
- #include "lltextureview.h"
- #include "lltoolcomp.h"
- #include "lltoolmgr.h"
- #include "lltoolpie.h"
- #include "lltoolselectland.h"
- #include "llviewergenericmessage.h"
- #include "llviewerhelp.h"
- #include "llviewermenufile.h" // init_menu_file()
- #include "llviewermessage.h"
- #include "llviewernetwork.h"
- #include "llviewerobjectlist.h"
- #include "llviewerparcelmgr.h"
- #include "llviewerstats.h"
- #include "llvoavatarself.h"
- #include "llworldmap.h"
- #include "pipeline.h"
- #include "llviewerjoystick.h"
- #include "llwlanimator.h"
- #include "llwlparammanager.h"
- #include "llfloatercamera.h"
- #include "lluilistener.h"
- #include "llappearancemgr.h"
- using namespace LLVOAvatarDefines;
- BOOL enable_land_build(void*);
- BOOL enable_object_build(void*);
- LLVOAvatar* find_avatar_from_object( LLViewerObject* object );
- LLVOAvatar* find_avatar_from_object( const LLUUID& object_id );
- void handle_test_load_url(void*);
- //
- // Evil hackish imported globals
- //extern BOOL gHideSelectedObjects;
- //extern BOOL gAllowSelectAvatar;
- //extern BOOL gDebugAvatarRotation;
- extern BOOL gDebugClicks;
- extern BOOL gDebugWindowProc;
- //extern BOOL gDebugTextEditorTips;
- //extern BOOL gDebugSelectMgr;
- //
- // Globals
- //
- LLMenuBarGL *gMenuBarView = NULL;
- LLViewerMenuHolderGL *gMenuHolder = NULL;
- LLMenuGL *gPopupMenuView = NULL;
- LLMenuBarGL *gLoginMenuBarView = NULL;
- // Pie menus
- LLContextMenu *gMenuAvatarSelf = NULL;
- LLContextMenu *gMenuAvatarOther = NULL;
- LLContextMenu *gMenuObject = NULL;
- LLContextMenu *gMenuAttachmentSelf = NULL;
- LLContextMenu *gMenuAttachmentOther = NULL;
- LLContextMenu *gMenuLand = NULL;
- const std::string SAVE_INTO_INVENTORY("Save Object Back to My Inventory");
- const std::string SAVE_INTO_TASK_INVENTORY("Save Object Back to Object Contents");
- LLMenuGL* gAttachSubMenu = NULL;
- LLMenuGL* gDetachSubMenu = NULL;
- LLMenuGL* gTakeOffClothes = NULL;
- LLContextMenu* gAttachScreenPieMenu = NULL;
- LLContextMenu* gAttachPieMenu = NULL;
- LLContextMenu* gAttachBodyPartPieMenus[8];
- LLContextMenu* gDetachPieMenu = NULL;
- LLContextMenu* gDetachScreenPieMenu = NULL;
- LLContextMenu* gDetachBodyPartPieMenus[8];
- LLMenuItemCallGL* gAFKMenu = NULL;
- LLMenuItemCallGL* gBusyMenu = NULL;
- //
- // Local prototypes
- // File Menu
- const char* upload_pick(void* data);
- void handle_compress_image(void*);
- // Edit menu
- void handle_dump_group_info(void *);
- void handle_dump_capabilities_info(void *);
- // Advanced->Consoles menu
- void handle_region_dump_settings(void*);
- void handle_region_dump_temp_asset_data(void*);
- void handle_region_clear_temp_asset_data(void*);
- // Object pie menu
- BOOL sitting_on_selection();
- void near_sit_object();
- //void label_sit_or_stand(std::string& label, void*);
- // buy and take alias into the same UI positions, so these
- // declarations handle this mess.
- BOOL is_selection_buy_not_take();
- S32 selection_price();
- BOOL enable_take();
- void handle_take();
- bool confirm_take(const LLSD& notification, const LLSD& response);
- void handle_buy_object(LLSaleInfo sale_info);
- void handle_buy_contents(LLSaleInfo sale_info);
- // Land pie menu
- void near_sit_down_point(BOOL success, void *);
- // Avatar pie menu
- // Debug menu
- void velocity_interpolate( void* );
- void handle_rebake_textures(void*);
- BOOL check_admin_override(void*);
- void handle_admin_override_toggle(void*);
- #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- void handle_toggle_hacked_godmode(void*);
- BOOL check_toggle_hacked_godmode(void*);
- bool enable_toggle_hacked_godmode(void*);
- #endif
- void toggle_show_xui_names(void *);
- BOOL check_show_xui_names(void *);
- // Debug UI
- void handle_buy_currency_test(void*);
- void handle_save_to_xml(void*);
- void handle_load_from_xml(void*);
- void handle_god_mode(void*);
- // God menu
- void handle_leave_god_mode(void*);
- void handle_reset_view();
- void handle_duplicate_in_place(void*);
- void handle_object_owner_self(void*);
- void handle_object_owner_permissive(void*);
- void handle_object_lock(void*);
- void handle_object_asset_ids(void*);
- void force_take_copy(void*);
- #ifdef _CORY_TESTING
- void force_export_copy(void*);
- void force_import_geometry(void*);
- #endif
- void handle_force_parcel_owner_to_me(void*);
- void handle_force_parcel_to_content(void*);
- void handle_claim_public_land(void*);
- void handle_god_request_avatar_geometry(void *); // Hack for easy testing of new avatar geometry
- void reload_vertex_shader(void *);
- void handle_disconnect_viewer(void *);
- void force_error_breakpoint(void *);
- void force_error_llerror(void *);
- void force_error_bad_memory_access(void *);
- void force_error_infinite_loop(void *);
- void force_error_software_exception(void *);
- void force_error_driver_crash(void *);
- void handle_force_delete(void*);
- void print_object_info(void*);
- void print_agent_nvpairs(void*);
- void toggle_debug_menus(void*);
- void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status);
- void dump_select_mgr(void*);
- void dump_inventory(void*);
- void toggle_visibility(void*);
- BOOL get_visibility(void*);
- // Avatar Pie menu
- void request_friendship(const LLUUID& agent_id);
- // Tools menu
- void handle_selected_texture_info(void*);
- void handle_dump_followcam(void*);
- void handle_viewer_enable_message_log(void*);
- void handle_viewer_disable_message_log(void*);
- BOOL enable_buy_land(void*);
- // Help menu
- void handle_test_male(void *);
- void handle_test_female(void *);
- void handle_toggle_pg(void*);
- void handle_dump_attachments(void *);
- void handle_dump_avatar_local_textures(void*);
- void handle_debug_avatar_textures(void*);
- void handle_grab_texture(void*);
- BOOL enable_grab_texture(void*);
- void handle_dump_region_object_cache(void*);
- BOOL enable_save_into_inventory(void*);
- BOOL enable_save_into_task_inventory(void*);
- BOOL enable_detach(const LLSD& = LLSD());
- void menu_toggle_attached_lights(void* user_data);
- void menu_toggle_attached_particles(void* user_data);
- class LLMenuParcelObserver : public LLParcelObserver
- {
- public:
- LLMenuParcelObserver();
- ~LLMenuParcelObserver();
- virtual void changed();
- };
- static LLMenuParcelObserver* gMenuParcelObserver = NULL;
- static LLUIListener sUIListener;
- LLMenuParcelObserver::LLMenuParcelObserver()
- {
- LLViewerParcelMgr::getInstance()->addObserver(this);
- }
- LLMenuParcelObserver::~LLMenuParcelObserver()
- {
- LLViewerParcelMgr::getInstance()->removeObserver(this);
- }
- void LLMenuParcelObserver::changed()
- {
- gMenuHolder->childSetEnabled("Land Buy Pass", LLPanelLandGeneral::enableBuyPass(NULL));
-
- BOOL buyable = enable_buy_land(NULL);
- gMenuHolder->childSetEnabled("Land Buy", buyable);
- gMenuHolder->childSetEnabled("Buy Land...", buyable);
- }
- void initialize_menus();
- //-----------------------------------------------------------------------------
- // Initialize main menus
- //
- // HOW TO NAME MENUS:
- //
- // First Letter Of Each Word Is Capitalized, Even At Or And
- //
- // Items that lead to dialog boxes end in "..."
- //
- // Break up groups of more than 6 items with separators
- //-----------------------------------------------------------------------------
- void set_underclothes_menu_options()
- {
- if (gMenuHolder && gAgent.isTeen())
- {
- gMenuHolder->getChild<LLView>("Self Underpants")->setVisible(FALSE);
- gMenuHolder->getChild<LLView>("Self Undershirt")->setVisible(FALSE);
- }
- if (gMenuBarView && gAgent.isTeen())
- {
- gMenuBarView->getChild<LLView>("Menu Underpants")->setVisible(FALSE);
- gMenuBarView->getChild<LLView>("Menu Undershirt")->setVisible(FALSE);
- }
- }
- void init_menus()
- {
- S32 top = gViewerWindow->getRootView()->getRect().getHeight();
- // Initialize actions
- initialize_menus();
- ///
- /// Popup menu
- ///
- /// The popup menu is now populated by the show_context_menu()
- /// method.
-
- LLMenuGL::Params menu_params;
- menu_params.name = "Popup";
- menu_params.visible = false;
- gPopupMenuView = LLUICtrlFactory::create<LLMenuGL>(menu_params);
- gMenuHolder->addChild( gPopupMenuView );
- ///
- /// Context menus
- ///
- const widget_registry_t& registry =
- LLViewerMenuHolderGL::child_registry_t::instance();
- gMenuAvatarSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_avatar_self.xml", gMenuHolder, registry);
- gMenuAvatarOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_avatar_other.xml", gMenuHolder, registry);
- gDetachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach HUD", true);
- gDetachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Detach", true);
- gMenuObject = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_object.xml", gMenuHolder, registry);
- gAttachScreenPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach HUD");
- gAttachPieMenu = gMenuHolder->getChild<LLContextMenu>("Object Attach");
- gMenuAttachmentSelf = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_attachment_self.xml", gMenuHolder, registry);
- gMenuAttachmentOther = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_attachment_other.xml", gMenuHolder, registry);
- gMenuLand = LLUICtrlFactory::createFromFile<LLContextMenu>(
- "menu_land.xml", gMenuHolder, registry);
- ///
- /// set up the colors
- ///
- LLColor4 color;
- LLColor4 context_menu_color = LLUIColorTable::instance().getColor("MenuPopupBgColor");
-
- gMenuAvatarSelf->setBackgroundColor( context_menu_color );
- gMenuAvatarOther->setBackgroundColor( context_menu_color );
- gMenuObject->setBackgroundColor( context_menu_color );
- gMenuAttachmentSelf->setBackgroundColor( context_menu_color );
- gMenuAttachmentOther->setBackgroundColor( context_menu_color );
- gMenuLand->setBackgroundColor( context_menu_color );
- color = LLUIColorTable::instance().getColor( "MenuPopupBgColor" );
- gPopupMenuView->setBackgroundColor( color );
- // If we are not in production, use a different color to make it apparent.
- if (LLViewerLogin::getInstance()->isInProductionGrid())
- {
- color = LLUIColorTable::instance().getColor( "MenuBarBgColor" );
- }
- else
- {
- color = LLUIColorTable::instance().getColor( "MenuNonProductionBgColor" );
- }
- gMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_viewer.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- gMenuBarView->setRect(LLRect(0, top, 0, top - MENU_BAR_HEIGHT));
- gMenuBarView->setBackgroundColor( color );
- gMenuHolder->addChild(gMenuBarView);
-
- gViewerWindow->setMenuBackgroundColor(false,
- LLViewerLogin::getInstance()->isInProductionGrid());
- // Assume L$10 for now, the server will tell us the real cost at login
- // *TODO:Also fix cost in llfolderview.cpp for Inventory menus
- const std::string upload_cost("10");
- gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost);
- gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost);
- gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost);
- gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost);
- gAFKMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Away", TRUE);
- gBusyMenu = gMenuBarView->getChild<LLMenuItemCallGL>("Set Busy", TRUE);
- gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE);
- gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE);
- #if !MEM_TRACK_MEM
- // Don't display the Memory console menu if the feature is turned off
- LLMenuItemCheckGL *memoryMenu = gMenuBarView->getChild<LLMenuItemCheckGL>("Memory", TRUE);
- if (memoryMenu)
- {
- memoryMenu->setVisible(FALSE);
- }
- #endif
- gMenuBarView->createJumpKeys();
- // Let land based option enable when parcel changes
- gMenuParcelObserver = new LLMenuParcelObserver();
- gLoginMenuBarView = LLUICtrlFactory::getInstance()->createFromFile<LLMenuBarGL>("menu_login.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
- gLoginMenuBarView->arrangeAndClear();
- LLRect menuBarRect = gLoginMenuBarView->getRect();
- gLoginMenuBarView->setRect(LLRect(menuBarRect.mLeft, menuBarRect.mTop, gViewerWindow->getRootView()->getRect().getWidth() - menuBarRect.mLeft, menuBarRect.mBottom));
- gLoginMenuBarView->setBackgroundColor( color );
- gMenuHolder->addChild(gLoginMenuBarView);
-
- // tooltips are on top of EVERYTHING, including menus
- gViewerWindow->getRootView()->sendChildToFront(gToolTipView);
- }
- ///////////////////
- // SHOW CONSOLES //
- ///////////////////
- class LLAdvancedToggleConsole : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- std::string console_type = userdata.asString();
- if ("texture" == console_type)
- {
- toggle_visibility( (void*)gTextureView );
- }
- else if ("debug" == console_type)
- {
- toggle_visibility( (void*)static_cast<LLUICtrl*>(gDebugView->mDebugConsolep));
- }
- else if (gTextureSizeView && "texture size" == console_type)
- {
- toggle_visibility( (void*)gTextureSizeView );
- }
- else if (gTextureCategoryView && "texture category" == console_type)
- {
- toggle_visibility( (void*)gTextureCategoryView );
- }
- else if ("fast timers" == console_type)
- {
- toggle_visibility( (void*)gDebugView->mFastTimerView );
- }
- #if MEM_TRACK_MEM
- else if ("memory view" == console_type)
- {
- toggle_visibility( (void*)gDebugView->mMemoryView );
- }
- #endif
- return true;
- }
- };
- class LLAdvancedCheckConsole : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- std::string console_type = userdata.asString();
- bool new_value = false;
- if ("texture" == console_type)
- {
- new_value = get_visibility( (void*)gTextureView );
- }
- else if ("debug" == console_type)
- {
- new_value = get_visibility( (void*)((LLView*)gDebugView->mDebugConsolep) );
- }
- else if (gTextureSizeView && "texture size" == console_type)
- {
- new_value = get_visibility( (void*)gTextureSizeView );
- }
- else if (gTextureCategoryView && "texture category" == console_type)
- {
- new_value = get_visibility( (void*)gTextureCategoryView );
- }
- else if ("fast timers" == console_type)
- {
- new_value = get_visibility( (void*)gDebugView->mFastTimerView );
- }
- #if MEM_TRACK_MEM
- else if ("memory view" == console_type)
- {
- new_value = get_visibility( (void*)gDebugView->mMemoryView );
- }
- #endif
- return new_value;
- }
- };
- //////////////////////////
- // DUMP INFO TO CONSOLE //
- //////////////////////////
- class LLAdvancedDumpInfoToConsole : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- std::string info_type = userdata.asString();
- if ("region" == info_type)
- {
- handle_region_dump_settings(NULL);
- }
- else if ("group" == info_type)
- {
- handle_dump_group_info(NULL);
- }
- else if ("capabilities" == info_type)
- {
- handle_dump_capabilities_info(NULL);
- }
- return true;
- }
- };
- //////////////
- // HUD INFO //
- //////////////
- class LLAdvancedToggleHUDInfo : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- std::string info_type = userdata.asString();
- if ("camera" == info_type)
- {
- gDisplayCameraPos = !(gDisplayCameraPos);
- }
- else if ("wind" == info_type)
- {
- gDisplayWindInfo = !(gDisplayWindInfo);
- }
- else if ("fov" == info_type)
- {
- gDisplayFOV = !(gDisplayFOV);
- }
- else if ("badge" == info_type)
- {
- gDisplayBadge = !(gDisplayBadge);
- }
- return true;
- }
- };
- class LLAdvancedCheckHUDInfo : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- std::string info_type = userdata.asString();
- bool new_value = false;
- if ("camera" == info_type)
- {
- new_value = gDisplayCameraPos;
- }
- else if ("wind" == info_type)
- {
- new_value = gDisplayWindInfo;
- }
- else if ("fov" == info_type)
- {
- new_value = gDisplayFOV;
- }
- else if ("badge" == info_type)
- {
- new_value = gDisplayBadge;
- }
- return new_value;
- }
- };
- //////////////
- // FLYING //
- //////////////
- class LLAdvancedAgentFlyingInfo : public view_listener_t
- {
- bool handleEvent(const LLSD&)
- {
- return gAgent.getFlying();
- }
- };
- ///////////////////////
- // CLEAR GROUP CACHE //
- ///////////////////////
- class LLAdvancedClearGroupCache : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLGroupMgr::debugClearAllGroups(NULL);
- return true;
- }
- };
- /////////////////
- // RENDER TYPE //
- /////////////////
- U32 render_type_from_string(std::string render_type)
- {
- if ("simple" == render_type)
- {
- return LLPipeline::RENDER_TYPE_SIMPLE;
- }
- else if ("alpha" == render_type)
- {
- return LLPipeline::RENDER_TYPE_ALPHA;
- }
- else if ("tree" == render_type)
- {
- return LLPipeline::RENDER_TYPE_TREE;
- }
- else if ("character" == render_type)
- {
- return LLPipeline::RENDER_TYPE_AVATAR;
- }
- else if ("surfacePath" == render_type)
- {
- return LLPipeline::RENDER_TYPE_TERRAIN;
- }
- else if ("sky" == render_type)
- {
- return LLPipeline::RENDER_TYPE_SKY;
- }
- else if ("water" == render_type)
- {
- return LLPipeline::RENDER_TYPE_WATER;
- }
- else if ("ground" == render_type)
- {
- return LLPipeline::RENDER_TYPE_GROUND;
- }
- else if ("volume" == render_type)
- {
- return LLPipeline::RENDER_TYPE_VOLUME;
- }
- else if ("grass" == render_type)
- {
- return LLPipeline::RENDER_TYPE_GRASS;
- }
- else if ("clouds" == render_type)
- {
- return LLPipeline::RENDER_TYPE_CLOUDS;
- }
- else if ("particles" == render_type)
- {
- return LLPipeline::RENDER_TYPE_PARTICLES;
- }
- else if ("bump" == render_type)
- {
- return LLPipeline::RENDER_TYPE_BUMP;
- }
- else
- {
- return 0;
- }
- }
- class LLAdvancedToggleRenderType : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- U32 render_type = render_type_from_string( userdata.asString() );
- if ( render_type != 0 )
- {
- LLPipeline::toggleRenderTypeControl( (void*)render_type );
- }
- return true;
- }
- };
- class LLAdvancedCheckRenderType : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- U32 render_type = render_type_from_string( userdata.asString() );
- bool new_value = false;
- if ( render_type != 0 )
- {
- new_value = LLPipeline::hasRenderTypeControl( (void*)render_type );
- }
- return new_value;
- }
- };
- /////////////
- // FEATURE //
- /////////////
- U32 feature_from_string(std::string feature)
- {
- if ("ui" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_UI;
- }
- else if ("selected" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_SELECTED;
- }
- else if ("highlighted" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_HIGHLIGHTED;
- }
- else if ("dynamic textures" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_DYNAMIC_TEXTURES;
- }
- else if ("foot shadows" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_FOOT_SHADOWS;
- }
- else if ("fog" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_FOG;
- }
- else if ("fr info" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_FR_INFO;
- }
- else if ("flexible" == feature)
- {
- return LLPipeline::RENDER_DEBUG_FEATURE_FLEXIBLE;
- }
- else
- {
- return 0;
- }
- };
- class LLAdvancedToggleFeature : public view_listener_t{
- bool handleEvent(const LLSD& userdata)
- {
- U32 feature = feature_from_string( userdata.asString() );
- if ( feature != 0 )
- {
- LLPipeline::toggleRenderDebugFeature( (void*)feature );
- }
- return true;
- }
- };
- class LLAdvancedCheckFeature : public view_listener_t
- {bool handleEvent(const LLSD& userdata)
- {
- U32 feature = feature_from_string( userdata.asString() );
- bool new_value = false;
- if ( feature != 0 )
- {
- new_value = LLPipeline::toggleRenderDebugFeatureControl( (void*)feature );
- }
- return new_value;
- }
- };
- //////////////////
- // INFO DISPLAY //
- //////////////////
- U32 info_display_from_string(std::string info_display)
- {
- if ("verify" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_VERIFY;
- }
- else if ("bboxes" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_BBOXES;
- }
- else if ("points" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_POINTS;
- }
- else if ("octree" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_OCTREE;
- }
- else if ("shadow frusta" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_SHADOW_FRUSTA;
- }
- else if ("occlusion" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_OCCLUSION;
- }
- else if ("render batches" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_BATCH_SIZE;
- }
- else if ("texture anim" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_TEXTURE_ANIM;
- }
- else if ("texture priority" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_TEXTURE_PRIORITY;
- }
- else if ("shame" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_SHAME;
- }
- else if ("texture area" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_TEXTURE_AREA;
- }
- else if ("face area" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_FACE_AREA;
- }
- else if ("lights" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_LIGHTS;
- }
- else if ("particles" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_PARTICLES;
- }
- else if ("composition" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_COMPOSITION;
- }
- else if ("glow" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_GLOW;
- }
- else if ("collision skeleton" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_AVATAR_VOLUME;
- }
- else if ("raycast" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_RAYCAST;
- }
- else if ("agent target" == info_display)
- {
- return LLPipeline::RENDER_DEBUG_AGENT_TARGET;
- }
- else
- {
- return 0;
- }
- };
- class LLAdvancedToggleInfoDisplay : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- U32 info_display = info_display_from_string( userdata.asString() );
- if ( info_display != 0 )
- {
- LLPipeline::toggleRenderDebug( (void*)info_display );
- }
- return true;
- }
- };
- class LLAdvancedCheckInfoDisplay : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- U32 info_display = info_display_from_string( userdata.asString() );
- bool new_value = false;
- if ( info_display != 0 )
- {
- new_value = LLPipeline::toggleRenderDebugControl( (void*)info_display );
- }
- return new_value;
- }
- };
- ///////////////////////////
- //// RANDOMIZE FRAMERATE //
- ///////////////////////////
- class LLAdvancedToggleRandomizeFramerate : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gRandomizeFramerate = !(gRandomizeFramerate);
- return true;
- }
- };
- class LLAdvancedCheckRandomizeFramerate : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gRandomizeFramerate;
- return new_value;
- }
- };
- void run_vectorize_perf_test(void *)
- {
- gSavedSettings.setBOOL("VectorizePerfTest", TRUE);
- }
- ////////////////////////////////
- // RUN Vectorized Perform Test//
- ////////////////////////////////
- class LLAdvancedVectorizePerfTest : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- run_vectorize_perf_test(NULL);
- return true;
- }
- };
- ///////////////////////////
- //// PERIODIC SLOW FRAME //
- ///////////////////////////
- class LLAdvancedTogglePeriodicSlowFrame : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gPeriodicSlowFrame = !(gPeriodicSlowFrame);
- return true;
- }
- };
- class LLAdvancedCheckPeriodicSlowFrame : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gPeriodicSlowFrame;
- return new_value;
- }
- };
- ////////////////
- // FRAME TEST //
- ////////////////
- class LLAdvancedToggleFrameTest : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLPipeline::sRenderFrameTest = !(LLPipeline::sRenderFrameTest);
- return true;
- }
- };
- class LLAdvancedCheckFrameTest : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLPipeline::sRenderFrameTest;
- return new_value;
- }
- };
- ///////////////////////////
- // SELECTED TEXTURE INFO //
- ///////////////////////////
- class LLAdvancedSelectedTextureInfo : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_selected_texture_info(NULL);
- return true;
- }
- };
- //////////////////////
- // TOGGLE WIREFRAME //
- //////////////////////
- class LLAdvancedToggleWireframe : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gUseWireframe = !(gUseWireframe);
- return true;
- }
- };
- class LLAdvancedCheckWireframe : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gUseWireframe;
- return new_value;
- }
- };
-
- //////////////////////
- // TEXTURE ATLAS //
- //////////////////////
- class LLAdvancedToggleTextureAtlas : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerTexture::sUseTextureAtlas = !LLViewerTexture::sUseTextureAtlas;
- gSavedSettings.setBOOL("EnableTextureAtlas", LLViewerTexture::sUseTextureAtlas) ;
- return true;
- }
- };
- class LLAdvancedCheckTextureAtlas : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLViewerTexture::sUseTextureAtlas; // <-- make this using LLCacheControl
- return new_value;
- }
- };
- //////////////////////////
- // DUMP SCRIPTED CAMERA //
- //////////////////////////
-
- class LLAdvancedDumpScriptedCamera : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_dump_followcam(NULL);
- return true;
- }
- };
- //////////////////////////////
- // DUMP REGION OBJECT CACHE //
- //////////////////////////////
- class LLAdvancedDumpRegionObjectCache : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_dump_region_object_cache(NULL);
- return true;
- }
- };
- class LLAdvancedBuyCurrencyTest : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_buy_currency_test(NULL);
- return true;
- }
- };
- /////////////////////
- // DUMP SELECT MGR //
- /////////////////////
- class LLAdvancedDumpSelectMgr : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- dump_select_mgr(NULL);
- return true;
- }
- };
- ////////////////////
- // DUMP INVENTORY //
- ////////////////////
- class LLAdvancedDumpInventory : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- dump_inventory(NULL);
- return true;
- }
- };
- ////////////////////////////////
- // PRINT SELECTED OBJECT INFO //
- ////////////////////////////////
- class LLAdvancedPrintSelectedObjectInfo : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- print_object_info(NULL);
- return true;
- }
- };
- //////////////////////
- // PRINT AGENT INFO //
- //////////////////////
- class LLAdvancedPrintAgentInfo : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- print_agent_nvpairs(NULL);
- return true;
- }
- };
- ////////////////////////////////
- // PRINT TEXTURE MEMORY STATS //
- ////////////////////////////////
- class LLAdvancedPrintTextureMemoryStats : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- output_statistics(NULL);
- return true;
- }
- };
- //////////////////
- // DEBUG CLICKS //
- //////////////////
- class LLAdvancedToggleDebugClicks : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gDebugClicks = !(gDebugClicks);
- return true;
- }
- };
- class LLAdvancedCheckDebugClicks : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gDebugClicks;
- return new_value;
- }
- };
- /////////////////
- // DEBUG VIEWS //
- /////////////////
- class LLAdvancedToggleDebugViews : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLView::sDebugRects = !(LLView::sDebugRects);
- return true;
- }
- };
- class LLAdvancedCheckDebugViews : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLView::sDebugRects;
- return new_value;
- }
- };
- ///////////////////////
- // XUI NAME TOOLTIPS //
- ///////////////////////
- class LLAdvancedToggleXUINameTooltips : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- toggle_show_xui_names(NULL);
- return true;
- }
- };
- class LLAdvancedCheckXUINameTooltips : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = check_show_xui_names(NULL);
- return new_value;
- }
- };
- ////////////////////////
- // DEBUG MOUSE EVENTS //
- ////////////////////////
- class LLAdvancedToggleDebugMouseEvents : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLView::sDebugMouseHandling = !(LLView::sDebugMouseHandling);
- return true;
- }
- };
- class LLAdvancedCheckDebugMouseEvents : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLView::sDebugMouseHandling;
- return new_value;
- }
- };
- ////////////////
- // DEBUG KEYS //
- ////////////////
- class LLAdvancedToggleDebugKeys : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLView::sDebugKeys = !(LLView::sDebugKeys);
- return true;
- }
- };
-
- class LLAdvancedCheckDebugKeys : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLView::sDebugKeys;
- return new_value;
- }
- };
-
- ///////////////////////
- // DEBUG WINDOW PROC //
- ///////////////////////
- class LLAdvancedToggleDebugWindowProc : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gDebugWindowProc = !(gDebugWindowProc);
- return true;
- }
- };
- class LLAdvancedCheckDebugWindowProc : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gDebugWindowProc;
- return new_value;
- }
- };
- // ------------------------------XUI MENU ---------------------------
- //////////////////////
- // LOAD UI FROM XML //
- //////////////////////
- class LLAdvancedLoadUIFromXML : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_load_from_xml(NULL);
- return true;
- }
- };
- ////////////////////
- // SAVE UI TO XML //
- ////////////////////
- class LLAdvancedSaveUIToXML : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_save_to_xml(NULL);
- return true;
- }
- };
- class LLAdvancedSendTestIms : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLIMModel::instance().testMessages();
- return true;
- }
- };
- ///////////////
- // XUI NAMES //
- ///////////////
- class LLAdvancedToggleXUINames : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- toggle_show_xui_names(NULL);
- return true;
- }
- };
- class LLAdvancedCheckXUINames : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = check_show_xui_names(NULL);
- return new_value;
- }
- };
- ////////////////////////
- // GRAB BAKED TEXTURE //
- ////////////////////////
- class LLAdvancedGrabBakedTexture : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- std::string texture_type = userdata.asString();
- if ("iris" == texture_type)
- {
- handle_grab_texture( (void*)TEX_EYES_BAKED );
- }
- else if ("head" == texture_type)
- {
- handle_grab_texture( (void*)TEX_HEAD_BAKED );
- }
- else if ("upper" == texture_type)
- {
- handle_grab_texture( (void*)TEX_UPPER_BAKED );
- }
- else if ("lower" == texture_type)
- {
- handle_grab_texture( (void*)TEX_SKIRT_BAKED );
- }
- else if ("skirt" == texture_type)
- {
- handle_grab_texture( (void*)TEX_SKIRT_BAKED );
- }
- else if ("hair" == texture_type)
- {
- handle_grab_texture( (void*)TEX_HAIR_BAKED );
- }
- return true;
- }
- };
- class LLAdvancedEnableGrabBakedTexture : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- std::string texture_type = userdata.asString();
- bool new_value = false;
- if ("iris" == texture_type)
- {
- new_value = enable_grab_texture( (void*)TEX_EYES_BAKED );
- }
- else if ("head" == texture_type)
- {
- new_value = enable_grab_texture( (void*)TEX_HEAD_BAKED );
- }
- else if ("upper" == texture_type)
- {
- new_value = enable_grab_texture( (void*)TEX_UPPER_BAKED );
- }
- else if ("lower" == texture_type)
- {
- new_value = enable_grab_texture( (void*)TEX_LOWER_BAKED );
- }
- else if ("skirt" == texture_type)
- {
- new_value = enable_grab_texture( (void*)TEX_SKIRT_BAKED );
- }
-
- return new_value;
- }
- };
- ///////////////////////
- // APPEARANCE TO XML //
- ///////////////////////
- class LLAdvancedAppearanceToXML : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar::dumpArchetypeXML(NULL);
- return true;
- }
- };
- ///////////////////////////////
- // TOGGLE CHARACTER GEOMETRY //
- ///////////////////////////////
- class LLAdvancedToggleCharacterGeometry : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_god_request_avatar_geometry(NULL);
- return true;
- }
- };
- /////////////////////////////
- // TEST MALE / TEST FEMALE //
- /////////////////////////////
- class LLAdvancedTestMale : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_test_male(NULL);
- return true;
- }
- };
- class LLAdvancedTestFemale : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_test_female(NULL);
- return true;
- }
- };
- ///////////////
- // TOGGLE PG //
- ///////////////
- class LLAdvancedTogglePG : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_toggle_pg(NULL);
- return true;
- }
- };
- class LLAdvancedForceParamsToDefault : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLAgent::clearVisualParams(NULL);
- return true;
- }
- };
- //////////////////////////
- // RELOAD VERTEX SHADER //
- //////////////////////////
- class LLAdvancedReloadVertexShader : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- reload_vertex_shader(NULL);
- return true;
- }
- };
- ////////////////////
- // ANIMATION INFO //
- ////////////////////
- class LLAdvancedToggleAnimationInfo : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar::sShowAnimationDebug = !(LLVOAvatar::sShowAnimationDebug);
- return true;
- }
- };
- class LLAdvancedCheckAnimationInfo : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLVOAvatar::sShowAnimationDebug;
- return new_value;
- }
- };
- //////////////////
- // SHOW LOOK AT //
- //////////////////
- class LLAdvancedToggleShowLookAt : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLHUDEffectLookAt::sDebugLookAt = !(LLHUDEffectLookAt::sDebugLookAt);
- return true;
- }
- };
- class LLAdvancedCheckShowLookAt : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLHUDEffectLookAt::sDebugLookAt;
- return new_value;
- }
- };
- ///////////////////
- // SHOW POINT AT //
- ///////////////////
- class LLAdvancedToggleShowPointAt : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLHUDEffectPointAt::sDebugPointAt = !(LLHUDEffectPointAt::sDebugPointAt);
- return true;
- }
- };
- class LLAdvancedCheckShowPointAt : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLHUDEffectPointAt::sDebugPointAt;
- return new_value;
- }
- };
- /////////////////////////
- // DEBUG JOINT UPDATES //
- /////////////////////////
- class LLAdvancedToggleDebugJointUpdates : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar::sJointDebug = !(LLVOAvatar::sJointDebug);
- return true;
- }
- };
- class LLAdvancedCheckDebugJointUpdates : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLVOAvatar::sJointDebug;
- return new_value;
- }
- };
- /////////////////
- // DISABLE LOD //
- /////////////////
- class LLAdvancedToggleDisableLOD : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerJoint::sDisableLOD = !(LLViewerJoint::sDisableLOD);
- return true;
- }
- };
-
- class LLAdvancedCheckDisableLOD : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLViewerJoint::sDisableLOD;
- return new_value;
- }
- };
- /////////////////////////
- // DEBUG CHARACTER VIS //
- /////////////////////////
- class LLAdvancedToggleDebugCharacterVis : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar::sDebugInvisible = !(LLVOAvatar::sDebugInvisible);
- return true;
- }
- };
- class LLAdvancedCheckDebugCharacterVis : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLVOAvatar::sDebugInvisible;
- return new_value;
- }
- };
- //////////////////////
- // DUMP ATTACHMENTS //
- //////////////////////
-
- class LLAdvancedDumpAttachments : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_dump_attachments(NULL);
- return true;
- }
- };
-
- /////////////////////
- // REBAKE TEXTURES //
- /////////////////////
-
-
- class LLAdvancedRebakeTextures : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_rebake_textures(NULL);
- return true;
- }
- };
-
-
- #if 1 //ndef LL_RELEASE_FOR_DOWNLOAD
- ///////////////////////////
- // DEBUG AVATAR TEXTURES //
- ///////////////////////////
- class LLAdvancedDebugAvatarTextures : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- #ifndef LL_RELEASE_FOR_DOWNLOAD
- handle_debug_avatar_textures(NULL);
- #endif
- return true;
- }
- };
- ////////////////////////////////
- // DUMP AVATAR LOCAL TEXTURES //
- ////////////////////////////////
- class LLAdvancedDumpAvatarLocalTextures : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- #ifndef LL_RELEASE_FOR_DOWNLOAD
- handle_dump_avatar_local_textures(NULL);
- #endif
- return true;
- }
- };
- #endif
-
- /////////////////
- // MESSAGE LOG //
- /////////////////
- class LLAdvancedEnableMessageLog : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_viewer_enable_message_log(NULL);
- return true;
- }
- };
- class LLAdvancedDisableMessageLog : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_viewer_disable_message_log(NULL);
- return true;
- }
- };
- /////////////////
- // DROP PACKET //
- /////////////////
- class LLAdvancedDropPacket : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gMessageSystem->mPacketRing.dropPackets(1);
- return true;
- }
- };
- /////////////////
- // AGENT PILOT //
- /////////////////
- class LLAdvancedAgentPilot : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- std::string command = userdata.asString();
- if ("start playback" == command)
- {
- LLAgentPilot::startPlayback(NULL);
- }
- else if ("stop playback" == command)
- {
- LLAgentPilot::stopPlayback(NULL);
- }
- else if ("start record" == command)
- {
- LLAgentPilot::startRecord(NULL);
- }
- else if ("stop record" == command)
- {
- LLAgentPilot::saveRecord(NULL);
- }
- return true;
- }
- };
- //////////////////////
- // AGENT PILOT LOOP //
- //////////////////////
- class LLAdvancedToggleAgentPilotLoop : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLAgentPilot::sLoop = !(LLAgentPilot::sLoop);
- return true;
- }
- };
- class LLAdvancedCheckAgentPilotLoop : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLAgentPilot::sLoop;
- return new_value;
- }
- };
- /////////////////////////
- // SHOW OBJECT UPDATES //
- /////////////////////////
- class LLAdvancedToggleShowObjectUpdates : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gShowObjectUpdates = !(gShowObjectUpdates);
- return true;
- }
- };
- class LLAdvancedCheckShowObjectUpdates : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gShowObjectUpdates;
- return new_value;
- }
- };
- ////////////////////
- // COMPRESS IMAGE //
- ////////////////////
- class LLAdvancedCompressImage : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_compress_image(NULL);
- return true;
- }
- };
- /////////////////////////
- // SHOW DEBUG SETTINGS //
- /////////////////////////
- class LLAdvancedShowDebugSettings : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLFloaterReg::showInstance("settings_debug",userdata);
- return true;
- }
- };
- ////////////////////////
- // VIEW ADMIN OPTIONS //
- ////////////////////////
- class LLAdvancedToggleViewAdminOptions : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_admin_override_toggle(NULL);
- return true;
- }
- };
- class LLAdvancedCheckViewAdminOptions : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = check_admin_override(NULL);
- return new_value;
- }
- };
- /////////////////////////////////////
- // Enable Object Object Occlusion ///
- /////////////////////////////////////
- class LLAdvancedEnableObjectObjectOcclusion: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
-
- bool new_value = gGLManager.mHasOcclusionQuery; // && LLFeatureManager::getInstance()->isFeatureAvailable(userdata.asString());
- return new_value;
- }
- };
- /////////////////////////////////////
- // Enable Framebuffer Objects ///
- /////////////////////////////////////
- class LLAdvancedEnableRenderFBO: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gGLManager.mHasFramebufferObject;
- return new_value;
- }
- };
- /////////////////////////////////////
- // Enable Deferred Rendering ///
- /////////////////////////////////////
- class LLAdvancedEnableRenderDeferred: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gSavedSettings.getBOOL("RenderUseFBO") && LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_WINDLIGHT > 0) &&
- LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_AVATAR) > 0;
- return new_value;
- }
- };
- /////////////////////////////////////
- // Enable Global Illumination ///
- /////////////////////////////////////
- class LLAdvancedEnableRenderDeferredGI: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gSavedSettings.getBOOL("RenderUseFBO") && gSavedSettings.getBOOL("RenderDeferred");
- return new_value;
- }
- };
- //////////////////
- // ADMIN STATUS //
- //////////////////
- class LLAdvancedRequestAdminStatus : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_god_mode(NULL);
- return true;
- }
- };
- class LLAdvancedLeaveAdminStatus : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_leave_god_mode(NULL);
- return true;
- }
- };
- //////////////////////////
- // Advanced > Debugging //
- //////////////////////////
- class LLAdvancedForceErrorBreakpoint : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- force_error_breakpoint(NULL);
- return true;
- }
- };
- class LLAdvancedForceErrorLlerror : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- force_error_llerror(NULL);
- return true;
- }
- };
- class LLAdvancedForceErrorBadMemoryAccess : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- force_error_bad_memory_access(NULL);
- return true;
- }
- };
- class LLAdvancedForceErrorInfiniteLoop : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- force_error_infinite_loop(NULL);
- return true;
- }
- };
- class LLAdvancedForceErrorSoftwareException : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- force_error_software_exception(NULL);
- return true;
- }
- };
- class LLAdvancedForceErrorDriverCrash : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- force_error_driver_crash(NULL);
- return true;
- }
- };
- class LLAdvancedForceErrorDisconnectViewer : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_disconnect_viewer(NULL);
- return true;
- }
- };
- #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- class LLAdvancedHandleToggleHackedGodmode : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_toggle_hacked_godmode(NULL);
- return true;
- }
- };
- class LLAdvancedCheckToggleHackedGodmode : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- check_toggle_hacked_godmode(NULL);
- return true;
- }
- };
- class LLAdvancedEnableToggleHackedGodmode : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = enable_toggle_hacked_godmode(NULL);
- return new_value;
- }
- };
- #endif
- //
- ////-------------------------------------------------------------------
- //// Advanced menu
- ////-------------------------------------------------------------------
- //////////////////
- // ADMIN MENU //
- //////////////////
- // Admin > Object
- class LLAdminForceTakeCopy : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- force_take_copy(NULL);
- return true;
- }
- };
- class LLAdminHandleObjectOwnerSelf : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_object_owner_self(NULL);
- return true;
- }
- };
- class LLAdminHandleObjectOwnerPermissive : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_object_owner_permissive(NULL);
- return true;
- }
- };
- class LLAdminHandleForceDelete : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_force_delete(NULL);
- return true;
- }
- };
- class LLAdminHandleObjectLock : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_object_lock(NULL);
- return true;
- }
- };
- class LLAdminHandleObjectAssetIDs: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_object_asset_ids(NULL);
- return true;
- }
- };
- //Admin >Parcel
- class LLAdminHandleForceParcelOwnerToMe: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_force_parcel_owner_to_me(NULL);
- return true;
- }
- };
- class LLAdminHandleForceParcelToContent: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_force_parcel_to_content(NULL);
- return true;
- }
- };
- class LLAdminHandleClaimPublicLand: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_claim_public_land(NULL);
- return true;
- }
- };
- // Admin > Region
- class LLAdminHandleRegionDumpTempAssetData: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_region_dump_temp_asset_data(NULL);
- return true;
- }
- };
- //Admin (Top Level)
- class LLAdminOnSaveState: public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLPanelRegionTools::onSaveState(NULL);
- return true;
- }
- };
- //-----------------------------------------------------------------------------
- // cleanup_menus()
- //-----------------------------------------------------------------------------
- void cleanup_menus()
- {
- delete gMenuParcelObserver;
- gMenuParcelObserver = NULL;
- delete gMenuAvatarSelf;
- gMenuAvatarSelf = NULL;
- delete gMenuAvatarOther;
- gMenuAvatarOther = NULL;
- delete gMenuObject;
- gMenuObject = NULL;
- delete gMenuAttachmentSelf;
- gMenuAttachmentSelf = NULL;
- delete gMenuAttachmentOther;
- gMenuAttachmentSelf = NULL;
- delete gMenuLand;
- gMenuLand = NULL;
- delete gMenuBarView;
- gMenuBarView = NULL;
- delete gPopupMenuView;
- gPopupMenuView = NULL;
- delete gMenuHolder;
- gMenuHolder = NULL;
- }
- //-----------------------------------------------------------------------------
- // Object pie menu
- //-----------------------------------------------------------------------------
- class LLObjectReportAbuse : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (objectp)
- {
- LLFloaterReporter::showFromObject(objectp->getID());
- }
- return true;
- }
- };
- // Enabled it you clicked an object
- class LLObjectEnableReportAbuse : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLSelectMgr::getInstance()->getSelection()->getObjectCount() != 0;
- return new_value;
- }
- };
- void handle_object_touch()
- {
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return;
- LLPickInfo pick = LLToolPie::getInstance()->getPick();
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_ObjectGrab);
- msg->nextBlockFast( _PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast( _PREHASH_ObjectData);
- msg->addU32Fast( _PREHASH_LocalID, object->mLocalID);
- msg->addVector3Fast(_PREHASH_GrabOffset, LLVector3::zero );
- msg->nextBlock("SurfaceInfo");
- msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
- msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
- msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
- msg->addVector3("Position", pick.mIntersection);
- msg->addVector3("Normal", pick.mNormal);
- msg->addVector3("Binormal", pick.mBinormal);
- msg->sendMessage( object->getRegion()->getHost());
- // *NOTE: Hope the packets arrive safely and in order or else
- // there will be some problems.
- // *TODO: Just fix this bad assumption.
- msg->newMessageFast(_PREHASH_ObjectDeGrab);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_ObjectData);
- msg->addU32Fast(_PREHASH_LocalID, object->mLocalID);
- msg->nextBlock("SurfaceInfo");
- msg->addVector3("UVCoord", LLVector3(pick.mUVCoords));
- msg->addVector3("STCoord", LLVector3(pick.mSTCoords));
- msg->addS32Fast(_PREHASH_FaceIndex, pick.mObjectFace);
- msg->addVector3("Position", pick.mIntersection);
- msg->addVector3("Normal", pick.mNormal);
- msg->addVector3("Binormal", pick.mBinormal);
- msg->sendMessage(object->getRegion()->getHost());
- }
- bool enable_object_touch()
- {
- LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- return obj && obj->flagHandleTouch();
- }
- // One object must have touch sensor
- class LLObjectEnableTouch : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = enable_object_touch();
- // Update label based on the node touch name if available.
- std::string touch_text;
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (node && node->mValid && !node->mTouchName.empty())
- {
- touch_text = node->mTouchName;
- }
- else
- {
- touch_text = userdata.asString();
- }
- gMenuHolder->childSetText("Object Touch", touch_text);
- gMenuHolder->childSetText("Attachment Object Touch", touch_text);
- return new_value;
- }
- };
- //void label_touch(std::string& label, void*)
- //{
- // LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- // if (node && node->mValid && !node->mTouchName.empty())
- // {
- // label.assign(node->mTouchName);
- // }
- // else
- // {
- // label.assign("Touch");
- // }
- //}
- void handle_object_open()
- {
- LLFloaterReg::showInstance("openobject");
- }
- bool enable_object_open()
- {
- // Look for contents in root object, which is all the LLFloaterOpenObject
- // understands.
- LLViewerObject* obj = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!obj) return false;
- LLViewerObject* root = obj->getRootEdit();
- if (!root) return false;
- return root->allowOpen();
- }
- class LLViewJoystickFlycam : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_toggle_flycam();
- return true;
- }
- };
- class LLViewCheckJoystickFlycam : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLViewerJoystick::getInstance()->getOverrideCamera();
- return new_value;
- }
- };
- void handle_toggle_flycam()
- {
- LLViewerJoystick::getInstance()->toggleFlycam();
- }
- class LLObjectBuild : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") )
- {
- // zoom in if we're looking at the avatar
- gAgent.setFocusOnAvatar(FALSE, ANIMATE);
- gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gAgent.cameraZoomIn(0.666f);
- gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD );
- gViewerWindow->moveCursorToCenter();
- }
- else if ( gSavedSettings.getBOOL("EditCameraMovement") )
- {
- gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gViewerWindow->moveCursorToCenter();
- }
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
- // Could be first use
- //LLFirstUse::useBuild();
- return true;
- }
- };
- void handle_object_edit()
- {
- LLViewerParcelMgr::getInstance()->deselectLand();
- if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit())
- {
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- if (selection->getSelectType() == SELECT_TYPE_HUD || !gSavedSettings.getBOOL("EditCameraMovement"))
- {
- // always freeze camera in space, even if camera doesn't move
- // so, for example, follow cam scripts can't affect you when in build mode
- gAgent.setFocusGlobal(gAgent.calcFocusPositionTargetGlobal(), LLUUID::null);
- gAgent.setFocusOnAvatar(FALSE, ANIMATE);
- }
- else
- {
- gAgent.setFocusOnAvatar(FALSE, ANIMATE);
- LLViewerObject* selected_objectp = selection->getFirstRootObject();
- if (selected_objectp)
- {
- // zoom in on object center instead of where we clicked, as we need to see the manipulator handles
- gAgent.setFocusGlobal(selected_objectp->getPositionGlobal(), selected_objectp->getID());
- gAgent.cameraZoomIn(0.666f);
- gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD );
- gViewerWindow->moveCursorToCenter();
- }
- }
- }
-
- LLFloaterReg::showInstance("build");
-
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- gFloaterTools->setEditTool( LLToolCompTranslate::getInstance() );
-
- LLViewerJoystick::getInstance()->moveObjects(true);
- LLViewerJoystick::getInstance()->setNeedsReset(true);
-
- // Could be first use
- //LLFirstUse::useBuild();
- return;
- }
- void handle_object_inspect()
- {
- LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection();
- LLViewerObject* selected_objectp = selection->getFirstRootObject();
- if (selected_objectp)
- {
- LLSD key;
- key["task"] = "task";
- LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
- }
-
- /*
- // Old floater properties
- LLFloaterReg::showInstance("inspect", LLSD());
- */
- }
- //---------------------------------------------------------------------------
- // Land pie menu
- //---------------------------------------------------------------------------
- class LLLandBuild : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerParcelMgr::getInstance()->deselectLand();
- if (gAgent.getFocusOnAvatar() && !LLToolMgr::getInstance()->inEdit() && gSavedSettings.getBOOL("EditCameraMovement") )
- {
- // zoom in if we're looking at the avatar
- gAgent.setFocusOnAvatar(FALSE, ANIMATE);
- gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gAgent.cameraZoomIn(0.666f);
- gAgent.cameraOrbitOver( 30.f * DEG_TO_RAD );
- gViewerWindow->moveCursorToCenter();
- }
- else if ( gSavedSettings.getBOOL("EditCameraMovement") )
- {
- // otherwise just move focus
- gAgent.setFocusGlobal(LLToolPie::getInstance()->getPick());
- gViewerWindow->moveCursorToCenter();
- }
- LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
- LLToolMgr::getInstance()->getCurrentToolset()->selectTool( LLToolCompCreate::getInstance() );
- // Could be first use
- //LLFirstUse::useBuild();
- return true;
- }
- };
- class LLLandBuyPass : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLPanelLandGeneral::onClickBuyPass((void *)FALSE);
- return true;
- }
- };
- class LLLandEnableBuyPass : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLPanelLandGeneral::enableBuyPass(NULL);
- return new_value;
- }
- };
- // BUG: Should really check if CLICK POINT is in a parcel where you can build.
- BOOL enable_land_build(void*)
- {
- if (gAgent.isGodlike()) return TRUE;
- if (gAgent.inPrelude()) return FALSE;
- BOOL can_build = FALSE;
- LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (agent_parcel)
- {
- can_build = agent_parcel->getAllowModify();
- }
- return can_build;
- }
- // BUG: Should really check if OBJECT is in a parcel where you can build.
- BOOL enable_object_build(void*)
- {
- if (gAgent.isGodlike()) return TRUE;
- if (gAgent.inPrelude()) return FALSE;
- BOOL can_build = FALSE;
- LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
- if (agent_parcel)
- {
- can_build = agent_parcel->getAllowModify();
- }
- return can_build;
- }
- bool enable_object_edit()
- {
- // *HACK: The new "prelude" Help Islands have a build sandbox area,
- // so users need the Edit and Create pie menu options when they are
- // there. Eventually this needs to be replaced with code that only
- // lets you edit objects if you have permission to do so (edit perms,
- // group edit, god). See also lltoolbar.cpp. JC
- bool enable = false;
- if (gAgent.inPrelude())
- {
- enable = LLViewerParcelMgr::getInstance()->allowAgentBuild()
- || LLSelectMgr::getInstance()->getSelection()->isAttachment();
- }
- else if (LLSelectMgr::getInstance()->selectGetAllValidAndObjectsFound())
- {
- enable = true;
- }
- return enable;
- }
- // mutually exclusive - show either edit option or build in menu
- bool enable_object_build()
- {
- return !enable_object_edit();
- }
- class LLSelfRemoveAllAttachments : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLAgentWearables::userRemoveAllAttachments();
- return true;
- }
- };
- class LLSelfEnableRemoveAllAttachments : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = false;
- if (gAgent.getAvatarObject())
- {
- LLVOAvatar* avatarp = gAgent.getAvatarObject();
- for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin();
- iter != avatarp->mAttachmentPoints.end(); )
- {
- LLVOAvatar::attachment_map_t::iterator curiter = iter++;
- LLViewerJointAttachment* attachment = curiter->second;
- if (attachment->getNumObjects() > 0)
- {
- new_value = true;
- break;
- }
- }
- }
- return new_value;
- }
- };
- BOOL enable_has_attachments(void*)
- {
- return FALSE;
- }
- //---------------------------------------------------------------------------
- // Avatar pie menu
- //---------------------------------------------------------------------------
- //void handle_follow(void *userdata)
- //{
- // // follow a given avatar by ID
- // LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- // if (objectp)
- // {
- // gAgent.startFollowPilot(objectp->getID());
- // }
- //}
- bool enable_object_mute()
- {
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return false;
- LLVOAvatar* avatar = find_avatar_from_object(object);
- if (avatar)
- {
- // It's an avatar
- LLNameValue *lastname = avatar->getNVPair("LastName");
- bool is_linden =
- lastname && !LLStringUtil::compareStrings(lastname->getString(), "Linden");
- bool is_self = avatar->isSelf();
- return !is_linden && !is_self;
- }
- else
- {
- // Just a regular object
- return LLSelectMgr::getInstance()->getSelection()->
- contains( object, SELECT_ALL_TES );
- }
- }
- class LLObjectMute : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (!object) return true;
-
- LLUUID id;
- std::string name;
- LLMute::EType type;
- LLVOAvatar* avatar = find_avatar_from_object(object);
- if (avatar)
- {
- id = avatar->getID();
- LLNameValue *firstname = avatar->getNVPair("FirstName");
- LLNameValue *lastname = avatar->getNVPair("LastName");
- if (firstname && lastname)
- {
- name = firstname->getString();
- name += " ";
- name += lastname->getString();
- }
-
- type = LLMute::AGENT;
- }
- else
- {
- // it's an object
- id = object->getID();
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if (node)
- {
- name = node->mName;
- }
-
- type = LLMute::OBJECT;
- }
-
- LLMute mute(id, name, type);
- if (LLMuteList::getInstance()->isMuted(mute.mID, mute.mName))
- {
- LLMuteList::getInstance()->remove(mute);
- }
- else
- {
- LLMuteList::getInstance()->add(mute);
- LLPanelBlockedList::showPanelAndSelect(mute.mID);
- }
-
- return true;
- }
- };
- bool handle_go_to()
- {
- // try simulator autopilot
- std::vector<std::string> strings;
- std::string val;
- LLVector3d pos = LLToolPie::getInstance()->getPick().mPosGlobal;
- val = llformat("%g", pos.mdV[VX]);
- strings.push_back(val);
- val = llformat("%g", pos.mdV[VY]);
- strings.push_back(val);
- val = llformat("%g", pos.mdV[VZ]);
- strings.push_back(val);
- send_generic_message("autopilot", strings);
- LLViewerParcelMgr::getInstance()->deselectLand();
- if (gAgent.getAvatarObject() && !gSavedSettings.getBOOL("AutoPilotLocksCamera"))
- {
- gAgent.setFocusGlobal(gAgent.getFocusTargetGlobal(), gAgent.getAvatarObject()->getID());
- }
- else
- {
- // Snap camera back to behind avatar
- gAgent.setFocusOnAvatar(TRUE, ANIMATE);
- }
- // Could be first use
- //LLFirstUse::useGoTo();
- return true;
- }
- class LLGoToObject : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- return handle_go_to();
- }
- };
- class LLAvatarReportAbuse : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if(avatar)
- {
- LLFloaterReporter::showFromObject(avatar->getID());
- }
- return true;
- }
- };
- //---------------------------------------------------------------------------
- // Parcel freeze, eject, etc.
- //---------------------------------------------------------------------------
- bool callback_freeze(const LLSD& notification, const LLSD& response)
- {
- LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (0 == option || 1 == option)
- {
- U32 flags = 0x0;
- if (1 == option)
- {
- // unfreeze
- flags |= 0x1;
- }
- LLMessageSystem* msg = gMessageSystem;
- LLViewerObject* avatar = gObjectList.findObject(avatar_id);
- if (avatar)
- {
- msg->newMessage("FreezeUser");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->nextBlock("Data");
- msg->addUUID("TargetID", avatar_id );
- msg->addU32("Flags", flags );
- msg->sendReliable( avatar->getRegion()->getHost() );
- }
- }
- return false;
- }
- void handle_avatar_freeze(const LLSD& avatar_id)
- {
- // Use avatar_id if available, otherwise default to right-click avatar
- LLVOAvatar* avatar = NULL;
- if (avatar_id.asUUID().notNull())
- {
- avatar = find_avatar_from_object(avatar_id.asUUID());
- }
- else
- {
- avatar = find_avatar_from_object(
- LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- }
- if( avatar )
- {
- std::string fullname = avatar->getFullname();
- LLSD payload;
- payload["avatar_id"] = avatar->getID();
- if (!fullname.empty())
- {
- LLSD args;
- args["AVATAR_NAME"] = fullname;
- LLNotificationsUtil::add("FreezeAvatarFullname",
- args,
- payload,
- callback_freeze);
- }
- else
- {
- LLNotificationsUtil::add("FreezeAvatar",
- LLSD(),
- payload,
- callback_freeze);
- }
- }
- }
- class LLAvatarVisibleDebug : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- return gAgent.isGodlike();
- }
- };
- class LLAvatarDebug : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() );
- if( avatar )
- {
- if (avatar->isSelf())
- {
- ((LLVOAvatarSelf *)avatar)->dumpLocalTextures();
- }
- llinfos << "Dumping temporary asset data to simulator logs for avatar " << avatar->getID() << llendl;
- std::vector<std::string> strings;
- strings.push_back(avatar->getID().asString());
- LLUUID invoice;
- send_generic_message("dumptempassetdata", strings, invoice);
- LLFloaterReg::showInstance( "avatar_textures", LLSD(avatar->getID()) );
- }
- return true;
- }
- };
- bool callback_eject(const LLSD& notification, const LLSD& response)
- {
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (2 == option)
- {
- // Cancel button.
- return false;
- }
- LLUUID avatar_id = notification["payload"]["avatar_id"].asUUID();
- bool ban_enabled = notification["payload"]["ban_enabled"].asBoolean();
- if (0 == option)
- {
- // Eject button
- LLMessageSystem* msg = gMessageSystem;
- LLViewerObject* avatar = gObjectList.findObject(avatar_id);
- if (avatar)
- {
- U32 flags = 0x0;
- msg->newMessage("EjectUser");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID() );
- msg->nextBlock("Data");
- msg->addUUID("TargetID", avatar_id );
- msg->addU32("Flags", flags );
- msg->sendReliable( avatar->getRegion()->getHost() );
- }
- }
- else if (ban_enabled)
- {
- // This is tricky. It is similar to say if it is not an 'Eject' button,
- // and it is also not an 'Cancle' button, and ban_enabled==ture,
- // it should be the 'Eject and Ban' button.
- LLMessageSystem* msg = gMessageSystem;
- LLViewerObject* avatar = gObjectList.findObject(avatar_id);
- if (avatar)
- {
- U32 flags = 0x1;
- msg->newMessage("EjectUser");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID() );
- msg->addUUID("SessionID", gAgent.getSessionID() );
- msg->nextBlock("Data");
- msg->addUUID("TargetID", avatar_id );
- msg->addU32("Flags", flags );
- msg->sendReliable( avatar->getRegion()->getHost() );
- }
- }
- return false;
- }
- void handle_avatar_eject(const LLSD& avatar_id)
- {
- // Use avatar_id if available, otherwise default to right-click avatar
- LLVOAvatar* avatar = NULL;
- if (avatar_id.asUUID().notNull())
- {
- avatar = find_avatar_from_object(avatar_id.asUUID());
- }
- else
- {
- avatar = find_avatar_from_object(
- LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- }
- if( avatar )
- {
- LLSD payload;
- payload["avatar_id"] = avatar->getID();
- std::string fullname = avatar->getFullname();
- const LLVector3d& pos = avatar->getPositionGlobal();
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos)->getParcel();
-
- if (LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_MANAGE_BANNED))
- {
- payload["ban_enabled"] = true;
- if (!fullname.empty())
- {
- LLSD args;
- args["AVATAR_NAME"] = fullname;
- LLNotificationsUtil::add("EjectAvatarFullname",
- args,
- payload,
- callback_eject);
- }
- else
- {
- LLNotificationsUtil::add("EjectAvatarFullname",
- LLSD(),
- payload,
- callback_eject);
- }
- }
- else
- {
- payload["ban_enabled"] = false;
- if (!fullname.empty())
- {
- LLSD args;
- args["AVATAR_NAME"] = fullname;
- LLNotificationsUtil::add("EjectAvatarFullnameNoBan",
- args,
- payload,
- callback_eject);
- }
- else
- {
- LLNotificationsUtil::add("EjectAvatarNoBan",
- LLSD(),
- payload,
- callback_eject);
- }
- }
- }
- }
- bool enable_freeze_eject(const LLSD& avatar_id)
- {
- // Use avatar_id if available, otherwise default to right-click avatar
- LLVOAvatar* avatar = NULL;
- if (avatar_id.asUUID().notNull())
- {
- avatar = find_avatar_from_object(avatar_id.asUUID());
- }
- else
- {
- avatar = find_avatar_from_object(
- LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- }
- if (!avatar) return false;
- // Gods can always freeze
- if (gAgent.isGodlike()) return true;
- // Estate owners / managers can freeze
- // Parcel owners can also freeze
- const LLVector3& pos = avatar->getPositionRegion();
- const LLVector3d& pos_global = avatar->getPositionGlobal();
- LLParcel* parcel = LLViewerParcelMgr::getInstance()->selectParcelAt(pos_global)->getParcel();
- LLViewerRegion* region = avatar->getRegion();
- if (!region) return false;
-
- bool new_value = region->isOwnedSelf(pos);
- if (!new_value || region->isOwnedGroup(pos))
- {
- new_value = LLViewerParcelMgr::getInstance()->isParcelOwnedByAgent(parcel,GP_LAND_ADMIN);
- }
- return new_value;
- }
- class LLAvatarGiveCard : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- llinfos << "handle_give_card()" << llendl;
- LLViewerObject* dest = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if(dest && dest->isAvatar())
- {
- bool found_name = false;
- LLSD args;
- LLSD old_args;
- LLNameValue* nvfirst = dest->getNVPair("FirstName");
- LLNameValue* nvlast = dest->getNVPair("LastName");
- if(nvfirst && nvlast)
- {
- args["FIRST"] = nvfirst->getString();
- args["LAST"] = nvlast->getString();
- old_args["FIRST"] = nvfirst->getString();
- old_args["LAST"] = nvlast->getString();
- found_name = true;
- }
- LLViewerRegion* region = dest->getRegion();
- LLHost dest_host;
- if(region)
- {
- dest_host = region->getHost();
- }
- if(found_name && dest_host.isOk())
- {
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("OfferCallingCard");
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_AgentBlock);
- msg->addUUIDFast(_PREHASH_DestID, dest->getID());
- LLUUID transaction_id;
- transaction_id.generate();
- msg->addUUIDFast(_PREHASH_TransactionID, transaction_id);
- msg->sendReliable(dest_host);
- LLNotificationsUtil::add("OfferedCard", args);
- }
- else
- {
- LLNotificationsUtil::add("CantOfferCallingCard", old_args);
- }
- }
- return true;
- }
- };
- void login_done(S32 which, void *user)
- {
- llinfos << "Login done " << which << llendl;
- LLPanelLogin::closePanel();
- }
- bool callback_leave_group(const LLSD& notification, const LLSD& response)
- {
- S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
- if (option == 0)
- {
- LLMessageSystem *msg = gMessageSystem;
- msg->newMessageFast(_PREHASH_LeaveGroupRequest);
- msg->nextBlockFast(_PREHASH_AgentData);
- msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID() );
- msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- msg->nextBlockFast(_PREHASH_GroupData);
- msg->addUUIDFast(_PREHASH_GroupID, gAgent.getGroupID() );
- gAgent.sendReliableMessage();
- }
- return false;
- }
- void append_aggregate(std::string& string, const LLAggregatePermissions& ag_perm, PermissionBit bit, const char* txt)
- {
- LLAggregatePermissions::EValue val = ag_perm.getValue(bit);
- std::string buffer;
- switch(val)
- {
- case LLAggregatePermissions::AP_NONE:
- buffer = llformat( "* %s Nonen", txt);
- break;
- case LLAggregatePermissions::AP_SOME:
- buffer = llformat( "* %s Somen", txt);
- break;
- case LLAggregatePermissions::AP_ALL:
- buffer = llformat( "* %s Alln", txt);
- break;
- case LLAggregatePermissions::AP_EMPTY:
- default:
- break;
- }
- string.append(buffer);
- }
- bool enable_buy_object()
- {
- // In order to buy, there must only be 1 purchaseable object in
- // the selection manger.
- if(LLSelectMgr::getInstance()->getSelection()->getRootObjectCount() != 1) return false;
- LLViewerObject* obj = NULL;
- LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode();
- if(node)
- {
- obj = node->getObject();
- if(!obj) return false;
- if( for_sale_selection(node) )
- {
- // *NOTE: Is this needed? This checks to see if anyone owns the
- // object, dating back to when we had "public" objects owned by
- // no one. JC
- if(obj->permAnyOwner()) return true;
- }
- }
- return false;
- }
- // Note: This will only work if the selected object's data has been
- // received by the viewer and cached in the selection manager.
- void handle_buy_object(LLSaleInfo sale_info)
- {
- if(!LLSelectMgr::getInstance()->selectGetAllRootsValid())
- {
- LLNotificationsUtil::add("UnableToBuyWhileDownloading");
- return;
- }
- LLUUID owner_id;
- std::string owner_name;
- BOOL owners_identical = LLSelectMgr::getInstance()->selectGetOwner(owner_id, owner_name);
- if (!owners_identical)
- {
- LLNotificationsUtil::add("CannotBuyObjectsFromDifferentOwners");
- return;
- }
- LLPermissions perm;
- BOOL valid = LLSelectMgr::getInstance()->selectGetPermissions(perm);
- LLAggregatePermissions ag_perm;
- valid &= LLSelectMgr::getInstance()->selectGetAggregatePermissions(ag_perm);
- if(!valid || !sale_info.isForSale() || !perm.allowTransferTo(gAgent.getID()))
- {
- LLNotificationsUtil::add("ObjectNotForSale");
- return;
- }
- S32 price = sale_info.getSalePrice();
-
- if (price > 0 && price > gStatusBar->getBalance())
- {
- LLFloaterBuyCurrency::buyCurrency("This object costs", price);
- return;
- }
- LLFloaterBuy::show(sale_info);
- }
- void handle_buy_contents(LLSaleInfo sale_info)
- {
- LLFloaterBuyContents::show(sale_info);
- }
- void handle_region_dump_temp_asset_data(void*)
- {
- llinfos << "Dumping temporary asset data to simulator logs" << llendl;
- std::vector<std::string> strings;
- LLUUID invoice;
- send_generic_message("dumptempassetdata", strings, invoice);
- }
- void handle_region_clear_temp_asset_data(void*)
- {
- llinfos << "Clearing temporary asset data" << llendl;
- std::vector<std::string> strings;
- LLUUID invoice;
- send_generic_message("cleartempassetdata", strings, invoice);
- }
- void handle_region_dump_settings(void*)
- {
- LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- llinfos << "Damage: " << (regionp->getAllowDamage() ? "on" : "off") << llendl;
- llinfos << "Landmark: " << (regionp->getAllowLandmark() ? "on" : "off") << llendl;
- llinfos << "SetHome: " << (regionp->getAllowSetHome() ? "on" : "off") << llendl;
- llinfos << "ResetHome: " << (regionp->getResetHomeOnTeleport() ? "on" : "off") << llendl;
- llinfos << "SunFixed: " << (regionp->getSunFixed() ? "on" : "off") << llendl;
- llinfos << "BlockFly: " << (regionp->getBlockFly() ? "on" : "off") << llendl;
- llinfos << "AllowP2P: " << (regionp->getAllowDirectTeleport() ? "on" : "off") << llendl;
- llinfos << "Water: " << (regionp->getWaterHeight()) << llendl;
- }
- }
- void handle_dump_group_info(void *)
- {
- gAgent.dumpGroupInfo();
- }
- void handle_dump_capabilities_info(void *)
- {
- LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- regionp->logActiveCapabilities();
- }
- }
- void handle_dump_region_object_cache(void*)
- {
- LLViewerRegion* regionp = gAgent.getRegion();
- if (regionp)
- {
- regionp->dumpCache();
- }
- }
- void handle_dump_focus()
- {
- LLUICtrl *ctrl = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
- llinfos << "Keyboard focus " << (ctrl ? ctrl->getName() : "(none)") << llendl;
- }
- class LLSelfStandUp : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gAgent.standUp();
- return true;
- }
- };
- bool enable_standup_self()
- {
- bool new_value = gAgent.getAvatarObject() && gAgent.getAvatarObject()->isSitting();
- return new_value;
- }
- // Used from the login screen to aid in UI work on side tray
- void handle_show_side_tray()
- {
- LLSideTray* side_tray = LLSideTray::getInstance();
- LLView* root = gViewerWindow->getRootView();
- // automatically removes and re-adds if there already
- root->addChild(side_tray);
- }
- // Toggle one of "People" panel tabs in side tray.
- class LLTogglePanelPeopleTab : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- std::string panel_name = userdata.asString();
- LLSD param;
- param["people_panel_tab_name"] = panel_name;
- static LLPanel* friends_panel = NULL;
- static LLPanel* groups_panel = NULL;
- static LLPanel* nearby_panel = NULL;
- if (panel_name == "friends_panel")
- {
- return togglePeoplePanel(friends_panel, panel_name, param);
- }
- else if (panel_name == "groups_panel")
- {
- return togglePeoplePanel(groups_panel, panel_name, param);
- }
- else if (panel_name == "nearby_panel")
- {
- return togglePeoplePanel(nearby_panel, panel_name, param);
- }
- else
- {
- return false;
- }
- }
- static bool togglePeoplePanel(LLPanel* &panel, const std::string& panel_name, const LLSD& param)
- {
- if(!panel)
- {
- panel = LLSideTray::getInstance()->getPanel(panel_name);
- if(!panel)
- return false;
- }
- LLSideTray::getInstance()->togglePanel(panel, "panel_people", param);
- return true;
- }
- };
- BOOL check_admin_override(void*)
- {
- return gAgent.getAdminOverride();
- }
- void handle_admin_override_toggle(void*)
- {
- gAgent.setAdminOverride(!gAgent.getAdminOverride());
- // The above may have affected which debug menus are visible
- show_debug_menus();
- }
- void handle_god_mode(void*)
- {
- gAgent.requestEnterGodMode();
- }
- void handle_leave_god_mode(void*)
- {
- gAgent.requestLeaveGodMode();
- }
- void set_god_level(U8 god_level)
- {
- U8 old_god_level = gAgent.getGodLevel();
- gAgent.setGodLevel( god_level );
- LLViewerParcelMgr::getInstance()->notifyObservers();
- // God mode changes region visibility
- LLWorldMap::getInstance()->reloadItems(true);
- // inventory in items may change in god mode
- gObjectList.dirtyAllObjectInventory();
- if(gViewerWindow)
- {
- gViewerWindow->setMenuBackgroundColor(god_level > GOD_NOT,
- LLViewerLogin::getInstance()->isInProductionGrid());
- }
-
- LLSD args;
- if(god_level > GOD_NOT)
- {
- args["LEVEL"] = llformat("%d",(S32)god_level);
- LLNotificationsUtil::add("EnteringGodMode", args);
- }
- else
- {
- args["LEVEL"] = llformat("%d",(S32)old_god_level);
- LLNotificationsUtil::add("LeavingGodMode", args);
- }
- // changing god-level can affect which menus we see
- show_debug_menus();
- // changing god-level can invalidate search results
- LLFloaterSearch *search = dynamic_cast<LLFloaterSearch*>(LLFloaterReg::getInstance("search"));
- if (search)
- {
- search->godLevelChanged(god_level);
- }
- }
- #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
- void handle_toggle_hacked_godmode(void*)
- {
- gHackGodmode = !gHackGodmode;
- set_god_level(gHackGodmode ? GOD_MAINTENANCE : GOD_NOT);
- }
- BOOL check_toggle_hacked_godmode(void*)
- {
- return gHackGodmode;
- }
- bool enable_toggle_hacked_godmode(void*)
- {
- return !LLViewerLogin::getInstance()->isInProductionGrid();
- }
- #endif
- void process_grant_godlike_powers(LLMessageSystem* msg, void**)
- {
- LLUUID agent_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_AgentID, agent_id);
- LLUUID session_id;
- msg->getUUIDFast(_PREHASH_AgentData, _PREHASH_SessionID, session_id);
- if((agent_id == gAgent.getID()) && (session_id == gAgent.getSessionID()))
- {
- U8 god_level;
- msg->getU8Fast(_PREHASH_GrantData, _PREHASH_GodLevel, god_level);
- set_god_level(god_level);
- }
- else
- {
- llwarns << "Grant godlike for wrong agent " << agent_id << llendl;
- }
- }
- /*
- class LLHaveCallingcard : public LLInventoryCollectFunctor
- {
- public:
- LLHaveCallingcard(const LLUUID& agent_id);
- virtual ~LLHaveCallingcard() {}
- virtual bool operator()(LLInventoryCategory* cat,
- LLInventoryItem* item);
- BOOL isThere() const { return mIsThere;}
- protected:
- LLUUID mID;
- BOOL mIsThere;
- };
- LLHaveCallingcard::LLHaveCallingcard(const LLUUID& agent_id) :
- mID(agent_id),
- mIsThere(FALSE)
- {
- }
- bool LLHaveCallingcard::operator()(LLInventoryCategory* cat,
- LLInventoryItem* item)
- {
- if(item)
- {
- if((item->getType() == LLAssetType::AT_CALLINGCARD)
- && (item->getCreatorUUID() == mID))
- {
- mIsThere = TRUE;
- }
- }
- return FALSE;
- }
- */
- BOOL is_agent_mappable(const LLUUID& agent_id)
- {
- const LLRelationship* buddy_info = NULL;
- bool is_friend = LLAvatarActions::isFriend(agent_id);
- if (is_friend)
- buddy_info = LLAvatarTracker::instance().getBuddyInfo(agent_id);
- return (buddy_info &&
- buddy_info->isOnline() &&
- buddy_info->isRightGrantedFrom(LLRelationship::GRANT_MAP_LOCATION)
- );
- }
- // Enable a menu item when you don't have someone's card.
- class LLAvatarEnableAddFriend : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject());
- bool new_value = avatar && !LLAvatarActions::isFriend(avatar->getID());
- return new_value;
- }
- };
- void request_friendship(const LLUUID& dest_id)
- {
- LLViewerObject* dest = gObjectList.findObject(dest_id);
- if(dest && dest->isAvatar())
- {
- std::string fullname;
- LLSD args;
- LLNameValue* nvfirst = dest->getNVPair("FirstName");
- LLNameValue* nvlast = dest->getNVPair("LastName");
- if(nvfirst && nvlast)
- {
- args["FIRST"] = nvfirst->getString();
- args["LAST"] = nvlast->getString();
- fullname = nvfirst->getString();
- fullname += " ";
- fullname += nvlast->getString();
- }
- if (!fullname.empty())
- {
- LLAvatarActions::requestFriendshipDialog(dest_id, fullname);
- }
- else
- {
- LLNotificationsUtil::add("CantOfferFriendship");
- }
- }
- }
- class LLEditEnableCustomizeAvatar : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = gAgentWearables.areWearablesLoaded();
- return new_value;
- }
- };
- bool enable_sit_object()
- {
- LLViewerObject* object = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject();
- if (object && object->getPCode() == LL_PCODE_VOLUME)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- // only works on pie menu
- void handle_object_sit_or_stand()
- {
- LLPickInfo pick = LLToolPie::getInstance()->getPick();
- LLViewerObject *object = pick.getObject();;
- if (!object || pick.mPickType == LLPickInfo::PICK_FLORA)
- {
- return;
- }
- if (sitting_on_selection())
- {
- gAgent.standUp();
- return;
- }
- // get object selection offset
- if (object && object->getPCode() == LL_PCODE_VOLUME)
- {
- gMessageSystem->newMessageFast(_PREHASH_AgentRequestSit);
- gMessageSystem->nextBlockFast(_PREHASH_AgentData);
- gMessageSystem->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
- gMessageSystem->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
- gMessageSystem->nextBlockFast(_PREHASH_TargetObject);
- gMessageSystem->addUUIDFast(_PREHASH_TargetID, object->mID);
- gMessageSystem->addVector3Fast(_PREHASH_Offset, pick.mObjectOffset);
- object->getRegion()->sendReliableMessage();
- }
- }
- void near_sit_down_point(BOOL success, void *)
- {
- if (success)
- {
- gAgent.setFlying(FALSE);
- gAgent.setControlFlags(AGENT_CONTROL_SIT_ON_GROUND);
- // Might be first sit
- //LLFirstUse::useSit();
- }
- }
- class LLLandSit : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gAgent.standUp();
- LLViewerParcelMgr::getInstance()->deselectLand();
- LLVector3d posGlobal = LLToolPie::getInstance()->getPick().mPosGlobal;
-
- LLQuaternion target_rot;
- if (gAgent.getAvatarObject())
- {
- target_rot = gAgent.getAvatarObject()->getRotation();
- }
- else
- {
- target_rot = gAgent.getFrameAgent().getQuaternion();
- }
- gAgent.startAutoPilotGlobal(posGlobal, "Sit", &target_rot, near_sit_down_point, NULL, 0.7f);
- return true;
- }
- };
- //-------------------------------------------------------------------
- // Help menu functions
- //-------------------------------------------------------------------
- //
- // Major mode switching
- //
- void reset_view_final( BOOL proceed );
- void handle_reset_view()
- {
- if( (CAMERA_MODE_CUSTOMIZE_AVATAR == gAgent.getCameraMode()) && gFloaterCustomize )
- {
- // Show dialog box if needed.
- gFloaterCustomize->askToSaveIfDirty( reset_view_final );
- }
- else
- {
- gAgent.switchCameraPreset(CAMERA_PRESET_REAR_VIEW);
- reset_view_final( TRUE );
- LLFloaterCamera::resetCameraMode();
- }
- }
- class LLViewResetView : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- handle_reset_view();
- return true;
- }
- };
- // Note: extra parameters allow this function to be called from dialog.
- void reset_view_final( BOOL proceed )
- {
- if( !proceed )
- {
- return;
- }
- gAgent.resetView(TRUE, TRUE);
- gAgent.setLookAt(LOOKAT_TARGET_CLEAR);
- }
- class LLViewLookAtLastChatter : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gAgent.lookAtLastChat();
- return true;
- }
- };
- class LLViewMouselook : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- if (!gAgent.cameraMouselook())
- {
- gAgent.changeCameraToMouselook();
- }
- else
- {
- gAgent.changeCameraToDefault();
- }
- return true;
- }
- };
- class LLViewFullscreen : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gViewerWindow->toggleFullscreen(TRUE);
- return true;
- }
- };
- class LLViewDefaultUISize : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- gSavedSettings.setF32("UIScaleFactor", 1.0f);
- gSavedSettings.setBOOL("UIAutoScale", FALSE);
- gViewerWindow->reshape(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
- return true;
- }
- };
- class LLEditDuplicate : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- if(LLEditMenuHandler::gEditMenuHandler)
- {
- LLEditMenuHandler::gEditMenuHandler->duplicate();
- }
- return true;
- }
- };
- class LLEditEnableDuplicate : public view_listener_t
- {
- bool handleEvent(const LLSD& userdata)
- {
- bool new_value = LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDuplicate();
- return new_value;
- }
- };
- void handle_duplicate_in_place(void*)
- {
- llinfos << "handle_duplicate_in_place" << llendl;
- LLVector3 offset(0.f, 0.f, 0.f);
- LLSelectMgr::getInstance()->selectDuplicate(offset, TRUE);
- }
- /* dead code 30-apr-2008
- void handle_deed_object_to_group(void*)
- {
- LLUUID group_id;
-
- LLSelectMgr::getInstance()->selectGetGroup(group_id);
- LLSelectMgr::getInstance()->sendOwner(LLUUID::null, group_id, FALSE);
- LLViewerStats::getInstance()->incStat(LLViewerStats::ST_RELEASE_COUNT);
- }
- BOOL enable_deed_object_to_group(void*)
- {
- if(LLSelectMgr::getInstance()->getSelection()->isEmpty()) return FALSE;
- LLPermissions perm;
- LLUUID group_id;
- if (LLSelectMgr::getInstance()->selectGetGroup(group_id) &&
- gAgent.hasPowerInGroup(group_id, GP_OBJECT_DEED) &&
- LLSelectMgr::getInstance()->selectGetPermissions(perm) &&
- perm.deedToGroup(gAgent.getID(), group_id))
- {
- return TRUE;
- }
- return FALSE;
- }
- */
- /*
- * No longer able to support viewer side manipulations in this way
- *
- void god_force_inv_owner_permissive(LLViewerObject* object,
- InventoryObjectList* inventory,
- S32 serial_num,
- void*)
- {
- typedef std::vector<LLPointer<LLViewerInventoryItem> > item_array_t;
- item_array_t items;
- InventoryObjectList::const_iterator inv_it = inventory->begin();
- InventoryObjectList::const_iterator inv_end = inventory->end();
- for ( ; inv_it != inv_end; ++inv_it)
- {
- if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY))
- {
- LLInventoryObject* obj = *inv_it;
- LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem((LLViewerInventoryItem*)obj);
- LLPermissions perm(new_item->getPermissions());
- perm.setMaskBase(PERM_ALL);
- perm.setMaskOwner(PERM_ALL);
- new_item->setPermissions(perm);
- items.push_back(new_item);
- }
- }
- item_array_t::iterator end = items.end();
- item_array_t::iterator it;
- for(it = items.begin(); it != end; ++it)
- {
- // since we have the inventory item in the callback, it should not
- // invalidate iteration through the selection manager.
- object->updateInventory((*it), TASK_INVENTORY_ITEM_KEY, false);
- }
- }
- */
- void handle_object_owner_permissive(void*)
- {
- // only send this if they're a god.
- if(gAgent.isGodlike())
- {
- // do the objects.
- LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_BASE, TRUE, PERM_ALL, TRUE);
- LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, TRUE, PERM_ALL, TRUE);
- }
- }
- void handle_object_owner_self(void*)
- {
- // only send this if they're a god.
- if(gAgent.isGodlike())
- {
- LLSelectMgr::getInstance()->sendOwner(gAgent.getID(), gAgent.getGroupID(), TRUE);
- }
- }
- // Shortcut to set owner permissions to not editable.
- void handle_object_lock(void*)
- {
- LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, FALSE, PERM_MODIFY);
- }
- void handle_object_asset_ids(void*)
- {
- // only send this if they're a god.
- if (gAgent.isGodlike())
- {
- LLSelectMgr::getInstance()->sendGodlikeRequest("objectinfo", "assetids");
- }
- }
- void handle_force_parcel_owner_to_me(void*)
- {
- LLViewerParcelMgr::getInstance()->sendParcelGodForceOwner( gAgent.getID() );
- }
- void handle_force_parcel_to_content(void*)
- {
- LLViewerParcelMgr::getInstance()->sendParcelGodForceToContent();
- }
- void handle_claim_public_land(void*)
- {
- if (LLViewerParcelMgr::getInstance()->getSelectionRegion() != gAgent.getRegion())
- {
- LLNotificationsUtil::add("ClaimPublicLand");
- return;
- }
- LLVector3d west_south_global;
- LLVector3d east_north_global;
- LLViewerParcelMgr::getInstance()->getSelection(west_south_global, east_north_global);
- LLVector3 west_south = gAgent.getPosAgentFromGlobal(west_south_global);
- LLVector3 east_north = gAgent.getPosAgentFromGlobal(east_north_global);
- LLMessageSystem* msg = gMessageSystem;
- msg->newMessage("GodlikeMessage");
- msg->nextBlock("AgentData");
- msg->addUUID("AgentID", gAgent.getID());
- msg->addUUID("SessionID", gAgent.getSessionID());
- msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used
- msg->nextBlock("MethodData");
- msg->addString("Method", "claimpublicland");
- msg->addUUID("Invoice", LLUUID::null);
- std::string buffer;
- buffer = llformat( "%f", west_south.mV[VX]);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buffer);
- buffer = llformat( "%f", west_south.mV[VY]);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buffer);
- buffer = llformat( "%f", east_north.mV[VX]);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buffer);
- buffer = llformat( "%f", east_north.mV[VY]);
- msg->nextBlock("ParamList");
- msg->addString("Parameter", buffer);
- gAgent.sendReliableMessage();
- }
- // HACK for easily testing new avatar geometry
- void handle_god_request_avatar_geometry(void *)
- {
- if (gAgent.isGodlike())
- {
- LLSelectMgr::getInstance()->sendGodlikeRequest("avatar toggle", "");
- }
- }
- void derez_objects(EDeRezDestination dest, const LLUUID& dest_id)
- {
- if(gAgent.cameraMouselook())
- {
- gAgent.changeCameraToDefault();
- }
- //gInventoryView->setPanelOpen(TRUE);
- std::string error;
- LLDynamicArray<LLViewerObject*> derez_objects;
-
- // Check conditions that we can't deal with, building a list of
- // everything that we'll actually be derezzing.
- LLViewerRegion* first_region = NULL;
- for (LLObjectSelection::valid_root_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_root_begin();
- iter != LLSelectMgr::getInstance()->getSelection()->valid_root_end(); iter++)
- {
- LLSelectNode* node = *iter;
- LLViewerObject* object = node->getObject();
- LLViewerRegion* region = object->getRegion();
- if (!first_region)
- {
- first_region = region;
- }
- else
- {
- if(region != first_region)
- {
- // Derez doesn't work at all if the some of the objects
- // are in regions besides the first object selected.
-
- // ...crosses region boundaries
- error = "AcquireErrorObjectSpan";
- break;
- }
- }
- if (object->isAvatar())
- {
- // ...don't acquire avatars
- continue;
- }
- // If AssetContainers are being sent back, they will appear as
- // boxes in the owner's inventory.
- if (object->getNVPair("AssetContainer")
- && dest != DRD_RETURN_TO_OWNER)
- {
- // this object is an asset container, derez its contents, not it
- llwarns << "Attempt to derez deprecated AssetContainer object type not supported." << llendl;
- /*
- object->requestInventory(container_inventory_arrived,
- (void *)(BOOL)(DRD_TAKE_INTO_AGENT_INVENTORY == dest));
- */
- continue;
- }
- BOOL can_derez_current = FALSE;
- switch(dest)
- {
- case DRD_TAKE_INTO_AGENT_INVENTORY: