From 8f3c1af82d8a8a1d1334feac5dd83ae687ceee01 Mon Sep 17 00:00:00 2001 From: Shyotl Date: Wed, 10 Jul 2013 02:15:47 -0500 Subject: [PATCH 01/78] Fixed textentry combobox arrow positioning issues. --- indra/llui/llcombobox.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index 6fd7084df..46ba4d93e 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -94,10 +94,6 @@ LLComboBox::LLComboBox( const std::string& name, const LLRect &rect, const std:: mButton->setFont(LLFontGL::getFontSansSerifSmall()); mButton->setFollows(FOLLOWS_LEFT | FOLLOWS_BOTTOM | FOLLOWS_RIGHT); mButton->setHAlign( LLFontGL::LEFT ); - if(mAllowTextEntry) - { - mButton->setRightHPad(2); - } addChild(mButton); @@ -931,6 +927,11 @@ BOOL LLComboBox::handleUnicodeCharHere(llwchar uni_char) void LLComboBox::setAllowTextEntry(BOOL allow, S32 max_chars, BOOL set_tentative) { mAllowTextEntry = allow; + if(allow) + mButton->setRightHPad(2); + else + mButton->setRightHPad(LLBUTTON_H_PAD); + mTextEntryTentative = set_tentative; mMaxChars = max_chars; From 742ccdcf0c7e4ab6dd2cc73ba458e810c0a59a3d Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Wed, 10 Jul 2013 06:30:19 -0400 Subject: [PATCH 02/78] Touched up awavefront once more to conform to permissions and be used as intended Added debug settings OBJExportNotifyFailed and OBJExportNotifySuccess for whether or not to notify about OBJ Exports failing or succeeding respectively Moved exports back into tools submenu, there's not enough variety to justify a menu dedicated to exportation Removed hardcoded "Insufficient Permissions" string, there's already a notification for this. Implemented proper permissions checking, along with own Avatar Export. --- indra/llappearance/llavatarappearance.h | 6 +- indra/llappearance/llavatarjointmesh.h | 5 +- .../newview/app_settings/settings_ascent.xml | 24 +++- indra/newview/awavefront.cpp | 70 ++++++++-- indra/newview/awavefront.h | 10 +- indra/newview/llviewermenu.cpp | 131 +----------------- .../default/xui/en-us/menu_pie_object.xml | 19 ++- .../skins/default/xui/en-us/menu_pie_self.xml | 3 + .../skins/default/xui/en-us/notifications.xml | 18 +-- 9 files changed, 105 insertions(+), 181 deletions(-) diff --git a/indra/llappearance/llavatarappearance.h b/indra/llappearance/llavatarappearance.h index 2348f152b..b3a02e410 100644 --- a/indra/llappearance/llavatarappearance.h +++ b/indra/llappearance/llavatarappearance.h @@ -244,15 +244,11 @@ protected: virtual void dirtyMesh(S32 priority) = 0; // Dirty the avatar mesh, with priority protected: + friend class WavefrontSaver; typedef std::multimap polymesh_map_t; polymesh_map_t mPolyMeshes; avatar_joint_list_t mMeshLOD; -// -public: - const virtual avatar_joint_list_t& getMeshLOD() const { return mMeshLOD; } -// - /** Meshes ** ** *******************************************************************************/ diff --git a/indra/llappearance/llavatarjointmesh.h b/indra/llappearance/llavatarjointmesh.h index 90a0a5725..53b82c50a 100644 --- a/indra/llappearance/llavatarjointmesh.h +++ b/indra/llappearance/llavatarjointmesh.h @@ -62,6 +62,7 @@ public: class LLAvatarJointMesh : public virtual LLAvatarJoint { protected: + friend class WavefrontSaver; LLColor4 mColor; // color value // LLColor4 mSpecular; // specular color (always white for now) F32 mShiny; // shiny value @@ -131,10 +132,6 @@ public: void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; } - // -public: - LLFace* getFace() { return mFace; } - // private: // Allocate skin data BOOL allocateSkinData( U32 numSkinJoints ); diff --git a/indra/newview/app_settings/settings_ascent.xml b/indra/newview/app_settings/settings_ascent.xml index e60c658c2..d5c0fd2e3 100644 --- a/indra/newview/app_settings/settings_ascent.xml +++ b/indra/newview/app_settings/settings_ascent.xml @@ -642,6 +642,28 @@ Value 0 + OBJExportNotifyFailed + + Comment + Show a notification when exporting to OBJ fails (both partially and completely) + Persist + 1 + Type + Boolean + Value + 1 + + OBJExportNotifySuccess + + Comment + Show a notification when exporting to OBJ succeeds + Persist + 1 + Type + Boolean + Value + 1 + OBJExportSwapYZ Comment @@ -653,5 +675,5 @@ Value 0 - + diff --git a/indra/newview/awavefront.cpp b/indra/newview/awavefront.cpp index d4cc49520..d48bb8dfa 100644 --- a/indra/newview/awavefront.cpp +++ b/indra/newview/awavefront.cpp @@ -1,7 +1,7 @@ /** * @file awavefront.cpp * @brief A system which allows saving in-world objects to Wavefront .OBJ files for offline texturizing/shading. - * @author Apelsin + * @authors Apelsin, Lirusaito * * $LicenseInfo:firstyear=2011&license=LGPLV3$ * Copyright (C) 2011-2013 Apelsin @@ -27,13 +27,14 @@ // library includes #include "aifilepicker.h" +#include "llnotificationsutil.h" // newview includes +#include "lfsimfeaturehandler.h" #include "llavatarappearancedefines.h" #include "llface.h" #include "llvoavatar.h" - -typedef std::vector avatar_joint_list_t; +#include "llvovolume.h" // menu includes #include "llevent.h" @@ -42,7 +43,10 @@ typedef std::vector avatar_joint_list_t; #include "llselectmgr.h" LLVOAvatar* find_avatar_from_object(LLViewerObject* object); +extern LLUUID gAgentID; +//Typedefs used in other files, using here for consistency. +typedef std::vector avatar_joint_list_t; typedef LLMemberListener view_listener_t; namespace @@ -57,6 +61,8 @@ namespace { wfsaver->saveFile(fp); llinfos << "OBJ file saved to " << selected_filename << llendl; + if (gSavedSettings.getBOOL("OBJExportNotifySuccess")) + LLNotificationsUtil::add("WavefrontExportSuccess", LLSD().with("FILENAME", selected_filename)); fclose(fp); } else llerrs << "can't open: " << selected_filename << llendl; @@ -192,22 +198,42 @@ void WavefrontSaver::Add(const LLViewerObject* some_vo) normfix.setRotation(v_form.getRotation()); //Should work... Add(some_vo->getVolume(), &v_form, &normfix); } - namespace { - class LLSaveSelectedObjects : public view_listener_t + bool can_export_node(const LLSelectNode* node) + { + if (const LLPermissions* perms = node->mPermissions) + { + if (!(gAgentID == perms->getCreator() || (LFSimFeatureHandler::instance().simSupportsExport() && gAgentID == perms->getOwner() && perms->getMaskEveryone() & PERM_EXPORT))) + { + static const LLCachedControl notify("OBJExportNotifyFailed", false); + if (notify) LLNotificationsUtil::add("WavefrontExportPartial", LLSD().with("OBJECT", node->mName)); + } + else return true; + } + return false; + } + class LFSaveSelectedObjects : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { if (LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection()) { - WavefrontSaver* wfsaver = new WavefrontSaver; //deleted in callback + WavefrontSaver* wfsaver = new WavefrontSaver; // deleted in callback wfsaver->offset = -selection->getFirstRootObject()->getRenderPosition(); for (LLObjectSelection::iterator iter = selection->begin(); iter != selection->end(); ++iter) { LLSelectNode* node = *iter; + if (!can_export_node(node)) continue; wfsaver->Add(node->getObject()); } + if (wfsaver->obj_v.empty()) + { + if (gSavedSettings.getBOOL("OBJExportNotifyFailed")) + LLNotificationsUtil::add("ExportFailed"); + delete wfsaver; + return true; + } AIFilePicker* filepicker = AIFilePicker::create(); filepicker->open(selection->getFirstNode()->mName.c_str()+OBJ); @@ -221,7 +247,7 @@ namespace void WavefrontSaver::Add(const LLVOAvatar* av_vo) //adds attachments, too! { offset = -av_vo->getRenderPosition(); - avatar_joint_list_t vjv = av_vo->getMeshLOD(); + avatar_joint_list_t vjv = av_vo->mMeshLOD; for (avatar_joint_list_t::const_iterator itervj = vjv.begin(); itervj != vjv.end(); ++itervj) { const LLViewerJoint* vj = dynamic_cast(*itervj); @@ -231,7 +257,7 @@ void WavefrontSaver::Add(const LLVOAvatar* av_vo) //adds attachments, too! if (!vjm) continue; vjm->updateJointGeometry(); - LLFace* face = vjm->getFace(); + LLFace* face = vjm->mFace; if (!face) continue; //Beware: this is a hack because LLFace has multiple LODs @@ -271,6 +297,11 @@ void WavefrontSaver::Add(const LLVOAvatar* av_vo) //adds attachments, too! { const LLViewerObject* c = *iterc; if (!c) continue; + if (const LLSelectNode* n = LLSelectMgr::getInstance()->getSelection()->findNode(const_cast(c))) + { + if (!can_export_node(n)) continue; + } + else continue; const LLVolume* vol = c->getVolume(); if (!vol) continue; @@ -293,17 +324,28 @@ void WavefrontSaver::Add(const LLVOAvatar* av_vo) //adds attachments, too! } } } - namespace { - class LLSaveSelectedAvatar : public view_listener_t + class LFSaveSelectedAvatar : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { if (const LLVOAvatar* avatar = find_avatar_from_object(LLSelectMgr::getInstance()->getSelection()->getPrimaryObject())) { - WavefrontSaver* wfsaver = new WavefrontSaver; //deleted in callback + if (!avatar->isSelf()) + { + if (gSavedSettings.getBOOL("OBJExportNotifyFailed")) LLNotificationsUtil::add("ExportFailed"); + return true; + } + WavefrontSaver* wfsaver = new WavefrontSaver; // deleted in callback wfsaver->Add(avatar); + if (wfsaver->obj_v.empty()) + { + if (gSavedSettings.getBOOL("OBJExportNotifyFailed")) + LLNotificationsUtil::add("ExportFailed"); + delete wfsaver; + return true; + } AIFilePicker* filepicker = AIFilePicker::create(); filepicker->open(avatar->getFullname()+OBJ); @@ -383,9 +425,9 @@ bool WavefrontSaver::saveFile(LLFILE* fp) } void addMenu(view_listener_t* menu, const std::string& name); -void add_wave_listeners() //Called in llviewermenu with other addMenu calls, function linked against +void add_wave_listeners() // Called in llviewermenu with other addMenu calls, function linked against { - addMenu(new LLSaveSelectedObjects(), "Object.SaveAsOBJ"); - addMenu(new LLSaveSelectedAvatar(), "Avatar.SaveAsOBJ"); + addMenu(new LFSaveSelectedObjects(), "Object.SaveAsOBJ"); + addMenu(new LFSaveSelectedAvatar(), "Avatar.SaveAsOBJ"); } diff --git a/indra/newview/awavefront.h b/indra/newview/awavefront.h index f97099cd1..3f58ee4a0 100644 --- a/indra/newview/awavefront.h +++ b/indra/newview/awavefront.h @@ -1,7 +1,7 @@ /** * @file awavefront.h * @brief A system which allows saving in-world objects to Wavefront .OBJ files for offline texturizing/shading. - * @author Apelsin + * @authors Apelsin, Lirusaito * * $LicenseInfo:firstyear=2011&license=LGPLV3$ * Copyright (C) 2011-2013 Apelsin @@ -24,14 +24,6 @@ #ifndef AWAVEFRONT #define AWAVEFRONT -#include -#include "v3math.h" -#include "v2math.h" -#include "llface.h" -#include "llvolume.h" - -using namespace std; - class LLFace; class LLPolyMesh; class LLViewerObject; diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 69bcbb308..fcafd4bfd 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -171,7 +171,6 @@ #include "shfloatermediaticker.h" #include "llpacketring.h" #include "aihttpview.h" -#include "awavefront.h" // #include "scriptcounter.h" @@ -225,6 +224,7 @@ void handle_test_load_url(void*); class AIHTTPView; +void add_wave_listeners(); //extern BOOL gHideSelectedObjects; //extern BOOL gAllowSelectAvatar; //extern BOOL gDebugAvatarRotation; @@ -489,11 +489,6 @@ void handle_mesh_save_obj(void*); void handle_mesh_load_obj(void*); void handle_morph_save_obj(void*); void handle_morph_load_obj(void*); -void save_avatar_to_obj(LLVOAvatar *avatar); -void save_selected_avatar_to_obj(); -void save_selected_objects_to_obj(); -void save_wavefront_continued(WavefrontSaver* wfsaver, AIFilePicker* filepicker); -void handle_save_current_avatar_obj(void*); void handle_debug_avatar_textures(void*); void handle_dump_region_object_cache(void*); @@ -706,8 +701,6 @@ void init_menus() gAttachSubMenu = gMenuBarView->getChildMenuByName("Attach Object", TRUE); gDetachSubMenu = gMenuBarView->getChildMenuByName("Detach Object", TRUE); - LLMenuGL*menu; - // // Add in the pose stand ------------------------------------------- /*LLMenuGL* sub = new LLMenuGL("Pose Stand..."); @@ -722,6 +715,9 @@ void init_menus() sub->addChild(new LLMenuItemCallGL( "Stop Pose Stand", &handle_pose_stand_stop, NULL)); // ------------------------------------------------------*/ + // TomY TODO convert these two + LLMenuGL*menu; + menu = new LLMenuGL(CLIENT_MENU_NAME); menu->setCanTearOff(TRUE); init_client_menu(menu); @@ -6137,24 +6133,6 @@ class LLAvatarInviteToGroup : public view_listener_t } }; -class LLAvatarSaveAsOBJ : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - save_selected_avatar_to_obj(); - return true; - } -}; - -class LLSelectionSaveAsOBJ : public view_listener_t -{ - bool handleEvent(LLPointer event, const LLSD& userdata) - { - save_selected_objects_to_obj(); - return true; - } -}; - class LLAvatarAddFriend : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) @@ -8538,104 +8516,6 @@ static void handle_morph_load_obj_continued(void* data, AIFilePicker* filepicker morph_data->setMorphFromMesh(&mesh); } -void handle_save_current_avatar_obj(void* data) -{ - if(gAgentAvatarp) - save_avatar_to_obj(gAgentAvatarp); -} - -void save_selected_avatar_to_obj() -{ - LLVOAvatar* avatar = find_avatar_from_object( LLSelectMgr::getInstance()->getSelection()->getPrimaryObject() ); - if(avatar) - save_avatar_to_obj(avatar); -} - -void save_avatar_to_obj(LLVOAvatar *avatar) -{ - std::string file_name = llformat("%s.obj", avatar->getFullname().c_str()); - std::string full_path = gDirUtilp->getExpandedFilename(LL_PATH_NONE, file_name); - - WavefrontSaver* wfsaver = new WavefrontSaver(); - wfsaver->Add((LLVOAvatar*)avatar); - - AIFilePicker* filepicker = AIFilePicker::create(); - filepicker->open(full_path); - filepicker->run(boost::bind(&save_wavefront_continued, wfsaver, filepicker)); -} - -void save_selected_objects_to_obj() -{ - struct ff : public LLSelectedNodeFunctor - { - virtual bool apply(LLSelectNode* node) - { - return LLObjectBackup::getInstance()->validatePerms(node->mPermissions); - } - } func; - - LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); - - if(!selection) - return; - - if (!selection->applyToNodes(&func, false)) - { - llwarns << "Incorrect permissions: Wavefront OBJ export aborted" << llendl; - LLSD args; - args["REASON"] = "Insufficient Permissions"; - LLNotificationsUtil::add("WavefrontExportFailed", args); - return; - } - - std::string file_name = llformat("%s.obj", selection->getFirstNode()->mName.c_str()); - std::string full_path = gDirUtilp->getExpandedFilename(LL_PATH_NONE, file_name); - - WavefrontSaver* wfsaver = new WavefrontSaver(); - LLSelectNode* root_one = (LLSelectNode *)*selection->root_begin(); - wfsaver->offset = -root_one->getObject()->getRenderPosition(); - for (LLObjectSelection::iterator iter = selection->begin(); - iter != selection->end(); iter++) - { - LLSelectNode* node = *iter; - LLViewerObject* object = node->getObject(); - wfsaver->Add(object); - } - - AIFilePicker* filepicker = AIFilePicker::create(); - filepicker->open(full_path); - filepicker->run(boost::bind(&save_wavefront_continued, wfsaver, filepicker)); -} - -void save_wavefront_continued(WavefrontSaver* wfsaver, AIFilePicker* filepicker) -{ - if (!filepicker->hasFilename()) - { - llwarns << "No file; bailing" << llendl; - return; - } - std::string selected_filename = filepicker->getFilename(); - LLFILE* fp = LLFile::fopen(selected_filename, "wb"); - if (!fp) - { - llerrs << "can't open: " << selected_filename << llendl; - return; - } - try - { - wfsaver->saveFile(fp); - } - catch(int e) - { - llwarns << "An exception occurred while generating / saving OBJ file. Exception #" << e << llendl; - } - llinfos << "OBJ file saved to " << selected_filename << llendl; - LLSD args; - args["FILENAME"] = selected_filename; - LLNotificationsUtil::add("WavefrontExportSuccess", args); - fclose(fp); -} - // Returns a pointer to the avatar give the UUID of the avatar OR of an attachment the avatar is wearing. // Returns NULL on failure. LLVOAvatar* find_avatar_from_object( LLViewerObject* object ) @@ -9509,7 +9389,6 @@ void initialize_menus() addMenu(new LLAvatarEnableFreezeEject(), "Avatar.EnableFreezeEject"); addMenu(new LLAvatarCopyUUID(), "Avatar.CopyUUID"); addMenu(new LLAvatarClientUUID(), "Avatar.ClientID"); - addMenu(new LLAvatarSaveAsOBJ(), "Avatar.SaveAsOBJ"); // Object pie menu addMenu(new LLObjectOpen(), "Object.Open"); @@ -9529,6 +9408,7 @@ void initialize_menus() addMenu(new LLPowerfulWizard(), "Object.Explode"); addMenu(new LLCanIHasKillEmAll(), "Object.EnableDestroy"); addMenu(new LLOHGOD(), "Object.EnableExplode"); + add_wave_listeners(); // addMenu(new LLObjectMute(), "Object.Mute"); addMenu(new LLObjectBuy(), "Object.Buy"); @@ -9541,7 +9421,6 @@ void initialize_menus() addMenu(new LLObjectExport(), "Object.Export"); addMenu(new LLObjectImport(), "Object.Import"); addMenu(new LLObjectImportUpload(), "Object.ImportUpload"); - addMenu(new LLSelectionSaveAsOBJ(), "Object.SaveAsOBJ"); addMenu(new LLObjectEnableOpen(), "Object.EnableOpen"); diff --git a/indra/newview/skins/default/xui/en-us/menu_pie_object.xml b/indra/newview/skins/default/xui/en-us/menu_pie_object.xml index a3015ed48..75fba2a28 100644 --- a/indra/newview/skins/default/xui/en-us/menu_pie_object.xml +++ b/indra/newview/skins/default/xui/en-us/menu_pie_object.xml @@ -60,20 +60,17 @@ + + + + + + + + - - - - - diff --git a/indra/newview/skins/default/xui/en-us/menu_pie_self.xml b/indra/newview/skins/default/xui/en-us/menu_pie_self.xml index d787e16e0..96c845e00 100644 --- a/indra/newview/skins/default/xui/en-us/menu_pie_self.xml +++ b/indra/newview/skins/default/xui/en-us/menu_pie_self.xml @@ -119,4 +119,7 @@ + + + diff --git a/indra/newview/skins/default/xui/en-us/notifications.xml b/indra/newview/skins/default/xui/en-us/notifications.xml index 0849f9b4d..d6f8d4b34 100644 --- a/indra/newview/skins/default/xui/en-us/notifications.xml +++ b/indra/newview/skins/default/xui/en-us/notifications.xml @@ -9638,21 +9638,17 @@ Would you like to enable announcing keys to objects in the sim? -Export to Wavefront OBJ file failed: - -[REASON] + icon="notify.tga" + name="WavefrontExportPartial" + type="notify"> +Unable to include [OBJECT] in export, insufficient permissions. -Object successfully exported in Wavefront OBJ format to: - -[FILENAME] + type="notifytip"> +Object successfully exported to: [FILENAME] From 7e874d7d56084f42061e5d216dfe685826b70932 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Wed, 10 Jul 2013 07:35:50 -0400 Subject: [PATCH 03/78] Fix Issue 931: When viewing the profile of a muted avatar, the Mute button should be changed to Unmute --- indra/newview/llpanelavatar.cpp | 22 +------------------ indra/newview/llpanelavatar.h | 13 ----------- .../skins/default/xui/en-us/panel_avatar.xml | 4 ++-- 3 files changed, 3 insertions(+), 36 deletions(-) diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 26e2f356f..85845e7f0 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -520,7 +520,7 @@ BOOL LLPanelAvatarSecondLife::postBuild(void) getChild("Add Friend...")->setCommitCallback(boost::bind(LLAvatarActions::requestFriendshipDialog, boost::bind(&LLPanelAvatar::getAvatarID, pa))); getChild("Pay...")->setCommitCallback(boost::bind(LLAvatarActions::pay, boost::bind(&LLPanelAvatar::getAvatarID, pa))); - childSetAction("Mute", LLPanelAvatar::onClickMute, pa); + getChild("Mute")->setCommitCallback(boost::bind(LLAvatarActions::toggleBlock, boost::bind(&LLPanelAvatar::getAvatarID, pa))); getChild("Offer Teleport...")->setCommitCallback(boost::bind(static_cast(LLAvatarActions::offerTeleport), boost::bind(&LLPanelAvatar::getAvatarID, pa))); @@ -1727,26 +1727,6 @@ void LLPanelAvatar::onClickGetKey(void *userdata) gViewerWindow->mWindow->copyTextToClipboard(utf8str_to_wstring(agent_id.asString())); } -//----------------------------------------------------------------------------- -// onClickMute() -//----------------------------------------------------------------------------- -void LLPanelAvatar::onClickMute(void *userdata) -{ - LLPanelAvatar* self = (LLPanelAvatar*) userdata; - - LLUUID agent_id = self->getAvatarID(); - - LLFloaterMute::showInstance(); - if (LLAvatarActions::isBlocked(agent_id)) - { - LLFloaterMute::getInstance()->selectMute(agent_id); - } - else - { - LLAvatarActions::toggleBlock(agent_id); - } -} - // static void LLPanelAvatar::onClickOK(void *userdata) { diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index ef9841992..a7c18e796 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -40,23 +40,11 @@ #include "llavatarpropertiesprocessor.h" class LLAvatarName; -class LLButton; class LLCheckBoxCtrl; -class LLDropTarget; -class LLInventoryItem; class LLLineEditor; -class LLNameEditor; class LLPanelAvatar; -class LLScrollListCtrl; class LLTabContainer; -class LLTextBox; -class LLTextEditor; -class LLTextureCtrl; -class LLUICtrl; -class LLViewerTexture; class LLViewerObject; -class LLMessageSystem; -class LLIconCtrl; class LLMediaCtrl; class LLPanelPick; @@ -328,7 +316,6 @@ public: static void onClickGetKey(void *userdata); static void onClickOK( void *userdata); static void onClickCancel( void *userdata); - static void onClickMute( void *userdata); private: void enableOKIfReady(); diff --git a/indra/newview/skins/default/xui/en-us/panel_avatar.xml b/indra/newview/skins/default/xui/en-us/panel_avatar.xml index 3637ee8af..c4d6f0f97 100644 --- a/indra/newview/skins/default/xui/en-us/panel_avatar.xml +++ b/indra/newview/skins/default/xui/en-us/panel_avatar.xml @@ -183,8 +183,8 @@ label="Instant Message..." label_selected="Instant Message..." left_delta="71" mouse_opaque="true" name="Instant Message..." tool_tip="Instant Message (IM)" width="140" /> - + name="next_owner_copy" control_name="BulkChangeNextOwnerCopy" > + + + mouse_opaque="true" font="SansSerif" scale_image="true" halign="center" > + + Selection contains no editable contents. Setting permissions on [NAME] diff --git a/indra/newview/skins/default/xui/en-us/floater_notifications_console.xml b/indra/newview/skins/default/xui/en-us/floater_notifications_console.xml index 7186bb41d..b35508556 100644 --- a/indra/newview/skins/default/xui/en-us/floater_notifications_console.xml +++ b/indra/newview/skins/default/xui/en-us/floater_notifications_console.xml @@ -3,7 +3,9 @@ can_resize="true" enabled="true" height="500" left="176" title="Notifications Console" min_height="50" min_width="100" mouse_opaque="true" name="notifications_console" width="500"> - + diff --git a/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml b/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml index 32487a53d..59b920ecd 100644 --- a/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml +++ b/indra/newview/skins/default/xui/en-us/floater_settings_debug.xml @@ -2,8 +2,12 @@ - - + + + + + + False + - + + + + name="val_color_swatch" visible="false" width="37"> + + + name="val_spinner_1" visible="false" width="120"> + + + max_val="10000000" name="val_spinner_2" visible="false" width="120"> + + + max_val="10000000" name="val_spinner_3" visible="false" width="120"> + + + max_val="10000000" name="val_spinner_4" visible="false" width="120"> + + From cf2f455430b32a780bce088fb053437884623971 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 13 Jul 2013 15:40:45 -0400 Subject: [PATCH 15/78] Update LLFloaterInspect, updates RLVa code, fixes inspect not always working at first --- indra/newview/llfloaterinspect.cpp | 298 ++++++++++-------- indra/newview/llfloaterinspect.h | 37 ++- indra/newview/llselectmgr.cpp | 53 ++-- indra/newview/llviewermenu.cpp | 2 +- .../default/xui/en-us/floater_inspect.xml | 12 +- 5 files changed, 239 insertions(+), 163 deletions(-) diff --git a/indra/newview/llfloaterinspect.cpp b/indra/newview/llfloaterinspect.cpp index f8c4afd2c..448e1bb37 100644 --- a/indra/newview/llfloaterinspect.cpp +++ b/indra/newview/llfloaterinspect.cpp @@ -32,32 +32,48 @@ #include "llviewerprecompiledheaders.h" -#include "llavataractions.h" #include "llfloaterinspect.h" + #include "llfloatertools.h" -#include "llcachename.h" +#include "llavataractions.h" +#include "llavatarnamecache.h" #include "llscrolllistctrl.h" #include "llscrolllistitem.h" #include "llselectmgr.h" #include "lltoolcomp.h" #include "lltoolmgr.h" +#include "lltrans.h" #include "llviewerobject.h" #include "lluictrlfactory.h" - -// [RLVa:KB] +// [RLVa:KB] - Checked: 2011-05-22 (RLVa-1.3.1a) #include "rlvhandler.h" +#include "llagent.h" // [/RLVa:KB] -LLFloaterInspect* LLFloaterInspect::sInstance = NULL; +//LLFloaterInspect* LLFloaterInspect::sInstance = NULL; -LLFloaterInspect::LLFloaterInspect(void) : - LLFloater(std::string("Inspect Object")), +LLFloaterInspect::LLFloaterInspect() + : LLFloater(std::string("Inspect Object")), mDirty(FALSE) { - sInstance = this; + mCommitCallbackRegistrar.add("Inspect.OwnerProfile", boost::bind(&LLFloaterInspect::onClickOwnerProfile, this)); + mCommitCallbackRegistrar.add("Inspect.CreatorProfile", boost::bind(&LLFloaterInspect::onClickCreatorProfile, this)); + mCommitCallbackRegistrar.add("Inspect.SelectObject", boost::bind(&LLFloaterInspect::onSelectObject, this)); LLUICtrlFactory::getInstance()->buildFloater(this, "floater_inspect.xml"); } +BOOL LLFloaterInspect::postBuild() +{ + mObjectList = getChild("object_list"); +// childSetAction("button owner",onClickOwnerProfile, this); +// childSetAction("button creator",onClickCreatorProfile, this); +// childSetCommitCallback("object_list", onSelectObject, this); + + refresh(); + + return TRUE; +} + LLFloaterInspect::~LLFloaterInspect(void) { if(!gFloaterTools->getVisible()) @@ -73,42 +89,30 @@ LLFloaterInspect::~LLFloaterInspect(void) { gFloaterTools->setFocus(TRUE); } - sInstance = NULL; + //sInstance = NULL; } -BOOL LLFloaterInspect::isVisible() +// static +void LLFloaterInspect::showInstance() { - return (!!sInstance); + getInstance()->open(); } -void LLFloaterInspect::show(void* ignored) +void LLFloaterInspect::onOpen() { - // setForceSelection ensures that the pie menu does not deselect things when it - // looses the focus (this can happen with "select own objects only" enabled - // VWR-1471 BOOL forcesel = LLSelectMgr::getInstance()->setForceSelection(TRUE); - - if (!sInstance) // first use - { - sInstance = new LLFloaterInspect; - } - - sInstance->open(); LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance()); LLSelectMgr::getInstance()->setForceSelection(forcesel); // restore previouis value - - sInstance->mObjectSelection = LLSelectMgr::getInstance()->getSelection(); - sInstance->refresh(); + mObjectSelection = LLSelectMgr::getInstance()->getSelection(); + refresh(); } - -void LLFloaterInspect::onClickCreatorProfile(void* ctrl) +void LLFloaterInspect::onClickCreatorProfile() { - if(sInstance->mObjectList->getAllSelected().size() == 0) + if(mObjectList->getAllSelected().size() == 0) { return; } - LLScrollListItem* first_selected = - sInstance->mObjectList->getFirstSelected(); + LLScrollListItem* first_selected =mObjectList->getFirstSelected(); if (first_selected) { @@ -121,19 +125,27 @@ void LLFloaterInspect::onClickCreatorProfile(void* ctrl) return (obj_id == node->getObject()->getID()); } } func(first_selected->getUUID()); - LLSelectNode* node = sInstance->mObjectSelection->getFirstNode(&func); + LLSelectNode* node = mObjectSelection->getFirstNode(&func); if(node) { - LLAvatarActions::showProfile(node->mPermissions->getCreator()); +// LLAvatarActions::showProfile(node->mPermissions->getCreator()); +// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) | Modified: RLVa-1.0.0e + const LLUUID& idCreator = node->mPermissions->getCreator(); + if ( (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && + ((node->mPermissions->getOwner() == idCreator) || (RlvUtil::isNearbyAgent(idCreator))) ) + { + return; + } + LLAvatarActions::showProfile(idCreator); +// [/RLVa:KB] } } } -void LLFloaterInspect::onClickOwnerProfile(void* ctrl) +void LLFloaterInspect::onClickOwnerProfile() { - if(sInstance->mObjectList->getAllSelected().size() == 0) return; - LLScrollListItem* first_selected = - sInstance->mObjectList->getFirstSelected(); + if(mObjectList->getAllSelected().size() == 0) return; + LLScrollListItem* first_selected =mObjectList->getFirstSelected(); if (first_selected) { @@ -147,66 +159,62 @@ void LLFloaterInspect::onClickOwnerProfile(void* ctrl) return (obj_id == node->getObject()->getID()); } } func(selected_id); - LLSelectNode* node = sInstance->mObjectSelection->getFirstNode(&func); + LLSelectNode* node = mObjectSelection->getFirstNode(&func); if(node) { const LLUUID& owner_id = node->mPermissions->getOwner(); -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) - if (!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - LLAvatarActions::showProfile(owner_id); - } +// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) | Modified: RLVa-1.0.0e + if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) + return; // [/RLVa:KB] -// LLAvatarActions::showProfile(owner_id); + LLAvatarActions::showProfile(owner_id); } } } -BOOL LLFloaterInspect::postBuild() -{ - mObjectList = getChild("object_list"); - childSetAction("button owner",onClickOwnerProfile, this); - childSetAction("button creator",onClickCreatorProfile, this); - childSetCommitCallback("object_list", onSelectObject, this); - return TRUE; -} - -void LLFloaterInspect::onSelectObject(LLUICtrl* ctrl, void* user_data) +void LLFloaterInspect::onSelectObject() { if(LLFloaterInspect::getSelectedUUID() != LLUUID::null) { - //sInstance->childSetEnabled("button owner", true); -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e - sInstance->childSetEnabled("button owner", !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); +// getChildView("button owner")->setEnabled(true); +// getChildView("button creator")->setEnabled(true); +// [RLVa:KB] - Checked: 2010-08-25 (RLVa-1.2.2a) | Modified: RLVa-1.0.0e + getChildView("button owner")->setEnabled(!gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)); + // TODO-RLVa: [RLVa-1.2.2] Is it worth checking the selected node just to selectively disable this button? + getChildView("button creator")->setEnabled(true); // [/RLVa:KB] - sInstance->childSetEnabled("button creator", true); } } LLUUID LLFloaterInspect::getSelectedUUID() { - if(sInstance) + if(mObjectList->getAllSelected().size() > 0) { - if(sInstance->mObjectList->getAllSelected().size() > 0) + LLScrollListItem* first_selected =mObjectList->getFirstSelected(); + if (first_selected) { - LLScrollListItem* first_selected = - sInstance->mObjectList->getFirstSelected(); - if (first_selected) - { - return first_selected->getUUID(); - } + return first_selected->getUUID(); } } return LLUUID::null; } +void LLFloaterInspect::onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr) +{ + if (FloaterPtr) + { + LLFloaterInspect* floater = (LLFloaterInspect*)FloaterPtr; + floater->dirty(); + } +} + void LLFloaterInspect::refresh() { LLUUID creator_id; std::string creator_name; S32 pos = mObjectList->getScrollPos(); - childSetEnabled("button owner", false); - childSetEnabled("button creator", false); + getChildView("button owner")->setEnabled(false); + getChildView("button creator")->setEnabled(false); LLUUID selected_uuid; S32 selected_index = mObjectList->getFirstSelectedIndex(); if(selected_index > -1) @@ -235,18 +243,67 @@ void LLFloaterInspect::refresh() time_t timestamp = (time_t) (obj->mCreationDate/1000000); timeToFormattedString(timestamp, gSavedSettings.getString("TimestampFormat"), time); - gCacheName->getFullName(obj->mPermissions->getOwner(), owner_name); -// [RLVa:KB] - Checked: 2009-07-08 (RLVa-1.0.0e) - if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) - { - // TODO-RLVa: shouldn't filter if this is a group-owned prim (will show "(nobody)") - owner_name = RlvStrings::getAnonym(owner_name); - } -// [/RLVa:KB] - gCacheName->getFullName(obj->mPermissions->getCreator(), creator_name); + + const LLUUID& idOwner = obj->mPermissions->getOwner(); + const LLUUID& idCreator = obj->mPermissions->getCreator(); // - gCacheName->getFullName(obj->mPermissions->getLastOwner(), last_owner_name); + const LLUUID& idLastOwner = obj->mPermissions->getLastOwner(); // + LLAvatarName av_name; + + // Only work with the names if we actually get a result + // from the name cache. If not, defer setting the + // actual name and set a placeholder. + if (LLAvatarNameCache::get(idOwner, &av_name)) + { +// owner_name = av_name.getCompleteName(); +// [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a + bool fRlvFilterOwner = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idOwner != gAgent.getID()) && + (!obj->mPermissions->isGroupOwned()); + owner_name = (!fRlvFilterOwner) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); +// [/RLVa:KB] + } + else + { + owner_name = LLTrans::getString("RetrievingData"); + LLAvatarNameCache::get(idOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); + } + + if (LLAvatarNameCache::get(idCreator, &av_name)) + { +// creator_name = av_name.getCompleteName(); +// [RLVa:KB] - Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a + const LLUUID& idCreator = obj->mPermissions->getCreator(); + LLAvatarNameCache::get(idCreator, &av_name); + bool fRlvFilterCreator = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idCreator != gAgent.getID()) && + ( (obj->mPermissions->getOwner() == idCreator) || (RlvUtil::isNearbyAgent(idCreator)) ); + creator_name = (!fRlvFilterCreator) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); +// [/RLVa:KB] + } + else + { + creator_name = LLTrans::getString("RetrievingData"); + LLAvatarNameCache::get(idCreator, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); + } + + // + if (LLAvatarNameCache::get(idLastOwner, &av_name)) + { +// last_owner_name = av_name.getCompleteName(); +// [RLVa:LF] - Copied from the above creator check Checked: 2010-11-01 (RLVa-1.2.2a) | Modified: RLVa-1.2.2a + LLAvatarNameCache::get(idLastOwner, &av_name); + bool fRlvFilterLastOwner = (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES)) && (idLastOwner != gAgent.getID()) && + ( (obj->mPermissions->getOwner() == idLastOwner) || (RlvUtil::isNearbyAgent(idLastOwner)) ); + last_owner_name = (!fRlvFilterLastOwner) ? av_name.getCompleteName() : RlvStrings::getAnonym(av_name); +// [/RLVa:LF] + } + else + { + last_owner_name = LLTrans::getString("RetrievingData"); + LLAvatarNameCache::get(idLastOwner, boost::bind(&LLFloaterInspect::onGetAvNameCallback, _1, _2, this)); + } + // + row["id"] = obj->getObject()->getID(); row["columns"][0]["column"] = "object_name"; row["columns"][0]["type"] = "text"; @@ -260,28 +317,25 @@ void LLFloaterInspect::refresh() { row["columns"][0]["value"] = obj->mName; } + row["columns"][1]["column"] = "owner_name"; + row["columns"][1]["type"] = "text"; + row["columns"][1]["value"] = owner_name; // - int i = 1; - row["columns"][i]["column"] = "owner_name"; - row["columns"][i]["type"] = "text"; - row["columns"][i]["value"] = owner_name; - ++i; - row["columns"][i]["column"] = "last_owner_name"; - row["columns"][i]["type"] = "text"; - row["columns"][i]["value"] = last_owner_name; - ++i; - row["columns"][i]["column"] = "creator_name"; - row["columns"][i]["type"] = "text"; - row["columns"][i]["value"] = creator_name; - ++i; - row["columns"][i]["column"] = "face_num"; - row["columns"][i]["type"] = "text"; - row["columns"][i]["value"] = llformat("%d",obj->getObject()->getNumFaces()); - ++i; - row["columns"][i]["column"] = "vertex_num"; - row["columns"][i]["type"] = "text"; - row["columns"][i]["value"] = llformat("%d",obj->getObject()->getNumVertices()); - ++i; + row["columns"][2]["column"] = "last_owner_name"; + row["columns"][2]["type"] = "text"; + row["columns"][2]["value"] = last_owner_name; + // + row["columns"][3]["column"] = "creator_name"; + row["columns"][3]["type"] = "text"; + row["columns"][3]["value"] = creator_name; + // + row["columns"][4]["column"] = "face_num"; + row["columns"][4]["type"] = "text"; + row["columns"][4]["value"] = llformat("%d",obj->getObject()->getNumFaces()); + + row["columns"][5]["column"] = "vertex_num"; + row["columns"][5]["type"] = "text"; + row["columns"][5]["value"] = llformat("%d",obj->getObject()->getNumVertices()); // inventory silliness S32 scripts,total_inv; std::map >::iterator itr = mInventoryNums.find(obj->getObject()->getID()); @@ -301,18 +355,16 @@ void LLFloaterInspect::refresh() requestVOInventory(); } } - row["columns"][i]["column"] = "script_num"; - row["columns"][i]["type"] = "text"; - row["columns"][i]["value"] = llformat("%d",scripts); - ++i; - row["columns"][i]["column"] = "inv_num"; - row["columns"][i]["type"] = "text"; - row["columns"][i]["value"] = llformat("%d",total_inv); - ++i; - row["columns"][i]["column"] = "creation_date"; - row["columns"][i]["type"] = "text"; - row["columns"][i]["value"] = time; + row["columns"][6]["column"] = "script_num"; + row["columns"][6]["type"] = "text"; + row["columns"][6]["value"] = llformat("%d",scripts); + row["columns"][7]["column"] = "inv_num"; + row["columns"][7]["type"] = "text"; + row["columns"][7]["value"] = llformat("%d",total_inv); // + row["columns"][8]["column"] = "creation_date"; + row["columns"][8]["type"] = "text"; + row["columns"][8]["value"] = time; mObjectList->addElement(row, ADD_TOP); } if(selected_index > -1 && mObjectList->getItemIndex(selected_uuid) == selected_index) @@ -323,26 +375,23 @@ void LLFloaterInspect::refresh() { mObjectList->selectNthItem(0); } - onSelectObject(this, NULL); + onSelectObject(); mObjectList->setScrollPos(pos); } + // -void LLFloaterInspect::inventoryChanged(LLViewerObject* viewer_object, - LLInventoryObject::object_list_t* inv, - S32, - void* q_id) +void LLFloaterInspect::inventoryChanged(LLViewerObject* viewer_object, LLInventoryObject::object_list_t* inv, S32, void* q_id) { - S32 scripts = 0; std::vector::iterator iter = std::find(mQueue.begin(),mQueue.end(),viewer_object->getID()); if (viewer_object && inv && iter != mQueue.end() ) { - LLInventoryObject::object_list_t::const_iterator it = inv->begin(); + S32 scripts = 0; LLInventoryObject::object_list_t::const_iterator end = inv->end(); - for ( ; it != end; ++it) + for (LLInventoryObject::object_list_t::const_iterator it = inv->begin(); it != end; ++it) { if((*it)->getType() == LLAssetType::AT_LSL_TEXT) { - scripts++; + ++scripts; } } mInventoryNums[viewer_object->getID()] = std::make_pair(scripts,inv->size()); @@ -351,6 +400,7 @@ void LLFloaterInspect::inventoryChanged(LLViewerObject* viewer_object, } } // + void LLFloaterInspect::onFocusReceived() { LLToolMgr::getInstance()->setTransientTool(LLToolCompInspect::getInstance()); @@ -359,13 +409,11 @@ void LLFloaterInspect::onFocusReceived() void LLFloaterInspect::dirty() { - if(sInstance) - { - // - sInstance->mInventoryNums.clear(); - sInstance->mQueue.clear(); - sInstance->setDirty(); - } + // + mInventoryNums.clear(); + mQueue.clear(); + // + setDirty(); } void LLFloaterInspect::draw() diff --git a/indra/newview/llfloaterinspect.h b/indra/newview/llfloaterinspect.h index 29a2fce77..db84eadfb 100644 --- a/indra/newview/llfloaterinspect.h +++ b/indra/newview/llfloaterinspect.h @@ -35,6 +35,7 @@ #ifndef LL_LLFLOATERINSPECT_H #define LL_LLFLOATERINSPECT_H +#include "llavatarname.h" #include "llfloater.h" #include "llvoinventorylistener.h" @@ -43,41 +44,47 @@ class LLObjectSelection; class LLScrollListCtrl; class LLUICtrl; -class LLFloaterInspect : public LLFloater, public LLVOInventoryListener +class LLFloaterInspect : public LLFloater, public LLSingleton, public LLVOInventoryListener { + friend class LLSingleton; public: - virtual ~LLFloaterInspect(void); - static void show(void* ignored = NULL); + + static void showInstance(); +// static void show(void* ignored = NULL); + void onOpen(); virtual BOOL postBuild(); - static void dirty(); - static LLUUID getSelectedUUID(); + void dirty(); + LLUUID getSelectedUUID(); virtual void draw(); virtual void refresh(); - static BOOL isVisible(); +// static BOOL isVisible(); virtual void onFocusReceived(); - static void onClickCreatorProfile(void* ctrl); - static void onClickOwnerProfile(void* ctrl); - static void onSelectObject(LLUICtrl* ctrl, void* user_data); + void onClickCreatorProfile(); + void onClickOwnerProfile(); + void onSelectObject(); + + static void onGetAvNameCallback(const LLUUID& idCreator, const LLAvatarName& av_name, void* FloaterPtr); + LLScrollListCtrl* mObjectList; protected: // protected members - LLFloaterInspect(); void setDirty() { mDirty = TRUE; } bool mDirty; // - /*virtual*/ void inventoryChanged(LLViewerObject* obj, - LLInventoryObject::object_list_t* inv, - S32 serial_num, - void* queue); + /*virtual*/ void inventoryChanged(LLViewerObject* obj, LLInventoryObject::object_list_t* inv, S32, void* queue); + // private: + LLFloaterInspect(); + virtual ~LLFloaterInspect(void); // static data - static LLFloaterInspect* sInstance; +// static LLFloaterInspect* sInstance; LLSafeHandle mObjectSelection; // std::map > mInventoryNums; // std::vector mQueue; + // }; #endif //LL_LLFLOATERINSPECT_H diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 646f83f2e..a2d0e64c0 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -3292,6 +3292,7 @@ void LLSelectMgr::selectDelete() return; } // [/RLVa:KB] + S32 deleteable_count = 0; BOOL locked_but_deleteable_object = FALSE; @@ -4069,7 +4070,6 @@ void LLSelectMgr::deselectUnused() } } - void LLSelectMgr::convertTransient() { LLObjectSelection::iterator node_it; @@ -4080,23 +4080,23 @@ void LLSelectMgr::convertTransient() } } - void LLSelectMgr::deselectAllIfTooFar() { // [RLVa:KB] - Checked: 2010-11-29 (RLVa-1.3.0c) | Modified: RLVa-1.3.0c if ( (!mSelectedObjects->isEmpty()) && ((gRlvHandler.hasBehaviour(RLV_BHVR_EDIT)) || (gRlvHandler.hasBehaviour(RLV_BHVR_EDITOBJ))) ) { - struct NotTransientOrEditable : public LLSelectedNodeFunctor + struct NotTransientOrFocusedMediaOrEditable : public LLSelectedNodeFunctor { bool apply(LLSelectNode* pNode) { const LLViewerObject* pObj = pNode->getObject(); - return (!pNode->isTransient()) && (pObj) && (!gRlvHandler.canEdit(pObj)); - } - } f; - if (mSelectedObjects->getFirstRootNode(&f, TRUE)) - deselectAll(); - } + return (!pNode->isTransient()) && (pObj) && (!gRlvHandler.canEdit(pObj)) && + (pObj->getID() != LLViewerMediaFocus::getInstance()->getFocusedObjectID()); + } + } f; + if (mSelectedObjects->getFirstRootNode(&f, TRUE)) + deselectAll(); + } // [/RLVa:KB] if (mSelectedObjects->isEmpty() || mSelectedObjects->mSelectType == SELECT_TYPE_HUD) @@ -4123,9 +4123,8 @@ void LLSelectMgr::deselectAllIfTooFar() } LLVector3d selectionCenter = getSelectionCenterGlobal(); - // if (gSavedSettings.getBOOL("LimitSelectDistance") -// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f +// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-0.2.0f BOOL fRlvFartouch = gRlvHandler.hasBehaviour(RLV_BHVR_FARTOUCH) && gFloaterTools->getVisible(); if ( (gSavedSettings.getBOOL("LimitSelectDistance") || (fRlvFartouch) ) // [/RLVa:KB] @@ -4135,7 +4134,7 @@ void LLSelectMgr::deselectAllIfTooFar() && !selectionCenter.isExactlyZero()) { // F32 deselect_dist = gSavedSettings.getF32("MaxSelectDistance"); -// [RLVa:KB] - Checked: 2009-07-10 (RLVa-1.0.0g) | Modified: RLVa-0.2.0f +// [RLVa:KB] - Checked: 2010-04-11 (RLVa-1.2.0e) | Modified: RLVa-0.2.0f F32 deselect_dist = (!fRlvFartouch) ? gSavedSettings.getF32("MaxSelectDistance") : 1.5f; // [/RLVa:KB] F32 deselect_dist_sq = deselect_dist * deselect_dist; @@ -4157,6 +4156,7 @@ void LLSelectMgr::deselectAllIfTooFar() } } + void LLSelectMgr::selectionSetObjectName(const std::string& name) { // we only work correctly if 1 object is selected. @@ -4334,6 +4334,7 @@ void LLSelectMgr::sendDelink() } sendfunc; getSelection()->applyToObjects(&sendfunc); + // Delink needs to send individuals so you can unlink a single object from // a linked set. sendListToRegions( @@ -5047,6 +5048,7 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data } } + // Iterate through nodes at end, since it can be on both the regular AND hover list struct f : public LLSelectedNodeFunctor { @@ -5059,7 +5061,11 @@ void LLSelectMgr::processObjectProperties(LLMessageSystem* msg, void** user_data } func(id); LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func); - if (node) + if (!node) + { + llwarns << "Couldn't find object " << id << " selected." << llendl; + } + else { if (node->mInventorySerial != inv_serial) { @@ -5570,13 +5576,18 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) } if (mSelectedObjects->getNumNodes()) { - LLUUID inspect_item_id = LLFloaterInspect::getSelectedUUID(); + LLUUID inspect_item_id= LLUUID::null; + LLFloaterInspect* inspect_instance = LLFloaterInspect::instanceExists() ? LLFloaterInspect::getInstance() : NULL; + if(inspect_instance && inspect_instance->getVisible()) + { + inspect_item_id = inspect_instance->getSelectedUUID(); + } LLUUID focus_item_id = LLViewerMediaFocus::getInstance()->getFocusedObjectID(); // //for (S32 pass = 0; pass < 2; pass++) - //{ // + { for (LLObjectSelection::iterator iter = mSelectedObjects->begin(); iter != mSelectedObjects->end(); iter++) { @@ -5612,9 +5623,7 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) node->renderOneSilhouette(sSilhouetteChildColor); } } - // - //} - // + } } if (mHighlightedObjects->getNumNodes()) @@ -6271,7 +6280,6 @@ void LLSelectNode::renderOneSilhouette(const LLColor4 &color) // Update everyone who cares about the selection list void dialog_refresh_all() - { // This is the easiest place to fire the update signal, as it will // make cleaning up the functions below easier. Also, sometimes entities @@ -6300,7 +6308,12 @@ void dialog_refresh_all() } LLFloaterProperties::dirtyAll(); - LLFloaterInspect::dirty(); + + LLFloaterInspect* inspect_instance = LLFloaterInspect::instanceExists() ? LLFloaterInspect::getInstance() : NULL; + if(inspect_instance) + { + inspect_instance->dirty(); + } } S32 get_family_count(LLViewerObject *parent) diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index fcafd4bfd..dcb3a9c4c 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -2057,7 +2057,7 @@ class LLObjectInspect : public view_listener_t { bool handleEvent(LLPointer event, const LLSD& userdata) { - LLFloaterInspect::show(); + LLFloaterInspect::showInstance(); return true; } }; diff --git a/indra/newview/skins/default/xui/en-us/floater_inspect.xml b/indra/newview/skins/default/xui/en-us/floater_inspect.xml index 5999dd549..e10b2fe06 100644 --- a/indra/newview/skins/default/xui/en-us/floater_inspect.xml +++ b/indra/newview/skins/default/xui/en-us/floater_inspect.xml @@ -16,14 +16,22 @@ + From ffe403e0f04875f68cf22efb8c325302fd4043bf Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 13 Jul 2013 16:38:20 -0400 Subject: [PATCH 16/78] Update administrative tools code from upstream Updates LLFloaterTopObjects code to have parcel filter(STAT_FILTER_BY_PARCEL_NAME) and use the CallbackRegistrar Top Objects XML (and Translation) bits updated in part from Firestorm, as LL Viewer lacks certain buttons and the old xml was too far behind - Translators may want to have a look at this... although you sorta need to have estate powers for it to be of any worth... *sigh* Updates LLFloaterGodTools to use CallbackRegistrar --- indra/llcommon/indra_constants.h | 1 + indra/newview/llfloatergodtools.cpp | 201 +++---- indra/newview/llfloatergodtools.h | 14 +- indra/newview/llfloaterregioninfo.cpp | 12 +- indra/newview/llfloatertopobjects.cpp | 492 ++++++++---------- indra/newview/llfloatertopobjects.h | 48 +- .../default/xui/de/floater_top_objects.xml | 83 +-- .../default/xui/en-us/floater_god_tools.xml | 200 +++++-- .../default/xui/en-us/floater_top_objects.xml | 381 +++++++++++--- .../default/xui/es/floater_top_objects.xml | 85 +-- .../default/xui/fr/floater_top_objects.xml | 73 +-- .../default/xui/pt/floater_top_objects.xml | 70 +-- 12 files changed, 942 insertions(+), 718 deletions(-) diff --git a/indra/llcommon/indra_constants.h b/indra/llcommon/indra_constants.h index 05e59d51f..3f0e8dd6c 100644 --- a/indra/llcommon/indra_constants.h +++ b/indra/llcommon/indra_constants.h @@ -63,6 +63,7 @@ enum LAND_STAT_FLAGS STAT_FILTER_BY_PARCEL = 0x00000001, STAT_FILTER_BY_OWNER = 0x00000002, STAT_FILTER_BY_OBJECT = 0x00000004, + STAT_FILTER_BY_PARCEL_NAME = 0x00000008, STAT_REQUEST_LAST_ENTRY = 0x80000000, }; diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp index d4d21f352..fc4287982 100644 --- a/indra/newview/llfloatergodtools.cpp +++ b/indra/newview/llfloatergodtools.cpp @@ -62,7 +62,6 @@ #include "llviewerwindow.h" #include "llworld.h" #include "llfloateravatarpicker.h" -#include "llnotify.h" #include "llxfermanager.h" #include "llvlcomposition.h" #include "llsurface.h" @@ -77,9 +76,9 @@ const F32 SECONDS_BETWEEN_UPDATE_REQUESTS = 5.0f; -// ***************************************************************************** +//***************************************************************************** // LLFloaterGodTools -// ***************************************************************************** +//***************************************************************************** void LLFloaterGodTools::onOpen() { @@ -100,6 +99,7 @@ void LLFloaterGodTools::onOpen() } } + // static void LLFloaterGodTools::refreshAll() { @@ -121,36 +121,31 @@ LLFloaterGodTools::LLFloaterGodTools() mCurrentHost(LLHost::invalid), mUpdateTimer() { - LLCallbackMap::map_t factory_map; - factory_map["grid"] = LLCallbackMap(createPanelGrid, this); - factory_map["region"] = LLCallbackMap(createPanelRegion, this); - factory_map["objects"] = LLCallbackMap(createPanelObjects, this); - factory_map["request"] = LLCallbackMap(createPanelRequest, this); - LLUICtrlFactory::getInstance()->buildFloater(this, "floater_god_tools.xml", &factory_map); + mFactoryMap["grid"] = LLCallbackMap(createPanelGrid, this); + mFactoryMap["region"] = LLCallbackMap(createPanelRegion, this); + mFactoryMap["objects"] = LLCallbackMap(createPanelObjects, this); + mFactoryMap["request"] = LLCallbackMap(createPanelRequest, this); + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_god_tools.xml", &getFactoryMap()); } BOOL LLFloaterGodTools::postBuild() { - getChild("GodTools Tabs")->setCommitCallback(boost::bind(&LLFloaterGodTools::onTabChanged,_1,_2)); - sendRegionInfoRequest(); getChild("GodTools Tabs")->selectTabByName("region"); - - childSetTextArg("land cost text", "[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); + getChild("land cost text")->setTextArg("[CURRENCY]", gHippoGridManager->getConnectedGrid()->getCurrencySymbol()); return TRUE; } - // static void* LLFloaterGodTools::createPanelGrid(void *userdata) { - return new LLPanelGridTools("grid"); + return new LLPanelGridTools(); } // static void* LLFloaterGodTools::createPanelRegion(void *userdata) { LLFloaterGodTools* self = (LLFloaterGodTools*)userdata; - self->mPanelRegionTools = new LLPanelRegionTools("region"); + self->mPanelRegionTools = new LLPanelRegionTools(); return self->mPanelRegionTools; } @@ -158,14 +153,14 @@ void* LLFloaterGodTools::createPanelRegion(void *userdata) void* LLFloaterGodTools::createPanelObjects(void *userdata) { LLFloaterGodTools* self = (LLFloaterGodTools*)userdata; - self->mPanelObjectTools = new LLPanelObjectTools("objects"); + self->mPanelObjectTools = new LLPanelObjectTools(); return self->mPanelObjectTools; } // static void* LLFloaterGodTools::createPanelRequest(void *userdata) { - return new LLPanelRequestTools("region"); + return new LLPanelRequestTools(); } LLFloaterGodTools::~LLFloaterGodTools() @@ -226,14 +221,6 @@ void LLFloaterGodTools::showPanel(const std::string& panel_name) panel->setFocus(TRUE); } -//static -void LLFloaterGodTools::onTabChanged(LLUICtrl* ctrl, const LLSD& param) -{ - LLPanel* panel = (LLPanel*)ctrl->getChildView(param.asString(),false,false); - if (panel) - panel->setFocus(TRUE); -} - // static void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg) { @@ -403,9 +390,9 @@ void LLFloaterGodTools::sendGodUpdateRegionInfo() } } -// ***************************************************************************** +//***************************************************************************** // LLPanelRegionTools -// ***************************************************************************** +//***************************************************************************** // || Region |______________________________________ @@ -440,72 +427,37 @@ const F32 PRICE_PER_METER_MIN = 0.f; const F32 PRICE_PER_METER_MAX = 100.f; -LLPanelRegionTools::LLPanelRegionTools(const std::string& title) -: LLPanel(title) +LLPanelRegionTools::LLPanelRegionTools() +: LLPanel() { + mCommitCallbackRegistrar.add("RegionTools.ChangeAnything", boost::bind(&LLPanelRegionTools::onChangeAnything, this)); + mCommitCallbackRegistrar.add("RegionTools.ChangePrelude", boost::bind(&LLPanelRegionTools::onChangePrelude, this)); + mCommitCallbackRegistrar.add("RegionTools.BakeTerrain", boost::bind(&LLPanelRegionTools::onBakeTerrain, this)); + mCommitCallbackRegistrar.add("RegionTools.RevertTerrain", boost::bind(&LLPanelRegionTools::onRevertTerrain, this)); + mCommitCallbackRegistrar.add("RegionTools.SwapTerrain", boost::bind(&LLPanelRegionTools::onSwapTerrain, this)); + mCommitCallbackRegistrar.add("RegionTools.Refresh", boost::bind(&LLPanelRegionTools::onRefresh, this)); + mCommitCallbackRegistrar.add("RegionTools.ApplyChanges", boost::bind(&LLPanelRegionTools::onApplyChanges, this)); + mCommitCallbackRegistrar.add("RegionTools.SelectRegion", boost::bind(&LLPanelRegionTools::onSelectRegion, this)); + mCommitCallbackRegistrar.add("RegionTools.SaveState", boost::bind(&LLPanelRegionTools::onSaveState, this)); } BOOL LLPanelRegionTools::postBuild() { - LLLineEditor* region_name = getChild("region name"); - region_name->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - region_name->setKeystrokeCallback(boost::bind(&LLPanelRegionTools::onChangeSimName, this)); - region_name->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); + getChild("region name")->setKeystrokeCallback(boost::bind(&LLPanelRegionTools::onChangeSimName, this)); + getChild("region name")->setPrevalidate(&LLLineEditor::prevalidatePrintableNotPipe); + getChild("estate")->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); + getChild("parentestate")->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); + getChildView("parentestate")->setEnabled(FALSE); + getChild("gridposx")->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); + getChildView("gridposx")->setEnabled(FALSE); + getChild("gridposy")->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); + getChildView("gridposy")->setEnabled(FALSE); + + getChild("redirectx")->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); + getChild("redirecty")->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); - getChild("check prelude")->setCommitCallback(boost::bind(&LLPanelRegionTools:: onChangePrelude, this)); - getChild("check fixed sun")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - getChild("check reset home")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - getChild("check visible")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - getChild("check damage")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - getChild("block dwell")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - getChild("block terraform")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - getChild("allow transfer")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - getChild("is sandbox")->setCommitCallback( boost::bind(&LLPanelRegionTools::onChangeAnything, this)); getChild("is gaming")->setVisible((gAgent.getRegion()->getGamingFlags() & REGION_GAMING_PRESENT) && !(gAgent.getRegion()->getGamingFlags() & REGION_GAMING_HIDE_GOD_FLOATER)); - getChild("is gaming")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); getChild("hide from search")->setVisible(!gHippoGridManager->getConnectedGrid()->isSecondLife()); - getChild("hide from search")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - - childSetAction("Bake Terrain", boost::bind(&LLPanelRegionTools::onBakeTerrain, this)); - childSetAction("Revert Terrain", boost::bind(&LLPanelRegionTools::onRevertTerrain, this)); - childSetAction("Swap Terrain", boost::bind(&LLPanelRegionTools::onSwapTerrain, this)); - - LLLineEditor* estate = getChild("estate name"); - estate->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - estate->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); - - LLLineEditor* parentestate = getChild("parentestate"); - parentestate->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - parentestate->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); - parentestate->setEnabled(false); - - LLLineEditor* gridposx = getChild("gridposx"); - gridposx->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - gridposx->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); - gridposx->setEnabled(false); - - LLLineEditor* gridposy = getChild("gridposy"); - gridposy->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - gridposy->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); - gridposy->setEnabled(false); - - LLLineEditor* redirectx = getChild("redirectx"); - redirectx->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - redirectx->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); - - LLLineEditor* redirecty = getChild("redirecty"); - redirecty->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - redirecty->setPrevalidate(&LLLineEditor::prevalidatePositiveS32); - - getChild("billable factor")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - - getChild("land cost")->setCommitCallback(boost::bind(&LLPanelRegionTools::onChangeAnything, this)); - - getChild("Refresh")->setClickedCallback(boost::bind(&LLPanelRegionTools::onRefresh, this)); - getChild("Apply")->setClickedCallback(boost::bind(&LLPanelRegionTools::onApplyChanges, this)); - - getChild("Select Region")->setClickedCallback(boost::bind(&LLPanelRegionTools::onSelectRegion, this)); - getChild("Autosave now")->setClickedCallback(boost::bind(&LLPanelRegionTools::onSaveState,(void*)NULL)); return TRUE; } @@ -592,8 +544,7 @@ void LLPanelRegionTools::enableAllWidgets() getChildView("Autosave now")->setEnabled(TRUE); } -//static -void LLPanelRegionTools::onSaveState(void*) +void LLPanelRegionTools::onSaveState(void* userdata) { if (gAgent.isGodlike()) { @@ -918,12 +869,13 @@ void LLPanelRegionTools::onSelectRegion() // LEFT R2 RIGHT const F32 HOURS_TO_RADIANS = (2.f*F_PI)/24.f; -const char FLOATER_GRID_ADMIN_TITLE[] = "Grid Administration"; -LLPanelGridTools::LLPanelGridTools(const std::string& name) : - LLPanel(name) +LLPanelGridTools::LLPanelGridTools() : + LLPanel() { + mCommitCallbackRegistrar.add("GridTools.KickAllUsers", boost::bind(&LLPanelGridTools::onClickKickAll, this)); + mCommitCallbackRegistrar.add("GridTools.FlushMapVisibilityCaches", boost::bind(&LLPanelGridTools::onClickFlushMapVisibilityCaches, this)); } // Destroys the object @@ -933,9 +885,6 @@ LLPanelGridTools::~LLPanelGridTools() BOOL LLPanelGridTools::postBuild() { - childSetAction("Kick all users", boost::bind(&LLPanelGridTools::onClickKickAll, this)); - childSetAction("Flush This Region's Map Visibility Caches", boost::bind(&LLPanelGridTools::onClickFlushMapVisibilityCaches, this)); - return TRUE; } @@ -943,7 +892,6 @@ void LLPanelGridTools::refresh() { } - void LLPanelGridTools::onClickKickAll() { LLNotificationsUtil::add("KickAllUsers", LLSD(), LLSD(), LLPanelGridTools::confirmKick); @@ -952,7 +900,7 @@ void LLPanelGridTools::onClickKickAll() // static bool LLPanelGridTools::confirmKick(const LLSD& notification, const LLSD& response) { - if (LLNotification::getSelectedOption(notification, response) == 0) + if (LLNotificationsUtil::getSelectedOption(notification, response) == 0) { LLSD payload; payload["kick_message"] = response["message"].asString(); @@ -964,7 +912,7 @@ bool LLPanelGridTools::confirmKick(const LLSD& notification, const LLSD& respons // static bool LLPanelGridTools::finishKick(const LLSD& notification, const LLSD& response) { - S32 option = LLNotification::getSelectedOption(notification, response); + S32 option = LLNotificationsUtil::getSelectedOption(notification, response); if (option == 0) { @@ -1036,10 +984,19 @@ bool LLPanelGridTools::flushMapVisibilityCachesConfirm(const LLSD& notification, // LEFT RIGHT // Default constructor -LLPanelObjectTools::LLPanelObjectTools(const std::string& title) - : LLPanel(title), +LLPanelObjectTools::LLPanelObjectTools() + : LLPanel(), mTargetAvatar() { + mCommitCallbackRegistrar.add("ObjectTools.ChangeAnything", boost::bind(&LLPanelObjectTools::onChangeAnything, this)); + mCommitCallbackRegistrar.add("ObjectTools.DeletePublicOwnedBy", boost::bind(&LLPanelObjectTools::onClickDeletePublicOwnedBy, this)); + mCommitCallbackRegistrar.add("ObjectTools.DeleteAllScriptedOwnedBy", boost::bind(&LLPanelObjectTools::onClickDeleteAllScriptedOwnedBy, this)); + mCommitCallbackRegistrar.add("ObjectTools.DeleteAllOwnedBy", boost::bind(&LLPanelObjectTools::onClickDeleteAllOwnedBy, this)); + mCommitCallbackRegistrar.add("ObjectTools.ApplyChanges", boost::bind(&LLPanelObjectTools::onApplyChanges, this)); + mCommitCallbackRegistrar.add("ObjectTools.Set", boost::bind(&LLPanelObjectTools::onClickSet, this)); + mCommitCallbackRegistrar.add("ObjectTools.GetTopColliders", boost::bind(&LLPanelObjectTools::onGetTopColliders, this)); + mCommitCallbackRegistrar.add("ObjectTools.GetTopScripts", boost::bind(&LLPanelObjectTools::onGetTopScripts, this)); + mCommitCallbackRegistrar.add("ObjectTools.GetScriptDigest", boost::bind(&LLPanelObjectTools::onGetScriptDigest, this)); } // Destroys the object @@ -1050,22 +1007,6 @@ LLPanelObjectTools::~LLPanelObjectTools() BOOL LLPanelObjectTools::postBuild() { - getChild("disable scripts")->setCommitCallback(boost::bind(&LLPanelObjectTools::onChangeAnything, this)); - getChild("disable collisions")->setCommitCallback(boost::bind(&LLPanelObjectTools::onChangeAnything, this)); - getChild("disable physics")->setCommitCallback(boost::bind(&LLPanelObjectTools::onChangeAnything, this)); - - childSetAction("Apply", boost::bind(&LLPanelObjectTools::onApplyChanges, this)); - - childSetAction("Set Target", boost::bind(&LLPanelObjectTools::onClickSet, this)); - - childSetAction("Delete Target's Scripted Objects On Others Land", boost::bind(&LLPanelObjectTools::onClickDeletePublicOwnedBy, this)); - childSetAction("Delete Target's Scripted Objects On *Any* Land", boost::bind(&LLPanelObjectTools::onClickDeleteAllScriptedOwnedBy, this)); - childSetAction("Delete *ALL* Of Target's Objects", boost::bind(&LLPanelObjectTools::onClickDeleteAllOwnedBy, this)); - - childSetAction("Get Top Colliders", boost::bind(&LLPanelObjectTools::onGetTopColliders, this)); - childSetAction("Get Top Scripts", boost::bind(&LLPanelObjectTools::onGetTopScripts, this)); - childSetAction("Scripts digest", boost::bind(&LLPanelObjectTools::onGetScriptDigest, this)); - refresh(); return TRUE; } @@ -1154,29 +1095,30 @@ void LLPanelObjectTools::enableAllWidgets() getChildView("Get Top Scripts")->setEnabled(TRUE); } + void LLPanelObjectTools::onGetTopColliders() { - LLFloaterGodTools* god_tools = LLFloaterGodTools::instanceExists() ? LLFloaterGodTools::getInstance() : NULL; - if(!god_tools) - return; + LLFloaterTopObjects* instance = LLFloaterTopObjects::getInstance(); + if(!instance) return; + if (gAgent.isGodlike()) { - LLFloaterTopObjects::show(); + instance->open(); LLFloaterTopObjects::setMode(STAT_REPORT_TOP_COLLIDERS); - LLFloaterTopObjects::onRefresh(NULL); + instance->onRefresh(); } } void LLPanelObjectTools::onGetTopScripts() { - LLFloaterGodTools* god_tools = LLFloaterGodTools::instanceExists() ? LLFloaterGodTools::getInstance() : NULL; - if(!god_tools) - return; + LLFloaterTopObjects* instance = LLFloaterTopObjects::getInstance(); + if(!instance) return; + if (gAgent.isGodlike()) { - LLFloaterTopObjects::show(); + instance->open(); LLFloaterTopObjects::setMode(STAT_REPORT_TOP_SCRIPTS); - LLFloaterTopObjects::onRefresh(NULL); + instance->onRefresh(); } } @@ -1282,7 +1224,7 @@ void LLPanelObjectTools::onClickSetBySelection(void* data) LLPanelObjectTools* panelp = (LLPanelObjectTools*) data; if (!panelp) return; - const BOOL non_root_ok = TRUE; + const BOOL non_root_ok = TRUE; LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(NULL, non_root_ok); if (!node) return; @@ -1336,9 +1278,10 @@ void LLPanelObjectTools::onApplyChanges() const std::string SELECTION = "Selection"; const std::string AGENT_REGION = "Agent Region"; -LLPanelRequestTools::LLPanelRequestTools(const std::string& name): - LLPanel(name) +LLPanelRequestTools::LLPanelRequestTools(): + LLPanel() { + mCommitCallbackRegistrar.add("GodTools.Request", boost::bind(&LLPanelRequestTools::onClickRequest, this)); } LLPanelRequestTools::~LLPanelRequestTools() @@ -1347,8 +1290,6 @@ LLPanelRequestTools::~LLPanelRequestTools() BOOL LLPanelRequestTools::postBuild() { - childSetAction("Make Request", boost::bind(&LLPanelRequestTools::onClickRequest, this)); - refresh(); return TRUE; diff --git a/indra/newview/llfloatergodtools.h b/indra/newview/llfloatergodtools.h index ecfdd98b4..f01c0ac44 100644 --- a/indra/newview/llfloatergodtools.h +++ b/indra/newview/llfloatergodtools.h @@ -52,7 +52,7 @@ class LLTextBox; class LLMessageSystem; class LLFloaterGodTools -: public LLFloater, public LLSingleton + : public LLFloater, public LLSingleton { public: @@ -94,8 +94,6 @@ public: // Send possibly changed values to simulator. void sendGodUpdateRegionInfo(); - static void onTabChanged(LLUICtrl* ctrl, const LLSD& param); - public: LLFloaterGodTools(); @@ -128,14 +126,14 @@ class LLPanelRegionTools : public LLPanel { public: - LLPanelRegionTools(const std::string& name); + LLPanelRegionTools(); /*virtual*/ ~LLPanelRegionTools(); BOOL postBuild(); /*virtual*/ void refresh(); - static void onSaveState(void*); + static void onSaveState(void* userdata); void onChangeSimName(); void onChangeAnything(); @@ -190,7 +188,7 @@ class LLPanelGridTools : public LLPanel { public: - LLPanelGridTools(const std::string& name); + LLPanelGridTools(); virtual ~LLPanelGridTools(); BOOL postBuild(); @@ -217,7 +215,7 @@ class LLPanelObjectTools : public LLPanel { public: - LLPanelObjectTools(const std::string& name); + LLPanelObjectTools(); /*virtual*/ ~LLPanelObjectTools(); BOOL postBuild(); @@ -258,7 +256,7 @@ protected: class LLPanelRequestTools : public LLPanel { public: - LLPanelRequestTools(const std::string& name); + LLPanelRequestTools(); /*virtual*/ ~LLPanelRequestTools(); BOOL postBuild(); diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index e05e2f5e1..8719cf98f 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -1081,8 +1081,10 @@ void LLPanelRegionDebugInfo::onClickTopColliders(void* data) strings_t strings; strings.push_back("1"); // one physics step LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); - LLFloaterTopObjects::show(); - LLFloaterTopObjects::clearList(); + LLFloaterTopObjects* instance = LLFloaterTopObjects::getInstance(); + if(!instance) return; + instance->open(); + instance->clearList(); self->sendEstateOwnerMessage(gMessageSystem, "colliders", invoice, strings); } @@ -1093,8 +1095,10 @@ void LLPanelRegionDebugInfo::onClickTopScripts(void* data) strings_t strings; strings.push_back("6"); // top 5 scripts LLUUID invoice(LLFloaterRegionInfo::getLastInvoice()); - LLFloaterTopObjects::show(); - LLFloaterTopObjects::clearList(); + LLFloaterTopObjects* instance = LLFloaterTopObjects::getInstance(); + if(!instance) return; + instance->open(); + instance->clearList(); self->sendEstateOwnerMessage(gMessageSystem, "scripts", invoice, strings); } diff --git a/indra/newview/llfloatertopobjects.cpp b/indra/newview/llfloatertopobjects.cpp index 215a8940e..4b16cb28c 100644 --- a/indra/newview/llfloatertopobjects.cpp +++ b/indra/newview/llfloatertopobjects.cpp @@ -34,11 +34,11 @@ #include "llfloatertopobjects.h" +// library includes #include "message.h" #include "llfontgl.h" #include "llagent.h" -#include "llavataractions.h" #include "llbutton.h" #include "llfloatergodtools.h" #include "llnotificationsutil.h" @@ -56,13 +56,13 @@ #include "llagentcamera.h" #include "llviewerobjectlist.h" -void cmdline_printchat(std::string message); +#include "llavataractions.h" -LLFloaterTopObjects* LLFloaterTopObjects::sInstance = NULL; +//LLFloaterTopObjects* LLFloaterTopObjects::sInstance = NULL; // Globals // const U32 TIME_STR_LENGTH = 30; - +/* // static void LLFloaterTopObjects::show() { @@ -73,89 +73,76 @@ void LLFloaterTopObjects::show() } sInstance = new LLFloaterTopObjects(); - LLUICtrlFactory::getInstance()->buildFloater(sInstance, "floater_top_objects.xml"); sInstance->center(); } - +*/ LLFloaterTopObjects::LLFloaterTopObjects() : LLFloater(std::string("top_objects")), mInitialized(FALSE), mtotalScore(0.f) { - sInstance = this; + mCommitCallbackRegistrar.add("TopObjects.ShowBeacon", boost::bind(&LLFloaterTopObjects::onClickShowBeacon, this)); + mCommitCallbackRegistrar.add("TopObjects.ReturnSelected", boost::bind(&LLFloaterTopObjects::onReturnSelected, this)); + mCommitCallbackRegistrar.add("TopObjects.ReturnAll", boost::bind(&LLFloaterTopObjects::onReturnAll, this)); + mCommitCallbackRegistrar.add("TopObjects.DisableSelected", boost::bind(&LLFloaterTopObjects::onDisableSelected, this)); + mCommitCallbackRegistrar.add("TopObjects.DisableAll", boost::bind(&LLFloaterTopObjects::onDisableAll, this)); + mCommitCallbackRegistrar.add("TopObjects.Refresh", boost::bind(&LLFloaterTopObjects::onRefresh, this)); + mCommitCallbackRegistrar.add("TopObjects.GetByObjectName", boost::bind(&LLFloaterTopObjects::onGetByObjectName, this)); + mCommitCallbackRegistrar.add("TopObjects.GetByOwnerName", boost::bind(&LLFloaterTopObjects::onGetByOwnerName, this)); + mCommitCallbackRegistrar.add("TopObjects.GetByParcelName", boost::bind(&LLFloaterTopObjects::onGetByParcelName, this)); + mCommitCallbackRegistrar.add("TopObjects.CommitObjectsList",boost::bind(&LLFloaterTopObjects::onCommitObjectsList, this)); + + mCommitCallbackRegistrar.add("TopObjects.TeleportToObject", boost::bind(&LLFloaterTopObjects::onTeleportToObject, this)); + mCommitCallbackRegistrar.add("TopObjects.Kick", boost::bind(&LLFloaterTopObjects::onKick, this)); + mCommitCallbackRegistrar.add("TopObjects.Profile", boost::bind(&LLFloaterTopObjects::onProfile, this)); + + LLUICtrlFactory::getInstance()->buildFloater(this, "floater_top_objects.xml"); } LLFloaterTopObjects::~LLFloaterTopObjects() { - sInstance = NULL; } // virtual BOOL LLFloaterTopObjects::postBuild() { - LLScrollListCtrl *objects_list = getChild("objects_list"); - if (objects_list) - { - objects_list->setCommitCallback(boost::bind(&LLFloaterTopObjects::onCommitObjectsList,_1,this)); - objects_list->setDoubleClickCallback(boost::bind(&LLFloaterTopObjects::onDoubleClickObjectsList,this)); - objects_list->setFocus(true); - objects_list->setCommitOnSelectionChange(TRUE); - } + getChild("objects_list")->setFocus(TRUE); + objects_list->setDoubleClickCallback(onDoubleClickObjectsList, this); + objects_list->setCommitOnSelectionChange(TRUE); - childSetAction("show_beacon_btn", onClickShowBeacon, this); setDefaultBtn("show_beacon_btn"); - childSetAction("return_selected_btn", onReturnSelected, this); - childSetAction("return_all_btn", onReturnAll, this); - childSetAction("disable_selected_btn", onDisableSelected, this); - childSetAction("disable_all_btn", onDisableAll, this); - childSetAction("refresh_btn", onRefresh, this); - - childSetAction("lagwarning", onLagWarningBtn, this); - childSetAction("profile", onProfileBtn, this); - childSetAction("kick", onKickBtn, this); - childSetAction("tpto", onTPBtn, this); - - - childSetAction("filter_object_btn", onGetByObjectNameClicked, this); - childSetAction("filter_owner_btn", onGetByOwnerNameClicked, this); - - - /* - LLLineEditor* line_editor = getChild("owner_name_editor"); - if (line_editor) - { - line_editor->setCommitOnFocusLost(FALSE); - line_editor->setCommitCallback(onGetByOwnerName, this); - } - - line_editor = getChild("object_name_editor"); - if (line_editor) - { - line_editor->setCommitOnFocusLost(FALSE); - line_editor->setCommitCallback(onGetByObjectName, this); - }*/ - mCurrentMode = STAT_REPORT_TOP_SCRIPTS; mFlags = 0; mFilter.clear(); + center(); return TRUE; } +// static +void LLFloaterTopObjects::setMode(U32 mode) +{ + LLFloaterTopObjects* instance = instanceExists() ? getInstance() : NULL; + if(!instance) return; + instance->mCurrentMode = mode; +} +// static void LLFloaterTopObjects::handle_land_reply(LLMessageSystem* msg, void** data) { + LLFloaterTopObjects* instance = instanceExists() ? getInstance() : NULL; + if(!instance) return; // Make sure dialog is on screen - show(); - sInstance->handleReply(msg, data); + instance->open(); + instance->handleReply(msg, data); //HACK: for some reason sometimes top scripts originally comes back //with no results even though they're there - if (!sInstance->mObjectListIDs.size() && !sInstance->mInitialized) + if (!instance->mObjectListIDs.size() && !instance->mInitialized) { - sInstance->onRefresh(NULL); - sInstance->mInitialized = TRUE; + instance->onRefresh(); + instance->mInitialized = TRUE; } } @@ -170,7 +157,7 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) msg->getU32Fast(_PREHASH_RequestData, _PREHASH_ReportType, mCurrentMode); LLScrollListCtrl *list = getChild("objects_list"); - + S32 block_count = msg->getNumberOfBlocks("ReportData"); for (S32 block = 0; block < block_count; ++block) { @@ -181,9 +168,11 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) F32 score; std::string name_buf; std::string owner_buf; + std::string parcel_buf("unknown"); F32 mono_score = 0.f; bool have_extended_data = false; S32 public_urls = 0; + F32 script_memory = 0.f; msg->getU32Fast(_PREHASH_ReportData, _PREHASH_TaskLocalID, task_local_id, block); msg->getUUIDFast(_PREHASH_ReportData, _PREHASH_TaskID, task_id, block); @@ -193,12 +182,18 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) msg->getF32Fast(_PREHASH_ReportData, _PREHASH_Score, score, block); msg->getStringFast(_PREHASH_ReportData, _PREHASH_TaskName, name_buf, block); msg->getStringFast(_PREHASH_ReportData, _PREHASH_OwnerName, owner_buf, block); + if(msg->has("DataExtended")) { have_extended_data = true; msg->getU32("DataExtended", "TimeStamp", time_stamp, block); msg->getF32("DataExtended", "MonoScore", mono_score, block); - msg->getS32(_PREHASH_ReportData,"PublicURLs",public_urls,block); + msg->getS32("DataExtended", "PublicURLs", public_urls, block); + if (msg->getSize("DataExtended", "ParcelName") > 0) + { + msg->getString("DataExtended", "ParcelName", parcel_buf, block); + msg->getF32("DataExtended", "Size", script_memory, block); + } } LLSD element; @@ -206,39 +201,49 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) element["id"] = task_id; element["object_name"] = name_buf; element["owner_name"] = owner_buf; - element["columns"][0]["column"] = "score"; - element["columns"][0]["value"] = llformat("%0.3f", score); - element["columns"][0]["font"] = "SANSSERIF"; + + LLSD columns; + S32 column_num = 0; + columns[column_num]["column"] = "score"; + columns[column_num]["value"] = llformat("%0.3f", score); + columns[column_num++]["font"] = "SANSSERIF"; - element["columns"][1]["column"] = "name"; - element["columns"][1]["value"] = name_buf; - element["columns"][1]["font"] = "SANSSERIF"; - if (name_buf == owner_buf) + columns[column_num]["column"] = "name"; + columns[column_num]["value"] = name_buf; + if (name_buf == owner_buf) { - element["columns"][1]["color"] = LLColor4::red.getValue(); + columns[column_num]["color"] = LLColor4::red.getValue(); } - element["columns"][2]["column"] = "owner"; - element["columns"][2]["value"] = owner_buf; - element["columns"][2]["font"] = "SANSSERIF"; - element["columns"][3]["column"] = "location"; - element["columns"][3]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z); - element["columns"][3]["font"] = "SANSSERIF"; - element["columns"][4]["column"] = "time"; - element["columns"][4]["value"] = formatted_time((time_t)time_stamp); - element["columns"][4]["font"] = "SANSSERIF"; + columns[column_num++]["font"] = "SANSSERIF"; + + columns[column_num]["column"] = "owner"; + columns[column_num]["value"] = owner_buf; + columns[column_num++]["font"] = "SANSSERIF"; + + columns[column_num]["column"] = "location"; + columns[column_num]["value"] = llformat("<%0.1f,%0.1f,%0.1f>", location_x, location_y, location_z); + columns[column_num++]["font"] = "SANSSERIF"; + + columns[column_num]["column"] = "parcel"; + columns[column_num]["value"] = parcel_buf; + columns[column_num++]["font"] = "SANSSERIF"; + + columns[column_num]["column"] = "time"; + columns[column_num]["value"] = formatted_time((time_t)time_stamp); + columns[column_num++]["font"] = "SANSSERIF"; if (mCurrentMode == STAT_REPORT_TOP_SCRIPTS && have_extended_data) { - element["columns"][5]["column"] = "mono_time"; - element["columns"][5]["value"] = llformat("%0.3f", mono_score); - element["columns"][5]["font"] = "SANSSERIF"; + columns[column_num]["column"] = "memory"; + columns[column_num]["value"] = llformat("%0.0f", (script_memory / 1000.f)); + columns[column_num++]["font"] = "SANSSERIF"; - element["columns"][6]["column"] = "URLs"; - element["columns"][6]["value"] = llformat("%d", public_urls); - element["columns"][6]["font"] = "SANSSERIF"; + columns[column_num]["column"] = "URLs"; + columns[column_num]["value"] = llformat("%d", public_urls); + columns[column_num++]["font"] = "SANSSERIF"; } - + element["columns"] = columns; list->addElement(element); mObjectListData.append(element); @@ -260,30 +265,27 @@ void LLFloaterTopObjects::handleReply(LLMessageSystem *msg, void** data) { setTitle(getString("top_scripts_title")); list->setColumnLabel("score", getString("scripts_score_label")); - list->setColumnLabel("mono_time", getString("scripts_mono_time_label")); LLUIString format = getString("top_scripts_text"); format.setArg("[COUNT]", llformat("%d", total_count)); - format.setArg("[TIME]", llformat("%0.1f", mtotalScore)); - childSetValue("title_text", LLSD(format)); + format.setArg("[TIME]", llformat("%0.3f", mtotalScore)); + getChild("title_text")->setValue(LLSD(format)); } else { setTitle(getString("top_colliders_title")); list->setColumnLabel("score", getString("colliders_score_label")); - list->setColumnLabel("mono_time", ""); + list->setColumnLabel("URLs", ""); + list->setColumnLabel("memory", ""); LLUIString format = getString("top_colliders_text"); format.setArg("[COUNT]", llformat("%d", total_count)); - childSetValue("title_text", LLSD(format)); + getChild("title_text")->setValue(LLSD(format)); } } -// static -void LLFloaterTopObjects::onCommitObjectsList(LLUICtrl* ctrl, void* data) +void LLFloaterTopObjects::onCommitObjectsList() { - LLFloaterTopObjects* self = (LLFloaterTopObjects*)data; - - self->updateSelectionInfo(); + updateSelectionInfo(); } void LLFloaterTopObjects::updateSelectionInfo() @@ -297,9 +299,15 @@ void LLFloaterTopObjects::updateSelectionInfo() std::string object_id_string = object_id.asString(); - childSetValue("id_editor", LLSD(object_id_string)); - childSetValue("object_name_editor", list->getFirstSelected()->getColumn(1)->getValue().asString()); - childSetValue("owner_name_editor", list->getFirstSelected()->getColumn(2)->getValue().asString()); + getChild("id_editor")->setValue(LLSD(object_id_string)); + LLScrollListItem* sli = list->getFirstSelected(); + llassert(sli); + if (sli) + { + getChild("object_name_editor")->setValue(sli->getColumn(1)->getValue().asString()); + getChild("owner_name_editor")->setValue(sli->getColumn(2)->getValue().asString()); + getChild("parcel_name_editor")->setValue(sli->getColumn(4)->getValue().asString()); + } } // static @@ -307,36 +315,12 @@ void LLFloaterTopObjects::onDoubleClickObjectsList(void* data) { LLFloaterTopObjects* self = (LLFloaterTopObjects*)data; self->showBeacon(); - self->lookAtAvatar(); -} - -void LLFloaterTopObjects::lookAtAvatar() -{ - LLScrollListCtrl* list = getChild("objects_list"); - if (!list) return; - LLScrollListItem* first_selected = list->getFirstSelected(); - if (!first_selected) return; - LLUUID taskid = first_selected->getUUID(); - - LLVOAvatar* voavatar = gObjectList.findAvatar(taskid); - if(voavatar) - { - gAgentCamera.setFocusOnAvatar(FALSE, FALSE); - gAgentCamera.changeCameraToThirdPerson(); - gAgentCamera.setFocusGlobal(voavatar->getPositionGlobal(),taskid); - gAgentCamera.setCameraPosAndFocusGlobal(voavatar->getPositionGlobal() - + LLVector3d(3.5,1.35,0.75) * voavatar->getRotation(), - voavatar->getPositionGlobal(), - taskid ); - } } // static -void LLFloaterTopObjects::onClickShowBeacon(void* data) +void LLFloaterTopObjects::onClickShowBeacon() { - LLFloaterTopObjects* self = (LLFloaterTopObjects*)data; - if (!self) return; - self->showBeacon(); + showBeacon(); } void LLFloaterTopObjects::doToObjects(int action, bool all) @@ -346,10 +330,10 @@ void LLFloaterTopObjects::doToObjects(int action, bool all) LLViewerRegion* region = gAgent.getRegion(); if (!region) return; - LLCtrlListInterface *list = childGetListInterface("objects_list"); + LLCtrlListInterface *list = getChild("objects_list")->getListInterface(); if (!list || list->getItemCount() == 0) return; - std::vector::iterator id_itor; + uuid_vec_t::iterator id_itor; bool start_message = true; @@ -400,194 +384,76 @@ void LLFloaterTopObjects::doToObjects(int action, bool all) bool LLFloaterTopObjects::callbackReturnAll(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + LLFloaterTopObjects* instance = instanceExists() ? getInstance() : NULL; + if(!instance) return false; if (option == 0) { - sInstance->doToObjects(ACTION_RETURN, true); + instance->doToObjects(ACTION_RETURN, true); } return false; } -void LLFloaterTopObjects::onReturnAll(void* data) +void LLFloaterTopObjects::onReturnAll() { LLNotificationsUtil::add("ReturnAllTopObjects", LLSD(), LLSD(), &callbackReturnAll); } -void LLFloaterTopObjects::onReturnSelected(void* data) +void LLFloaterTopObjects::onReturnSelected() { - sInstance->doToObjects(ACTION_RETURN, false); + doToObjects(ACTION_RETURN, false); } -void LLFloaterTopObjects::onLagWarningBtn(void* data) -{ - LLFloaterTopObjects* self = (LLFloaterTopObjects*)data; - - self->onLagWarning(data); -} - -void LLFloaterTopObjects::onLagWarning(void* data) -{ - LLScrollListCtrl* list = getChild("objects_list"); - if (!list) return; - LLScrollListItem* first_selected = list->getFirstSelected(); - if (!first_selected) return; - LLUUID taskid = first_selected->getUUID(); - - std::string name = first_selected->getColumn(1)->getValue().asString(); - std::string score = first_selected->getColumn(0)->getValue().asString(); - - std::istringstream stm; - stm.str(score); - F32 f_score; - stm >> f_score; - F32 percentage = 100.f * (f_score / 22); - - std::string message = llformat( - "Hello %s, you are receiving this automated message because you are wearing heavily scripted attachments/HUDs, " - "causing excessive script lag (%5.2f ms, that's ca. %5.2f%% of the region's resources.)\n\n" - "Please remove resizer scripts or attachments to reduce your script time, thank you.", - name.c_str(), - (F32)f_score, - (F32)percentage - ); - - std::string my_name; - gAgent.buildFullname(my_name); - - cmdline_printchat(llformat("Script time warning sent to %s: (%5.2f ms)", - name.c_str(),(F32)f_score)); - - send_improved_im(LLUUID(taskid), - my_name, - message, - IM_ONLINE, - IM_NOTHING_SPECIAL, - LLUUID::null, - NO_TIMESTAMP, - (U8*)EMPTY_BINARY_BUCKET, - EMPTY_BINARY_BUCKET_SIZE); -} - -void LLFloaterTopObjects::onProfileBtn(void* data) -{ - LLFloaterTopObjects* self = (LLFloaterTopObjects*)data; - self->onProfile(data); -} - -void LLFloaterTopObjects::onProfile(void* data) -{ - LLScrollListCtrl* list = getChild("objects_list"); - if (!list) return; - LLScrollListItem* first_selected = list->getFirstSelected(); - if (!first_selected) return; - LLAvatarActions::showProfile(first_selected->getUUID()); -} - -void LLFloaterTopObjects::onKickBtn(void* data) -{ - LLFloaterTopObjects* self = (LLFloaterTopObjects*)data; - self->onKick(data); -} - -void LLFloaterTopObjects::onKick(void* data) -{ - LLScrollListCtrl* list = getChild("objects_list"); - if (!list) return; - LLScrollListItem* first_selected = list->getFirstSelected(); - if (!first_selected) return; - LLUUID taskid = first_selected->getUUID(); - - LLMessageSystem* msg = gMessageSystem; - msg->newMessage("EstateOwnerMessage"); - msg->nextBlockFast(_PREHASH_AgentData); - msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); - msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); - msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used - msg->nextBlock("MethodData"); - msg->addString("Method", "kickestate"); - msg->addUUID("Invoice", LLUUID::null); - msg->nextBlock("ParamList"); - msg->addString("Parameter", taskid.asString().c_str()); - msg->sendReliable(gAgent.getRegionHost()); -} -void LLFloaterTopObjects::onTPBtn(void* data) -{ - LLFloaterTopObjects* self = (LLFloaterTopObjects*)data; - self->onTP(data); -} - -void LLFloaterTopObjects::onTP(void* data) -{ - LLScrollListCtrl* list = getChild("objects_list"); - if (!list) return; - LLScrollListItem* first_selected = list->getFirstSelected(); - if (!first_selected) return; - - std::string name = first_selected->getColumn(1)->getValue().asString(); - std::string pos_string = first_selected->getColumn(3)->getValue().asString(); - - F32 x, y, z; - S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z); - if (matched != 3) return; - - LLVector3 pos_agent(x, y, z); - LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent); - - gAgent.teleportViaLocation( pos_global ); -} - - //static bool LLFloaterTopObjects::callbackDisableAll(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); + LLFloaterTopObjects* instance = instanceExists() ? getInstance() : NULL; + if(!instance) return false; if (option == 0) { - sInstance->doToObjects(ACTION_DISABLE, true); + instance->doToObjects(ACTION_DISABLE, true); } return false; } -void LLFloaterTopObjects::onDisableAll(void* data) +void LLFloaterTopObjects::onDisableAll() { LLNotificationsUtil::add("DisableAllTopObjects", LLSD(), LLSD(), callbackDisableAll); } -void LLFloaterTopObjects::onDisableSelected(void* data) +void LLFloaterTopObjects::onDisableSelected() { - sInstance->doToObjects(ACTION_DISABLE, false); + doToObjects(ACTION_DISABLE, false); } -//static + void LLFloaterTopObjects::clearList() { - LLCtrlListInterface *list = sInstance->childGetListInterface("objects_list"); + LLCtrlListInterface *list = childGetListInterface("objects_list"); if (list) { list->operateOnAll(LLCtrlListInterface::OP_DELETE); } - sInstance->mObjectListData.clear(); - sInstance->mObjectListIDs.clear(); - sInstance->mtotalScore = 0.f; + mObjectListData.clear(); + mObjectListIDs.clear(); + mtotalScore = 0.f; } -//static -void LLFloaterTopObjects::onRefresh(void* data) + +void LLFloaterTopObjects::onRefresh() { U32 mode = STAT_REPORT_TOP_SCRIPTS; U32 flags = 0; std::string filter = ""; - if (sInstance) - { - mode = sInstance->mCurrentMode; - flags = sInstance->mFlags; - filter = sInstance->mFilter; - sInstance->clearList(); - } + mode = mCurrentMode; + flags = mFlags; + filter = mFilter; + clearList(); LLMessageSystem *msg = gMessageSystem; msg->newMessageFast(_PREHASH_LandStatRequest); @@ -602,35 +468,35 @@ void LLFloaterTopObjects::onRefresh(void* data) msg->sendReliable(gAgent.getRegionHost()); - if (sInstance) - { - sInstance->mFilter.clear(); - sInstance->mFlags = 0; - } + mFilter.clear(); + mFlags = 0; } -void LLFloaterTopObjects::onGetByObjectName(LLUICtrl* ctrl, void* data) +void LLFloaterTopObjects::onGetByObjectName() { - if (sInstance) - { - sInstance->mFlags = STAT_FILTER_BY_OBJECT; - sInstance->mFilter = sInstance->childGetText("object_name_editor"); - onRefresh(NULL); - } + mFlags = STAT_FILTER_BY_OBJECT; + mFilter = getChild("object_name_editor")->getValue().asString(); + onRefresh(); } -void LLFloaterTopObjects::onGetByOwnerName(LLUICtrl* ctrl, void* data) +void LLFloaterTopObjects::onGetByOwnerName() { - if (sInstance) - { - sInstance->mFlags = STAT_FILTER_BY_OWNER; - sInstance->mFilter = sInstance->childGetText("owner_name_editor"); - onRefresh(NULL); - } + mFlags = STAT_FILTER_BY_OWNER; + mFilter = getChild("owner_name_editor")->getValue().asString(); + onRefresh(); } + +void LLFloaterTopObjects::onGetByParcelName() +{ + mFlags = STAT_FILTER_BY_PARCEL_NAME; + mFilter = getChild("parcel_name_editor")->getValue().asString(); + onRefresh(); +} + + void LLFloaterTopObjects::showBeacon() -{ +{ LLScrollListCtrl* list = getChild("objects_list"); if (!list) return; @@ -648,4 +514,68 @@ void LLFloaterTopObjects::showBeacon() LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent); std::string tooltip(""); LLTracker::trackLocation(pos_global, name, tooltip, LLTracker::LOCATION_ITEM); + + const LLUUID& taskid = first_selected->getUUID(); + if(LLVOAvatar* voavatar = gObjectList.findAvatar(taskid)) + { + gAgentCamera.setFocusOnAvatar(FALSE, FALSE); + gAgentCamera.changeCameraToThirdPerson(); + gAgentCamera.setFocusGlobal(voavatar->getPositionGlobal(),taskid); + gAgentCamera.setCameraPosAndFocusGlobal(voavatar->getPositionGlobal() + LLVector3d(3.5,1.35,0.75) * voavatar->getRotation(), voavatar->getPositionGlobal(), taskid); + } +} + +void LLFloaterTopObjects::onTeleportToObject() +{ + LLScrollListCtrl* list = getChild("objects_list"); + if (!list) return; + + LLScrollListItem* first_selected = list->getFirstSelected(); + if (!first_selected) return; + + std::string pos_string = first_selected->getColumn(3)->getValue().asString(); + + F32 x, y, z; + S32 matched = sscanf(pos_string.c_str(), "<%g,%g,%g>", &x, &y, &z); + if (matched != 3) return; + + LLVector3 pos_agent(x, y, z); + LLVector3d pos_global = gAgent.getPosGlobalFromAgent(pos_agent); + + gAgent.teleportViaLocation( pos_global ); +} + +void LLFloaterTopObjects::onKick() +{ + LLScrollListCtrl* list = getChild("objects_list"); + if (!list) return; + + LLScrollListItem* first_selected = list->getFirstSelected(); + if (!first_selected) return; + + const LLUUID& objectId = first_selected->getUUID(); + LLMessageSystem* msg = gMessageSystem; + msg->newMessage("EstateOwnerMessage"); + msg->nextBlockFast(_PREHASH_AgentData); + msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); + msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID()); + msg->addUUIDFast(_PREHASH_TransactionID, LLUUID::null); //not used + msg->nextBlock("MethodData"); + msg->addString("Method", "kickestate"); + msg->addUUID("Invoice", LLUUID::null); + msg->nextBlock("ParamList"); + msg->addString("Parameter", objectId.asString().c_str()); + msg->sendReliable(gAgent.getRegionHost()); +} + +void LLFloaterTopObjects::onProfile() +{ + LLScrollListCtrl* list = getChild("objects_list"); + if (!list) return; + + LLScrollListItem* first_selected = list->getFirstSelected(); + if (!first_selected) return; + + const LLUUID& objectId = first_selected->getUUID(); + LLAvatarActions::showProfile(objectId); } diff --git a/indra/newview/llfloatertopobjects.h b/indra/newview/llfloatertopobjects.h index 74a7ed611..c96d4ccd2 100644 --- a/indra/newview/llfloatertopobjects.h +++ b/indra/newview/llfloatertopobjects.h @@ -37,29 +37,25 @@ class LLUICtrl; -class LLFloaterTopObjects : public LLFloater +class LLFloaterTopObjects : public LLFloater, public LLSingleton { + friend class LLSingleton; public: // Opens the floater on screen. - static void show(); +// static void show(); // Opens the floater if it's not on-screen. // Juggles the UI based on method = "scripts" or "colliders" static void handle_land_reply(LLMessageSystem* msg, void** data); void handleReply(LLMessageSystem* msg, void** data); - static void clearList(); + void clearList(); void updateSelectionInfo(); virtual BOOL postBuild(); - static void onRefresh(void* data); + void onRefresh(); - static void setMode(U32 mode) { if (sInstance) sInstance->mCurrentMode = mode; } - - void onProfile(void* data); - void onKick(void* data); - void onTP(void* data); - void onLagWarning(void* data); + static void setMode(U32 mode); private: LLFloaterTopObjects(); @@ -67,31 +63,27 @@ private: void initColumns(LLCtrlListInterface *list); - static void onCommitObjectsList(LLUICtrl* ctrl, void* data); + void onCommitObjectsList(); static void onDoubleClickObjectsList(void* data); - void lookAtAvatar(); - static void onClickShowBeacon(void* data); + void onClickShowBeacon(); void doToObjects(int action, bool all); - static void onReturnAll(void* data); - static void onReturnSelected(void* data); - static void onDisableAll(void* data); - static void onDisableSelected(void* data); + void onReturnAll(); + void onReturnSelected(); + void onDisableAll(); + void onDisableSelected(); + + void onTeleportToObject(); + void onKick(); + void onProfile(); - static void onProfileBtn(void* data); - static void onKickBtn(void* data); - static void onTPBtn(void* data); - static void onLagWarningBtn(void* data); - static bool callbackReturnAll(const LLSD& notification, const LLSD& response); static bool callbackDisableAll(const LLSD& notification, const LLSD& response); - static void onGetByOwnerName(LLUICtrl* ctrl, void* data); - static void onGetByObjectName(LLUICtrl* ctrl, void* data); - - static void onGetByOwnerNameClicked(void* data) { onGetByOwnerName(NULL, data); }; - static void onGetByObjectNameClicked(void* data) { onGetByObjectName(NULL, data); }; + void onGetByOwnerName(); + void onGetByObjectName(); + void onGetByParcelName(); void showBeacon(); @@ -99,7 +91,7 @@ private: std::string mMethod; LLSD mObjectListData; - std::vector mObjectListIDs; + uuid_vec_t mObjectListIDs; U32 mCurrentMode; U32 mFlags; diff --git a/indra/newview/skins/default/xui/de/floater_top_objects.xml b/indra/newview/skins/default/xui/de/floater_top_objects.xml index 586d13491..e30fe8147 100644 --- a/indra/newview/skins/default/xui/de/floater_top_objects.xml +++ b/indra/newview/skins/default/xui/de/floater_top_objects.xml @@ -1,40 +1,65 @@ - - Wird geladen... + + + Top-Skripte + + + [COUNT] Skripts benötigen insgesamt [TIME] ms + + + Zeit + + + Top-Kollisionsobjekte + + + Top [COUNT] Objekte mit vielen potenziellen Kollisionen + + + Wertung + + + Nicht gefunden. + + + Wird geladen... + - + + - - - - Objekt-ID: - + + + + + Objekt-ID: + + @@ -25,55 +31,97 @@ + max_length="63" mouse_opaque="true" name="region name" width="208"> + + + width="180"> + + + width="180"> + + + width="180"> + + + tool_tip="Set this to make the region visible to non-gods." width="180"> + + + width="180"> + + + tool_tip="Set this to make the region not compute traffic." width="180"> + + + tool_tip="Set this to disallow people terraforming their land" width="180"> + + - - + width="180"> + + + + + + + + + max_length="10" mouse_opaque="true" name="estate" width="50"> + + + tool_tip="This is the parent estate for this region" width="50"> + + + tool_tip="This is the grid x position for this region" width="50"> + + + tool_tip="This is the grid y position for this region" width="40"> + + + max_length="10" mouse_opaque="true" name="redirectx" width="50"> + + + max_length="10" mouse_opaque="true" name="redirecty" width="40"> + + + mouse_opaque="true" name="billable factor" width="80"> + + + name="land cost" width="80"> + + + tool_tip="Click here to refresh the above information." width="110"> + + @@ -175,24 +259,39 @@ + tool_tip="Set this to disable all scripts in this region" width="110"> + + + width="121"> + + + tool_tip="Set this to disable all physics in this region" width="130"> + + + width="380"> + + @@ -285,7 +402,10 @@ max_length="63" mouse_opaque="true" name="parameter" width="290" /> diff --git a/indra/newview/skins/default/xui/en-us/floater_top_objects.xml b/indra/newview/skins/default/xui/en-us/floater_top_objects.xml index 6b59ee391..ec4f7d736 100644 --- a/indra/newview/skins/default/xui/en-us/floater_top_objects.xml +++ b/indra/newview/skins/default/xui/en-us/floater_top_objects.xml @@ -1,90 +1,299 @@ - - - Loading... - - - - - - - - - - - - Object ID: - - - + + Object name: + + + + + Owner: + + + + + Parcel: + + + + + + + + + + + diff --git a/indra/newview/skins/default/xui/es/floater_top_objects.xml b/indra/newview/skins/default/xui/es/floater_top_objects.xml index 7e30241f7..56fee7a04 100644 --- a/indra/newview/skins/default/xui/es/floater_top_objects.xml +++ b/indra/newview/skins/default/xui/es/floater_top_objects.xml @@ -1,40 +1,7 @@ - - - Cargando... - - - - - - - - - - - - ID del Objeto: - - Name: - Description: - Creator: Nicole Linden -