From 0f166a199d9a3deb82dd42dc5c68d72a2ca07165 Mon Sep 17 00:00:00 2001 From: Cosmic Linden Date: Tue, 3 Sep 2024 17:53:21 -0700 Subject: secondlife/viewer#2490: Fix PBR terrain texture transform feature flag handled by viewer in unpredictable manner --- indra/newview/app_settings/settings.xml | 2 +- indra/newview/llfloaterregioninfo.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a52d21edb5..fc896b41fd 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9391,7 +9391,7 @@ Comment EXPERIMENTAL: Enable PBR Terrain texture transforms. Persist - 1 + 0 Type Boolean Value diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp index 66e88e8841..8070284e32 100644 --- a/indra/newview/llfloaterregioninfo.cpp +++ b/indra/newview/llfloaterregioninfo.cpp @@ -268,7 +268,7 @@ bool LLFloaterRegionInfo::postBuild() mInfoPanels.push_back(panel); static LLCachedControl feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false); static LLCachedControl feature_pbr_terrain_transforms_enabled(gSavedSettings, "RenderTerrainPBRTransformsEnabled", false); - if (!feature_pbr_terrain_transforms_enabled || !feature_pbr_terrain_enabled) + if (!feature_pbr_terrain_transforms_enabled() || !feature_pbr_terrain_enabled()) { panel->buildFromFile("panel_region_terrain.xml"); } @@ -1694,7 +1694,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) static LLCachedControl feature_pbr_terrain_enabled(gSavedSettings, "RenderTerrainPBREnabled", false); const bool textures_ready = compp->makeTexturesReady(false, false); - const bool materials_ready = feature_pbr_terrain_enabled && compp->makeMaterialsReady(false, false); + const bool materials_ready = feature_pbr_terrain_enabled() && compp->makeMaterialsReady(false, false); bool set_texture_swatches; bool set_material_swatches; @@ -1724,7 +1724,7 @@ bool LLPanelRegionTerrainInfo::refreshFromRegion(LLViewerRegion* region) { material_type_to_ctrl(mMaterialTypeCtrl, material_type); updateForMaterialType(); - mMaterialTypeCtrl->setVisible(feature_pbr_terrain_enabled); + mMaterialTypeCtrl->setVisible(feature_pbr_terrain_enabled()); } if (set_texture_swatches) @@ -1938,7 +1938,7 @@ bool LLPanelRegionTerrainInfo::sendUpdate() // POST to ModifyRegion endpoint, if enabled static LLCachedControl feature_pbr_terrain_transforms_enabled(gSavedSettings, "RenderTerrainPBRTransformsEnabled", false); - if (material_type == LLTerrainMaterials::Type::PBR && feature_pbr_terrain_transforms_enabled) + if (material_type == LLTerrainMaterials::Type::PBR && feature_pbr_terrain_transforms_enabled()) { LLTerrainMaterials composition; for (S32 i = 0; i < LLTerrainMaterials::ASSET_COUNT; ++i) -- cgit v1.2.3 From f1e0fc68e78d732ff433bb83c0c894ed23bbf3b2 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 4 Sep 2024 16:31:39 +0200 Subject: #2471 The Destinations ComboBox on Login Screen... (quick fix) --- indra/llui/llcombobox.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indra/llui/llcombobox.cpp b/indra/llui/llcombobox.cpp index b64794a244..a1c16ccdec 100644 --- a/indra/llui/llcombobox.cpp +++ b/indra/llui/llcombobox.cpp @@ -521,12 +521,16 @@ bool LLComboBox::setCurrentByIndex(S32 index) if (item->getEnabled()) { mList->selectItem(item, -1, true); + LLSD::String label = item->getColumn(0)->getValue().asString(); if (mTextEntry) { - LLSD::String label = item->getColumn(0)->getValue().asString(); mTextEntry->setText(label); mTextEntry->setTentative(false); } + if (!mAllowTextEntry) + { + mButton->setLabel(label); + } mLastSelectedIndex = index; return true; } -- cgit v1.2.3 From c2724537adab9d31c23d33e36002772a9c56f4c3 Mon Sep 17 00:00:00 2001 From: TJ Date: Thu, 5 Sep 2024 02:42:01 +1000 Subject: Fixed missing comma in list. Fixed loop with too small loop variable. (#2497) --- indra/newview/llfloaterimagepreview.cpp | 2 +- indra/newview/llviewerfloaterreg.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp index a900e04707..711c33e73d 100644 --- a/indra/newview/llfloaterimagepreview.cpp +++ b/indra/newview/llfloaterimagepreview.cpp @@ -852,7 +852,7 @@ void LLImagePreviewSculpted::setPreviewTarget(LLImageRaw* imagep, F32 distance) } // build indices - for (U16 i = 0; i < num_indices; i++) + for (U32 i = 0; i < num_indices; i++) { *(index_strider++) = vf.mIndices[i]; } diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 9bdd246129..ef68609182 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -242,7 +242,7 @@ public: "avatar_picker", "camera", "camera_presets", - "change_item_thumbnail" + "change_item_thumbnail", "classified", "add_landmark", "delete_pref_preset", -- cgit v1.2.3 From d9f0a587a88373dbe839afd6489bc9a1ca4edeea Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Wed, 4 Sep 2024 15:45:03 -0700 Subject: Fix some race conditions on connection shutdown. In a few locations, there were cases where connection shutdown would stall, leaving the connection in place. This was due to bad handling of the outstanding operations counter. --- indra/newview/llvoicewebrtc.cpp | 48 ++++++++++++++++++++++++----------------- indra/newview/llvoicewebrtc.h | 5 +++++ 2 files changed, 33 insertions(+), 20 deletions(-) diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 22b53c0b85..4528b57061 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2012,7 +2012,10 @@ bool LLWebRTCVoiceClient::estateSessionState::processConnectionStates() // shut down connections to neighbors that are too far away. spatialConnection.get()->shutDown(); } - neighbor_ids.erase(regionID); + if (!spatialConnection.get()->isShuttingDown()) + { + neighbor_ids.erase(regionID); + } } // add new connections for new neighbors @@ -2512,8 +2515,6 @@ void LLVoiceWebRTCConnection::breakVoiceConnectionCoro(connectionPtr_t connectio httpOpts->setWantHeaders(true); - connection->mOutstandingRequests++; - // tell the server to shut down the connection as a courtesy. // shutdownConnection will drop the WebRTC connection which will // also shut things down. @@ -2544,6 +2545,7 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection() // try again. setVoiceConnectionState(VOICE_STATE_REQUEST_CONNECTION); + mOutstandingRequests--; return; } @@ -2551,6 +2553,7 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection() if (url.empty()) { setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); + mOutstandingRequests--; return; } @@ -2575,7 +2578,6 @@ void LLVoiceWebRTCSpatialConnection::requestVoiceConnection() LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); httpOpts->setWantHeaders(true); - mOutstandingRequests++; LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; @@ -2663,7 +2665,10 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() { LL_PROFILE_ZONE_SCOPED_CATEGORY_VOICE; - processIceUpdates(); + if (!mShutDown) + { + processIceUpdates(); + } switch (getVoiceConnectionState()) { @@ -2707,6 +2712,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() // a given voice channel. On completion, we'll move on to the // VOICE_STATE_SESSION_ESTABLISHED via a callback on a webrtc thread. setVoiceConnectionState(VOICE_STATE_CONNECTION_WAIT); + mOutstandingRequests++; LLCoros::getInstance()->launch("LLVoiceWebRTCConnection::requestVoiceConnectionCoro", boost::bind(&LLVoiceWebRTCConnection::requestVoiceConnectionCoro, this->shared_from_this())); break; @@ -2757,24 +2763,25 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() case VOICE_STATE_SESSION_UP: { mRetryWaitPeriod = 0; - mRetryWaitSecs = (F32)((F32) rand() / (RAND_MAX)) + 0.5f; - LLUUID agentRegionID; - if (isSpatial() && gAgent.getRegion()) - { - - bool primary = (mRegionID == gAgent.getRegion()->getRegionID()); - if (primary != mPrimary) - { - mPrimary = primary; - sendJoin(); - } - } + mRetryWaitSecs = (F32)((F32)rand() / (RAND_MAX)) + 0.5f; // we'll stay here as long as the session remains up. if (mShutDown) { setVoiceConnectionState(VOICE_STATE_DISCONNECT); } + else + { + if (isSpatial() && gAgent.getRegion()) + { + bool primary = (mRegionID == gAgent.getRegion()->getRegionID()); + if (primary != mPrimary) + { + mPrimary = primary; + sendJoin(); + } + } + } break; } @@ -2799,6 +2806,7 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() case VOICE_STATE_DISCONNECT: if (!LLWebRTCVoiceClient::isShuttingDown()) { + mOutstandingRequests++; setVoiceConnectionState(VOICE_STATE_WAIT_FOR_EXIT); LLCoros::instance().launch("LLVoiceWebRTCConnection::breakVoiceConnectionCoro", boost::bind(&LLVoiceWebRTCConnection::breakVoiceConnectionCoro, this->shared_from_this())); @@ -2807,7 +2815,6 @@ bool LLVoiceWebRTCConnection::connectionStateMachine() { // llwebrtc::terminate() is already shuting down the connection. setVoiceConnectionState(VOICE_STATE_WAIT_FOR_CLOSE); - mOutstandingRequests++; } break; @@ -3051,7 +3058,6 @@ void LLVoiceWebRTCConnection::sendJoin() boost::json::object root; boost::json::object join_obj; - LLUUID regionID = gAgent.getRegion()->getRegionID(); if (mPrimary) { join_obj["p"] = true; @@ -3134,6 +3140,7 @@ void LLVoiceWebRTCAdHocConnection::requestVoiceConnection() LL_DEBUGS("Voice") << "no capabilities for voice provisioning; retrying " << LL_ENDL; // try again. setVoiceConnectionState(VOICE_STATE_REQUEST_CONNECTION); + mOutstandingRequests--; return; } @@ -3141,6 +3148,7 @@ void LLVoiceWebRTCAdHocConnection::requestVoiceConnection() if (url.empty()) { setVoiceConnectionState(VOICE_STATE_SESSION_RETRY); + mOutstandingRequests--; return; } @@ -3164,7 +3172,7 @@ void LLVoiceWebRTCAdHocConnection::requestVoiceConnection() LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); httpOpts->setWantHeaders(true); - mOutstandingRequests++; + LLSD result = httpAdapter->postAndSuspend(httpRequest, url, body, httpOpts); LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; diff --git a/indra/newview/llvoicewebrtc.h b/indra/newview/llvoicewebrtc.h index 32127f9b17..ff82d2739d 100644 --- a/indra/newview/llvoicewebrtc.h +++ b/indra/newview/llvoicewebrtc.h @@ -631,6 +631,11 @@ class LLVoiceWebRTCConnection : mShutDown = true; } + bool isShuttingDown() + { + return mShutDown; + } + void OnVoiceConnectionRequestSuccess(const LLSD &body); protected: -- cgit v1.2.3 From 8c65a61b095545b88ecb0820fa0e6ccd484d242a Mon Sep 17 00:00:00 2001 From: Rye Cogtail Date: Wed, 4 Sep 2024 23:10:13 -0400 Subject: Introduce OpenXR SDK prebuilt package and cmake setup (#2503) --- autobuild.xml | 62 ++++++++++++++++++++++++++++++++++++++++++++ indra/cmake/OpenXR.cmake | 22 ++++++++++++++++ indra/newview/CMakeLists.txt | 2 ++ 3 files changed, 86 insertions(+) create mode 100644 indra/cmake/OpenXR.cmake diff --git a/autobuild.xml b/autobuild.xml index f90f114601..95ee34439b 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -2210,6 +2210,68 @@ Copyright (c) 2012, 2014, 2015, 2016 nghttp2 contributors description Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) Library + openxr + + platforms + + windows64 + + archive + + hash + 3cccc3e3f3137066c286270b35abc00ee0c0bb0c + hash_algorithm + sha1 + url + https://github.com/secondlife/3p-openxr/releases/download/v1.1.40-r1/openxr-1.1.40-r1-windows64-10710818432.tar.zst + + name + windows64 + + linux64 + + archive + + hash + f0ad0418a98fb8cb6e158fca3902c15ac1de9d2a + hash_algorithm + sha1 + url + https://github.com/secondlife/3p-openxr/releases/download/v1.1.40-r1/openxr-1.1.40-r1-linux64-10710818432.tar.zst + + name + linux64 + + darwin64 + + archive + + hash + a9bfabec63a987bd34bcfdc295b928bd0696e1d7 + hash_algorithm + sha1 + url + https://github.com/secondlife/3p-openxr/releases/download/v1.1.40-r1/openxr-1.1.40-r1-darwin64-10710818432.tar.zst + + name + darwin64 + + + license + Apache 2.0 + license_file + LICENSES/openxr.txt + copyright + Copyright 2017-2024, The Khronos Group Inc. + version + 1.1.40-r1 + name + openxr + canonical_repo + https://github.com/secondlife/3p-openxr + description + Generated headers and sources for OpenXR loader. + slvoice platforms diff --git a/indra/cmake/OpenXR.cmake b/indra/cmake/OpenXR.cmake new file mode 100644 index 0000000000..2cc862b927 --- /dev/null +++ b/indra/cmake/OpenXR.cmake @@ -0,0 +1,22 @@ +# -*- cmake -*- + +include(Prebuilt) + +include_guard() +add_library( ll::openxr INTERFACE IMPORTED ) + +if(USE_CONAN ) + target_link_libraries( ll::openxr INTERFACE CONAN_PKG::openxr ) + return() +endif() + +use_prebuilt_binary(openxr) +if (WINDOWS) + target_link_libraries( ll::openxr INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/openxr_loader.lib ) +else() + target_link_libraries( ll::openxr INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libopenxr_loader.a ) +endif (WINDOWS) + +if( NOT LINUX ) + target_include_directories( ll::openxr SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include) +endif() diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 7a9f3a46b5..859ccbd4cd 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -33,6 +33,7 @@ include(NVAPI) include(OPENAL) include(OpenGL) include(OpenSSL) +include(OpenXR) include(PNG) include(TemplateCheck) include(TinyEXR) @@ -1928,6 +1929,7 @@ target_link_libraries(${VIEWER_BINARY_NAME} ${LLPHYSICSEXTENSIONS_LIBRARIES} ll::bugsplat ll::tracy + ll::openxr ) if( TARGET ll::intel_memops ) -- cgit v1.2.3 From 238a2a64b31e6a0b431309e363067a7fe57125ae Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 4 Sep 2024 13:42:11 +0300 Subject: viewer#2411 Use font buffer in text segments --- indra/llrender/llfontvertexbuffer.cpp | 2 + indra/llui/lltextbase.cpp | 55 ++++++++++++++---- indra/llui/lltextbase.h | 9 +++ indra/llui/llviewmodel.cpp | 10 ++++ indra/llui/llviewmodel.h | 4 +- indra/newview/llpanelmaininventory.cpp | 102 +++++++++++++++++++++------------ indra/newview/llpanelmaininventory.h | 5 +- 7 files changed, 137 insertions(+), 50 deletions(-) diff --git a/indra/llrender/llfontvertexbuffer.cpp b/indra/llrender/llfontvertexbuffer.cpp index 96ec94fe0f..392f235aad 100644 --- a/indra/llrender/llfontvertexbuffer.cpp +++ b/indra/llrender/llfontvertexbuffer.cpp @@ -42,6 +42,8 @@ LLFontVertexBuffer::~LLFontVertexBuffer() void LLFontVertexBuffer::reset() { + // Todo: some form of debug only frequecy check&assert to see if this is happening too often. + // Regenerating this list is expensive mBufferList.clear(); } diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 0aebf7543c..6d480e8e00 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -948,7 +948,6 @@ S32 LLTextBase::insertStringNoUndo(S32 pos, const LLWString &wstr, LLTextBase::s S32 LLTextBase::removeStringNoUndo(S32 pos, S32 length) { - beforeValueChange(); segment_set_t::iterator seg_iter = getSegIterContaining(pos); while(seg_iter != mSegments.end()) @@ -1325,6 +1324,7 @@ void LLTextBase::reshape(S32 width, S32 height, bool called_from_parent) //virtual void LLTextBase::draw() { + LL_PROFILE_ZONE_SCOPED_CATEGORY_UI; // reflow if needed, on demand reflow(); @@ -2586,6 +2586,11 @@ const LLWString& LLTextBase::getWText() const return getViewModel()->getDisplay(); } +S32 LLTextBase::getTextGeneration() const +{ + return getViewModel()->getDisplayGeneration(); +} + // If round is true, if the position is on the right half of a character, the cursor // will be put to its right. If round is false, the cursor will always be put to the // character's left. @@ -3280,7 +3285,8 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e : LLTextSegment(start, end), mStyle( style ), mToken(NULL), - mEditor(editor) + mEditor(editor), + mLastGeneration(-1) { mFontHeight = mStyle->getFont()->getLineHeight(); @@ -3294,7 +3300,8 @@ LLNormalTextSegment::LLNormalTextSegment( LLStyleConstSP style, S32 start, S32 e LLNormalTextSegment::LLNormalTextSegment( const LLUIColor& color, S32 start, S32 end, LLTextBase& editor, bool is_visible) : LLTextSegment(start, end), mToken(NULL), - mEditor(editor) + mEditor(editor), + mLastGeneration(-1) { mStyle = new LLStyle(LLStyle::Params().visible(is_visible).color(color)); @@ -3313,22 +3320,38 @@ F32 LLNormalTextSegment::draw(S32 start, S32 end, S32 selection_start, S32 selec { return drawClippedSegment( getStart() + start, getStart() + end, selection_start, selection_end, draw_rect); } + else + { + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); + } return draw_rect.mLeft; } // Draws a single text segment, reversing the color for selection if needed. F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRectf rect) { - F32 alpha = LLViewDrawContext::getCurrentContext().mAlpha; - - const LLWString &text = getWText(); - F32 right_x = rect.mLeft; if (!mStyle->isVisible()) { return right_x; } + F32 alpha = LLViewDrawContext::getCurrentContext().mAlpha; + + const LLWString& text = getWText(); + S32 text_gen = mEditor.getTextGeneration(); + + if (text_gen != mLastGeneration) + { + mLastGeneration = text_gen; + + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); + } + const LLFontGL* font = mStyle->getFont(); LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha()); @@ -3339,7 +3362,8 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 start = seg_start; S32 end = llmin( selection_start, seg_end ); S32 length = end - start; - font->render(text, start, + mFontBufferPreSelection.render(font, + text, start, rect, color, LLFontGL::LEFT, mEditor.mTextVAlign, @@ -3359,7 +3383,8 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 end = llmin( selection_end, seg_end ); S32 length = end - start; - font->render(text, start, + mFontBufferSelection.render(font, + text, start, rect, mStyle->getSelectedColor().get(), LLFontGL::LEFT, mEditor.mTextVAlign, @@ -3377,7 +3402,8 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 start = llmax( selection_end, seg_start ); S32 end = seg_end; S32 length = end - start; - font->render(text, start, + mFontBufferPostSelection.render(font, + text, start, rect, color, LLFontGL::LEFT, mEditor.mTextVAlign, @@ -3573,6 +3599,15 @@ S32 LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin return num_chars; } +void LLNormalTextSegment::updateLayout(const class LLTextBase& editor) +{ + LLTextSegment::updateLayout(editor); + + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); +} + void LLNormalTextSegment::dump() const { LL_INFOS() << "Segment [" << diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index 00cf66b134..e2981c2637 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -30,6 +30,7 @@ #include "v4color.h" #include "lleditmenuhandler.h" +#include "llfontvertexbuffer.h" #include "llspellcheckmenuhandler.h" #include "llstyle.h" #include "llkeywords.h" @@ -131,6 +132,7 @@ public: /*virtual*/ bool getDimensionsF32(S32 first_char, S32 num_chars, F32& width, S32& height) const; /*virtual*/ S32 getOffset(S32 segment_local_x_coord, S32 start_offset, S32 num_chars, bool round) const; /*virtual*/ S32 getNumChars(S32 num_pixels, S32 segment_offset, S32 line_offset, S32 max_chars, S32 line_ind) const; + /*virtual*/ void updateLayout(const class LLTextBase& editor); /*virtual*/ F32 draw(S32 start, S32 end, S32 selection_start, S32 selection_end, const LLRectf& draw_rect); /*virtual*/ bool canEdit() const { return true; } /*virtual*/ const LLUIColor& getColor() const { return mStyle->getColor(); } @@ -161,6 +163,12 @@ protected: LLKeywordToken* mToken; std::string mTooltip; boost::signals2::connection mImageLoadedConnection; + + // font rendering + LLFontVertexBuffer mFontBufferPreSelection; + LLFontVertexBuffer mFontBufferSelection; + LLFontVertexBuffer mFontBufferPostSelection; + S32 mLastGeneration = -1; }; // This text segment is the same as LLNormalTextSegment, the only difference @@ -432,6 +440,7 @@ public: // wide-char versions void setWText(const LLWString& text); const LLWString& getWText() const; + S32 getTextGeneration() const; void appendText(const std::string &new_text, bool prepend_newline, const LLStyle::Params& input_params = LLStyle::Params()); diff --git a/indra/llui/llviewmodel.cpp b/indra/llui/llviewmodel.cpp index 93106b344f..35963c2b99 100644 --- a/indra/llui/llviewmodel.cpp +++ b/indra/llui/llviewmodel.cpp @@ -82,11 +82,20 @@ void LLTextViewModel::setValue(const LLSD& value) // approximate LLSD storage usage LLViewModel::setValue(value); mDisplay = utf8str_to_wstring(mStringValue = value.asString()); + mDisplayGeneration++; // mDisplay and mValue agree mUpdateFromDisplay = false; } +LLWString& LLTextViewModel::getEditableDisplay() +{ + mDirty = true; + mDisplayGeneration++; + mUpdateFromDisplay = true; + return mDisplay; +} + void LLTextViewModel::setDisplay(const LLWString& value) { // This is the strange way to alter the value. Normally we'd setValue() @@ -94,6 +103,7 @@ void LLTextViewModel::setDisplay(const LLWString& value) // value. But a text editor might want to edit the display string // directly, then convert back to UTF8 on commit. mDisplay = value; + mDisplayGeneration++; mDirty = true; // Don't immediately convert to UTF8 -- do it lazily -- we expect many // more setDisplay() calls than getValue() calls. Just flag that it needs diff --git a/indra/llui/llviewmodel.h b/indra/llui/llviewmodel.h index 6cf2200a81..16b0800ce2 100644 --- a/indra/llui/llviewmodel.h +++ b/indra/llui/llviewmodel.h @@ -105,7 +105,8 @@ public: // New functions /// Get the stored value in string form const LLWString& getDisplay() const { return mDisplay; } - LLWString& getEditableDisplay() { mDirty = true; mUpdateFromDisplay = true; return mDisplay; } + S32 getDisplayGeneration() const { return mDisplayGeneration; } + LLWString& getEditableDisplay(); /** * Set the display string directly (see LLTextEditor). What the user is @@ -120,6 +121,7 @@ private: /// To avoid converting every widget's stored value from LLSD to LLWString /// every frame, cache the converted value LLWString mDisplay; + S32 mDisplayGeneration = -1; /// As the user edits individual characters (setDisplay()), defer /// LLWString-to-UTF8 conversions until s/he's done. diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 2466ee5973..0c068ff993 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -963,59 +963,87 @@ void LLPanelMainInventory::draw() void LLPanelMainInventory::updateItemcountText() { - if(mItemCount != gInventory.getItemCount()) - { - mItemCount = gInventory.getItemCount(); - mItemCountString = ""; - LLLocale locale(LLLocale::USER_LOCALE); - LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount); - } - - if(mCategoryCount != gInventory.getCategoryCount()) + bool update = false; + if (mSingleFolderMode) { - mCategoryCount = gInventory.getCategoryCount(); - mCategoryCountString = ""; - LLLocale locale(LLLocale::USER_LOCALE); - LLResMgr::getInstance()->getIntegerString(mCategoryCountString, mCategoryCount); - } - - LLStringUtil::format_map_t string_args; - string_args["[ITEM_COUNT]"] = mItemCountString; - string_args["[CATEGORY_COUNT]"] = mCategoryCountString; - string_args["[FILTER]"] = getFilterText(); + LLInventoryModel::cat_array_t* cats; + LLInventoryModel::item_array_t* items; - std::string text = ""; + gInventory.getDirectDescendentsOf(getCurrentSFVRoot(), cats, items); + S32 item_count = items ? (S32)items->size() : 0; + S32 cat_count = cats ? (S32)cats->size() : 0; - if (LLInventoryModelBackgroundFetch::instance().folderFetchActive()) - { - text = getString("ItemcountFetching", string_args); + if (mItemCount != item_count) + { + mItemCount = item_count; + update = true; + } + if (mCategoryCount != cat_count) + { + mCategoryCount = cat_count; + update = true; + } } - else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched()) + else { - text = getString("ItemcountCompleted", string_args); + if (mItemCount != gInventory.getItemCount()) + { + mItemCount = gInventory.getItemCount(); + update = true; + } + + if (mCategoryCount != gInventory.getCategoryCount()) + { + mCategoryCount = gInventory.getCategoryCount(); + update = true; + } } - else + + if (mLastFilterText != getFilterText()) { - text = getString("ItemcountUnknown", string_args); + mLastFilterText = getFilterText(); + update = true; } - if (mSingleFolderMode) + if (update) { - LLInventoryModel::cat_array_t *cats; - LLInventoryModel::item_array_t *items; + mItemCountString = ""; + LLLocale locale(LLLocale::USER_LOCALE); + LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount); - gInventory.getDirectDescendentsOf(getCurrentSFVRoot(), cats, items); + mCategoryCountString = ""; + LLResMgr::getInstance()->getIntegerString(mCategoryCountString, mCategoryCount); - if (items && cats) + LLStringUtil::format_map_t string_args; + string_args["[ITEM_COUNT]"] = mItemCountString; + string_args["[CATEGORY_COUNT]"] = mCategoryCountString; + string_args["[FILTER]"] = mLastFilterText; + + std::string text = ""; + + if (mSingleFolderMode) { - string_args["[ITEM_COUNT]"] = llformat("%d", items->size()); - string_args["[CATEGORY_COUNT]"] = llformat("%d", cats->size()); text = getString("ItemcountCompleted", string_args); } - } + else + { + if (LLInventoryModelBackgroundFetch::instance().folderFetchActive()) + { + text = getString("ItemcountFetching", string_args); + } + else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched()) + { + text = getString("ItemcountCompleted", string_args); + } + else + { + text = getString("ItemcountUnknown", string_args); + } + } - mCounterCtrl->setValue(text); - mCounterCtrl->setToolTip(text); + mCounterCtrl->setValue(text); + mCounterCtrl->setToolTip(text); + } } void LLPanelMainInventory::onFocusReceived() diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 3347ab904b..d28daddd73 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -196,9 +196,10 @@ private: LLSaveFolderState* mSavedFolderState; std::string mFilterText; std::string mFilterSubString; - S32 mItemCount; + S32 mItemCount = 0; + std::string mLastFilterText; std::string mItemCountString; - S32 mCategoryCount; + S32 mCategoryCount = 0; std::string mCategoryCountString; LLComboBox* mSearchTypeCombo; -- cgit v1.2.3 From 442ee9795ecde5a89df254b78465c8f4ed46845f Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 4 Sep 2024 15:40:11 +0300 Subject: viewer#2411 Use font buffer in line editor --- indra/llui/lllineeditor.cpp | 60 ++++++++++++++++++++++++++++++++++++++++----- indra/llui/lllineeditor.h | 5 ++++ 2 files changed, 59 insertions(+), 6 deletions(-) diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp index 60b6115b34..66b274c33f 100644 --- a/indra/llui/lllineeditor.cpp +++ b/indra/llui/lllineeditor.cpp @@ -436,6 +436,9 @@ void LLLineEditor::setText(const LLStringExplicit &new_text, bool use_size_limit { mText.assign(utf8str_symbol_truncate(truncated_utf8, mMaxLengthChars)); } + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); if (all_selected) { @@ -617,6 +620,10 @@ void LLLineEditor::replaceWithSuggestion(U32 index) mText.insert(it->first, suggestion); setCursor(it->first + (S32)suggestion.length()); + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); + break; } } @@ -969,6 +976,10 @@ void LLLineEditor::removeChar() mText.erase(getCursor() - 1, 1); setCursor(getCursor() - 1); + + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); } else { @@ -992,6 +1003,10 @@ void LLLineEditor::addChar(const llwchar uni_char) return; mText.erase(getCursor(), 1); + + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); } S32 cur_bytes = static_cast(mText.getString().size()); @@ -1022,6 +1037,10 @@ void LLLineEditor::addChar(const llwchar uni_char) mText.insert(getCursor(), w_buf); setCursor(getCursor() + 1); + + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); } else { @@ -1186,6 +1205,10 @@ void LLLineEditor::deleteSelection() mText.erase(left_pos, selection_length); deselect(); setCursor(left_pos); + + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); } } @@ -1346,6 +1369,10 @@ void LLLineEditor::pasteHelper(bool is_primary) setCursor( getCursor() + (S32)clean_string.length() ); deselect(); + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); + // Validate new string and rollback the if needed. bool need_to_rollback = mPrevalidator && !mPrevalidator.validate(mText.getWString()); if (need_to_rollback) @@ -1506,6 +1533,10 @@ bool LLLineEditor::handleSpecialKey(KEY key, MASK mask) { mText.assign(*(--mCurrentHistoryLine)); setCursorToEnd(); + + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); } else { @@ -1523,6 +1554,10 @@ bool LLLineEditor::handleSpecialKey(KEY key, MASK mask) { mText.assign( *(++mCurrentHistoryLine) ); setCursorToEnd(); + + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); } else { @@ -1897,7 +1932,8 @@ void LLLineEditor::draw() if( select_left > mScrollHPos ) { // unselected, left side - rendered_text = mGLFont->render( + rendered_text = mFontBufferPreSelection.render( + mGLFont, mText, mScrollHPos, rendered_pixels_right, text_bottom, text_color, @@ -1919,7 +1955,8 @@ void LLLineEditor::draw() gl_rect_2d(ll_round(rendered_pixels_right), cursor_top, ll_round(rendered_pixels_right)+width, cursor_bottom, color); LLColor4 tmp_color( 1.f - text_color.mV[0], 1.f - text_color.mV[1], 1.f - text_color.mV[2], alpha ); - rendered_text += mGLFont->render( + rendered_text += mFontBufferSelection.render( + mGLFont, mText, mScrollHPos + rendered_text, rendered_pixels_right, text_bottom, tmp_color, @@ -1934,7 +1971,8 @@ void LLLineEditor::draw() if( (rendered_pixels_right < (F32)mTextRightEdge) && (rendered_text < text_len) ) { // unselected, right side - rendered_text += mGLFont->render( + rendered_text += mFontBufferPostSelection.render( + mGLFont, mText, mScrollHPos + rendered_text, rendered_pixels_right, text_bottom, text_color, @@ -1948,7 +1986,8 @@ void LLLineEditor::draw() } else { - rendered_text = mGLFont->render( + rendered_text = mFontBufferPreSelection.render( + mGLFont, mText, mScrollHPos, rendered_pixels_right, text_bottom, text_color, @@ -2108,7 +2147,8 @@ void LLLineEditor::draw() //to give indication that it is not text you typed in if (0 == mText.length() && (mReadOnly || mShowLabelFocused)) { - mGLFont->render(mLabel.getWString(), 0, + mFontBufferLabel.render(mGLFont, + mLabel.getWString(), 0, (F32)mTextLeftEdge, (F32)text_bottom, label_color, LLFontGL::LEFT, @@ -2133,7 +2173,8 @@ void LLLineEditor::draw() // draw label if no text provided if (0 == mText.length()) { - mGLFont->render(mLabel.getWString(), 0, + mFontBufferLabel.render(mGLFont, + mLabel.getWString(), 0, (F32)mTextLeftEdge, (F32)text_bottom, label_color, LLFontGL::LEFT, @@ -2404,12 +2445,16 @@ void LLLineEditor::setKeystrokeCallback(callback_t callback, void* user_data) bool LLLineEditor::setTextArg( const std::string& key, const LLStringExplicit& text ) { mText.setArg(key, text); + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); return true; } bool LLLineEditor::setLabelArg( const std::string& key, const LLStringExplicit& text ) { mLabel.setArg(key, text); + mFontBufferLabel.reset(); return true; } @@ -2508,6 +2553,9 @@ void LLLineEditor::updatePreedit(const LLWString &preedit_string, mPreeditOverwrittenWString.clear(); } mText.insert(insert_preedit_at, mPreeditWString); + mFontBufferPreSelection.reset(); + mFontBufferSelection.reset(); + mFontBufferPostSelection.reset(); mPreeditStandouts = preedit_standouts; diff --git a/indra/llui/lllineeditor.h b/indra/llui/lllineeditor.h index cdd22413e7..12fe800acb 100644 --- a/indra/llui/lllineeditor.h +++ b/indra/llui/lllineeditor.h @@ -40,6 +40,7 @@ #include "llframetimer.h" #include "lleditmenuhandler.h" +#include "llfontvertexbuffer.h" #include "llspellcheckmenuhandler.h" #include "lluictrl.h" #include "lluiimage.h" @@ -344,6 +345,10 @@ protected: LLViewBorder* mBorder; const LLFontGL* mGLFont; + LLFontVertexBuffer mFontBufferPreSelection; + LLFontVertexBuffer mFontBufferSelection; + LLFontVertexBuffer mFontBufferPostSelection; + LLFontVertexBuffer mFontBufferLabel; S32 mMaxLengthBytes; // Max length of the UTF8 string in bytes S32 mMaxLengthChars; // Maximum number of characters in the string S32 mCursorPos; // I-beam is just after the mCursorPos-th character. -- cgit v1.2.3 From 494ac09216c547cd62ebd43f57056807bb46d49c Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 4 Sep 2024 19:22:49 +0300 Subject: viewer#2411 Confine font vertex buffers to static text segments Collection of vertex buffers happens to often with segmented text. --- indra/llui/lltextbase.cpp | 129 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 95 insertions(+), 34 deletions(-) diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 6d480e8e00..615619d244 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -3342,6 +3342,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele const LLWString& text = getWText(); S32 text_gen = mEditor.getTextGeneration(); + bool is_text_read_only = mEditor.getReadOnly(); if (text_gen != mLastGeneration) { @@ -3354,7 +3355,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele const LLFontGL* font = mStyle->getFont(); - LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha()); + LLColor4 color = (is_text_read_only ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha()); if( selection_start > seg_start ) { @@ -3362,17 +3363,40 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 start = seg_start; S32 end = llmin( selection_start, seg_end ); S32 length = end - start; - mFontBufferPreSelection.render(font, - text, start, - rect, - color, - LLFontGL::LEFT, mEditor.mTextVAlign, - LLFontGL::NORMAL, - mStyle->getShadowType(), - length, - &right_x, - mEditor.getUseEllipses(), - mEditor.getUseColor()); + if (is_text_read_only) + { + mFontBufferPreSelection.render( + font, + text, start, + rect, + color, + LLFontGL::LEFT, mEditor.mTextVAlign, + LLFontGL::NORMAL, + mStyle->getShadowType(), + length, + &right_x, + mEditor.getUseEllipses(), + mEditor.getUseColor()); + } + else + { + // Font buffer doesn't do well with changes and huge notecard with a bunch + // of segments will see a lot of buffer updates, so instead use derect + // rendering to cache. + // Todo: instead of mLastGeneration make buffer invalidation more fine grained + // like string hash of a given segment. + font->render( + text, start, + rect, + color, + LLFontGL::LEFT, mEditor.mTextVAlign, + LLFontGL::NORMAL, + mStyle->getShadowType(), + length, + &right_x, + mEditor.getUseEllipses(), + mEditor.getUseColor()); + } } rect.mLeft = right_x; @@ -3383,17 +3407,35 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 end = llmin( selection_end, seg_end ); S32 length = end - start; - mFontBufferSelection.render(font, - text, start, - rect, - mStyle->getSelectedColor().get(), - LLFontGL::LEFT, mEditor.mTextVAlign, - LLFontGL::NORMAL, - LLFontGL::NO_SHADOW, - length, - &right_x, - mEditor.getUseEllipses(), - mEditor.getUseColor()); + if (is_text_read_only) + { + mFontBufferSelection.render( + font, + text, start, + rect, + mStyle->getSelectedColor().get(), + LLFontGL::LEFT, mEditor.mTextVAlign, + LLFontGL::NORMAL, + LLFontGL::NO_SHADOW, + length, + &right_x, + mEditor.getUseEllipses(), + mEditor.getUseColor()); + } + else + { + font->render( + text, start, + rect, + mStyle->getSelectedColor().get(), + LLFontGL::LEFT, mEditor.mTextVAlign, + LLFontGL::NORMAL, + LLFontGL::NO_SHADOW, + length, + &right_x, + mEditor.getUseEllipses(), + mEditor.getUseColor()); + } } rect.mLeft = right_x; if( selection_end < seg_end ) @@ -3402,17 +3444,36 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 start = llmax( selection_end, seg_start ); S32 end = seg_end; S32 length = end - start; - mFontBufferPostSelection.render(font, - text, start, - rect, - color, - LLFontGL::LEFT, mEditor.mTextVAlign, - LLFontGL::NORMAL, - mStyle->getShadowType(), - length, - &right_x, - mEditor.getUseEllipses(), - mEditor.getUseColor()); + if (is_text_read_only) + { + mFontBufferPostSelection.render( + font, + text, start, + rect, + color, + LLFontGL::LEFT, mEditor.mTextVAlign, + LLFontGL::NORMAL, + mStyle->getShadowType(), + length, + &right_x, + mEditor.getUseEllipses(), + mEditor.getUseColor()); + } + else + { + font->render( + text, start, + rect, + color, + LLFontGL::LEFT, mEditor.mTextVAlign, + LLFontGL::NORMAL, + mStyle->getShadowType(), + length, + &right_x, + mEditor.getUseEllipses(), + mEditor.getUseColor()); + + } } return right_x; } -- cgit v1.2.3 From 61627f6524fdb6e723fef71312b23f75a6799a65 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 4 Sep 2024 23:51:42 +0200 Subject: #2461 changing the color of my dot on the minimap --- .../skins/default/textures/map_avatar_you_32.tga | Bin 3395 -> 4140 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/indra/newview/skins/default/textures/map_avatar_you_32.tga b/indra/newview/skins/default/textures/map_avatar_you_32.tga index 782207efd6..84b57aceaf 100644 Binary files a/indra/newview/skins/default/textures/map_avatar_you_32.tga and b/indra/newview/skins/default/textures/map_avatar_you_32.tga differ -- cgit v1.2.3 From bacf9cfeab90bd1ffad827fa3c34ced985c768a2 Mon Sep 17 00:00:00 2001 From: TJ Date: Thu, 5 Sep 2024 23:55:02 +1000 Subject: Fixed md5 buffer not being correctly zero-initialized and refactored code. (#2507) --- indra/llcommon/llmd5.cpp | 551 ++++++++++++++++++++++------------------------- indra/llcommon/llmd5.h | 82 ++++--- 2 files changed, 293 insertions(+), 340 deletions(-) diff --git a/indra/llcommon/llmd5.cpp b/indra/llcommon/llmd5.cpp index f64f54c262..e999b8f597 100644 --- a/indra/llcommon/llmd5.cpp +++ b/indra/llcommon/llmd5.cpp @@ -68,10 +68,6 @@ documentation and/or software. */ - - - - #include "linden_common.h" #include "llmd5.h" @@ -81,232 +77,203 @@ documentation and/or software. // how many bytes to grab at a time when checking files const int LLMD5::BLOCK_LEN = 4096; - // LLMD5 simple initialization method - LLMD5::LLMD5() { - init(); + init(); } - - - // MD5 block update operation. Continues an MD5 message-digest // operation, processing another message block, and updating the // context. +void LLMD5::update(const uint8_t* input, const size_t input_length) +{ + size_t input_index, buffer_index; + size_t buffer_space; // how much space is left in buffer -void LLMD5::update (const uint8_t *input, const size_t input_length) { - - size_t input_index, buffer_index; - size_t buffer_space; // how much space is left in buffer - - if (finalized){ // so we can't update! - std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl; - return; - } - - // Compute number of bytes mod 64 - buffer_index = size_t((count >> 3) & 0x3F); + if (finalized) + { // so we can't update! + std::cerr << "LLMD5::update: Can't update a finalized digest!" << std::endl; + return; + } - // Update number of bits - count += input_length << 3; + // Compute number of bytes mod 64 + buffer_index = size_t((count >> 3) & 0x3F); - buffer_space = 64 - buffer_index; // how much space is left in buffer + // Update number of bits + count += input_length << 3; - // now, transform each 64-byte piece of the input, bypassing the buffer - if (input == NULL || input_length == 0){ - std::cerr << "LLMD5::update: Invalid input!" << std::endl; - return; - } + buffer_space = 64 - buffer_index; // how much space is left in buffer - // Transform as many times as possible. - if (input_length >= buffer_space) { // ie. we have enough to fill the buffer - // fill the rest of the buffer and transform - memcpy( /* Flawfinder: ignore */ - buffer + buffer_index, - input, - buffer_space); - transform (buffer); + // now, transform each 64-byte piece of the input, bypassing the buffer + if (input == NULL || input_length == 0) + { + std::cerr << "LLMD5::update: Invalid input!" << std::endl; + return; + } - for (input_index = buffer_space; input_index + 63 < input_length; - input_index += 64) - transform (input+input_index); + // Transform as many times as possible. + if (input_length >= buffer_space) // ie. we have enough to fill the buffer + { + // fill the rest of the buffer and transform + memcpy(/* Flawfinder: ignore */ + buffer + buffer_index, + input, + buffer_space); + transform(buffer); - buffer_index = 0; // so we can buffer remaining - } - else - input_index=0; // so we can buffer the whole input + for (input_index = buffer_space; input_index + 63 < input_length; input_index += 64) + transform(input + input_index); + buffer_index = 0; // so we can buffer remaining + } + else + input_index = 0; // so we can buffer the whole input - // and here we do the buffering: - memcpy(buffer+buffer_index, input+input_index, input_length-input_index); /* Flawfinder: ignore */ + // and here we do the buffering: + memcpy(buffer + buffer_index, input + input_index, input_length - input_index); /* Flawfinder: ignore */ } - - // MD5 update for files. // Like above, except that it works on files (and uses above as a primitive.) +void LLMD5::update(FILE* file) +{ + unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ + int len; -void LLMD5::update(FILE* file){ - - unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ - int len; - - while ( (len=(int)fread(buffer, 1, BLOCK_LEN, file)) ) - update(buffer, len); - - fclose (file); + while ((len = (int)fread(buffer, 1, BLOCK_LEN, file))) + update(buffer, len); + fclose(file); } // MD5 update for istreams. // Like update for files; see above. +void LLMD5::update(std::istream& stream) +{ + unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ + int len; -void LLMD5::update(std::istream& stream){ - - unsigned char buffer[BLOCK_LEN]; /* Flawfinder: ignore */ - int len; - - while (stream.good()){ - stream.read( (char*)buffer, BLOCK_LEN); /* Flawfinder: ignore */ // note that return value of read is unusable. - len=(int)stream.gcount(); - update(buffer, len); - } - + while (stream.good()) + { + stream.read((char*)buffer, BLOCK_LEN); /* Flawfinder: ignore */ // note that return value of read is unusable. + len = (int)stream.gcount(); + update(buffer, len); + } } -void LLMD5::update(const std::string& s) +void LLMD5::update(const std::string& s) { - update((unsigned char *)s.c_str(),s.length()); + update((unsigned char*)s.c_str(), s.length()); } // MD5 finalization. Ends an MD5 message-digest operation, writing the // the message digest and zeroizing the context. - - -void LLMD5::finalize (){ - - unsigned char bits[8]; /* Flawfinder: ignore */ - size_t index, padLen; - static uint8_t PADDING[64]={ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +void LLMD5::finalize() +{ + unsigned char bits[8]; /* Flawfinder: ignore */ + size_t index, padLen; + static uint8_t PADDING[64] = + { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - if (finalized){ - std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl; - return; - } - - // Save number of bits. - // Treat count, a uint64_t, as uint32_t[2]. - encode (bits, reinterpret_cast(&count), 8); + if (finalized) + { + std::cerr << "LLMD5::finalize: Already finalized this digest!" << std::endl; + return; + } - // Pad out to 56 mod 64. - index = size_t((count >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - update (PADDING, padLen); + // Save number of bits. + // Treat count, a uint64_t, as uint32_t[2]. + encode(bits, reinterpret_cast(&count), 8); - // Append length (before padding) - update (bits, 8); + // Pad out to 56 mod 64. + index = size_t((count >> 3) & 0x3f); + padLen = (index < 56) ? (56 - index) : (120 - index); + update(PADDING, padLen); - // Store state in digest - encode (digest, state, 16); + // Append length (before padding) + update(bits, 8); - // Zeroize sensitive information - memset (buffer, 0, sizeof(*buffer)); + // Store state in digest + encode(digest, state, 16); - finalized=1; + // Zeroize sensitive information + memset(buffer, 0, sizeof(buffer)); + finalized = true; } - - - -LLMD5::LLMD5(FILE *file){ - - init(); // must be called be all constructors - update(file); - finalize (); +LLMD5::LLMD5(FILE* file) +{ + init(); // must be called be all constructors + update(file); + finalize(); } - - - -LLMD5::LLMD5(std::istream& stream){ - - init(); // must called by all constructors - update (stream); - finalize(); +LLMD5::LLMD5(std::istream& stream) +{ + init(); // must called by all constructors + update(stream); + finalize(); } // Digest a string of the format ("%s:%i" % (s, number)) -LLMD5::LLMD5(const unsigned char *string, const unsigned int number) +LLMD5::LLMD5(const unsigned char* string, const unsigned int number) { - const char *colon = ":"; - char tbuf[16]; /* Flawfinder: ignore */ + const char* colon = ":"; + char tbuf[16]; /* Flawfinder: ignore */ init(); - update(string, (U32)strlen((const char *) string)); /* Flawfinder: ignore */ - update((const unsigned char *) colon, (U32)strlen(colon)); /* Flawfinder: ignore */ - snprintf(tbuf, sizeof(tbuf), "%i", number); /* Flawfinder: ignore */ - update((const unsigned char *) tbuf, (U32)strlen(tbuf)); /* Flawfinder: ignore */ + update(string, (U32)strlen((const char*)string)); /* Flawfinder: ignore */ + update((const unsigned char*)colon, (U32)strlen(colon)); /* Flawfinder: ignore */ + snprintf(tbuf, sizeof(tbuf), "%i", number); /* Flawfinder: ignore */ + update((const unsigned char*)tbuf, (U32)strlen(tbuf)); /* Flawfinder: ignore */ finalize(); } // Digest a string -LLMD5::LLMD5(const unsigned char *s) +LLMD5::LLMD5(const unsigned char* s) { init(); - update(s, (U32)strlen((const char *) s)); /* Flawfinder: ignore */ + update(s, (U32)strlen((const char*)s)); /* Flawfinder: ignore */ finalize(); } -void LLMD5::raw_digest(unsigned char *s) const +void LLMD5::raw_digest(unsigned char* s) const { if (!finalized) { - std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't "<< - "finalized the digest!" << std::endl; + std::cerr << "LLMD5::raw_digest: Can't get digest if you haven't " + << "finalized the digest!" << std::endl; s[0] = '\0'; return; } - memcpy(s, digest, 16); /* Flawfinder: ignore */ - return; + memcpy(s, digest, 16); /* Flawfinder: ignore */ } - - -void LLMD5::hex_digest(char *s) const +void LLMD5::hex_digest(char* s) const { - int i; - if (!finalized) { - std::cerr << "LLMD5::hex_digest: Can't get digest if you haven't "<< - "finalized the digest!" <> (32-(n)))) +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) /* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is separate from addition to prevent recomputation. */ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (U32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (U32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (U32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (U32)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ - } - - +#define FF(a, b, c, d, x, s, ac) \ + { \ + (a) += F((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } +#define GG(a, b, c, d, x, s, ac) \ + { \ + (a) += G((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } +#define HH(a, b, c, d, x, s, ac) \ + { \ + (a) += H((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } +#define II(a, b, c, d, x, s, ac) \ + { \ + (a) += I((b), (c), (d)) + (x) + (U32)(ac); \ + (a) = ROTATE_LEFT((a), (s)); \ + (a) += (b); \ + } // LLMD5 basic transformation. Transforms state based on block. -void LLMD5::transform (const U8 block[64]){ - - uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - decode (x, block, 64); - - assert(!finalized); // not just a user error, since the method is private - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ - FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ - FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ - FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ - FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ - FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ - FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ - FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ - FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ - FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ - FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ - GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ - GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ - GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ - GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ - GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ - GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ - GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ - GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ - GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ - GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ - HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ - HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ - HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ - HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ - HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ - HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ - HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ - HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ - HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ - II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ - II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ - II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ - II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ - II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ - II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ - II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ - II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ - II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - // Zeroize sensitive information. - memset ( (uint8_t *) x, 0, sizeof(x)); - +void LLMD5::transform(const U8 block[64]) +{ + uint32_t a = state[0], b = state[1], c = state[2], d = state[3], x[16]; + + decode(x, block, 64); + + assert(!finalized); // not just a user error, since the method is private + + /* Round 1 */ + FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */ + FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */ + FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */ + FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */ + FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */ + FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */ + FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */ + FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */ + FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */ + FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */ + FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ + FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ + FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ + FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ + FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ + FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ + + /* Round 2 */ + GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */ + GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */ + GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ + GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */ + GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */ + GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */ + GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ + GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */ + GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */ + GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ + GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */ + GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */ + GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ + GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */ + GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */ + GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ + + /* Round 3 */ + HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */ + HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */ + HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ + HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ + HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */ + HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */ + HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */ + HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ + HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ + HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */ + HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */ + HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */ + HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */ + HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ + HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ + HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */ + + /* Round 4 */ + II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */ + II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */ + II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ + II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */ + II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ + II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */ + II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ + II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */ + II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */ + II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ + II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */ + II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ + II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */ + II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ + II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */ + II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */ + + state[0] += a; + state[1] += b; + state[2] += c; + state[3] += d; + + // Zeroize sensitive information. + memset(x, 0, sizeof(x)); } - - // Encodes input (uint32_t) into output (unsigned char). Assumes len is // a multiple of 4. -void LLMD5::encode (uint8_t *output, const uint32_t *input, const size_t len) { - - size_t i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (uint8_t) (input[i] & 0xff); - output[j+1] = (uint8_t) ((input[i] >> 8) & 0xff); - output[j+2] = (uint8_t) ((input[i] >> 16) & 0xff); - output[j+3] = (uint8_t) ((input[i] >> 24) & 0xff); - } +void LLMD5::encode(uint8_t* output, const uint32_t* input, const size_t len) +{ + for (size_t i = 0, j = 0; j < len; i++, j += 4) + { + output[j] = (uint8_t)(input[i] & 0xff); + output[j + 1] = (uint8_t)((input[i] >> 8) & 0xff); + output[j + 2] = (uint8_t)((input[i] >> 16) & 0xff); + output[j + 3] = (uint8_t)((input[i] >> 24) & 0xff); + } } - - - // Decodes input (unsigned char) into output (uint32_t). Assumes len is // a multiple of 4. -void LLMD5::decode (uint32_t *output, const uint8_t *input, const size_t len){ - - size_t i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) | - (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24); +void LLMD5::decode(uint32_t* output, const uint8_t* input, const size_t len) +{ + for (size_t i = 0, j = 0; j < len; i++, j += 4) + output[i] = ((uint32_t)input[j]) | (((uint32_t)input[j+1]) << 8) | + (((uint32_t)input[j+2]) << 16) | (((uint32_t)input[j+3]) << 24); } - - diff --git a/indra/llcommon/llmd5.h b/indra/llcommon/llmd5.h index 46c79cf5a2..ad063fda46 100644 --- a/indra/llcommon/llmd5.h +++ b/indra/llcommon/llmd5.h @@ -67,59 +67,57 @@ documentation and/or software. */ -#include // uint32_t et al. +#include // uint32_t et al. // use for the raw digest output const int MD5RAW_BYTES = 16; // use for outputting hex digests -const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null +const int MD5HEX_STR_SIZE = 33; // char hex[MD5HEX_STR_SIZE]; with null const int MD5HEX_STR_BYTES = 32; // message system fixed size -class LL_COMMON_API LLMD5 { -// how many bytes to grab at a time when checking files - static const int BLOCK_LEN; +class LL_COMMON_API LLMD5 +{ + // how many bytes to grab at a time when checking files + static const int BLOCK_LEN; public: -// methods for controlled operation: - LLMD5 (); // simple initializer - void update (const uint8_t *input, const size_t input_length); - void update (std::istream& stream); - void update (FILE *file); - void update (const std::string& str); - void finalize (); - -// constructors for special circumstances. All these constructors finalize -// the MD5 context. - LLMD5 (const unsigned char *string); // digest string, finalize - LLMD5 (std::istream& stream); // digest stream, finalize - LLMD5 (FILE *file); // digest file, close, finalize - LLMD5 (const unsigned char *string, const unsigned int number); - -// methods to acquire finalized result - void raw_digest(unsigned char *array) const; // provide 16-byte array for binary data - void hex_digest(char *string) const; // provide 33-byte array for ascii-hex string - - friend LL_COMMON_API std::ostream& operator<< (std::ostream&, LLMD5 context); + // methods for controlled operation: + LLMD5(); // simple initializer + void update(const uint8_t* input, const size_t input_length); + void update(std::istream& stream); + void update(FILE* file); + void update(const std::string& str); + void finalize(); + + // constructors for special circumstances. All these constructors finalize + // the MD5 context. + LLMD5(const unsigned char* string); // digest string, finalize + LLMD5(std::istream& stream); // digest stream, finalize + LLMD5(FILE* file); // digest file, close, finalize + LLMD5(const unsigned char* string, const unsigned int number); + + // methods to acquire finalized result + void raw_digest(unsigned char* array) const; // provide 16-byte array for binary data + void hex_digest(char* string) const; // provide 33-byte array for ascii-hex string + + friend LL_COMMON_API std::ostream& operator<<(std::ostream&, const LLMD5& context); private: - - -// next, the private data: - uint32_t state[4]; - uint64_t count; // number of *bits*, mod 2^64 - uint8_t buffer[64]; // input buffer - uint8_t digest[16]; - uint8_t finalized; - -// last, the private methods, mostly static: - void init (); // called by all constructors - void transform (const uint8_t *buffer); // does the real update work. Note - // that length is implied to be 64. - - static void encode (uint8_t *dest, const uint32_t *src, const size_t length); - static void decode (uint32_t *dest, const uint8_t *src, const size_t length); - + // next, the private data: + uint32_t state[4]; + uint64_t count; // number of *bits*, mod 2^64 + uint8_t buffer[64]; // input buffer + uint8_t digest[16]; + bool finalized; + + // last, the private methods, mostly static: + void init(); // called by all constructors + void transform(const uint8_t* buffer); // does the real update work. Note + // that length is implied to be 64. + + static void encode(uint8_t* dest, const uint32_t* src, const size_t length); + static void decode(uint32_t* dest, const uint8_t* src, const size_t length); }; LL_COMMON_API bool operator==(const LLMD5& a, const LLMD5& b); -- cgit v1.2.3 From fe9596bf79659b2dd334fa6332473c8284df7659 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Thu, 5 Sep 2024 12:07:51 -0700 Subject: Fix race condition that was preventing "Voice Call" menu from reliably calling. The code attempted to do a call to a session immediately after a call that launched a coroutine to set up a session. Sometimes, the coroutine executed in time, sometimes not. The fix is to set a flag to start a call after the session has been created on the server. Test Plan: * Close all active chat sessions. * Select 'Voice Call' in the context menu of a nearby avatar. * Validate popup appears for that nearby avatar requesting to start/ignore/go to im. * Select 'start' * Validate the call completes. --- indra/newview/llavataractions.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp index 038030a1f6..6f6b89ea81 100644 --- a/indra/newview/llavataractions.cpp +++ b/indra/newview/llavataractions.cpp @@ -242,10 +242,7 @@ static void on_avatar_name_cache_start_call(const LLUUID& agent_id, { std::string name = av_name.getDisplayName(); LLUUID session_id = gIMMgr->addSession(name, IM_NOTHING_SPECIAL, agent_id, LLSD()); - if (session_id != LLUUID::null) - { - gIMMgr->startCall(session_id); - } + gIMMgr->autoStartCallOnStartup(session_id); make_ui_sound("UISndStartIM"); } -- cgit v1.2.3 From 3c471b81554d9727b1a1929681ce3bfb4734aabc Mon Sep 17 00:00:00 2001 From: Ansariel Date: Fri, 6 Sep 2024 02:20:10 +0200 Subject: Follow-up fix for 238a2a64b31e6a0b431309e363067a7fe57125ae: Item count will always show fetch label even after fetch is complete --- indra/newview/llpanelmaininventory.cpp | 30 +++++++++++++++++++++++------- indra/newview/llpanelmaininventory.h | 8 ++++++++ 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 0c068ff993..143873f168 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -997,6 +997,22 @@ void LLPanelMainInventory::updateItemcountText() mCategoryCount = gInventory.getCategoryCount(); update = true; } + + EFetchState currentFetchState{ EFetchState::Unknown }; + if (LLInventoryModelBackgroundFetch::instance().folderFetchActive()) + { + currentFetchState = EFetchState::Fetching; + } + else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched()) + { + currentFetchState = EFetchState::Complete; + } + + if (mLastFetchState != currentFetchState) + { + mLastFetchState = currentFetchState; + update = true; + } } if (mLastFilterText != getFilterText()) @@ -1027,17 +1043,17 @@ void LLPanelMainInventory::updateItemcountText() } else { - if (LLInventoryModelBackgroundFetch::instance().folderFetchActive()) + switch (mLastFetchState) { + case EFetchState::Fetching: text = getString("ItemcountFetching", string_args); - } - else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched()) - { + break; + case EFetchState::Complete: text = getString("ItemcountCompleted", string_args); - } - else - { + break; + default: text = getString("ItemcountUnknown", string_args); + break; } } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index d28daddd73..21100cc03c 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -182,6 +182,13 @@ protected: LLSidepanelInventory* getParentSidepanelInventory(); private: + enum class EFetchState + { + Unknown, + Fetching, + Complete + }; + LLFloaterInventoryFinder* getFinder(); LLFilterEditor* mFilterEditor; @@ -202,6 +209,7 @@ private: S32 mCategoryCount = 0; std::string mCategoryCountString; LLComboBox* mSearchTypeCombo; + EFetchState mLastFetchState{ EFetchState::Unknown }; LLButton* mBackBtn; LLButton* mForwardBtn; -- cgit v1.2.3 From 256ac6e9627073903614263476f357f368082edb Mon Sep 17 00:00:00 2001 From: Ansariel Hiller Date: Fri, 6 Sep 2024 15:58:50 +0200 Subject: Fix login progress always showing incorrect attempt number (#2517) --- indra/newview/llviewerregion.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp index 115db57a06..71add76dd2 100755 --- a/indra/newview/llviewerregion.cpp +++ b/indra/newview/llviewerregion.cpp @@ -345,11 +345,10 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) impl = regionp->getRegionImplNC(); - ++(impl->mSeedCapAttempts); - if (!result.isMap() || result.has("error")) { LL_WARNS("AppInit", "Capabilities") << "Malformed response" << LL_ENDL; + ++(impl->mSeedCapAttempts); // setup for retry. continue; } @@ -359,6 +358,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) if (!status) { LL_WARNS("AppInit", "Capabilities") << "HttpStatus error " << LL_ENDL; + ++(impl->mSeedCapAttempts); // setup for retry. continue; } @@ -369,6 +369,7 @@ void LLViewerRegionImpl::requestBaseCapabilitiesCoro(U64 regionHandle) if (id != impl->mHttpResponderID) // region is no longer referring to this request { LL_WARNS("AppInit", "Capabilities") << "Received results for a stale capabilities request!" << LL_ENDL; + ++(impl->mSeedCapAttempts); // setup for retry. continue; } -- cgit v1.2.3 From 6af471482d6801530915c1c9ae4bdf788af52eae Mon Sep 17 00:00:00 2001 From: TJ Date: Sat, 7 Sep 2024 00:08:32 +1000 Subject: Add toggles to avatar dropdown for hear sound or voice from avatar. (#2518, #2519) --- indra/newview/llagent.cpp | 14 ++++++++++++++ indra/newview/llagent.h | 7 +++++++ indra/newview/llviewermenu.cpp | 2 ++ indra/newview/skins/default/xui/en/menu_viewer.xml | 18 ++++++++++++++++++ 4 files changed, 41 insertions(+) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index c4336758ac..7c37cc1c00 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -355,6 +355,20 @@ bool LLAgent::isMicrophoneOn(const LLSD& sdname) return LLVoiceClient::getInstance()->getUserPTTState(); } +//static +void LLAgent::toggleHearMediaSoundFromAvatar() +{ + const S32 mediaSoundsEarLocation = gSavedSettings.getS32("MediaSoundsEarLocation"); + gSavedSettings.setS32("MediaSoundsEarLocation", !mediaSoundsEarLocation); +} + +//static +void LLAgent::toggleHearVoiceFromAvatar() +{ + const S32 voiceEarLocation = gSavedSettings.getS32("VoiceEarLocation"); + gSavedSettings.setS32("VoiceEarLocation", !voiceEarLocation); +} + // ************************************************************ // Enabled this definition to compile a 'hacked' viewer that // locally believes the end user has godlike powers. diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 8f892025c9..7c7f7aa91d 100644 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -374,6 +374,13 @@ public: private: bool mVoiceConnected; + //-------------------------------------------------------------------- + // Sound + //-------------------------------------------------------------------- +public: + static void toggleHearMediaSoundFromAvatar(); + static void toggleHearVoiceFromAvatar(); + //-------------------------------------------------------------------- // Chat //-------------------------------------------------------------------- diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 344a9737b1..d8c4e03d93 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -9757,6 +9757,8 @@ void initialize_menus() commit.add("Agent.ToggleMicrophone", boost::bind(&LLAgent::toggleMicrophone, _2)); enable.add("Agent.IsMicrophoneOn", boost::bind(&LLAgent::isMicrophoneOn, _2)); enable.add("Agent.IsActionAllowed", boost::bind(&LLAgent::isActionAllowed, _2)); + commit.add("Agent.ToggleHearMediaSoundFromAvatar", boost::bind(&LLAgent::toggleHearMediaSoundFromAvatar)); + commit.add("Agent.ToggleHearVoiceFromAvatar", boost::bind(&LLAgent::toggleHearVoiceFromAvatar)); // File menu init_menu_file(); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 7fe9d0efe5..324e868bd5 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -465,6 +465,24 @@ + + + + + + + + + Date: Fri, 6 Sep 2024 12:00:00 -0700 Subject: Don't enable vivox spatial when teleporting while in a webrtc conference/p2p/group call Processing for vivox was being enabled when teleporting into a vivox region regardless as to whether the user was in a conference/p2p/group call, resulting in vivox spatial and webrtc conference/p2p/group simultaneously being active. --- indra/newview/llvoiceclient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 5af7528ada..1a35a71706 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -256,8 +256,8 @@ void LLVoiceClient::setSpatialVoiceModule(const std::string &voice_server_type) if (inProximalChannel()) { mSpatialVoiceModule->processChannels(false); + module->processChannels(true); } - module->processChannels(true); mSpatialVoiceModule = module; mSpatialVoiceModule->updateSettings(); } -- cgit v1.2.3 From 4a00280b892ea82d2c0732ab52778a2c19bdc810 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Fri, 6 Sep 2024 20:13:17 +0300 Subject: viewer#2411 Use font buffer for inventory --- indra/llui/llfolderviewitem.cpp | 10 ++++++---- indra/llui/llfolderviewitem.h | 4 ++++ indra/llui/lltextbase.cpp | 11 +++++------ indra/llui/lltextbase.h | 3 ++- indra/llui/lltexteditor.h | 2 ++ indra/newview/llfloaterimcontainer.cpp | 10 +++++++++- indra/newview/llfloaterimcontainer.h | 1 + 7 files changed, 29 insertions(+), 12 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index e4f5664908..2879f0354f 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -307,6 +307,7 @@ void LLFolderViewItem::refresh() LLFolderViewModelItem& vmi = *getViewModelItem(); mLabel = utf8str_to_wstring(vmi.getDisplayName()); + mLabelFontBuffer.reset(); setToolTip(vmi.getName()); // icons are slightly expensive to get, can be optimized // see LLInventoryIcon::getIcon() @@ -320,6 +321,7 @@ void LLFolderViewItem::refresh() // Can do a number of expensive checks, like checking active motions, wearables or friend list mLabelStyle = vmi.getLabelStyle(); mLabelSuffix = utf8str_to_wstring(vmi.getLabelSuffix()); + mSuffixFontBuffer.reset(); } // Dirty the filter flag of the model from the view (CHUI-849) @@ -890,7 +892,7 @@ void LLFolderViewItem::drawLabel(const LLFontGL * font, const F32 x, const F32 y //--------------------------------------------------------------------------------// // Draw the actual label text // - font->render(mLabel, 0, x, y, color, + mLabelFontBuffer.render(font, mLabel, 0, x, y, color, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, getRect().getWidth() - (S32) x - mLabelPaddingRight, &right_x, /*use_ellipses*/true); } @@ -999,9 +1001,9 @@ void LLFolderViewItem::draw() // if (!mLabelSuffix.empty()) { - suffix_font->render( mLabelSuffix, 0, right_x, y, isFadeItem() ? color : sSuffixColor.get(), - LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, - S32_MAX, S32_MAX, &right_x); + mSuffixFontBuffer.render(suffix_font, mLabelSuffix, 0, right_x, y, isFadeItem() ? color : sSuffixColor.get(), + LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, + S32_MAX, S32_MAX, &right_x); } //--------------------------------------------------------------------------------// diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index 60cdac3ab9..c37bf64dee 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -29,6 +29,7 @@ #include "llflashtimer.h" #include "llview.h" #include "lluiimage.h" +#include "llfontvertexbuffer.h" class LLFolderView; class LLFolderViewModelItem; @@ -307,6 +308,9 @@ public: private: static std::map sFonts; // map of styles to fonts + + LLFontVertexBuffer mLabelFontBuffer; + LLFontVertexBuffer mSuffixFontBuffer; }; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp index 615619d244..e2d31085c4 100644 --- a/indra/llui/lltextbase.cpp +++ b/indra/llui/lltextbase.cpp @@ -3342,7 +3342,6 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele const LLWString& text = getWText(); S32 text_gen = mEditor.getTextGeneration(); - bool is_text_read_only = mEditor.getReadOnly(); if (text_gen != mLastGeneration) { @@ -3354,8 +3353,8 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele } const LLFontGL* font = mStyle->getFont(); - - LLColor4 color = (is_text_read_only ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha()); + LLColor4 color = (mEditor.getReadOnly() ? mStyle->getReadOnlyColor() : mStyle->getColor()) % (alpha * mStyle->getAlpha()); + bool use_font_buffers = useFontBuffers(); if( selection_start > seg_start ) { @@ -3363,7 +3362,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 start = seg_start; S32 end = llmin( selection_start, seg_end ); S32 length = end - start; - if (is_text_read_only) + if (use_font_buffers) { mFontBufferPreSelection.render( font, @@ -3407,7 +3406,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 end = llmin( selection_end, seg_end ); S32 length = end - start; - if (is_text_read_only) + if (use_font_buffers) { mFontBufferSelection.render( font, @@ -3444,7 +3443,7 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele S32 start = llmax( selection_end, seg_start ); S32 end = seg_end; S32 length = end - start; - if (is_text_read_only) + if (use_font_buffers) { mFontBufferPostSelection.render( font, diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h index e2981c2637..eb4697da15 100644 --- a/indra/llui/lltextbase.h +++ b/indra/llui/lltextbase.h @@ -151,6 +151,7 @@ public: /*virtual*/ bool handleToolTip(S32 x, S32 y, MASK mask); protected: + virtual bool useFontBuffers() const { return true; } F32 drawClippedSegment(S32 seg_start, S32 seg_end, S32 selection_start, S32 selection_end, LLRectf rect); virtual const LLWString& getWText() const; @@ -484,7 +485,7 @@ public: LLRect getDocRectFromDocIndex(S32 pos) const; void setReadOnly(bool read_only) { mReadOnly = read_only; } - bool getReadOnly() { return mReadOnly; } + bool getReadOnly() const { return mReadOnly; } void setSkipLinkUnderline(bool skip_link_underline) { mSkipLinkUnderline = skip_link_underline; } bool getSkipLinkUnderline() { return mSkipLinkUnderline; } diff --git a/indra/llui/lltexteditor.h b/indra/llui/lltexteditor.h index 0b5acf19a1..e9e7070414 100644 --- a/indra/llui/lltexteditor.h +++ b/indra/llui/lltexteditor.h @@ -271,6 +271,8 @@ protected: virtual bool getPreeditLocation(S32 query_offset, LLCoordGL *coord, LLRect *bounds, LLRect *control) const; virtual S32 getPreeditFontSize() const; virtual LLWString getPreeditString() const { return getWText(); } + + virtual bool useFontBuffers() const { return getReadOnly(); } // // Protected data // diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp index abf15ea9cf..e55bf50724 100644 --- a/indra/newview/llfloaterimcontainer.cpp +++ b/indra/newview/llfloaterimcontainer.cpp @@ -306,6 +306,9 @@ bool LLFloaterIMContainer::postBuild() mParticipantRefreshTimer.setTimerExpirySec(0); mParticipantRefreshTimer.start(); + mGeneralTitleInUse = true; // avoid reseting strings on idle + setTitle(mGeneralTitle); + return true; } @@ -521,7 +524,12 @@ void LLFloaterIMContainer::idleUpdate() // Update floater's title as required by the currently selected session or use the default title LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(current_session->getUUID()); - setTitle(conversation_floaterp && conversation_floaterp->needsTitleOverwrite() ? conversation_floaterp->getTitle() : mGeneralTitle); + bool needs_override = conversation_floaterp && conversation_floaterp->needsTitleOverwrite(); + if (mGeneralTitleInUse == needs_override) + { + mGeneralTitleInUse = !needs_override; + setTitle(needs_override ? conversation_floaterp->getTitle() : mGeneralTitle); + } } mParticipantRefreshTimer.setTimerExpirySec(1.0f); diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h index d1cfd3442c..e5486e67da 100644 --- a/indra/newview/llfloaterimcontainer.h +++ b/indra/newview/llfloaterimcontainer.h @@ -234,6 +234,7 @@ private: conversations_items_deque mConversationEventQueue; LLTimer mParticipantRefreshTimer; + bool mGeneralTitleInUse = true; }; #endif // LL_LLFLOATERIMCONTAINER_H -- cgit v1.2.3 From 2b7b81fbdbaaaa8698828af9529f9693692da2a2 Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 3 Sep 2024 18:05:45 +0200 Subject: #459 Filters on object inventory --- indra/llui/llfolderviewitem.cpp | 14 +- indra/llui/llfolderviewitem.h | 4 +- indra/llui/llfolderviewmodel.h | 1 + indra/newview/llfolderviewmodelinventory.cpp | 2 +- indra/newview/llinventorybridge.cpp | 342 +++++++------- indra/newview/llinventoryfilter.cpp | 94 ++-- indra/newview/llinventoryfilter.h | 8 +- indra/newview/llinventoryfunctions.cpp | 14 +- indra/newview/llinventorygallery.cpp | 238 +++++----- indra/newview/llinventorypanel.cpp | 4 +- indra/newview/llpanelcontents.cpp | 41 +- indra/newview/llpanelcontents.h | 10 +- indra/newview/llpanelmaininventory.cpp | 27 +- indra/newview/llpanelmaininventory.h | 2 +- indra/newview/llpanelobjectinventory.cpp | 520 ++++++++++----------- indra/newview/llpanelobjectinventory.h | 2 + indra/newview/llsettingspicker.cpp | 8 +- indra/newview/llsidepanelinventory.cpp | 2 +- indra/newview/llviewerobjectlist.h | 11 +- .../newview/skins/default/xui/en/floater_tools.xml | 20 +- 20 files changed, 706 insertions(+), 658 deletions(-) diff --git a/indra/llui/llfolderviewitem.cpp b/indra/llui/llfolderviewitem.cpp index 2879f0354f..73803786a6 100644 --- a/indra/llui/llfolderviewitem.cpp +++ b/indra/llui/llfolderviewitem.cpp @@ -777,8 +777,9 @@ void LLFolderViewItem::drawOpenFolderArrow(const Params& default_params, const L return mIsItemCut; } -void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, - const LLUIColor &focusOutlineColor, const LLUIColor &mouseOverColor) +void LLFolderViewItem::drawHighlight(bool showContent, bool hasKeyboardFocus, + const LLUIColor& selectColor, const LLUIColor& flashColor, + const LLUIColor& focusOutlineColor, const LLUIColor& mouseOverColor) { const S32 focus_top = getRect().getHeight(); const S32 focus_bottom = getRect().getHeight() - mItemHeight; @@ -786,7 +787,7 @@ void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeybo const S32 FOCUS_LEFT = 1; // Determine which background color to use for highlighting - const LLUIColor& bgColor = (isFlashing() ? flashColor : selectColor); + const LLUIColor& bgColor = isFlashing() ? flashColor : selectColor; //--------------------------------------------------------------------------------// // Draw highlight for selected items @@ -794,7 +795,6 @@ void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeybo // items if mShowSingleSelection is false. // if (isHighlightAllowed()) - { gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -803,7 +803,7 @@ void LLFolderViewItem::drawHighlight(const bool showContent, const bool hasKeybo { LLColor4 bg_color = bgColor; // do time-based fade of extra objects - F32 fade_time = (getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.0f); + F32 fade_time = getRoot() ? getRoot()->getSelectionFadeElapsedTime() : 0.f; if (getRoot() && getRoot()->getShowSingleSelection()) { // fading out @@ -909,7 +909,7 @@ void LLFolderViewItem::draw() getViewModelItem()->update(); - if(!mSingleFolderMode) + if (!mSingleFolderMode) { drawOpenFolderArrow(default_params, sFgColor); } @@ -942,7 +942,7 @@ void LLFolderViewItem::draw() return; } - auto filter_string_length = mViewModelItem->hasFilterStringMatch() ? static_cast(mViewModelItem->getFilterStringSize()) : 0; + S32 filter_string_length = mViewModelItem->hasFilterStringMatch() ? (S32)mViewModelItem->getFilterStringSize() : 0; F32 right_x = 0; F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)mTextPad - (F32)TOP_PAD; F32 text_left = (F32)getLabelXPos(); diff --git a/indra/llui/llfolderviewitem.h b/indra/llui/llfolderviewitem.h index c37bf64dee..7ac28b1a8e 100644 --- a/indra/llui/llfolderviewitem.h +++ b/indra/llui/llfolderviewitem.h @@ -298,8 +298,8 @@ public: // virtual void handleDropped(); virtual void draw(); void drawOpenFolderArrow(const Params& default_params, const LLUIColor& fg_color); - void drawHighlight(const bool showContent, const bool hasKeyboardFocus, const LLUIColor &selectColor, const LLUIColor &flashColor, const LLUIColor &outlineColor, const LLUIColor &mouseOverColor); - void drawLabel(const LLFontGL * font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x); + void drawHighlight(bool showContent, bool hasKeyboardFocus, const LLUIColor& selectColor, const LLUIColor& flashColor, const LLUIColor& outlineColor, const LLUIColor& mouseOverColor); + void drawLabel(const LLFontGL* font, const F32 x, const F32 y, const LLColor4& color, F32 &right_x); virtual bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, diff --git a/indra/llui/llfolderviewmodel.h b/indra/llui/llfolderviewmodel.h index b8d6d89971..9372818ca5 100644 --- a/indra/llui/llfolderviewmodel.h +++ b/indra/llui/llfolderviewmodel.h @@ -292,6 +292,7 @@ public: dirtyFilter(); requestSort(); } + virtual void removeChild(LLFolderViewModelItem* child) { mChildren.remove(child); diff --git a/indra/newview/llfolderviewmodelinventory.cpp b/indra/newview/llfolderviewmodelinventory.cpp index 734f20830d..c668d414d3 100644 --- a/indra/newview/llfolderviewmodelinventory.cpp +++ b/indra/newview/llfolderviewmodelinventory.cpp @@ -234,7 +234,7 @@ bool LLFolderViewModelItemInventory::filterChildItem( LLFolderViewModelItem* ite return continue_filtering; } -bool LLFolderViewModelItemInventory::filter( LLFolderViewFilter& filter) +bool LLFolderViewModelItemInventory::filter(LLFolderViewFilter& filter) { const S32 filter_generation = filter.getCurrentGeneration(); const S32 must_pass_generation = filter.getFirstRequiredGeneration(); diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index c86492f005..2e8b1b94fe 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -1897,20 +1897,24 @@ void LLItemBridge::selectItem() } } +// virtual void LLItemBridge::restoreItem() { - LLViewerInventoryItem* item = static_cast(getItem()); - if(item) + if (LLViewerInventoryItem* item = getItem()) { - LLInventoryModel* model = getInventoryModel(); - bool is_snapshot = (item->getInventoryType() == LLInventoryType::IT_SNAPSHOT); + bool is_snapshot = item->getInventoryType() == LLInventoryType::IT_SNAPSHOT; + LLFolderType::EType preferred_type = is_snapshot ? + LLFolderType::FT_SNAPSHOT_CATEGORY : + LLFolderType::assetTypeToFolderType(item->getType()); - const LLUUID new_parent = model->findCategoryUUIDForType(is_snapshot? LLFolderType::FT_SNAPSHOT_CATEGORY : LLFolderType::assetTypeToFolderType(item->getType())); - // do not restamp on restore. + LLInventoryModel* model = getInventoryModel(); + LLUUID new_parent = model->findCategoryUUIDForType(preferred_type); + // Do not restamp on restore. LLInvFVBridge::changeItemParent(model, item, new_parent, false); } } +// virtual void LLItemBridge::restoreToWorld() { //Similar functionality to the drag and drop rez logic @@ -1931,26 +1935,27 @@ void LLItemBridge::restoreToWorld() //remove local inventory copy, sim will deal with permissions and removing the item //from the actual inventory if its a no-copy etc - if(!itemp->getPermissions().allowCopyBy(gAgent.getID())) + if (!itemp->getPermissions().allowCopyBy(gAgent.getID())) { remove_from_inventory = true; } // Check if it's in the trash. (again similar to the normal rez logic) const LLUUID trash_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_TRASH); - if(gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) + if (gInventory.isObjectDescendentOf(itemp->getUUID(), trash_id)) { remove_from_inventory = true; } } - if(remove_from_inventory) + if (remove_from_inventory) { gInventory.deleteObject(itemp->getUUID()); gInventory.notifyObservers(); } } +// virtual void LLItemBridge::gotoItem() { LLInventoryObject *obj = getInventoryObject(); @@ -1960,39 +1965,43 @@ void LLItemBridge::gotoItem() } } +// virtual LLUIImagePtr LLItemBridge::getIcon() const { - LLInventoryObject *obj = getInventoryObject(); - if (obj) + if (LLInventoryObject* obj = getInventoryObject()) { - return LLInventoryIcon::getIcon(obj->getType(), - LLInventoryType::IT_NONE, - mIsLink); + return LLInventoryIcon::getIcon(obj->getType(), LLInventoryType::IT_NONE, mIsLink); } return LLInventoryIcon::getIcon(LLInventoryType::ICONNAME_OBJECT); } +// virtual LLUIImagePtr LLItemBridge::getIconOverlay() const { if (getItem() && getItem()->getIsLinkType()) { return LLUI::getUIImage("Inv_Link"); } + return NULL; } +// virtual PermissionMask LLItemBridge::getPermissionMask() const { - LLViewerInventoryItem* item = getItem(); - PermissionMask perm_mask = 0; - if (item) perm_mask = item->getPermissionMask(); - return perm_mask; + if (LLViewerInventoryItem* item = getItem()) + { + return item->getPermissionMask(); + } + + return 0; } +// virtual void LLItemBridge::buildDisplayName() const { - if(getItem()) + if (getItem()) { mDisplayName.assign(getItem()->getName()); } @@ -2005,14 +2014,15 @@ void LLItemBridge::buildDisplayName() const mSearchableName.append(getLabelSuffix()); LLStringUtil::toUpper(mSearchableName); - //Name set, so trigger a sort + // Name set, so trigger a sort LLInventorySort sorter = static_cast(mRootViewModel).getSorter(); - if(mParent && !sorter.isByDate()) + if (mParent && !sorter.isByDate()) { mParent->requestSort(); } } +// virtual LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const { U8 font = LLFontGL::NORMAL; @@ -2023,7 +2033,7 @@ LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const // LL_INFOS() << "BOLD" << LL_ENDL; font |= LLFontGL::BOLD; } - else if(item && item->getIsLinkType()) + else if (item && item->getIsLinkType()) { font |= LLFontGL::ITALIC; } @@ -2031,6 +2041,7 @@ LLFontGL::StyleFlags LLItemBridge::getLabelStyle() const return (LLFontGL::StyleFlags)font; } +// virtual std::string LLItemBridge::getLabelSuffix() const { // String table is loaded before login screen and inventory items are @@ -2040,19 +2051,19 @@ std::string LLItemBridge::getLabelSuffix() const static std::string NO_XFER = LLTrans::getString("no_transfer_lbl"); static std::string LINK = LLTrans::getString("link"); static std::string BROKEN_LINK = LLTrans::getString("broken_link"); + std::string suffix; - LLInventoryItem* item = getItem(); - if(item) + if (LLInventoryItem* item = getItem()) { // Any type can have the link suffix... - bool broken_link = LLAssetType::lookupIsLinkType(item->getType()); - if (broken_link) return BROKEN_LINK; + if (LLAssetType::lookupIsLinkType(item->getType())) + return BROKEN_LINK; - bool link = item->getIsLinkType(); - if (link) return LINK; + if (item->getIsLinkType()) + return LINK; // ...but it's a bit confusing to put nocopy/nomod/etc suffixes on calling cards. - if(LLAssetType::AT_CALLINGCARD != item->getType() + if (LLAssetType::AT_CALLINGCARD != item->getType() && item->getPermissions().getOwner() == gAgent.getID()) { bool copy = item->getPermissions().allowCopyBy(gAgent.getID()); @@ -2067,8 +2078,7 @@ std::string LLItemBridge::getLabelSuffix() const suffix += suffix.empty() ? " " : ","; suffix += NO_MOD; } - bool xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, - gAgent.getID()); + bool xfer = item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID()); if (!xfer) { suffix += suffix.empty() ? " " : ","; @@ -2076,24 +2086,25 @@ std::string LLItemBridge::getLabelSuffix() const } } } + return suffix; } +// virtual time_t LLItemBridge::getCreationDate() const { - LLViewerInventoryItem* item = getItem(); - if (item) + if (LLViewerInventoryItem* item = getItem()) { return item->getCreationDate(); } + return 0; } - +// virtual bool LLItemBridge::isItemRenameable() const { - LLViewerInventoryItem* item = getItem(); - if(item) + if (LLViewerInventoryItem* item = getItem()) { // (For now) Don't allow calling card rename since that may confuse users as to // what the calling card points to. @@ -2112,50 +2123,62 @@ bool LLItemBridge::isItemRenameable() const return false; } - return (item->getPermissions().allowModifyBy(gAgent.getID())); + return item->getPermissions().allowModifyBy(gAgent.getID()); } + return false; } +// virtual bool LLItemBridge::renameItem(const std::string& new_name) { - if(!isItemRenameable()) + if (!isItemRenameable()) return false; + LLPreview::dirty(mUUID); LLInventoryModel* model = getInventoryModel(); - if(!model) + if (!model) return false; + LLViewerInventoryItem* item = getItem(); - if(item && (item->getName() != new_name)) + if (item && (item->getName() != new_name)) { LLSD updates; updates["name"] = new_name; update_inventory_item(item->getUUID(),updates, NULL); } - // return false because we either notified observers (& therefore - // rebuilt) or we didn't update. + + // return false because we either notified observers + // (& therefore rebuilt) or we didn't update. return false; } +// virtual bool LLItemBridge::removeItem() { - if(!isItemRemovable()) + if (!isItemRemovable()) { return false; } // move it to the trash LLInventoryModel* model = getInventoryModel(); - if(!model) return false; + if (!model) + return false; + const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); LLViewerInventoryItem* item = getItem(); - if (!item) return false; + if (!item) + return false; + if (item->getType() != LLAssetType::AT_LSL_TEXT) { LLPreview::hide(mUUID, true); } + // Already in trash - if (model->isObjectDescendentOf(mUUID, trash_id)) return false; + if (model->isObjectDescendentOf(mUUID, trash_id)) + return false; LLNotification::Params params("ConfirmItemDeleteHasLinks"); params.functor.function(boost::bind(&LLItemBridge::confirmRemoveItem, this, _1, _2)); @@ -2187,26 +2210,31 @@ bool LLItemBridge::removeItem() bool LLItemBridge::confirmRemoveItem(const LLSD& notification, const LLSD& response) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if (option != 0) return false; + if (option != 0) + return false; LLInventoryModel* model = getInventoryModel(); - if (!model) return false; + if (!model) + return false; LLViewerInventoryItem* item = getItem(); - if (!item) return false; + if (!item) + return false; const LLUUID& trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); // if item is not already in trash - if(item && !model->isObjectDescendentOf(mUUID, trash_id)) + if (item && !model->isObjectDescendentOf(mUUID, trash_id)) { // move to trash, and restamp LLInvFVBridge::changeItemParent(model, item, trash_id, true); // delete was successful return true; } + return false; } +// virtual bool LLItemBridge::isItemCopyable(bool can_copy_as_link) const { LLViewerInventoryItem* item = getItem(); @@ -2214,6 +2242,7 @@ bool LLItemBridge::isItemCopyable(bool can_copy_as_link) const { return false; } + // Can't copy worn objects. // Worn objects are tied to their inworld conterparts // Copy of modified worn object will return object with obsolete asset and inventory @@ -2230,37 +2259,36 @@ bool LLItemBridge::isItemCopyable(bool can_copy_as_link) const LLViewerInventoryItem* LLItemBridge::getItem() const { - LLViewerInventoryItem* item = NULL; - LLInventoryModel* model = getInventoryModel(); - if(model) + if (LLInventoryModel* model = getInventoryModel()) { - item = (LLViewerInventoryItem*)model->getItem(mUUID); + return model->getItem(mUUID); } - return item; + + return NULL; } +// virtual const LLUUID& LLItemBridge::getThumbnailUUID() const { - LLViewerInventoryItem* item = NULL; - LLInventoryModel* model = getInventoryModel(); - if(model) - { - item = (LLViewerInventoryItem*)model->getItem(mUUID); - } - if (item) + if (LLInventoryModel* model = getInventoryModel()) { - return item->getThumbnailUUID(); + if (LLViewerInventoryItem* item = model->getItem(mUUID)) + { + return item->getThumbnailUUID(); + } } + return LLUUID::null; } +// virtual bool LLItemBridge::isItemPermissive() const { - LLViewerInventoryItem* item = getItem(); - if(item) + if (LLViewerInventoryItem* item = getItem()) { return item->getIsFullPerm(); } + return false; } @@ -2583,16 +2611,22 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, LLInventoryModel* model = getInventoryModel(); - if (!inv_cat) return false; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL - if (!model) return false; - if (!isAgentAvatarValid()) return false; - if (!isAgentInventory()) return false; // cannot drag categories into library + if (!inv_cat) // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL + return false; + if (!model) + return false; + if (!isAgentAvatarValid()) + return false; + if (!isAgentInventory()) + return false; // cannot drag categories into library LLInventoryPanel* destination_panel = mInventoryPanel.get(); - if (!destination_panel) return false; + if (!destination_panel) + return false; LLInventoryFilter* filter = getInventoryFilter(); - if (!filter) return false; + if (!filter) + return false; const LLUUID &cat_id = inv_cat->getUUID(); const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); @@ -2689,7 +2723,7 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, is_movable = false; } } - if(is_movable && move_is_into_current_outfit && is_link) + if (is_movable && move_is_into_current_outfit && is_link) { is_movable = false; } @@ -2717,7 +2751,7 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, for (S32 i=0; i < descendent_categories.size(); ++i) { LLInventoryCategory* category = descendent_categories[i]; - if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) + if (LLFolderType::lookupIsProtectedType(category->getPreferredType())) { // Can't move "special folders" (e.g. Textures Folder). is_movable = false; @@ -2749,9 +2783,8 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if (is_movable && move_is_into_trash) { - for (S32 i=0; i < descendent_items.size(); ++i) + for (LLViewerInventoryItem* item : descendent_items) { - LLInventoryItem* item = descendent_items[i]; if (get_is_item_worn(item->getUUID())) { is_movable = false; @@ -2761,10 +2794,8 @@ bool LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat, } if (is_movable && move_is_into_landmarks) { - for (S32 i=0; i < descendent_items.size(); ++i) + for (LLViewerInventoryItem* item : descendent_items) { - LLViewerInventoryItem* item = descendent_items[i]; - // Don't move anything except landmarks and categories into Landmarks folder. // We use getType() instead of getActua;Type() to allow links to landmarks and folders. if (LLAssetType::AT_LANDMARK != item->getType() && LLAssetType::AT_CATEGORY != item->getType()) @@ -3055,7 +3086,7 @@ bool move_inv_category_world_to_agent(const LLUUID& object_id, // permissions. // content category has same ID as object itself LLViewerObject* object = gObjectList.findObject(object_id); - if(!object) + if (!object) { LL_INFOS() << "Object not found for drop." << LL_ENDL; return false; @@ -3083,11 +3114,9 @@ bool move_inv_category_world_to_agent(const LLUUID& object_id, // coming from a task. Need to figure out if the person can // move/copy this item. - LLInventoryObject::object_list_t::iterator it = inventory_objects.begin(); - LLInventoryObject::object_list_t::iterator end = inventory_objects.end(); - for ( ; it != end; ++it) + for (LLPointer obj : inventory_objects) { - LLInventoryItem* item = dynamic_cast(it->get()); + LLInventoryItem* item = dynamic_cast(obj.get()); if (!item) { LL_WARNS() << "Invalid inventory item for drop" << LL_ENDL; @@ -3097,13 +3126,13 @@ bool move_inv_category_world_to_agent(const LLUUID& object_id, // coming from a task. Need to figure out if the person can // move/copy this item. LLPermissions perm(item->getPermissions()); - if((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) + if ((perm.allowCopyBy(gAgent.getID(), gAgent.getGroupID()) && perm.allowTransferTo(gAgent.getID()))) // || gAgent.isGodlike()) { accept = true; } - else if(object->permYouOwner()) + else if (object->permYouOwner()) { // If the object cannot be copied, but the object the // inventory is owned by the agent, then the item can be @@ -3123,22 +3152,21 @@ bool move_inv_category_world_to_agent(const LLUUID& object_id, } } - if(drop && accept) + if (drop && accept) { - it = inventory_objects.begin(); std::shared_ptr move_inv(new LLMoveInv); move_inv->mObjectID = object_id; move_inv->mCategoryID = category_id; move_inv->mCallback = callback; move_inv->mUserData = user_data; - for ( ; it != end; ++it) + for (LLPointer obj : inventory_objects) { - two_uuids_t two(category_id, (*it)->getUUID()); + two_uuids_t two(category_id, obj->getUUID()); move_inv->mMoveList.push_back(two); } - if(is_move) + if (is_move) { // Callback called from within here. warn_move_inventory(object, move_inv); @@ -3156,13 +3184,13 @@ bool move_inv_category_world_to_agent(const LLUUID& object_id, void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) { // Bail out immediately if no descendents - if( mComplete.empty() ) + if (mComplete.empty()) { LL_WARNS() << "LLRightClickInventoryFetchDescendentsObserver::done with empty mCompleteFolders" << LL_ENDL; if (clear_observer) { - gInventory.removeObserver(this); - delete this; + gInventory.removeObserver(this); + delete this; } return; } @@ -3186,13 +3214,13 @@ void LLRightClickInventoryFetchDescendentsObserver::execute(bool clear_observer) gInventory.getDirectDescendentsOf(*current_folder, cat_array, item_array); size_t item_count(0); - if( item_array ) + if (item_array) { item_count = item_array->size(); } size_t cat_count(0); - if( cat_array ) + if (cat_array) { cat_count = cat_array->size(); } @@ -3291,20 +3319,16 @@ protected: }; - void LLInventoryCopyAndWearObserver::changed(U32 mask) { - if((mask & (LLInventoryObserver::ADD)) != 0) + if ((mask & (LLInventoryObserver::ADD)) != 0) { if (!mFolderAdded) { const std::set& changed_items = gInventory.getChangedIDs(); - - std::set::const_iterator id_it = changed_items.begin(); - std::set::const_iterator id_end = changed_items.end(); - for (;id_it != id_end; ++id_it) + for (const LLUUID& item_id : changed_items) { - if ((*id_it) == mCatID) + if (item_id == mCatID) { mFolderAdded = true; break; @@ -3322,8 +3346,7 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) } else { - if (category->getDescendentCount() == - mContentsCount) + if (category->getDescendentCount() == mContentsCount) { gInventory.removeObserver(this); LLAppearanceMgr::instance().wearInventoryCategory(category, false, !mReplace); @@ -3335,8 +3358,6 @@ void LLInventoryCopyAndWearObserver::changed(U32 mask) } } - - void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) { if ("open" == action) @@ -3429,19 +3450,19 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLMarketplaceValidator::getInstance()->validateMarketplaceListings( version_folder_id, [this](bool result) - { - // todo: might need to ensure bridge/mUUID exists or this will cause crashes - if (!result) { - LLSD subs; - subs["[ERROR_CODE]"] = mMessage; - LLNotificationsUtil::add("MerchantListingFailed", subs); - } - else - { - LLMarketplaceData::instance().activateListing(mUUID, true); - } - }, + // todo: might need to ensure bridge/mUUID exists or this will cause crashes + if (!result) + { + LLSD subs; + subs["[ERROR_CODE]"] = mMessage; + LLNotificationsUtil::add("MerchantListingFailed", subs); + } + else + { + LLMarketplaceData::instance().activateListing(mUUID, true); + } + }, boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2, _3) ); } @@ -3456,19 +3477,19 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLMarketplaceValidator::getInstance()->validateMarketplaceListings( mUUID, [this](bool result) - { - if (!result) { - LLSD subs; - subs["[ERROR_CODE]"] = mMessage; - LLNotificationsUtil::add("MerchantFolderActivationFailed", subs); - } - else - { - LLInventoryCategory* category = gInventory.getCategory(mUUID); - LLMarketplaceData::instance().setVersionFolder(category->getParentUUID(), mUUID); - } - }, + if (!result) + { + LLSD subs; + subs["[ERROR_CODE]"] = mMessage; + LLNotificationsUtil::add("MerchantFolderActivationFailed", subs); + } + else + { + LLInventoryCategory* category = gInventory.getCategory(mUUID); + LLMarketplaceData::instance().setVersionFolder(category->getParentUUID(), mUUID); + } + }, boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2, _3), false, 2); @@ -3500,35 +3521,35 @@ void LLFolderBridge::performAction(LLInventoryModel* model, std::string action) LLMarketplaceValidator::getInstance()->validateMarketplaceListings( mUUID, [this](bool result) - { - if (!result) { - mMessage = ""; - - LLMarketplaceValidator::getInstance()->validateMarketplaceListings( - mUUID, - [this](bool result) + if (!result) { - if (result) - { - LLNotificationsUtil::add("MerchantForceValidateListing"); - LLMarketplaceData::instance().createListing(mUUID); - } - else + mMessage = ""; + + LLMarketplaceValidator::getInstance()->validateMarketplaceListings( + mUUID, + [this](bool result) { - LLSD subs; - subs["[ERROR_CODE]"] = mMessage; - LLNotificationsUtil::add("MerchantListingFailed", subs); - } - }, - boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2, _3), - true); - } - else - { - LLMarketplaceData::instance().createListing(mUUID); - } - }, + if (result) + { + LLNotificationsUtil::add("MerchantForceValidateListing"); + LLMarketplaceData::instance().createListing(mUUID); + } + else + { + LLSD subs; + subs["[ERROR_CODE]"] = mMessage; + LLNotificationsUtil::add("MerchantListingFailed", subs); + } + }, + boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2, _3), + true); + } + else + { + LLMarketplaceData::instance().createListing(mUUID); + } + }, boost::bind(&LLFolderBridge::gatherMessage, this, _1, _2, _3), false); @@ -3607,7 +3628,7 @@ void LLFolderBridge::copyOutfitToClipboard() gInventory.getDirectDescendentsOf(mUUID, cat_array, item_array); size_t item_count(0); - if( item_array ) + if (item_array) { item_count = item_array->size(); } @@ -3699,8 +3720,7 @@ void LLFolderBridge::restoreItem() LLFolderType::EType LLFolderBridge::getPreferredType() const { LLFolderType::EType preferred_type = LLFolderType::FT_NONE; - LLViewerInventoryCategory* cat = getCategory(); - if(cat) + if (LLViewerInventoryCategory* cat = getCategory()) { preferred_type = cat->getPreferredType(); } @@ -3742,7 +3762,6 @@ LLUIImagePtr LLFolderBridge::getIconOverlay() const bool LLFolderBridge::renameItem(const std::string& new_name) { - LLScrollOnRenameObserver *observer = new LLScrollOnRenameObserver(mUUID, mRoot); gInventory.addObserver(observer); @@ -3755,7 +3774,7 @@ bool LLFolderBridge::renameItem(const std::string& new_name) bool LLFolderBridge::removeItem() { - if(!isItemRemovable()) + if (!isItemRemovable()) { return false; } @@ -3771,7 +3790,6 @@ bool LLFolderBridge::removeItem() return true; } - bool LLFolderBridge::removeSystemFolder() { const LLViewerInventoryCategory *cat = getCategory(); diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp index e3d4645701..5c0905af3c 100644 --- a/indra/newview/llinventoryfilter.cpp +++ b/indra/newview/llinventoryfilter.cpp @@ -103,7 +103,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) } std::string desc = listener->getSearchableCreatorName(); - switch(mSearchType) + switch (mSearchType) { case SEARCHTYPE_CREATOR: desc = listener->getSearchableCreatorName(); @@ -129,7 +129,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) boost::char_separator sep(" "); tokenizer tokens(desc, sep); - for (auto token_iter : tokens) + for (const auto& token_iter : tokens) { if (token_iter == mExactToken) { @@ -138,9 +138,9 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) } } } - else if ((mFilterTokens.size() > 0) && (mSearchType == SEARCHTYPE_NAME)) + else if (!mFilterTokens.empty() && mSearchType == SEARCHTYPE_NAME) { - for (auto token_iter : mFilterTokens) + for (const auto& token_iter : mFilterTokens) { if (desc.find(token_iter) == std::string::npos) { @@ -150,7 +150,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) } else { - passed = (mFilterSubString.size() ? desc.find(mFilterSubString) != std::string::npos : true); + passed = checkAgainstFilterSubString(desc); } passed = passed && checkAgainstFilterType(listener); @@ -166,7 +166,7 @@ bool LLInventoryFilter::check(const LLFolderViewModelItem* item) bool LLInventoryFilter::check(const LLInventoryItem* item) { - const bool passed_string = (mFilterSubString.size() ? item->getName().find(mFilterSubString) != std::string::npos : true); + const bool passed_string = checkAgainstFilterSubString(item->getName()); const bool passed_filtertype = checkAgainstFilterType(item); const bool passed_permissions = checkAgainstPermissions(item); @@ -295,9 +295,19 @@ bool LLInventoryFilter::checkFolder(const LLUUID& folder_id) const return true; } +bool LLInventoryFilter::checkAgainstFilterSubString(const std::string& desc) const +{ + if (mFilterSubString.empty()) + return true; + + size_t pos = desc.find(mFilterSubString); + return pos != std::string::npos; +} + bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInventory* listener) const { - if (!listener) return false; + if (!listener) + return false; LLInventoryType::EType object_type = listener->getInventoryType(); const LLUUID object_id = listener->getUUID(); @@ -338,7 +348,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent } } - if(filterTypes & FILTERTYPE_WORN) + if (filterTypes & FILTERTYPE_WORN) { if (!get_is_item_worn(object_id)) { @@ -351,7 +361,8 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent // Pass if this item is the target UUID or if it links to the target UUID if (filterTypes & FILTERTYPE_UUID) { - if (!object) return false; + if (!object) + return false; if (object->getLinkedUUID() != mFilterOps.mFilterUUID) return false; @@ -363,7 +374,7 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLFolderViewModelItemInvent if (filterTypes & FILTERTYPE_DATE) { const U16 HOURS_TO_SECONDS = 3600; - time_t earliest = time_corrected() - mFilterOps.mHoursAgo * HOURS_TO_SECONDS; + time_t earliest = time_corrected() - (U64)mFilterOps.mHoursAgo * HOURS_TO_SECONDS; if (mFilterOps.mMinDate > time_min() && mFilterOps.mMinDate < earliest) { @@ -494,7 +505,8 @@ bool LLInventoryFilter::checkAgainstFilterType(const LLInventoryItem* item) cons // Pass if this item is the target UUID or if it links to the target UUID if (filterTypes & FILTERTYPE_UUID) { - if (!item) return false; + if (!item) + return false; if (item->getLinkedUUID() != mFilterOps.mFilterUUID) return false; @@ -540,7 +552,8 @@ bool LLInventoryFilter::checkAgainstClipboard(const LLUUID& object_id) const bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewModelItemInventory* listener) const { - if (!listener) return false; + if (!listener) + return false; PermissionMask perm = listener->getPermissionMask(); const LLInvFVBridge *bridge = dynamic_cast(listener); @@ -556,7 +569,8 @@ bool LLInventoryFilter::checkAgainstPermissions(const LLFolderViewModelItemInven bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) const { - if (!item) return false; + if (!item) + return false; LLPointer new_item = new LLViewerInventoryItem(item); PermissionMask perm = new_item->getPermissionMask(); @@ -567,11 +581,13 @@ bool LLInventoryFilter::checkAgainstPermissions(const LLInventoryItem* item) con bool LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewModelItemInventory* listener) const { - if (!listener) return true; + if (!listener) + return true; const LLUUID object_id = listener->getUUID(); const LLInventoryObject *object = gInventory.getObject(object_id); - if (!object) return true; + if (!object) + return true; const bool is_link = object->getIsLinkType(); if (is_link && (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS)) @@ -584,7 +600,8 @@ bool LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewModelItemInven bool LLInventoryFilter::checkAgainstFilterThumbnails(const LLUUID& object_id) const { const LLInventoryObject *object = gInventory.getObject(object_id); - if (!object) return true; + if (!object) + return true; const bool is_thumbnail = object->getThumbnailUUID().notNull(); if (is_thumbnail && (mFilterOps.mFilterThumbnails == FILTER_EXCLUDE_THUMBNAILS)) @@ -596,16 +613,20 @@ bool LLInventoryFilter::checkAgainstFilterThumbnails(const LLUUID& object_id) co bool LLInventoryFilter::checkAgainstCreator(const LLFolderViewModelItemInventory* listener) const { - if (!listener) return true; + if (!listener) + return true; + const bool is_folder = listener->getInventoryType() == LLInventoryType::IT_CATEGORY; switch (mFilterOps.mFilterCreatorType) { case FILTERCREATOR_SELF: - if(is_folder) return false; - return (listener->getSearchableCreatorName() == mUsername); + if (is_folder) + return false; + return listener->getSearchableCreatorName() == mUsername; case FILTERCREATOR_OTHERS: - if(is_folder) return false; - return (listener->getSearchableCreatorName() != mUsername); + if (is_folder) + return false; + return listener->getSearchableCreatorName() != mUsername; case FILTERCREATOR_ALL: default: return true; @@ -618,7 +639,8 @@ bool LLInventoryFilter::checkAgainstSearchVisibility(const LLFolderViewModelItem const LLUUID object_id = listener->getUUID(); const LLInventoryObject *object = gInventory.getObject(object_id); - if (!object) return true; + if (!object) + return true; const bool is_link = object->getIsLinkType(); if (is_link && ((mFilterOps.mSearchVisibility & VISIBILITY_LINKS) == 0)) @@ -647,10 +669,8 @@ std::string::size_type LLInventoryFilter::getStringMatchOffset(LLFolderViewModel { return mFilterSubString.size() ? item->getSearchableName().find(mFilterSubString) : std::string::npos; } - else - { - return std::string::npos; - } + + return std::string::npos; } bool LLInventoryFilter::isDefault() const @@ -725,7 +745,7 @@ void LLInventoryFilter::updateFilterTypes(U64 types, U64& current_types) void LLInventoryFilter::setSearchType(ESearchType type) { - if(mSearchType != type) + if (mSearchType != type) { mSearchType = type; setModified(); @@ -918,6 +938,7 @@ void LLInventoryFilter::setFilterUUID(const LLUUID& object_id) { setModified(FILTER_RESTART); } + mFilterOps.mFilterUUID = object_id; mFilterOps.mFilterTypes = FILTERTYPE_UUID; } @@ -931,7 +952,6 @@ void LLInventoryFilter::setFilterSubString(const std::string& string) if (mFilterSubString != filter_sub_string_new) { - mFilterTokens.clear(); if (filter_sub_string_new.find_first_of("+") != std::string::npos) { @@ -1243,7 +1263,7 @@ void LLInventoryFilter::setFindAllLinksMode(const std::string &search_name, cons { // Save a copy of settings so that we will be able to restore it later // but make sure we are not searching for links already - if(mFilterOps.mFilterLinks != FILTERLINK_ONLY_LINKS) + if (mFilterOps.mFilterLinks != FILTERLINK_ONLY_LINKS) { mBackupFilterOps = mFilterOps; } @@ -1283,7 +1303,7 @@ void LLInventoryFilter::setModified(EFilterModified behavior) } // if not keeping current filter results, update last valid as well - switch(mFilterModified) + switch (mFilterModified) { case FILTER_RESTART: mFirstRequiredGeneration = mCurrentGeneration; @@ -1499,11 +1519,11 @@ const std::string& LLInventoryFilter::getFilterText() { mFilterText += LLTrans::getString("Since Logoff"); } + return mFilterText; } - -LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& other ) +LLInventoryFilter& LLInventoryFilter::operator =(const LLInventoryFilter& other) { setFilterObjectTypes(other.getFilterObjectTypes()); setDateRange(other.getMinDate(), other.getMaxDate()); @@ -1516,7 +1536,6 @@ LLInventoryFilter& LLInventoryFilter::operator=( const LLInventoryFilter& othe return *this; } - void LLInventoryFilter::toParams(Params& params) const { params.filter_ops.types = (U32)getFilterObjectTypes(); @@ -1686,14 +1705,13 @@ std::string LLInventoryFilter::getEmptyLookupMessage(bool is_empty_folder) const return LLTrans::getString(mEmptyLookupMessage, args); } - } bool LLInventoryFilter::areDateLimitsSet() { - return mFilterOps.mMinDate != time_min() - || mFilterOps.mMaxDate != time_max() - || mFilterOps.mHoursAgo != 0; + return mFilterOps.mMinDate != time_min() + || mFilterOps.mMaxDate != time_max() + || mFilterOps.mHoursAgo != 0; } bool LLInventoryFilter::showAllResults() const @@ -1701,8 +1719,6 @@ bool LLInventoryFilter::showAllResults() const return hasFilterString() && !mSingleFolderMode; } - - bool LLInventoryFilter::FilterOps::DateRange::validateBlock( bool emit_errors /*= true*/ ) const { bool valid = LLInitParam::Block::validateBlock(emit_errors); diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h index 7203c6f743..7e64a03e73 100644 --- a/indra/newview/llinventoryfilter.h +++ b/indra/newview/llinventoryfilter.h @@ -45,7 +45,8 @@ public: SHOW_NO_FOLDERS }; - enum EFilterType { + enum EFilterType + { FILTERTYPE_NONE = 0, FILTERTYPE_OBJECT = 0x1 << 0, // normal default search-by-object-type FILTERTYPE_CATEGORY = 0x1 << 1, // search by folder type @@ -275,9 +276,9 @@ public: // +-------------------------------------------------------------------+ // + Execution And Results // +-------------------------------------------------------------------+ - bool check(const LLFolderViewModelItem* listener); + bool check(const LLFolderViewModelItem* item); bool check(const LLInventoryItem* item); - bool checkFolder(const LLFolderViewModelItem* listener) const; + bool checkFolder(const LLFolderViewModelItem* item) const; bool checkFolder(const LLUUID& folder_id) const; bool showAllResults() const; @@ -341,6 +342,7 @@ public: private: bool areDateLimitsSet(); + bool checkAgainstFilterSubString(const std::string& desc) const; bool checkAgainstFilterType(const class LLFolderViewModelItemInventory* listener) const; bool checkAgainstFilterType(const LLInventoryItem* item) const; bool checkAgainstPermissions(const class LLFolderViewModelItemInventory* listener) const; diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 57c0d57190..dadd0590a9 100644 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -2400,18 +2400,16 @@ void ungroup_folder_items(const LLUUID& folder_id) LLInventoryModel::cat_array_t cats = *cat_array; LLInventoryModel::item_array_t items = *item_array; - for (LLInventoryModel::cat_array_t::const_iterator cat_iter = cats.begin(); cat_iter != cats.end(); ++cat_iter) + for (const LLPointer& cat : cats) { - LLViewerInventoryCategory* cat = *cat_iter; if (cat) { gInventory.changeCategoryParent(cat, new_cat_uuid, false); } } - for (LLInventoryModel::item_array_t::const_iterator item_iter = items.begin(); item_iter != items.end(); ++item_iter) + for (const LLPointer& item : items) { - LLViewerInventoryItem* item = *item_iter; - if(item) + if (item) { gInventory.changeItemParent(item, new_cat_uuid, false); } @@ -2424,8 +2422,7 @@ std::string get_searchable_description(LLInventoryModel* model, const LLUUID& it { if (model) { - const LLInventoryItem *item = model->getItem(item_id); - if(item) + if (const LLInventoryItem* item = model->getItem(item_id)) { std::string desc = item->getDescription(); LLStringUtil::toUpper(desc); @@ -2439,8 +2436,7 @@ std::string get_searchable_creator_name(LLInventoryModel* model, const LLUUID& i { if (model) { - const LLInventoryItem *item = model->getItem(item_id); - if(item) + if (const LLInventoryItem* item = model->getItem(item_id)) { LLAvatarName av_name; if (LLAvatarNameCache::get(item->getCreatorUUID(), &av_name)) diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 46d1e822de..c4f93cee98 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -2649,7 +2649,8 @@ bool LLInventoryGallery::hasDescendents(const LLUUID& cat_id) bool LLInventoryGallery::checkAgainstFilterType(const LLUUID& object_id) { const LLInventoryObject *object = gInventory.getObject(object_id); - if(!object) return false; + if (!object) + return false; LLInventoryType::EType object_type = LLInventoryType::IT_CATEGORY; LLInventoryItem* inv_item = gInventory.getItem(object_id); @@ -2657,8 +2658,8 @@ bool LLInventoryGallery::checkAgainstFilterType(const LLUUID& object_id) { object_type = inv_item->getInventoryType(); } - const U32 filterTypes = (U32)mFilter->getFilterTypes(); + const U32 filterTypes = (U32)mFilter->getFilterTypes(); if ((filterTypes & LLInventoryFilter::FILTERTYPE_OBJECT) && inv_item) { switch (object_type) @@ -2726,7 +2727,7 @@ bool LLInventoryGallery::hasVisibleItems() void LLInventoryGallery::handleModifiedFilter() { - if(mFilter->isModified()) + if (mFilter->isModified()) { reArrangeRows(); } @@ -2737,7 +2738,7 @@ void LLInventoryGallery::setSortOrder(U32 order, bool update) bool dirty = (mSortOrder != order); mSortOrder = order; - if(update && dirty) + if (update && dirty) { mNeedsArrange = true; gIdleCallbacks.addFunction(onIdle, (void*)this); @@ -2789,11 +2790,11 @@ void LLInventoryGalleryItem::setType(LLAssetType::EType type, LLInventoryType::E mIsLink = is_link; std::string icon_name = LLInventoryIcon::getIconName(mType, inventory_type, flags); - if(mIsFolder) + if (mIsFolder) { mSortGroup = SG_NORMAL_FOLDER; LLUUID folder_id = mUUID; - if(mIsLink) + if (mIsLink) { LLInventoryObject* obj = gInventory.getObject(mUUID); if (obj) @@ -2820,7 +2821,7 @@ void LLInventoryGalleryItem::setType(LLAssetType::EType type, LLInventoryType::E else { const LLInventoryItem *item = gInventory.getItem(mUUID); - if(item && (LLAssetType::AT_CALLINGCARD != item->getType()) && !mIsLink) + if (item && (LLAssetType::AT_CALLINGCARD != item->getType()) && !mIsLink) { std::string delim(" --"); bool copy = item->getPermissions().allowCopyBy(gAgent.getID()); @@ -2851,7 +2852,7 @@ void LLInventoryGalleryItem::setType(LLAssetType::EType type, LLInventoryType::E void LLInventoryGalleryItem::setThumbnail(LLUUID id) { mDefaultImage = id.isNull(); - if(mDefaultImage) + if (mDefaultImage) { mThumbnailCtrl->clearTexture(); } @@ -2900,10 +2901,10 @@ void LLInventoryGalleryItem::setSelected(bool value) mSelected = value; mTextBgPanel->setBackgroundVisible(value); - if(mSelected) + if (mSelected) { LLViewerInventoryItem* item = gInventory.getItem(mUUID); - if(item && !item->isFinished()) + if (item && !item->isFinished()) { LLInventoryModelBackgroundFetch::instance().start(mUUID, false); } @@ -2926,6 +2927,7 @@ bool LLInventoryGalleryItem::handleMouseDown(S32 x, S32 y, MASK mask) { mGallery->changeItemSelection(mUUID, false); } + setFocus(true); mGallery->claimEditHandler(); @@ -2958,7 +2960,7 @@ bool LLInventoryGalleryItem::handleRightMouseDown(S32 x, S32 y, MASK mask) bool LLInventoryGalleryItem::handleMouseUp(S32 x, S32 y, MASK mask) { - if(hasMouseCapture()) + if (hasMouseCapture()) { gFocusMgr.setMouseCapture(NULL); return true; @@ -2968,13 +2970,13 @@ bool LLInventoryGalleryItem::handleMouseUp(S32 x, S32 y, MASK mask) bool LLInventoryGalleryItem::handleHover(S32 x, S32 y, MASK mask) { - if(hasMouseCapture()) + if (hasMouseCapture()) { S32 screen_x; S32 screen_y; localPointToScreen(x, y, &screen_x, &screen_y ); - if(LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y) && mGallery) + if (LLToolDragAndDrop::getInstance()->isOverThreshold(screen_x, screen_y) && mGallery) { mGallery->startDrag(); return LLToolDragAndDrop::getInstance()->handleHover(x, y, mask); @@ -2993,13 +2995,13 @@ bool LLInventoryGalleryItem::handleDoubleClick(S32 x, S32 y, MASK mask) LLHandle handle = mGallery->getHandle(); LLUUID navigate_to = mUUID; doOnIdleOneTime([handle, navigate_to]() - { - LLInventoryGallery* gallery = (LLInventoryGallery*)handle.get(); - if (gallery) - { - gallery->setRootFolder(navigate_to); - } - }); + { + LLInventoryGallery* gallery = (LLInventoryGallery*)handle.get(); + if (gallery) + { + gallery->setRootFolder(navigate_to); + } + }); } else { @@ -3078,7 +3080,7 @@ void LLInventoryGalleryItem::setWorn(bool value) { mWorn = value; - if(mWorn) + if (mWorn) { mWornSuffix = (mType == LLAssetType::AT_GESTURE) ? LLTrans::getString("active") : LLTrans::getString("worn"); } @@ -3092,7 +3094,7 @@ void LLInventoryGalleryItem::setWorn(bool value) LLFontGL* LLInventoryGalleryItem::getTextFont() { - if(mWorn) + if (mWorn) { return LLFontGL::getFontSansSerifSmallBold(); } @@ -3127,12 +3129,10 @@ bool LLInventoryGalleryItem::isFadeItem() void LLThumbnailsObserver::changed(U32 mask) { std::vector deleted_ids; - for (item_map_t::iterator iter = mItemMap.begin(); - iter != mItemMap.end(); - ++iter) + for (item_map_t::value_type& it : mItemMap) { - const LLUUID& obj_id = (*iter).first; - LLItemData& data = (*iter).second; + const LLUUID& obj_id = it.first; + LLItemData& data = it.second; LLInventoryObject* obj = gInventory.getObject(obj_id); if (!obj) @@ -3158,8 +3158,7 @@ void LLThumbnailsObserver::changed(U32 mask) bool LLThumbnailsObserver::addItem(const LLUUID& obj_id, callback_t cb) { - LLInventoryObject* obj = gInventory.getObject(obj_id); - if (obj) + if (LLInventoryObject* obj = gInventory.getObject(obj_id)) { mItemMap.insert(item_map_value_t(obj_id, LLItemData(obj_id, obj->getThumbnailUUID(), cb))); return true; @@ -3190,79 +3189,74 @@ bool LLInventoryGallery::baseHandleDragAndDrop(LLUUID dest_id, bool drop, } bool accepted = false; - switch(cargo_type) - { - case DAD_TEXTURE: - case DAD_SOUND: - case DAD_CALLINGCARD: - case DAD_LANDMARK: - case DAD_SCRIPT: - case DAD_CLOTHING: - case DAD_OBJECT: - case DAD_NOTECARD: - case DAD_BODYPART: - case DAD_ANIMATION: - case DAD_GESTURE: - case DAD_MESH: - case DAD_SETTINGS: + switch (cargo_type) + { + case DAD_TEXTURE: + case DAD_SOUND: + case DAD_CALLINGCARD: + case DAD_LANDMARK: + case DAD_SCRIPT: + case DAD_CLOTHING: + case DAD_OBJECT: + case DAD_NOTECARD: + case DAD_BODYPART: + case DAD_ANIMATION: + case DAD_GESTURE: + case DAD_MESH: + case DAD_SETTINGS: + accepted = dragItemIntoFolder(dest_id, inv_item, drop, tooltip_msg, true); + if (accepted && drop) + { + // Don't select immediately, wait for item to arrive + mItemsToSelect.push_back(inv_item->getUUID()); + } + break; + case DAD_LINK: + // DAD_LINK type might mean one of two asset types: AT_LINK or AT_LINK_FOLDER. + // If we have an item of AT_LINK_FOLDER type we should process the linked + // category being dragged or dropped into folder. + if (inv_item && LLAssetType::AT_LINK_FOLDER == inv_item->getActualType()) + { + LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID()); + if (linked_category) + { + accepted = dragCategoryIntoFolder(dest_id, (LLInventoryCategory*)linked_category, drop, tooltip_msg, true); + } + } + else + { accepted = dragItemIntoFolder(dest_id, inv_item, drop, tooltip_msg, true); + } + if (accepted && drop && inv_item) + { + mItemsToSelect.push_back(inv_item->getUUID()); + } + break; + case DAD_CATEGORY: + if (LLFriendCardsManager::instance().isAnyFriendCategory(dest_id)) + { + accepted = false; + } + else + { + LLInventoryCategory* cat_ptr = (LLInventoryCategory*)cargo_data; + accepted = dragCategoryIntoFolder(dest_id, cat_ptr, drop, tooltip_msg, false); if (accepted && drop) { - // Don't select immediately, wait for item to arrive - mItemsToSelect.push_back(inv_item->getUUID()); - } - break; - case DAD_LINK: - // DAD_LINK type might mean one of two asset types: AT_LINK or AT_LINK_FOLDER. - // If we have an item of AT_LINK_FOLDER type we should process the linked - // category being dragged or dropped into folder. - if (inv_item && LLAssetType::AT_LINK_FOLDER == inv_item->getActualType()) - { - LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID()); - if (linked_category) - { - accepted = dragCategoryIntoFolder(dest_id, (LLInventoryCategory*)linked_category, drop, tooltip_msg, true); - } - } - else - { - accepted = dragItemIntoFolder(dest_id, inv_item, drop, tooltip_msg, true); - } - if (accepted && drop && inv_item) - { - mItemsToSelect.push_back(inv_item->getUUID()); - } - break; - case DAD_CATEGORY: - if (LLFriendCardsManager::instance().isAnyFriendCategory(dest_id)) - { - accepted = false; - } - else - { - LLInventoryCategory* cat_ptr = (LLInventoryCategory*)cargo_data; - accepted = dragCategoryIntoFolder(dest_id, cat_ptr, drop, tooltip_msg, false); - if (accepted && drop) - { - mItemsToSelect.push_back(cat_ptr->getUUID()); - } + mItemsToSelect.push_back(cat_ptr->getUUID()); } - break; - case DAD_ROOT_CATEGORY: - case DAD_NONE: - break; - default: - LL_WARNS() << "Unhandled cargo type for drag&drop " << cargo_type << LL_ENDL; - break; - } - if (accepted) - { - *accept = ACCEPT_YES_MULTI; - } - else - { - *accept = ACCEPT_NO; + } + break; + case DAD_ROOT_CATEGORY: + case DAD_NONE: + break; + default: + LL_WARNS() << "Unhandled cargo type for drag&drop " << cargo_type << LL_ENDL; + break; } + + *accept = accepted ? ACCEPT_YES_MULTI : ACCEPT_NO; + return accepted; } @@ -3274,16 +3268,20 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, { return false; } - LLInventoryModel* model = &gInventory; - if (!model || !inv_item) return false; + LLInventoryModel* model = &gInventory; + if (!model || !inv_item) + return false; // cannot drag into library - if((gInventory.getRootFolderID() != folder_id) && !model->isObjectDescendentOf(folder_id, gInventory.getRootFolderID())) + if (gInventory.getRootFolderID() != folder_id && + !model->isObjectDescendentOf(folder_id, gInventory.getRootFolderID())) { return false; } - if (!isAgentAvatarValid()) return false; + + if (!isAgentAvatarValid()) + return false; const LLUUID ¤t_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT); const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE); @@ -3302,7 +3300,7 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource(); bool accept = false; LLViewerObject* object = NULL; - if(LLToolDragAndDrop::SOURCE_AGENT == source) + if (LLToolDragAndDrop::SOURCE_AGENT == source) { const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH); @@ -3317,21 +3315,24 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, switch (inv_item->getActualType()) { - case LLAssetType::AT_CATEGORY: - is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); - break; - default: - break; + case LLAssetType::AT_CATEGORY: + is_movable = !LLFolderType::lookupIsProtectedType(((LLInventoryCategory*)inv_item)->getPreferredType()); + break; + default: + break; } + // Can't explicitly drag things out of the COF. if (move_is_outof_current_outfit) { is_movable = false; } + if (move_is_into_trash) { is_movable &= inv_item->getIsLinkType() || !get_is_item_worn(inv_item->getUUID()); } + if (is_movable) { // Don't allow creating duplicates in the Calling Card/Friends @@ -3540,7 +3541,7 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, move_inv->mMoveList.push_back(item_pair); move_inv->mCallback = NULL; move_inv->mUserData = NULL; - if(is_move) + if (is_move) { warn_move_inventory(object, move_inv); } @@ -3555,7 +3556,7 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, } } } - else if(LLToolDragAndDrop::SOURCE_NOTECARD == source) + else if (LLToolDragAndDrop::SOURCE_NOTECARD == source) { if (move_is_into_marketplacelistings) { @@ -3582,7 +3583,7 @@ bool dragItemIntoFolder(LLUUID folder_id, LLInventoryItem* inv_item, bool drop, inv_item); } } - else if(LLToolDragAndDrop::SOURCE_LIBRARY == source) + else if (LLToolDragAndDrop::SOURCE_LIBRARY == source) { LLViewerInventoryItem* item = (LLViewerInventoryItem*)inv_item; if(item && item->isFinished()) @@ -3665,11 +3666,14 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, return false; } - if (!inv_cat) return false; // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL + if (!inv_cat) // shouldn't happen, but in case item is incorrectly parented in which case inv_cat will be NULL + return false; + + if (!isAgentAvatarValid()) + return false; - if (!isAgentAvatarValid()) return false; // cannot drag into library - if((gInventory.getRootFolderID() != dest_id) && !model->isObjectDescendentOf(dest_id, gInventory.getRootFolderID())) + if ((gInventory.getRootFolderID() != dest_id) && !model->isObjectDescendentOf(dest_id, gInventory.getRootFolderID())) { return false; } @@ -3758,7 +3762,7 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, is_movable = false; } } - else if(dest_cat && dest_cat->getPreferredType() == LLFolderType::FT_NONE) + else if (dest_cat && dest_cat->getPreferredType() == LLFolderType::FT_NONE) { is_movable = ((inv_cat->getPreferredType() == LLFolderType::FT_NONE) || (inv_cat->getPreferredType() == LLFolderType::FT_OUTFIT)); } @@ -3767,7 +3771,7 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, is_movable = false; } } - if(is_movable && move_is_into_current_outfit && is_link) + if (is_movable && move_is_into_current_outfit && is_link) { is_movable = false; } @@ -3795,7 +3799,7 @@ bool dragCategoryIntoFolder(LLUUID dest_id, LLInventoryCategory* inv_cat, for (S32 i=0; i < descendent_categories.size(); ++i) { LLInventoryCategory* category = descendent_categories[i]; - if(LLFolderType::lookupIsProtectedType(category->getPreferredType())) + if (LLFolderType::lookupIsProtectedType(category->getPreferredType())) { // Can't move "special folders" (e.g. Textures Folder). is_movable = false; @@ -4000,7 +4004,6 @@ void outfitFolderCreatedCallback(LLUUID cat_source_id, LLUUID cat_dest_id) LLInventoryObject::const_object_list_t link_array; - LLInventoryModel::item_array_t::iterator iter = items->begin(); LLInventoryModel::item_array_t::iterator end = items->end(); while (iter!=end) @@ -4038,4 +4041,3 @@ void dropToMyOutfits(LLInventoryCategory* inv_cat) inventory_func_type func = boost::bind(&outfitFolderCreatedCallback, inv_cat->getUUID(), _1); gInventory.createNewCategory(dest_id, LLFolderType::FT_OUTFIT, inv_cat->getName(), func, inv_cat->getThumbnailUUID()); } - diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 9e4f4c0adc..e4d1010231 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -414,8 +414,10 @@ void LLInventoryPanel::setFilterTypes(U64 types, LLInventoryFilter::EFilterType { getFilter().setFilterObjectTypes(types); } - if (filter_type == LLInventoryFilter::FILTERTYPE_CATEGORY) + else if (filter_type == LLInventoryFilter::FILTERTYPE_CATEGORY) + { getFilter().setFilterCategoryTypes(types); + } } void LLInventoryPanel::setFilterWorn() diff --git a/indra/newview/llpanelcontents.cpp b/indra/newview/llpanelcontents.cpp index 7b78ad2934..dbf56c2b6d 100644 --- a/indra/newview/llpanelcontents.cpp +++ b/indra/newview/llpanelcontents.cpp @@ -31,6 +31,7 @@ // linden library includes #include "llerror.h" +#include "llfiltereditor.h" #include "llfloaterreg.h" #include "llfontgl.h" #include "llinventorydefines.h" @@ -83,8 +84,14 @@ bool LLPanelContents::postBuild() childSetAction("button new script",&LLPanelContents::onClickNewScript, this); childSetAction("button permissions",&LLPanelContents::onClickPermissions, this); + mFilterEditor = getChild("contents_filter"); + mFilterEditor->setCommitCallback([&](LLUICtrl*, const LLSD&) { onFilterEdit(); }); + mPanelInventoryObject = getChild("contents_inventory"); + // update permission filter once UI is fully initialized + mSavedFolderState.setApply(false); + return true; } @@ -129,6 +136,38 @@ void LLPanelContents::getState(LLViewerObject *objectp ) mPanelInventoryObject->setEnabled(!objectp->isPermanentEnforced()); } +void LLPanelContents::onFilterEdit() +{ + const std::string& filter_substring = mFilterEditor->getText(); + if (filter_substring.empty()) + { + if (mPanelInventoryObject->getFilter().getFilterSubString().empty()) + { + // The current filter and the new filter are empty, nothing to do + return; + } + + mSavedFolderState.setApply(true); + mPanelInventoryObject->getRootFolder()->applyFunctorRecursively(mSavedFolderState); + + // Add a folder with the current item to the list of previously opened folders + LLOpenFoldersWithSelection opener; + mPanelInventoryObject->getRootFolder()->applyFunctorRecursively(opener); + mPanelInventoryObject->getRootFolder()->scrollToShowSelection(); + } + else if (mPanelInventoryObject->getFilter().getFilterSubString().empty()) + { + // The first letter in search term, save existing folder open state + if (!mPanelInventoryObject->getFilter().isNotDefault()) + { + mSavedFolderState.setApply(false); + mPanelInventoryObject->getRootFolder()->applyFunctorRecursively(mSavedFolderState); + } + } + + mPanelInventoryObject->getFilter().setFilterSubString(filter_substring); +} + void LLPanelContents::refresh() { const bool children_ok = true; @@ -149,7 +188,6 @@ void LLPanelContents::clearContents() } } - // // Static functions // @@ -199,7 +237,6 @@ void LLPanelContents::onClickNewScript(void *userdata) } } - // static void LLPanelContents::onClickPermissions(void *userdata) { diff --git a/indra/newview/llpanelcontents.h b/indra/newview/llpanelcontents.h index 748bb76a82..bb6308e8b8 100644 --- a/indra/newview/llpanelcontents.h +++ b/indra/newview/llpanelcontents.h @@ -27,12 +27,13 @@ #ifndef LL_LLPANELCONTENTS_H #define LL_LLPANELCONTENTS_H -#include "v3math.h" -#include "llpanel.h" +#include "llfolderview.h" #include "llinventory.h" +#include "llpanel.h" #include "lluuid.h" #include "llviewerobject.h" #include "llvoinventorylistener.h" +#include "v3math.h" class LLButton; class LLPanelObjectInventory; @@ -66,9 +67,12 @@ public: static const char* PERMS_ANYONE_CONTROL_KEY; protected: - void getState(LLViewerObject *object); + void getState(LLViewerObject *object); + void onFilterEdit(); public: + class LLFilterEditor* mFilterEditor; + LLSaveFolderState mSavedFolderState; LLPanelObjectInventory* mPanelInventoryObject; }; diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 143873f168..377af4384a 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -908,12 +908,12 @@ bool LLPanelMainInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EAcceptance* accept, std::string& tooltip_msg) { - // Check to see if we are auto scrolling from the last frame - LLInventoryPanel* panel = (LLInventoryPanel*)this->getActivePanel(); - bool needsToScroll = panel->getScrollableContainer()->canAutoScroll(x, y); - if(mFilterTabs) + if (mFilterTabs) { - if(needsToScroll) + // Check to see if we are auto scrolling from the last frame + LLInventoryPanel* panel = (LLInventoryPanel*)this->getActivePanel(); + bool needsToScroll = panel->getScrollableContainer()->canAutoScroll(x, y); + if (needsToScroll) { mFilterTabs->startDragAndDropDelayTimer(); } @@ -930,9 +930,9 @@ void LLPanelMainInventory::changed(U32) updateItemcountText(); } -void LLPanelMainInventory::setFocusFilterEditor() +void LLPanelMainInventory::setFocusOnFilterEditor() { - if(mFilterEditor) + if (mFilterEditor) { mFilterEditor->setFocus(true); } @@ -1259,7 +1259,6 @@ void LLFloaterInventoryFinder::draw() filtered_by_all_types = false; } - if (!getChild("check_calling_card")->getValue()) { filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD); @@ -1279,8 +1278,6 @@ void LLFloaterInventoryFinder::draw() } if (!getChild("check_landmark")->getValue()) - - { filter &= ~(0x1 << LLInventoryType::IT_LANDMARK); filtered_by_all_types = false; @@ -1341,9 +1338,8 @@ void LLFloaterInventoryFinder::draw() filter &= ~(0x1 << LLInventoryType::IT_CATEGORY); } - bool is_sf_mode = mPanelMainInventory->isSingleFolderMode(); - if(is_sf_mode && mPanelMainInventory->isGalleryViewMode()) + if (is_sf_mode && mPanelMainInventory->isGalleryViewMode()) { mPanelMainInventory->mCombinationGalleryPanel->getFilter().setShowFolderState(getCheckShowEmpty() ? LLInventoryFilter::SHOW_ALL_FOLDERS : LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); @@ -1351,7 +1347,7 @@ void LLFloaterInventoryFinder::draw() } else { - if(is_sf_mode && mPanelMainInventory->isCombinationViewMode()) + if (is_sf_mode && mPanelMainInventory->isCombinationViewMode()) { mPanelMainInventory->mCombinationGalleryPanel->getFilter().setShowFolderState(getCheckShowEmpty() ? LLInventoryFilter::SHOW_ALL_FOLDERS : LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); @@ -1383,9 +1379,8 @@ void LLFloaterInventoryFinder::draw() } hours += days * 24; - mPanelMainInventory->setFilterTextFromFilter(); - if(is_sf_mode && mPanelMainInventory->isGalleryViewMode()) + if (is_sf_mode && mPanelMainInventory->isGalleryViewMode()) { mPanelMainInventory->mCombinationGalleryPanel->getFilter().setHoursAgo(hours); mPanelMainInventory->mCombinationGalleryPanel->getFilter().setDateRangeLastLogoff(getCheckSinceLogoff()); @@ -1393,7 +1388,7 @@ void LLFloaterInventoryFinder::draw() } else { - if(is_sf_mode && mPanelMainInventory->isCombinationViewMode()) + if (is_sf_mode && mPanelMainInventory->isCombinationViewMode()) { mPanelMainInventory->mCombinationGalleryPanel->getFilter().setHoursAgo(hours); mPanelMainInventory->mCombinationGalleryPanel->getFilter().setDateRangeLastLogoff(getCheckSinceLogoff()); diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 21100cc03c..a78c0c0fad 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -103,7 +103,7 @@ public: void onFilterEdit(const std::string& search_string ); - void setFocusFilterEditor(); + void setFocusOnFilterEditor(); static LLFloaterSidePanelContainer* newWindow(); static void newFolderWindow(LLUUID folder_id = LLUUID(), LLUUID item_to_select = LLUUID()); diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp index d33ccc0216..ef7986603b 100644 --- a/indra/newview/llpanelobjectinventory.cpp +++ b/indra/newview/llpanelobjectinventory.cpp @@ -173,8 +173,7 @@ LLTaskInvFVBridge::LLTaskInvFVBridge( mAssetType(LLAssetType::AT_NONE), mInventoryType(LLInventoryType::IT_NONE) { - const LLInventoryItem *item = findItem(); - if (item) + if (const LLInventoryItem* item = findItem()) { mAssetType = item->getType(); mInventoryType = item->getInventoryType(); @@ -183,15 +182,15 @@ LLTaskInvFVBridge::LLTaskInvFVBridge( LLInventoryObject* LLTaskInvFVBridge::findInvObject() const { - LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); - if (object) + const LLUUID& id = mPanel->getTaskUUID(); + if (LLViewerObject* object = gObjectList.findObject(id)) { return object->getInventoryObject(mUUID); } + return NULL; } - LLInventoryItem* LLTaskInvFVBridge::findItem() const { return dynamic_cast(findInvObject()); @@ -204,27 +203,24 @@ void LLTaskInvFVBridge::showProperties() S32 LLTaskInvFVBridge::getPrice() { - LLInventoryItem* item = findItem(); - if(item) + if (LLInventoryItem* item = findItem()) { return item->getSaleInfo().getSalePrice(); } - else - { - return -1; - } + + return -1; } +// virtual const std::string& LLTaskInvFVBridge::getName() const { return mName; } +// virtual const std::string& LLTaskInvFVBridge::getDisplayName() const { - LLInventoryItem* item = findItem(); - - if(item) + if (LLInventoryItem* item = findItem()) { mDisplayName.assign(item->getName()); @@ -240,31 +236,32 @@ const std::string& LLTaskInvFVBridge::getDisplayName() const bool mod = gAgent.allowOperation(PERM_MODIFY, perm, GP_OBJECT_MANIPULATE); bool xfer = gAgent.allowOperation(PERM_TRANSFER, perm, GP_OBJECT_MANIPULATE); - if(!copy) + if (!copy) { mDisplayName.append(LLTrans::getString("no_copy")); } - if(!mod) + if (!mod) { mDisplayName.append(LLTrans::getString("no_modify")); } - if(!xfer) + if (!xfer) { mDisplayName.append(LLTrans::getString("no_transfer")); } } mSearchableName.assign(mDisplayName + getLabelSuffix()); + LLStringUtil::toUpper(mSearchableName); return mDisplayName; } +// virtual const std::string& LLTaskInvFVBridge::getSearchableName() const { return mSearchableName; } - // BUG: No creation dates for task inventory time_t LLTaskInvFVBridge::getCreationDate() const { @@ -272,14 +269,14 @@ time_t LLTaskInvFVBridge::getCreationDate() const } void LLTaskInvFVBridge::setCreationDate(time_t creation_date_utc) -{} - +{ +} LLUIImagePtr LLTaskInvFVBridge::getIcon() const { - const bool item_is_multi = (mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS); + const bool item_is_multi = mFlags & LLInventoryItemFlags::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS; - return LLInventoryIcon::getIcon(mAssetType, mInventoryType, 0, item_is_multi ); + return LLInventoryIcon::getIcon(mAssetType, mInventoryType, 0, item_is_multi); } void LLTaskInvFVBridge::openItem() @@ -290,38 +287,38 @@ void LLTaskInvFVBridge::openItem() bool LLTaskInvFVBridge::isItemRenameable() const { - if(gAgent.isGodlike()) return true; - LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); - if(object) + if (gAgent.isGodlike()) + return true; + + if (LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID())) { - LLInventoryItem* item = (LLInventoryItem*)(object->getInventoryObject(mUUID)); - if(item && gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), - GP_OBJECT_MANIPULATE, GOD_LIKE)) + if (LLInventoryItem* item = (LLInventoryItem*)(object->getInventoryObject(mUUID))) { - return true; + if (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE, GOD_LIKE)) + { + return true; + } } } + return false; } bool LLTaskInvFVBridge::renameItem(const std::string& new_name) { - LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); - if(object) + if (LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID())) { - LLViewerInventoryItem* item = NULL; - item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID); - if(item && (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), - GP_OBJECT_MANIPULATE, GOD_LIKE))) + if (LLViewerInventoryItem* item = (LLViewerInventoryItem*)object->getInventoryObject(mUUID)) { - LLPointer new_item = new LLViewerInventoryItem(item); - new_item->rename(new_name); - object->updateInventory( - new_item, - TASK_INVENTORY_ITEM_KEY, - false); + if (gAgent.allowOperation(PERM_MODIFY, item->getPermissions(), GP_OBJECT_MANIPULATE, GOD_LIKE)) + { + LLPointer new_item = new LLViewerInventoryItem(item); + new_item->rename(new_name); + object->updateInventory(new_item, TASK_INVENTORY_ITEM_KEY, false); + } } } + return true; } @@ -338,33 +335,35 @@ bool LLTaskInvFVBridge::isItemMovable() const bool LLTaskInvFVBridge::isItemRemovable(bool check_worn) const { - const LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); - if(object - && (object->permModify() || object->permYouOwner())) + if (const LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID())) { - return true; + return object->permModify() || object->permYouOwner(); } + return false; } bool remove_task_inventory_callback(const LLSD& notification, const LLSD& response, LLPanelObjectInventory* panel) { S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - LLViewerObject* object = gObjectList.findObject(notification["payload"]["task_id"].asUUID()); - if(option == 0 && object) - { - // yes - LLSD::array_const_iterator list_end = notification["payload"]["inventory_ids"].endArray(); - for (LLSD::array_const_iterator list_it = notification["payload"]["inventory_ids"].beginArray(); - list_it != list_end; - ++list_it) + if (option == 0) + { + if (LLViewerObject* object = gObjectList.findObject(notification["payload"]["task_id"].asUUID())) { - object->removeInventory(list_it->asUUID()); - } + // yes + const LLSD& inventory_ids = notification["payload"]["inventory_ids"]; + LLSD::array_const_iterator list_it = inventory_ids.beginArray(); + LLSD::array_const_iterator list_end = inventory_ids.endArray(); + for (; list_it != list_end; ++list_it) + { + object->removeInventory(list_it->asUUID()); + } - // refresh the UI. - panel->refresh(); + // refresh the UI. + panel->refresh(); + } } + return false; } @@ -374,31 +373,29 @@ typedef std::pair > panel_two_uuids_list_t; typedef std::pair remove_data_t; bool LLTaskInvFVBridge::removeItem() { - if(isItemRemovable() && mPanel) + if (isItemRemovable() && mPanel) { - LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); - if(object) + if (LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID())) { - if(object->permModify()) + if (object->permModify()) { // just do it. object->removeInventory(mUUID); return true; } - else - { - LLSD payload; - payload["task_id"] = mPanel->getTaskUUID(); - payload["inventory_ids"].append(mUUID); - LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel)); - return false; - } + + LLSD payload; + payload["task_id"] = mPanel->getTaskUUID(); + payload["inventory_ids"].append(mUUID); + LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel)); + return false; } } + return false; } -void LLTaskInvFVBridge::removeBatch(std::vector& batch) +void LLTaskInvFVBridge::removeBatch(std::vector& batch) { if (!mPanel) { @@ -415,24 +412,21 @@ void LLTaskInvFVBridge::removeBatch(std::vector& batch { LLSD payload; payload["task_id"] = mPanel->getTaskUUID(); - for (S32 i = 0; i < (S32)batch.size(); i++) + for (LLFolderViewModelItem* item : batch) { - LLTaskInvFVBridge* itemp = (LLTaskInvFVBridge*)batch[i]; - payload["inventory_ids"].append(itemp->getUUID()); + payload["inventory_ids"].append(((LLTaskInvFVBridge*)item)->getUUID()); } LLNotificationsUtil::add("RemoveItemWarn", LLSD(), payload, boost::bind(&remove_task_inventory_callback, _1, _2, mPanel)); - } else { - for (S32 i = 0; i < (S32)batch.size(); i++) + for (LLFolderViewModelItem* item : batch) { - LLTaskInvFVBridge* itemp = (LLTaskInvFVBridge*)batch[i]; - - if(itemp->isItemRemovable()) + LLTaskInvFVBridge* bridge = (LLTaskInvFVBridge*)item; + if (bridge->isItemRemovable()) { - // just do it. - object->removeInventory(itemp->getUUID()); + // Just do it. + object->removeInventory(bridge->getUUID()); } } } @@ -444,10 +438,12 @@ void LLTaskInvFVBridge::move(LLFolderViewModelItem* parent_listener) bool LLTaskInvFVBridge::isItemCopyable(bool can_link) const { - LLInventoryItem* item = findItem(); - if(!item) return false; - return gAgent.allowOperation(PERM_COPY, item->getPermissions(), - GP_OBJECT_MANIPULATE); + if (LLInventoryItem* item = findItem()) + { + return gAgent.allowOperation(PERM_COPY, item->getPermissions(), GP_OBJECT_MANIPULATE); + } + + return false; } bool LLTaskInvFVBridge::copyToClipboard() const @@ -476,38 +472,35 @@ void LLTaskInvFVBridge::pasteLinkFromClipboard() bool LLTaskInvFVBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL; - if(mPanel) + if (!mPanel) + return false; + + if (LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID())) { - LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); - if(object) + if (LLInventoryItem* inv = (LLInventoryItem*)object->getInventoryObject(mUUID)) { - LLInventoryItem* inv = NULL; - if((inv = (LLInventoryItem*)object->getInventoryObject(mUUID))) + const LLPermissions& perm = inv->getPermissions(); + bool can_copy = gAgent.allowOperation(PERM_COPY, perm, GP_OBJECT_MANIPULATE); + if (!can_copy && object->isAttachment()) { - const LLPermissions& perm = inv->getPermissions(); - bool can_copy = gAgent.allowOperation(PERM_COPY, perm, - GP_OBJECT_MANIPULATE); - if (object->isAttachment() && !can_copy) - { - //RN: no copy contents of attachments cannot be dragged out - // due to a race condition and possible exploit where - // attached objects do not update their inventory items - // when their contents are manipulated - return false; - } - if((can_copy && perm.allowTransferTo(gAgent.getID())) - || object->permYouOwner()) -// || gAgent.isGodlike()) - - { - *type = LLViewerAssetType::lookupDragAndDropType(inv->getType()); + //RN: no copy contents of attachments cannot be dragged out + // due to a race condition and possible exploit where + // attached objects do not update their inventory items + // when their contents are manipulated + return false; + } - *id = inv->getUUID(); - return true; - } + if ((can_copy && perm.allowTransferTo(gAgent.getID())) + || object->permYouOwner()) +// || gAgent.isGodlike()) + { + *type = LLViewerAssetType::lookupDragAndDropType(inv->getType()); + *id = inv->getUUID(); + return true; } } } + return false; } @@ -554,7 +547,7 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { disabled_items.push_back(std::string("Task Properties")); } - if(isItemRenameable()) + if (isItemRenameable()) { items.push_back(std::string("Task Rename")); if ((flags & FIRST_SELECTED_ITEM) == 0) @@ -562,7 +555,7 @@ void LLTaskInvFVBridge::buildContextMenu(LLMenuGL& menu, U32 flags) disabled_items.push_back(std::string("Task Rename")); } } - if(isItemRemovable()) + if (isItemRemovable()) { items.push_back(std::string("Task Remove")); } @@ -585,10 +578,10 @@ public: virtual LLUIImagePtr getIcon() const; virtual const std::string& getDisplayName() const; - virtual bool isItemRenameable() const; + virtual bool isItemRenameable() const { return false; } // virtual bool isItemCopyable() const { return false; } - virtual bool renameItem(const std::string& new_name); - virtual bool isItemRemovable(bool check_worn = true) const; + virtual bool renameItem(const std::string& new_name) { return false; } + virtual bool isItemRemovable(bool check_worn = true) const { return false; } virtual void buildContextMenu(LLMenuGL& menu, U32 flags); virtual bool hasChildren() const; virtual bool startDrag(EDragAndDropType* type, LLUUID* id) const; @@ -609,6 +602,7 @@ LLTaskCategoryBridge::LLTaskCategoryBridge( { } +// virtual LLUIImagePtr LLTaskCategoryBridge::getIcon() const { return LLUI::getUIImage("Inv_FolderClosed"); @@ -617,9 +611,7 @@ LLUIImagePtr LLTaskCategoryBridge::getIcon() const // virtual const std::string& LLTaskCategoryBridge::getDisplayName() const { - LLInventoryObject* cat = findInvObject(); - - if (cat) + if (LLInventoryObject* cat = findInvObject()) { std::string name = cat->getName(); if (mChildren.size() > 0) @@ -633,26 +625,13 @@ const std::string& LLTaskCategoryBridge::getDisplayName() const name.append(" " + LLTrans::getString("InventoryItemsCount", args)); } mDisplayName.assign(name); + LLStringUtil::toUpper(name); + mSearchableName.assign(name); } return mDisplayName; } -bool LLTaskCategoryBridge::isItemRenameable() const -{ - return false; -} - -bool LLTaskCategoryBridge::renameItem(const std::string& new_name) -{ - return false; -} - -bool LLTaskCategoryBridge::isItemRemovable(bool check_worn) const -{ - return false; -} - void LLTaskCategoryBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { std::vector items; @@ -660,6 +639,7 @@ void LLTaskCategoryBridge::buildContextMenu(LLMenuGL& menu, U32 flags) hide_context_entries(menu, items, disabled_items); } +// virtual bool LLTaskCategoryBridge::hasChildren() const { // return true if we have or do know know if we have children. @@ -667,20 +647,21 @@ bool LLTaskCategoryBridge::hasChildren() const return false; } +// virtual void LLTaskCategoryBridge::openItem() { } +// virtual bool LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const { //LL_INFOS() << "LLTaskInvFVBridge::startDrag()" << LL_ENDL; - if(mPanel && mUUID.notNull()) + if (mPanel && mUUID.notNull()) { - LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); - if(object) + if (LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID())) { const LLInventoryObject* cat = object->getInventoryObject(mUUID); - if ( (cat) && (move_inv_category_world_to_agent(mUUID, LLUUID::null, false)) ) + if (cat && move_inv_category_world_to_agent(mUUID, LLUUID::null, false)) { *type = LLViewerAssetType::lookupDragAndDropType(cat->getType()); *id = mUUID; @@ -691,6 +672,7 @@ bool LLTaskCategoryBridge::startDrag(EDragAndDropType* type, LLUUID* id) const return false; } +// virtual bool LLTaskCategoryBridge::dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, @@ -775,14 +757,13 @@ public: virtual void openItem(); }; +// virtual void LLTaskTextureBridge::openItem() { LL_INFOS() << "LLTaskTextureBridge::openItem()" << LL_ENDL; - LLPreviewTexture* preview = LLFloaterReg::showTypedInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES); - if(preview) + if (LLPreviewTexture* preview = LLFloaterReg::showTypedInstance("preview_texture", LLSD(mUUID), TAKE_FOCUS_YES)) { - LLInventoryItem* item = findItem(); - if(item) + if (LLInventoryItem* item = findItem()) { preview->setAuxItem(item); } @@ -810,11 +791,13 @@ public: static void openSoundPreview(void* data); }; +// virtual void LLTaskSoundBridge::openItem() { openSoundPreview((void*)this); } +// static void LLTaskSoundBridge::openSoundPreview(void* data) { LLTaskSoundBridge* self = (LLTaskSoundBridge*)data; @@ -842,6 +825,7 @@ void LLTaskSoundBridge::performAction(LLInventoryModel* model, std::string actio LLTaskInvFVBridge::performAction(model, action); } +// virtual void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { LLInventoryItem* item = findItem(); @@ -865,18 +849,17 @@ void LLTaskSoundBridge::buildContextMenu(LLMenuGL& menu, U32 flags) { disabled_items.push_back(std::string("Task Properties")); } - if(isItemRenameable()) + if (isItemRenameable()) { items.push_back(std::string("Task Rename")); } - if(isItemRemovable()) + if (isItemRemovable()) { items.push_back(std::string("Task Remove")); } items.push_back(std::string("Task Play")); - hide_context_entries(menu, items, disabled_items); } @@ -905,20 +888,10 @@ public: const std::string& name) : LLTaskInvFVBridge(panel, uuid, name) {} - virtual bool isItemRenameable() const; - virtual bool renameItem(const std::string& new_name); + virtual bool isItemRenameable() const { return false; } + virtual bool renameItem(const std::string& new_name) { return false; } }; -bool LLTaskCallingCardBridge::isItemRenameable() const -{ - return false; -} - -bool LLTaskCallingCardBridge::renameItem(const std::string& new_name) -{ - return false; -} - ///---------------------------------------------------------------------------- /// Class LLTaskScriptBridge @@ -951,6 +924,7 @@ public: //static void copyToInventory(void* userdata); }; +// virtual void LLTaskLSLBridge::openItem() { LL_INFOS() << "LLTaskLSLBridge::openItem() " << mUUID << LL_ENDL; @@ -982,6 +956,7 @@ void LLTaskLSLBridge::openItem() } } +// virtual bool LLTaskLSLBridge::removeItem() { LLFloaterReg::hideInstance("preview_scriptedit", LLSD(mUUID)); @@ -1019,6 +994,7 @@ public: virtual bool removeItem(); }; +// virtual void LLTaskNotecardBridge::openItem() { LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); @@ -1045,6 +1021,7 @@ void LLTaskNotecardBridge::openItem() } } +// virtual bool LLTaskNotecardBridge::removeItem() { LLFloaterReg::hideInstance("preview_notecard", LLSD(mUUID)); @@ -1068,6 +1045,7 @@ public: virtual bool removeItem(); }; +// virtual void LLTaskGestureBridge::openItem() { LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); @@ -1078,6 +1056,7 @@ void LLTaskGestureBridge::openItem() LLPreviewGesture::show(mUUID, mPanel->getTaskUUID()); } +// virtual bool LLTaskGestureBridge::removeItem() { // Don't need to deactivate gesture because gestures inside objects can never be active. @@ -1102,10 +1081,12 @@ public: virtual bool removeItem(); }; +// virtual void LLTaskAnimationBridge::openItem() { - LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); - if(!object || object->isInventoryPending()) + const LLUUID& task_id = mPanel->getTaskUUID(); + LLViewerObject* object = gObjectList.findObject(task_id); + if (!object || object->isInventoryPending()) { return; } @@ -1117,6 +1098,7 @@ void LLTaskAnimationBridge::openItem() } } +// virtual bool LLTaskAnimationBridge::removeItem() { LLFloaterReg::hideInstance("preview_anim", LLSD(mUUID)); @@ -1139,6 +1121,7 @@ public: virtual LLUIImagePtr getIcon() const; }; +// virtual LLUIImagePtr LLTaskWearableBridge::getIcon() const { return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, false ); @@ -1161,11 +1144,13 @@ public: virtual LLSettingsType::type_e getSettingsType() const; }; +// virtual LLUIImagePtr LLTaskSettingsBridge::getIcon() const { return LLInventoryIcon::getIcon(mAssetType, mInventoryType, mFlags, false); } +// virtual LLSettingsType::type_e LLTaskSettingsBridge::getSettingsType() const { return LLSettingsType::ST_NONE; @@ -1188,6 +1173,7 @@ public: bool removeItem() override; }; +// virtual void LLTaskMaterialBridge::openItem() { LLViewerObject* object = gObjectList.findObject(mPanel->getTaskUUID()); @@ -1216,13 +1202,13 @@ void LLTaskMaterialBridge::openItem() } } +// virtual bool LLTaskMaterialBridge::removeItem() { LLFloaterReg::hideInstance("material_editor", LLSD(mUUID)); return LLTaskInvFVBridge::removeItem(); } - ///---------------------------------------------------------------------------- /// LLTaskInvFVBridge impl //---------------------------------------------------------------------------- @@ -1402,7 +1388,6 @@ void LLPanelObjectInventory::clearContents() } } - void LLPanelObjectInventory::reset() { clearContents(); @@ -1456,12 +1441,13 @@ void LLPanelObjectInventory::inventoryChanged(LLViewerObject* object, S32 serial_num, void* data) { - if(!object) return; + if (!object) + return; //LL_INFOS() << "invetnory arrived: \n" // << " panel UUID: " << panel->mTaskUUID << "\n" // << " task UUID: " << object->mID << LL_ENDL; - if(mTaskUUID == object->mID) + if (mTaskUUID == object->mID) { mInventoryNeedsUpdate = true; } @@ -1473,23 +1459,19 @@ void LLPanelObjectInventory::updateInventory() // << " panel UUID: " << panel->mTaskUUID << "\n" // << " task UUID: " << object->mID << LL_ENDL; // We're still interested in this task's inventory. + bool inventory_has_focus = mHaveInventory && mFolders && gFocusMgr.childHasKeyboardFocus(mFolders); + std::vector selected_item_ids; - std::set selected_items; - bool inventory_has_focus = false; if (mHaveInventory && mFolders) { - selected_items = mFolders->getSelectionList(); - inventory_has_focus = gFocusMgr.childHasKeyboardFocus(mFolders); - } - for (std::set::iterator it = selected_items.begin(), end_it = selected_items.end(); - it != end_it; - ++it) - { - selected_item_ids.push_back(static_cast((*it)->getViewModelItem())->getUUID()); + std::set selected_items = mFolders->getSelectionList(); + for (LLFolderViewItem* item : selected_items) + { + selected_item_ids.push_back(static_cast(item->getViewModelItem())->getUUID()); + } } - LLViewerObject* objectp = gObjectList.findObject(mTaskUUID); - if (objectp) + if (LLViewerObject* objectp = gObjectList.findObject(mTaskUUID)) { LLInventoryObject* inventory_root = objectp->getInventoryRoot(); LLInventoryObject::object_list_t contents; @@ -1525,15 +1507,12 @@ void LLPanelObjectInventory::updateInventory() } // restore previous selection - std::vector::iterator selection_it; bool first_item = true; - for (selection_it = selected_item_ids.begin(); selection_it != selected_item_ids.end(); ++selection_it) + for (const LLUUID& item_id : selected_item_ids) { - LLFolderViewItem* selected_item = getItemByID(*selection_it); - - if (selected_item) + if (LLFolderViewItem* selected_item = getItemByID(item_id)) { - //HACK: "set" first item then "change" each other one to get keyboard focus right + // HACK: "set" first item then "change" each other one to get keyboard focus right if (first_item) { mFolders->setSelection(selected_item, true, inventory_has_focus); @@ -1550,6 +1529,7 @@ void LLPanelObjectInventory::updateInventory() { mFolders->requestArrange(); } + mInventoryNeedsUpdate = false; // Edit menu handler is set in onFocusReceived } @@ -1565,10 +1545,9 @@ void LLPanelObjectInventory::createFolderViews(LLInventoryObject* inventory_root { return; } + // Create a visible root category. - LLTaskInvFVBridge* bridge = NULL; - bridge = LLTaskInvFVBridge::createObjectBridge(this, inventory_root); - if(bridge) + if (LLTaskInvFVBridge* bridge = LLTaskInvFVBridge::createObjectBridge(this, inventory_root)) { LLUIColor item_color = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE); @@ -1611,59 +1590,50 @@ void LLPanelObjectInventory::createViewsForCategory(LLInventoryObject::object_li // Find all in the first pass std::vector child_categories; - LLTaskInvFVBridge* bridge; - LLFolderViewItem* view; - - LLInventoryObject::object_list_t::iterator it = inventory->begin(); - LLInventoryObject::object_list_t::iterator end = inventory->end(); - for( ; it != end; ++it) + for (const LLPointer& obj : *inventory) { - LLInventoryObject* obj = *it; - - if(parent->getUUID() == obj->getParentUUID()) + if (parent->getUUID() == obj->getParentUUID()) { - bridge = LLTaskInvFVBridge::createObjectBridge(this, obj); - if(!bridge) + if (LLTaskInvFVBridge* bridge = LLTaskInvFVBridge::createObjectBridge(this, obj)) { - continue; - } - if(LLAssetType::AT_CATEGORY == obj->getType()) - { - LLFolderViewFolder::Params p; - p.name = obj->getName(); - p.root = mFolders; - p.listener = bridge; - p.tool_tip = p.name; - p.font_color = item_color; - p.font_highlight_color = item_color; - view = LLUICtrlFactory::create(p); - child_categories.push_back(new obj_folder_pair(obj, - (LLFolderViewFolder*)view)); - } - else - { - LLFolderViewItem::Params params; - params.name(obj->getName()); - params.creation_date(bridge->getCreationDate()); - params.root(mFolders); - params.listener(bridge); - params.rect(LLRect()); - params.tool_tip = params.name; - params.font_color = item_color; - params.font_highlight_color = item_color; - view = LLUICtrlFactory::create (params); + LLFolderViewItem* view; + if (LLAssetType::AT_CATEGORY == obj->getType()) + { + LLFolderViewFolder::Params params; + params.name = obj->getName(); + params.root = mFolders; + params.listener = bridge; + params.tool_tip = params.name; + params.font_color = item_color; + params.font_highlight_color = item_color; + view = LLUICtrlFactory::create(params); + child_categories.push_back(new obj_folder_pair(obj, (LLFolderViewFolder*)view)); + } + else + { + LLFolderViewItem::Params params; + params.name = obj->getName(); + params.root = mFolders; + params.listener = bridge; + params.creation_date = bridge->getCreationDate(); + params.rect = LLRect(); + params.tool_tip = params.name; + params.font_color = item_color; + params.font_highlight_color = item_color; + view = LLUICtrlFactory::create(params); + } + + view->addToFolder(folder); + addItemID(obj->getUUID(), view); } - view->addToFolder(folder); - addItemID(obj->getUUID(), view); } } // now, for each category, do the second pass - for(S32 i = 0; i < child_categories.size(); i++) + for (obj_folder_pair* pair : child_categories) { - createViewsForCategory(inventory, child_categories[i]->first, - child_categories[i]->second ); - delete child_categories[i]; + createViewsForCategory(inventory, pair->first, pair->second); + delete pair; } folder->setChildrenInited(true); } @@ -1675,11 +1645,10 @@ void LLPanelObjectInventory::refresh() const bool non_root_ok = true; LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); LLSelectNode* node = selection->getFirstRootNode(NULL, non_root_ok); - if(node && node->mValid) + if (node && node->mValid) { LLViewerObject* object = node->getObject(); - if(object && ((selection->getRootObjectCount() == 1) - || (selection->getObjectCount() == 1))) + if (object && ((selection->getRootObjectCount() == 1) || (selection->getObjectCount() == 1))) { // determine if we need to make a request. Start with a // default based on if we have inventory at all. @@ -1687,7 +1656,7 @@ void LLPanelObjectInventory::refresh() // If the task id is different than what we've stored, // then make the request. - if(mTaskUUID != object->mID) + if (mTaskUUID != object->mID) { mTaskUUID = object->mID; mAttachmentUUID = object->getAttachmentItemID(); @@ -1713,26 +1682,28 @@ void LLPanelObjectInventory::refresh() // Based on the node information, we may need to dirty the // object inventory and get it again. - if(node->mValid) + if (node->mValid) { - if(node->mInventorySerial != object->getInventorySerial() || object->isInventoryDirty()) + if (node->mInventorySerial != object->getInventorySerial() || object->isInventoryDirty()) { make_request = true; } } // do the request if necessary. - if(make_request) + if (make_request) { requestVOInventory(); } has_inventory = true; } } - if(!has_inventory) + + if (!has_inventory) { clearInventoryTask(); } + mInventoryViewModel.setTaskID(mTaskUUID); //LL_INFOS() << "LLPanelObjectInventory::refresh() " << mTaskUUID << LL_ENDL; } @@ -1747,7 +1718,7 @@ void LLPanelObjectInventory::clearInventoryTask() void LLPanelObjectInventory::removeSelectedItem() { - if(mFolders) + if (mFolders) { mFolders->removeSelectedItems(); } @@ -1755,7 +1726,7 @@ void LLPanelObjectInventory::removeSelectedItem() void LLPanelObjectInventory::startRenamingSelectedItem() { - if(mFolders) + if (mFolders) { mFolders->startRenamingSelectedItem(); } @@ -1765,25 +1736,26 @@ void LLPanelObjectInventory::draw() { LLPanel::draw(); - if(mIsInventoryEmpty) + if (mIsInventoryEmpty) { - if((LLUUID::null != mTaskUUID) && (!mHaveInventory)) + std::string text; + if (!mHaveInventory && mTaskUUID.notNull()) + { + text = LLTrans::getString("LoadingContents"); + } + else if (mHaveInventory) { - LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("LoadingContents"), 0, - (S32)(getRect().getWidth() * 0.5f), - 10, - LLColor4( 1, 1, 1, 1 ), - LLFontGL::HCENTER, - LLFontGL::BOTTOM); + text = LLTrans::getString("NoContents"); } - else if(mHaveInventory) + + if (!text.empty()) { - LLFontGL::getFontSansSerif()->renderUTF8(LLTrans::getString("NoContents"), 0, - (S32)(getRect().getWidth() * 0.5f), - 10, - LLColor4( 1, 1, 1, 1 ), - LLFontGL::HCENTER, - LLFontGL::BOTTOM); + LLFontGL::getFontSansSerif()->renderUTF8(text, 0, + (S32)(getRect().getWidth() * 0.5f), + 10, + LLColor4(1, 1, 1, 1), + LLFontGL::HCENTER, + LLFontGL::BOTTOM); } } } @@ -1797,31 +1769,21 @@ void LLPanelObjectInventory::deleteAllChildren() bool LLPanelObjectInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg) { - if (mFolders) - { - LLFolderViewItem* folderp = mFolders->getNextFromChild(NULL); - if (!folderp) - { - return false; - } - // Try to pass on unmodified mouse coordinates - S32 local_x = x - mFolders->getRect().mLeft; - S32 local_y = y - mFolders->getRect().mBottom; + LLFolderViewItem* folderp = mFolders ? mFolders->getNextFromChild(NULL) : NULL; + if (!folderp) + return false; - if (mFolders->pointInView(local_x, local_y)) - { - return mFolders->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - } - else - { - //force mouse coordinates to be inside folder rectangle - return mFolders->handleDragAndDrop(5, 1, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); - } - } - else + // Try to pass on unmodified mouse coordinates + S32 local_x = x - mFolders->getRect().mLeft; + S32 local_y = y - mFolders->getRect().mBottom; + + if (mFolders->pointInView(local_x, local_y)) { - return false; + return mFolders->handleDragAndDrop(local_x, local_y, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } + + //force mouse coordinates to be inside folder rectangle + return mFolders->handleDragAndDrop(5, 1, mask, drop, cargo_type, cargo_data, accept, tooltip_msg); } //static @@ -1858,11 +1820,9 @@ void LLPanelObjectInventory::onFocusReceived() LLPanel::onFocusReceived(); } - LLFolderViewItem* LLPanelObjectInventory::getItemByID( const LLUUID& id ) { - std::map::iterator map_it; - map_it = mItemMap.find(id); + std::map::iterator map_it = mItemMap.find(id); if (map_it != mItemMap.end()) { return map_it->second; @@ -1913,21 +1873,21 @@ bool LLPanelObjectInventory::isSelectionRemovable() { return false; } + std::set selection_set = mFolders->getRoot()->getSelectionList(); if (selection_set.empty()) { return false; } - for (std::set::iterator iter = selection_set.begin(); - iter != selection_set.end(); - ++iter) + + for (LLFolderViewItem* item : selection_set) { - LLFolderViewItem *item = *iter; const LLFolderViewModelItemInventory *listener = dynamic_cast(item->getViewModelItem()); if (!listener || !listener->isItemRemovable() || listener->isItemInTrash()) { return false; } } + return true; } diff --git a/indra/newview/llpanelobjectinventory.h b/indra/newview/llpanelobjectinventory.h index c150a841ae..abb48dbeed 100644 --- a/indra/newview/llpanelobjectinventory.h +++ b/indra/newview/llpanelobjectinventory.h @@ -73,6 +73,8 @@ public: void startRenamingSelectedItem(); LLFolderView* getRootFolder() const { return mFolders; } + LLInventoryFilter& getFilter() { return mInventoryViewModel.getFilter(); } + const LLInventoryFilter& getFilter() const { return mInventoryViewModel.getFilter(); } virtual void draw(); virtual void deleteAllChildren(); diff --git a/indra/newview/llsettingspicker.cpp b/indra/newview/llsettingspicker.cpp index 24cf543864..619882dc5e 100644 --- a/indra/newview/llsettingspicker.cpp +++ b/indra/newview/llsettingspicker.cpp @@ -98,7 +98,7 @@ bool LLFloaterSettingsPicker::postBuild() setTitle(prefix + " " + label); mFilterEdit = getChild(FLT_INVENTORY_SEARCH); - mFilterEdit->setCommitCallback([this](LLUICtrl*, const LLSD& param){ onFilterEdit(param.asString()); }); + mFilterEdit->setCommitCallback([this](LLUICtrl*, const LLSD& param) { onFilterEdit(param.asString()); }); mInventoryPanel = getChild(PNL_INVENTORY); if (mInventoryPanel) @@ -203,7 +203,6 @@ void LLFloaterSettingsPicker::draw() LLFloater::draw(); } - //========================================================================= void LLFloaterSettingsPicker::onFilterEdit(const std::string& search_string) { @@ -224,7 +223,6 @@ void LLFloaterSettingsPicker::onFilterEdit(const std::string& search_string) LLOpenFoldersWithSelection opener; mInventoryPanel->getRootFolder()->applyFunctorRecursively(opener); mInventoryPanel->getRootFolder()->scrollToShowSelection(); - } else if (mInventoryPanel->getFilterSubString().empty()) { @@ -269,6 +267,7 @@ void LLFloaterSettingsPicker::onSelectionChange(const LLFloaterSettingsPicker::i } } } + bool track_picker_enabled = mTrackMode != TRACK_NONE; getChild(CMB_TRACK_SELECTION)->setEnabled(is_item && track_picker_enabled && mSettingAssetID == asset_id); @@ -304,13 +303,14 @@ void LLFloaterSettingsPicker::onAssetLoaded(LLUUID asset_id, LLSettingsBase::ptr LLComboBox* track_selection = getChild(CMB_TRACK_SELECTION); track_selection->clear(); track_selection->removeall(); + if (!settings) { LL_WARNS() << "Failed to load asset " << asset_id << LL_ENDL; return; } - LLSettingsDay::ptr_t pday = std::dynamic_pointer_cast(settings); + LLSettingsDay::ptr_t pday = std::dynamic_pointer_cast(settings); if (!pday) { LL_WARNS() << "Wrong asset type received by id " << asset_id << LL_ENDL; diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 5693f2808c..b48417bd71 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -387,7 +387,7 @@ void LLSidepanelInventory::onToggleInboxBtn() void LLSidepanelInventory::onOpen(const LLSD& key) { LLFirstUse::newInventory(false); - mPanelMainInventory->setFocusFilterEditor(); + mPanelMainInventory->setFocusOnFilterEditor(); #if AUTO_EXPAND_INBOX // Expand the inbox if we have fresh items LLPanelMarketplaceInbox * inbox = findChild(MARKETPLACE_INBOX_PANEL); diff --git a/indra/newview/llviewerobjectlist.h b/indra/newview/llviewerobjectlist.h index 7dfa94b99f..dc31995eb1 100644 --- a/indra/newview/llviewerobjectlist.h +++ b/indra/newview/llviewerobjectlist.h @@ -259,15 +259,16 @@ extern LLViewerObjectList gObjectList; */ inline LLViewerObject *LLViewerObjectList::findObject(const LLUUID &id) { + if (id.isNull()) + return NULL; + auto iter = mUUIDObjectMap.find(id); - if(iter != mUUIDObjectMap.end()) + if (iter != mUUIDObjectMap.end()) { return iter->second; } - else - { - return NULL; - } + + return NULL; } inline LLViewerObject *LLViewerObjectList::getObject(const S32 index) diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml index e43143c8c3..d3a872c9d5 100644 --- a/indra/newview/skins/default/xui/en/floater_tools.xml +++ b/indra/newview/skins/default/xui/en/floater_tools.xml @@ -2774,7 +2774,7 @@ even though the user gets a free copy. label="New Script" label_selected="New Script" layout="topleft" - left="10" + left="8" name="button new script" top="10" width="134" /> @@ -2786,16 +2786,28 @@ even though the user gets a free copy. left_pad="8" name="button permissions" width="134" /> - + -- cgit v1.2.3 From 2f692fbac36117e1b3c5f2ec214fd188c7e73da7 Mon Sep 17 00:00:00 2001 From: TommyTheTerrible <81168766+TommyTheTerrible@users.noreply.github.com> Date: Mon, 9 Sep 2024 05:31:00 -0400 Subject: Update calcDataSizeJ2C to stop undersized blocks (#2525) The initial block area for the pyramid walk should not be smaller than the max_block_size area so need an llmax to not allow multiplication below 1. This was causing decode errors for complex small images (128x128 or smaller) on discard 1 and 2. --- indra/llimage/llimagej2c.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/llimage/llimagej2c.cpp b/indra/llimage/llimagej2c.cpp index 753e5d24df..aa161709a1 100644 --- a/indra/llimage/llimagej2c.cpp +++ b/indra/llimage/llimagej2c.cpp @@ -281,7 +281,7 @@ S32 LLImageJ2C::calcDataSizeJ2C(S32 w, S32 h, S32 comp, S32 discard_level, F32 r S32 height = (h > 0) ? h : 2048; S32 max_dimension = llmax(width, height); // Find largest dimension S32 block_area = MAX_BLOCK_SIZE * MAX_BLOCK_SIZE; // Calculated initial block area from established max block size (currently 64) - block_area *= (max_dimension / MAX_BLOCK_SIZE / max_components); // Adjust initial block area by ratio of largest dimension to block size per component + block_area *= llmax((max_dimension / MAX_BLOCK_SIZE / max_components), 1); // Adjust initial block area by ratio of largest dimension to block size per component S32 totalbytes = (S32) (block_area * max_components * precision); // First block layer computed before loop without compression rate S32 block_layers = 1; // Start at layer 1 since first block layer is computed outside loop while (block_layers < 6) // Walk five layers for the five discards in JPEG2000 -- cgit v1.2.3 From d91d39fa0f7f4f204d6fb7ff66b9817e498dbd61 Mon Sep 17 00:00:00 2001 From: Ansariel Hiller Date: Mon, 9 Sep 2024 12:02:34 +0200 Subject: Changes towards C++20 compatibility (#2520) --- indra/llcommon/llapp.cpp | 2 +- indra/llcommon/llmainthreadtask.h | 4 ++-- indra/llcommon/llpointer.h | 11 +++++++++++ indra/llcommon/llpredicate.h | 4 ++-- indra/llcorehttp/tests/test_httpoperation.hpp | 2 +- indra/llui/llviewereventrecorder.cpp | 2 +- indra/newview/lldeferredsounds.cpp | 2 -- indra/newview/lldeferredsounds.h | 3 +-- indra/newview/lldrawpoolalpha.cpp | 2 +- indra/newview/llspatialpartition.cpp | 4 ++-- indra/newview/llspatialpartition.h | 2 +- indra/newview/llviewertexteditor.cpp | 2 +- indra/newview/llvograss.cpp | 2 +- indra/newview/llvopartgroup.cpp | 2 +- 14 files changed, 26 insertions(+), 18 deletions(-) diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp index 6da764f94c..3db03aec7d 100644 --- a/indra/llcommon/llapp.cpp +++ b/indra/llcommon/llapp.cpp @@ -226,7 +226,7 @@ bool LLApp::parseCommandOptions(int argc, wchar_t** wargv) if(wargv[ii][0] != '-') { LL_INFOS() << "Did not find option identifier while parsing token: " - << wargv[ii] << LL_ENDL; + << (intptr_t)wargv[ii] << LL_ENDL; return false; } int offset = 1; diff --git a/indra/llcommon/llmainthreadtask.h b/indra/llcommon/llmainthreadtask.h index cec95b2356..c3ed7fef52 100644 --- a/indra/llcommon/llmainthreadtask.h +++ b/indra/llcommon/llmainthreadtask.h @@ -89,10 +89,10 @@ private: } // Given arbitrary CALLABLE, which might be a lambda, how are we // supposed to obtain its signature for std::packaged_task? It seems - // redundant to have to add an argument list to engage result_of, then + // redundant to have to add an argument list to engage invoke_result_t, then // add the argument list again to complete the signature. At least we // only support a nullary CALLABLE. - std::packaged_task::type()> mTask; + std::packaged_task()> mTask; }; }; diff --git a/indra/llcommon/llpointer.h b/indra/llcommon/llpointer.h index 6edff9fa5e..048547e4cc 100644 --- a/indra/llcommon/llpointer.h +++ b/indra/llcommon/llpointer.h @@ -418,6 +418,17 @@ private: bool mStayUnique; }; +template +bool operator!=(Type* lhs, const LLPointer& rhs) +{ + return (lhs != rhs.get()); +} + +template +bool operator==(Type* lhs, const LLPointer& rhs) +{ + return (lhs == rhs.get()); +} // boost hash adapter template diff --git a/indra/llcommon/llpredicate.h b/indra/llcommon/llpredicate.h index 7c6874d279..91c623eae1 100644 --- a/indra/llcommon/llpredicate.h +++ b/indra/llcommon/llpredicate.h @@ -139,7 +139,7 @@ namespace LLPredicate Rule() {} - void require(ENUM e, bool match) + void mandate(ENUM e, bool match) { mRule.set(e, match); } @@ -154,7 +154,7 @@ namespace LLPredicate return (mRule && value).someSet(); } - bool requires(const Value value) const + bool mandates(const Value value) const { return (mRule && value).someSet() && (!mRule && value).noneSet(); } diff --git a/indra/llcorehttp/tests/test_httpoperation.hpp b/indra/llcorehttp/tests/test_httpoperation.hpp index 6778c3440b..361091c7b2 100644 --- a/indra/llcorehttp/tests/test_httpoperation.hpp +++ b/indra/llcorehttp/tests/test_httpoperation.hpp @@ -92,7 +92,7 @@ namespace tut op->setReplyPath(LLCore::HttpOperation::HttpReplyQueuePtr_t(), h1); // Check ref count - ensure(op.unique() == 1); + ensure(op.use_count() == 1); // release the reference, releasing the operation but // not the handlers. diff --git a/indra/llui/llviewereventrecorder.cpp b/indra/llui/llviewereventrecorder.cpp index e5e0545dad..6d907d7e45 100644 --- a/indra/llui/llviewereventrecorder.cpp +++ b/indra/llui/llviewereventrecorder.cpp @@ -261,7 +261,7 @@ void LLViewerEventRecorder::logKeyUnicodeEvent(llwchar uni_char) { event.insert("event",LLSD("keyDown")); - LL_DEBUGS() << "[VITA] unicode key: " << uni_char << LL_ENDL; + LL_DEBUGS() << "[VITA] unicode key: " << (int)uni_char << LL_ENDL; LL_DEBUGS() << "[VITA] dumpxml " << LLSDXMLStreamer(event) << "\n" << LL_ENDL; diff --git a/indra/newview/lldeferredsounds.cpp b/indra/newview/lldeferredsounds.cpp index 8b7c399af1..44f51545dc 100644 --- a/indra/newview/lldeferredsounds.cpp +++ b/indra/newview/lldeferredsounds.cpp @@ -29,8 +29,6 @@ #include "lldeferredsounds.h" -#include "llaudioengine.h" - void LLDeferredSounds::deferSound(SoundData& sound) { soundVector.push_back(sound); diff --git a/indra/newview/lldeferredsounds.h b/indra/newview/lldeferredsounds.h index e586226184..9f3425fc66 100644 --- a/indra/newview/lldeferredsounds.h +++ b/indra/newview/lldeferredsounds.h @@ -28,8 +28,7 @@ #define LL_LLDEFERREDSOUNDS_H #include "llsingleton.h" - -struct SoundData; +#include "llaudioengine.h" class LLDeferredSounds : public LLSingleton { diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index b4d14e22f3..87b6ce6cb3 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -757,7 +757,7 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, bool depth_only, bool rigged) if (current_shader) { - current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, spec_color.mV[0], spec_color.mV[1], spec_color.mV[2], spec_color.mV[3]); + current_shader->uniform4f(LLShaderMgr::SPECULAR_COLOR, spec_color.mV[VRED], spec_color.mV[VGREEN], spec_color.mV[VBLUE], spec_color.mV[VALPHA]); current_shader->uniform1f(LLShaderMgr::ENVIRONMENT_INTENSITY, env_intensity); current_shader->uniform1f(LLShaderMgr::EMISSIVE_BRIGHTNESS, brightness); } diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index e517d009f5..a1a67c319c 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -300,7 +300,7 @@ bool LLSpatialGroup::addObject(LLDrawable *drawablep) } { drawablep->setGroup(this); - setState(OBJECT_DIRTY | GEOM_DIRTY); + setState(static_cast(OBJECT_DIRTY) | static_cast(GEOM_DIRTY)); setOcclusionState(LLSpatialGroup::DISCARD_QUERY, LLSpatialGroup::STATE_MODE_ALL_CAMERAS); gPipeline.markRebuild(this); if (drawablep->isSpatialBridge()) @@ -730,7 +730,7 @@ bool LLSpatialGroup::changeLOD() { LL_PROFILE_ZONE_SCOPED_CATEGORY_SPATIAL; - if (hasState(ALPHA_DIRTY | OBJECT_DIRTY)) + if (hasState(static_cast(ALPHA_DIRTY) | static_cast(OBJECT_DIRTY))) { //a rebuild is going to happen, update distance and LoD return true; diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index c074d6a89a..3aaa3d60e8 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -47,7 +47,7 @@ #include #define SG_STATE_INHERIT_MASK (OCCLUDED) -#define SG_INITIAL_STATE_MASK (DIRTY | GEOM_DIRTY) +#define SG_INITIAL_STATE_MASK (static_cast(DIRTY) | static_cast(GEOM_DIRTY)) class LLViewerOctreePartition; class LLSpatialPartition; diff --git a/indra/newview/llviewertexteditor.cpp b/indra/newview/llviewertexteditor.cpp index 14228b469f..5793a28b80 100644 --- a/indra/newview/llviewertexteditor.cpp +++ b/indra/newview/llviewertexteditor.cpp @@ -503,7 +503,7 @@ S32 LLEmbeddedItems::getIndexFromEmbeddedChar(llwchar wch) } else { - LL_WARNS() << "Embedded char " << wch << " not found, using 0" << LL_ENDL; + LL_WARNS() << "Embedded char " << (int)wch << " not found, using 0" << LL_ENDL; return 0; } } diff --git a/indra/newview/llvograss.cpp b/indra/newview/llvograss.cpp index 6903af2619..67adcbb244 100644 --- a/indra/newview/llvograss.cpp +++ b/indra/newview/llvograss.cpp @@ -596,7 +596,7 @@ U32 LLVOGrass::getPartitionType() const } LLGrassPartition::LLGrassPartition(LLViewerRegion* regionp) -: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, true, regionp) +: LLSpatialPartition(static_cast(LLDrawPoolAlpha::VERTEX_DATA_MASK) | static_cast(LLVertexBuffer::MAP_TEXTURE_INDEX), true, regionp) { mDrawableType = LLPipeline::RENDER_TYPE_GRASS; mPartitionType = LLViewerRegion::PARTITION_GRASS; diff --git a/indra/newview/llvopartgroup.cpp b/indra/newview/llvopartgroup.cpp index 81f16cf8cb..8f792c1042 100644 --- a/indra/newview/llvopartgroup.cpp +++ b/indra/newview/llvopartgroup.cpp @@ -702,7 +702,7 @@ U32 LLVOPartGroup::getPartitionType() const } LLParticlePartition::LLParticlePartition(LLViewerRegion* regionp) -: LLSpatialPartition(LLDrawPoolAlpha::VERTEX_DATA_MASK | LLVertexBuffer::MAP_TEXTURE_INDEX, true, regionp) +: LLSpatialPartition(static_cast(LLDrawPoolAlpha::VERTEX_DATA_MASK) | static_cast(LLVertexBuffer::MAP_TEXTURE_INDEX), true, regionp) { mRenderPass = LLRenderPass::PASS_ALPHA; mDrawableType = LLPipeline::RENDER_TYPE_PARTICLES; -- cgit v1.2.3 From 71c46bc6299ee27191b5a4610d066ace593f0fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kyler=20=22F=C3=A9lix=22=20Eastridge?= Date: Mon, 9 Sep 2024 06:45:34 -0400 Subject: Fix spelling error in variable name (#2526) --- indra/newview/llvoavatar.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e638e5b8c3..b04bb99b97 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -8444,14 +8444,14 @@ bool LLVOAvatar::isFullyLoaded() const bool LLVOAvatar::isTooComplex() const { bool too_complex; - static LLCachedControl compelxity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); - bool render_friend = (isBuddy() && compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY); + static LLCachedControl complexity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); + bool render_friend = (isBuddy() && complexity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY); if (isSelf() || render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER) { too_complex = false; } - else if (compelxity_render_mode == AV_RENDER_ONLY_SHOW_FRIENDS && !mIsControlAvatar) + else if (complexity_render_mode == AV_RENDER_ONLY_SHOW_FRIENDS && !mIsControlAvatar) { too_complex = true; } @@ -8479,16 +8479,16 @@ bool LLVOAvatar::isTooSlow() const return mTooSlow; } - static LLCachedControl compelxity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); + static LLCachedControl complexity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); static LLCachedControl friends_only(gSavedSettings, "RenderAvatarFriendsOnly", false); bool is_friend = isBuddy(); - bool render_friend = is_friend && compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY; + bool render_friend = is_friend && complexity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY; if (render_friend || mVisuallyMuteSetting == AV_ALWAYS_RENDER) { return false; } - else if (compelxity_render_mode == AV_RENDER_ONLY_SHOW_FRIENDS) + else if (complexity_render_mode == AV_RENDER_ONLY_SHOW_FRIENDS) { return true; } @@ -8504,7 +8504,7 @@ bool LLVOAvatar::isTooSlow() const void LLVOAvatar::updateTooSlow() { LL_PROFILE_ZONE_SCOPED_CATEGORY_AVATAR; - static LLCachedControl compelxity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); + static LLCachedControl complexity_render_mode(gSavedSettings, "RenderAvatarComplexityMode"); static LLCachedControl allowSelfImpostor(gSavedSettings, "AllowSelfImpostor"); const auto id = getID(); @@ -8537,14 +8537,14 @@ void LLVOAvatar::updateTooSlow() if(!mTooSlowWithoutShadows) // if we were not previously above the full impostor cap { - bool always_render_friends = compelxity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY; + bool always_render_friends = complexity_render_mode > AV_RENDER_LIMIT_BY_COMPLEXITY; bool render_friend_or_exception = (always_render_friends && isBuddy()) || ( getVisualMuteSettings() == LLVOAvatar::AV_ALWAYS_RENDER ); if( (!isSelf() || allowSelfImpostor) && !render_friend_or_exception) { // Note: slow rendering Friends still get their shadows zapped. mTooSlowWithoutShadows = (getGPURenderTime()*2.f >= max_art_ms) // NOTE: assumes shadow rendering doubles render time - || (compelxity_render_mode == AV_RENDER_ONLY_SHOW_FRIENDS && !mIsControlAvatar); + || (complexity_render_mode == AV_RENDER_ONLY_SHOW_FRIENDS && !mIsControlAvatar); } } } -- cgit v1.2.3 From 782facee39a62567d958ad85c42cb4c43de603ab Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Mon, 9 Sep 2024 14:26:00 +0300 Subject: Reduce 'World map' floater draw time --- indra/newview/llfloaterworldmap.cpp | 4 +-- indra/newview/llworldmapview.cpp | 69 +++++++++++++++++++++---------------- indra/newview/llworldmapview.h | 1 + 3 files changed, 42 insertions(+), 32 deletions(-) diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index fc2cfbcf2b..30ed723db6 100755 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -1773,8 +1773,8 @@ void LLFloaterWorldMap::onCommitSearchResult() } LLStringUtil::toLower(sim_name); - std::map::const_iterator it; - for (it = LLWorldMap::getInstance()->getRegionMap().begin(); it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) + LLWorldMap::sim_info_map_t::const_iterator end = LLWorldMap::instance().getRegionMap().end(); + for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin(); it != end; ++it) { LLSimInfo* info = it->second; diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index 4757bd42e0..ca854ac7f7 100755 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -186,6 +186,7 @@ LLWorldMapView::LLWorldMapView() : mMouseDownY(0), mSelectIDStart(0), mMapScale(0.f), + mMapRatio(0.5), mTargetMapScale(0.f), mMapIterpTime(MAP_ITERP_TIME_CONSTANT) { @@ -285,7 +286,9 @@ void LLWorldMapView::setScale(F32 scale, bool snap) { mMapScale = 0.1f; } + mMapRatio = mMapScale / REGION_WIDTH_METERS; mMapIterpTime = MAP_ITERP_TIME_CONSTANT; + F32 ratio = (scale / old_scale); mPanX *= ratio; mPanY *= ratio; @@ -359,6 +362,7 @@ bool is_agent_in_region(LLViewerRegion* region, LLSimInfo* info) void LLWorldMapView::draw() { + LL_PROFILE_ZONE_SCOPED; static LLUIColor map_track_color = LLUIColorTable::instance().getColor("MapTrackColor", LLColor4::white); LLTextureView::clearDebugImages(); @@ -412,8 +416,9 @@ void LLWorldMapView::draw() drawMipmap(width, height); // Draw per sim overlayed information (names, mature, offline...) - for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin(); - it != LLWorldMap::getInstance()->getRegionMap().end(); ++it) + static LLCachedControl show_for_sale(gSavedSettings, "MapShowLandForSale"); + LLWorldMap::sim_info_map_t::const_iterator end = LLWorldMap::instance().getRegionMap().end(); + for (LLWorldMap::sim_info_map_t::const_iterator it = LLWorldMap::getInstance()->getRegionMap().begin(); it != end; ++it) { U64 handle = it->first; LLSimInfo* info = it->second; @@ -422,8 +427,8 @@ void LLWorldMapView::draw() // Find x and y position relative to camera's center. LLVector3d rel_region_pos = origin_global - camera_global; - F32 relative_x = (F32)(rel_region_pos.mdV[0] / REGION_WIDTH_METERS) * mMapScale; - F32 relative_y = (F32)(rel_region_pos.mdV[1] / REGION_WIDTH_METERS) * mMapScale; + F32 relative_x = (F32)(rel_region_pos.mdV[0] * mMapRatio); + F32 relative_y = (F32)(rel_region_pos.mdV[1] * mMapRatio); // Coordinates of the sim in pixels in the UI panel // When the view isn't panned, 0,0 = center of rectangle @@ -464,7 +469,7 @@ void LLWorldMapView::draw() gGL.vertex2f(right, top); gGL.end(); } - else if (gSavedSettings.getBOOL("MapShowLandForSale") && (level <= DRAW_LANDFORSALE_THRESHOLD)) + else if (show_for_sale && (level <= DRAW_LANDFORSALE_THRESHOLD)) { // Draw the overlay image "Land for Sale / Land for Auction" LLViewerFetchedTexture* overlayimage = info->getLandForSaleImage(); @@ -500,7 +505,6 @@ void LLWorldMapView::draw() // Draw the region name in the lower left corner if (mMapScale >= DRAW_TEXT_THRESHOLD) { - LLFontGL* font = LLFontGL::getFont(LLFontDescriptor("SansSerif", "Small", LLFontGL::BOLD)); std::string mesg; if (info->isDown()) { @@ -512,7 +516,7 @@ void LLWorldMapView::draw() } if (!mesg.empty()) { - font->renderUTF8( + LLFontGL::getFontSansSerifSmallBold()->renderUTF8( mesg, 0, (F32)llfloor(left + 3), (F32)llfloor(bottom + 2), LLColor4::white, @@ -525,13 +529,19 @@ void LLWorldMapView::draw() } } + static LLCachedControl show_infohubs(gSavedSettings, "MapShowInfohubs"); + static LLCachedControl show_telehubs(gSavedSettings, "MapShowTelehubs"); + static LLCachedControl show_events(gSavedSettings, "MapShowEvents"); + static LLCachedControl show_mature_events(gSavedSettings, "ShowMatureEvents"); + static LLCachedControl show_adult_events(gSavedSettings, "ShowAdultEvents"); + // Draw item infos if we're not zoomed out too much and there's something to draw - if ((level <= DRAW_SIMINFO_THRESHOLD) && (gSavedSettings.getBOOL("MapShowInfohubs") || - gSavedSettings.getBOOL("MapShowTelehubs") || - gSavedSettings.getBOOL("MapShowLandForSale") || - gSavedSettings.getBOOL("MapShowEvents") || - gSavedSettings.getBOOL("ShowMatureEvents") || - gSavedSettings.getBOOL("ShowAdultEvents"))) + if ((level <= DRAW_SIMINFO_THRESHOLD) && (show_infohubs || + show_telehubs || + show_for_sale || + show_events || + show_mature_events || + show_adult_events)) { drawItems(); } @@ -828,11 +838,12 @@ void LLWorldMapView::drawImageStack(const LLVector3d& global_pos, LLUIImagePtr i void LLWorldMapView::drawItems() { - bool mature_enabled = gAgent.canAccessMature(); - bool adult_enabled = gAgent.canAccessAdult(); - - bool show_mature = mature_enabled && gSavedSettings.getBOOL("ShowMatureEvents"); - bool show_adult = adult_enabled && gSavedSettings.getBOOL("ShowAdultEvents"); + static LLCachedControl show_infohubs(gSavedSettings, "MapShowInfohubs"); + static LLCachedControl show_telehubs(gSavedSettings, "MapShowTelehubs"); + static LLCachedControl show_events(gSavedSettings, "MapShowEvents"); + static LLCachedControl show_mature_events(gSavedSettings, "ShowMatureEvents"); + static LLCachedControl show_adult_events(gSavedSettings, "ShowAdultEvents"); + static LLCachedControl show_for_sale(gSavedSettings, "MapShowLandForSale"); for (handle_list_t::iterator iter = mVisibleRegions.begin(); iter != mVisibleRegions.end(); ++iter) { @@ -843,17 +854,17 @@ void LLWorldMapView::drawItems() continue; } // Infohubs - if (gSavedSettings.getBOOL("MapShowInfohubs")) + if (show_infohubs) { drawGenericItems(info->getInfoHub(), sInfohubImage); } // Telehubs - if (gSavedSettings.getBOOL("MapShowTelehubs")) + if (show_telehubs) { drawGenericItems(info->getTeleHub(), sTelehubImage); } // Land for sale - if (gSavedSettings.getBOOL("MapShowLandForSale")) + if (show_for_sale) { drawGenericItems(info->getLandForSale(), sForSaleImage); // for 1.23, we're showing normal land and adult land in the same UI; you don't @@ -865,17 +876,17 @@ void LLWorldMapView::drawItems() } } // PG Events - if (gSavedSettings.getBOOL("MapShowEvents")) + if (show_events) { drawGenericItems(info->getPGEvent(), sEventImage); } // Mature Events - if (show_mature) + if (show_mature_events && gAgent.canAccessMature()) { drawGenericItems(info->getMatureEvent(), sEventMatureImage); } // Adult Events - if (show_adult) + if (show_adult_events && gAgent.canAccessAdult()) { drawGenericItems(info->getAdultEvent(), sEventAdultImage); } @@ -910,14 +921,12 @@ void LLWorldMapView::drawAgents() void LLWorldMapView::drawFrustum() { // Draw frustum - F32 meters_to_pixels = mMapScale/ REGION_WIDTH_METERS; - F32 horiz_fov = LLViewerCamera::getInstance()->getView() * LLViewerCamera::getInstance()->getAspect(); F32 far_clip_meters = LLViewerCamera::getInstance()->getFar(); - F32 far_clip_pixels = far_clip_meters * meters_to_pixels; + F32 far_clip_pixels = far_clip_meters * mMapRatio; F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 ); - F32 half_width_pixels = half_width_meters * meters_to_pixels; + F32 half_width_pixels = half_width_meters * mMapRatio; // Compute the frustum coordinates. Take the UI scale into account. F32 ctr_x = ((getLocalRect().getWidth() * 0.5f + mPanX) * LLUI::getScaleFactor().mV[VX]); @@ -978,8 +987,8 @@ LLVector3 LLWorldMapView::globalPosToView( const LLVector3d& global_pos ) LLVector3 pos_local; pos_local.setVec(relative_pos_global); // convert to floats from doubles - pos_local.mV[VX] *= mMapScale / REGION_WIDTH_METERS; - pos_local.mV[VY] *= mMapScale / REGION_WIDTH_METERS; + pos_local.mV[VX] *= mMapRatio; + pos_local.mV[VY] *= mMapRatio; // leave Z component in meters diff --git a/indra/newview/llworldmapview.h b/indra/newview/llworldmapview.h index ebc9c6d738..d4857113f2 100644 --- a/indra/newview/llworldmapview.h +++ b/indra/newview/llworldmapview.h @@ -210,6 +210,7 @@ private: F32 mMapScale; F32 mTargetMapScale; + F32 mMapRatio; static F32 sMapScaleSetting; static LLVector2 sZoomPivot; static LLFrameTimer sZoomTimer; -- cgit v1.2.3 From 9d8376071a9c943613a2f6e4fdc3e681e36b7fdb Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Mon, 9 Sep 2024 11:52:16 -0700 Subject: Callback button for groups was not being reenabled after hanging up on group call. For #2532, callback button was remaining disabled after hanging up on a group call. Also, fix an issue where user was automatically added to a group call after the initiator of the group call hangs up and re-calls the group. --- indra/newview/llfloaterimsessiontab.cpp | 8 +++----- indra/newview/llimview.cpp | 15 ++++++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp index 00e7dae657..fe0916bf15 100644 --- a/indra/newview/llfloaterimsessiontab.cpp +++ b/indra/newview/llfloaterimsessiontab.cpp @@ -450,7 +450,8 @@ void LLFloaterIMSessionTab::enableDisableCallBtn() else { // We allow to start call from this state only - if (mSession->mVoiceChannel->getState() == LLVoiceChannel::STATE_NO_CHANNEL_INFO && + if (mSession->mVoiceChannel && + !mSession->mVoiceChannel->callStarted() && LLVoiceClient::instanceExists()) { LLVoiceClient* client = LLVoiceClient::getInstance(); @@ -494,10 +495,7 @@ void LLFloaterIMSessionTab::onCallButtonClicked() } else { - LLVoiceChannel::EState channel_state = mSession && mSession->mVoiceChannel ? - mSession->mVoiceChannel->getState() : LLVoiceChannel::STATE_NO_CHANNEL_INFO; - // We allow to start call from this state only - if (channel_state == LLVoiceChannel::STATE_NO_CHANNEL_INFO) + if (mSession->mVoiceChannel && !mSession->mVoiceChannel->callStarted()) { gIMMgr->startCall(mSessionID); } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 136b59f3a6..06cf9919b6 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -390,11 +390,11 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg) } else { - LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); + LLAvatarNameCache::get(participant_id, boost::bind(&on_avatar_name_cache_toast, _1, _2, msg)); + } + } } } -} - } if (store_dnd_message) { // If in DND mode, allow notification to be stored so upon DND exit @@ -4178,11 +4178,16 @@ public: } if (input["body"]["info"].has("voice_channel_info")) { + // new voice channel info incoming, update and re-activate call + // if currently in a call. LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(session_id); if (session) { - session->initVoiceChannel(input["body"]["info"]["voice_channel_info"]); - session->mVoiceChannel->activate(); + if (session->mVoiceChannel && session->mVoiceChannel->callStarted()) + { + session->initVoiceChannel(input["body"]["info"]["voice_channel_info"]); + session->mVoiceChannel->activate(); + } } } } -- cgit v1.2.3 From 5f99c475dc89bd6293d157e85ad67cf6c832f578 Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Mon, 9 Sep 2024 15:12:40 -0700 Subject: Voice bars of self and as seen by others do not appear the same. The voice server sends up the float power level of peers as an integer multiplied by 128, in order to save character count as the voice power level will likely be only 3 digits, instead of many for a full float. The client was not taking this into account. --- indra/newview/llvoicewebrtc.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 4528b57061..7de8cf9cb1 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2983,7 +2983,9 @@ void LLVoiceWebRTCConnection::OnDataReceivedImpl(const std::string &data, bool b // we got a 'power' update. if (participant_obj.contains("p") && participant_obj["p"].is_number()) { - participant->mLevel = (F32)participant_obj["p"].as_int64(); + // server sends up power as an integer which is level * 128 to save + // character count. + participant->mLevel = (F32)participant_obj["p"].as_int64()/128.0f; } if (participant_obj.contains("v") && participant_obj["v"].is_bool()) -- cgit v1.2.3 From 761a4fa4291b4cbef0b2056c6a0b1f449c0cb4bf Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 10 Sep 2024 13:54:38 +0200 Subject: Clean up llviewermenu --- indra/newview/llselectmgr.cpp | 16 +- indra/newview/lltoolselect.cpp | 7 +- indra/newview/llviewermenu.cpp | 695 ++++++++++++++----------------------- indra/newview/llviewermenu.h | 53 +-- indra/newview/llviewermenufile.cpp | 4 +- indra/newview/pipeline.cpp | 1 - 6 files changed, 274 insertions(+), 502 deletions(-) diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 342048252f..51da051340 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -103,20 +103,12 @@ LLViewerObject* getSelectedParentObject(LLViewerObject *object) ; // Consts // -const F32 SILHOUETTE_UPDATE_THRESHOLD_SQUARED = 0.02f; -const S32 MAX_SILS_PER_FRAME = 50; -const S32 MAX_OBJECTS_PER_PACKET = 254; +constexpr F32 SILHOUETTE_UPDATE_THRESHOLD_SQUARED = 0.02f; +constexpr S32 MAX_SILS_PER_FRAME = 50; +constexpr S32 MAX_OBJECTS_PER_PACKET = 254; // For linked sets -const S32 MAX_CHILDREN_PER_TASK = 255; +constexpr S32 MAX_CHILDREN_PER_TASK = 255; -// -// Globals -// - -//bool gDebugSelectMgr = false; - -//bool gHideSelectedObjects = false; -//bool gAllowSelectAvatar = false; bool LLSelectMgr::sRectSelectInclusive = true; bool LLSelectMgr::sRenderHiddenSelections = true; diff --git a/indra/newview/lltoolselect.cpp b/indra/newview/lltoolselect.cpp index cc04f9e3fc..5ccda7d4eb 100644 --- a/indra/newview/lltoolselect.cpp +++ b/indra/newview/lltoolselect.cpp @@ -48,11 +48,8 @@ #include "llvoavatarself.h" #include "llworld.h" -// Globals -//extern bool gAllowSelectAvatar; - -const F32 SELECTION_ROTATION_TRESHOLD = 0.1f; -const F32 SELECTION_SITTING_ROTATION_TRESHOLD = 3.2f; //radian +constexpr F32 SELECTION_ROTATION_TRESHOLD = 0.1f; +constexpr F32 SELECTION_SITTING_ROTATION_TRESHOLD = 3.2f; //radian LLToolSelect::LLToolSelect( LLToolComposite* composite ) : LLTool( std::string("Select"), composite ), diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index d8c4e03d93..df60130c9f 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -154,27 +154,18 @@ typedef LLPointer LLViewerObjectPtr; static boost::unordered_map sDefaultItemLabels; -bool enable_land_build(void*); -bool enable_object_build(void*); +LLVOAvatar* find_avatar_from_object(LLViewerObject* object); +LLVOAvatar* find_avatar_from_object(const LLUUID& object_id); -LLVOAvatar* find_avatar_from_object( LLViewerObject* object ); -LLVOAvatar* find_avatar_from_object( const LLUUID& object_id ); - -void handle_test_load_url(void*); +void handle_test_load_url(); // // Evil hackish imported globals -//extern bool gHideSelectedObjects; -//extern bool gAllowSelectAvatar; -//extern bool gDebugAvatarRotation; extern bool gDebugClicks; extern bool gDebugWindowProc; extern bool gShaderProfileFrame; -//extern bool gDebugTextEditorTips; -//extern bool gDebugSelectMgr; - // // Globals // @@ -214,24 +205,22 @@ LLContextMenu* gDetachBodyPartPieMenus[9]; // Local prototypes // File Menu -void handle_compress_image(void*); -void handle_compress_file_test(void*); +void handle_compress_image(); +void handle_compress_file_test(); // Edit menu -void handle_dump_group_info(void *); -void handle_dump_capabilities_info(void *); +void handle_dump_group_info(); +void handle_dump_capabilities_info(); // Advanced->Consoles menu -void handle_region_dump_settings(void*); -void handle_region_dump_temp_asset_data(void*); -void handle_region_clear_temp_asset_data(void*); +void handle_region_dump_settings(); +void handle_region_dump_temp_asset_data(); +void handle_region_clear_temp_asset_data(); // Object pie menu bool sitting_on_selection(); -void near_sit_object(); -//void label_sit_or_stand(std::string& label, void*); // buy and take alias into the same UI positions, so these // declarations handle this mess. bool is_selection_buy_not_take(); @@ -246,107 +235,99 @@ void handle_buy_object(LLSaleInfo sale_info); void handle_buy_contents(LLSaleInfo sale_info); // Land pie menu -void near_sit_down_point(bool success, void *); - -// Avatar pie menu +void near_sit_down_point(bool success, void*); // Debug menu - - -void velocity_interpolate( void* ); -void handle_visual_leak_detector_toggle(void*); -void handle_rebake_textures(void*); -bool check_admin_override(void*); -void handle_admin_override_toggle(void*); +void handle_visual_leak_detector_toggle(); +void handle_rebake_textures(); +bool check_admin_override(); +void handle_admin_override_toggle(); #ifdef TOGGLE_HACKED_GODLIKE_VIEWER -void handle_toggle_hacked_godmode(void*); -bool check_toggle_hacked_godmode(void*); -bool enable_toggle_hacked_godmode(void*); +void handle_toggle_hacked_godmode(); +bool check_toggle_hacked_godmode(); +bool enable_toggle_hacked_godmode(); #endif -void toggle_show_xui_names(void *); -bool check_show_xui_names(void *); +void toggle_show_xui_names(); +bool check_show_xui_names(); // Debug UI -void handle_buy_currency_test(void*); +void handle_buy_currency_test(); -void handle_god_mode(void*); +void handle_god_mode(); // God menu -void handle_leave_god_mode(void*); +void handle_leave_god_mode(); void handle_reset_view(); -void handle_duplicate_in_place(void*); - -void handle_object_owner_self(void*); -void handle_object_owner_permissive(void*); -void handle_object_lock(void*); -void handle_object_asset_ids(void*); -void force_take_copy(void*); - -void handle_force_parcel_owner_to_me(void*); -void handle_force_parcel_to_content(void*); -void handle_claim_public_land(void*); - -void handle_god_request_avatar_geometry(void *); // Hack for easy testing of new avatar geometry -void reload_vertex_shader(void *); -void handle_disconnect_viewer(void *); - -void force_error_breakpoint(void *); -void force_error_llerror(void *); -void force_error_llerror_msg(void*); -void force_error_bad_memory_access(void *); -void force_error_infinite_loop(void *); -void force_error_software_exception(void *); -void force_error_os_exception(void*); -void force_error_driver_crash(void *); -void force_error_coroutine_crash(void *); -void force_error_thread_crash(void *); - -void handle_force_delete(void*); -void print_object_info(void*); -void print_agent_nvpairs(void*); -void toggle_debug_menus(void*); +void handle_object_owner_self(); +void handle_object_owner_permissive(); +void handle_object_lock(); +void handle_object_asset_ids(); +void force_take_copy(); + +void handle_force_parcel_owner_to_me(); +void handle_force_parcel_to_content(); +void handle_claim_public_land(); + +void handle_god_request_avatar_geometry(); // Hack for easy testing of new avatar geometry +void reload_vertex_shader(); +void handle_disconnect_viewer(); + +void force_error_breakpoint(); +void force_error_llerror(); +void force_error_llerror_msg(); +void force_error_bad_memory_access(); +void force_error_infinite_loop(); +void force_error_software_exception(); +void force_error_os_exception(); +void force_error_driver_crash(); +void force_error_coroutine_crash(); +void force_error_thread_crash(); + +void handle_force_delete(); +void print_object_info(); +void print_agent_nvpairs(); void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExtStat ext_status); -void dump_select_mgr(void*); +void dump_select_mgr(); -void dump_inventory(void*); -void toggle_visibility(void*); -bool get_visibility(void*); +void dump_inventory(); +void toggle_visibility(LLView* viewp); +bool get_visibility(LLView* viewp); // Avatar Pie menu void request_friendship(const LLUUID& agent_id); // Tools menu -void handle_selected_texture_info(void*); +void handle_selected_texture_info(); void handle_selected_material_info(); -void handle_dump_followcam(void*); -void handle_viewer_enable_message_log(void*); -void handle_viewer_disable_message_log(void*); +void handle_dump_followcam(); +void handle_viewer_enable_message_log(); +void handle_viewer_disable_message_log(); -bool enable_buy_land(void*); +bool enable_buy_land(); // Help menu -void handle_test_male(void *); -void handle_test_female(void *); -void handle_dump_attachments(void *); -void handle_dump_avatar_local_textures(void*); -void handle_debug_avatar_textures(void*); -void handle_grab_baked_texture(void*); -bool enable_grab_baked_texture(void*); -void handle_dump_region_object_cache(void*); -void handle_reset_interest_lists(void *); +void handle_test_male(); +void handle_test_female(); +void handle_dump_attachments(); +void handle_dump_avatar_local_textures(); +void handle_debug_avatar_textures(); +void handle_grab_baked_texture(EBakedTextureIndex baked_tex_index); +bool enable_grab_baked_texture(EBakedTextureIndex baked_tex_index); +void handle_dump_region_object_cache(); +void handle_reset_interest_lists(); -bool enable_save_into_task_inventory(void*); +bool enable_save_into_task_inventory(); bool enable_detach(const LLSD& = LLSD()); -void menu_toggle_attached_lights(void* user_data); -void menu_toggle_attached_particles(void* user_data); +void menu_toggle_attached_lights(); +void menu_toggle_attached_particles(); class LLMenuParcelObserver : public LLParcelObserver { @@ -383,12 +364,12 @@ void LLMenuParcelObserver::changed() if (!mLandBuyPassHandle.isDead()) { LLParcel *parcel = LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(); - static_cast(mLandBuyPassHandle.get())->setEnabled(LLPanelLandGeneral::enableBuyPass(NULL) && !(parcel->getOwnerID() == gAgent.getID())); + static_cast(mLandBuyPassHandle.get())->setEnabled(LLPanelLandGeneral::enableBuyPass(nullptr) && parcel->getOwnerID() != gAgentID); } if (!mLandBuyHandle.isDead()) { - bool buyable = enable_buy_land(NULL); + bool buyable = enable_buy_land(); static_cast(mLandBuyHandle.get())->setEnabled(buyable); } } @@ -444,7 +425,7 @@ void LLSLMMenuUpdater::setMerchantMenu() if (marketplacelistings_id.isNull()) { U32 mkt_status = LLMarketplaceData::instance().getSLMStatus(); - bool is_merchant = (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT) || (mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MIGRATED_MERCHANT); + bool is_merchant = mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MERCHANT || mkt_status == MarketplaceStatusCodes::MARKET_PLACE_MIGRATED_MERCHANT; if (is_merchant) { gInventory.ensureCategoryForTypeExists(LLFolderType::FT_MARKETPLACE_LISTINGS); @@ -476,12 +457,14 @@ void LLSLMMenuUpdater::checkMerchantStatus(bool force) void set_merchant_SLM_menu() { - if(gSLMMenuUpdater) gSLMMenuUpdater->setMerchantMenu(); + if (gSLMMenuUpdater) + gSLMMenuUpdater->setMerchantMenu(); } void check_merchant_status(bool force) { - if(gSLMMenuUpdater) gSLMMenuUpdater->checkMerchantStatus(force); + if (gSLMMenuUpdater) + gSLMMenuUpdater->checkMerchantStatus(force); } void init_menus() @@ -623,11 +606,11 @@ class LLAdvancedToggleConsole : public view_listener_t std::string console_type = userdata.asString(); if ("texture" == console_type) { - toggle_visibility( (void*)gTextureView ); + toggle_visibility(gTextureView); } else if ("debug" == console_type) { - toggle_visibility( (void*)static_cast(gDebugView->mDebugConsolep)); + toggle_visibility(gDebugView->mDebugConsolep); } else if ("fast timers" == console_type) { @@ -635,11 +618,11 @@ class LLAdvancedToggleConsole : public view_listener_t } else if ("scene view" == console_type) { - toggle_visibility( (void*)gSceneView); + toggle_visibility(gSceneView); } else if ("scene monitor" == console_type) { - toggle_visibility( (void*)gSceneMonitorView); + toggle_visibility(gSceneMonitorView); } return true; @@ -653,11 +636,11 @@ class LLAdvancedCheckConsole : public view_listener_t bool new_value = false; if ("texture" == console_type) { - new_value = get_visibility( (void*)gTextureView ); + new_value = get_visibility(gTextureView); } else if ("debug" == console_type) { - new_value = get_visibility( (void*)((LLView*)gDebugView->mDebugConsolep) ); + new_value = get_visibility(gDebugView->mDebugConsolep); } else if ("fast timers" == console_type) { @@ -665,11 +648,11 @@ class LLAdvancedCheckConsole : public view_listener_t } else if ("scene view" == console_type) { - new_value = get_visibility( (void*) gSceneView); + new_value = get_visibility(gSceneView); } else if ("scene monitor" == console_type) { - new_value = get_visibility( (void*) gSceneMonitorView); + new_value = get_visibility(gSceneMonitorView); } return new_value; @@ -690,15 +673,15 @@ class LLAdvancedDumpInfoToConsole : public view_listener_t std::string info_type = userdata.asString(); if ("region" == info_type) { - handle_region_dump_settings(NULL); + handle_region_dump_settings(); } else if ("group" == info_type) { - handle_dump_group_info(NULL); + handle_dump_group_info(); } else if ("capabilities" == info_type) { - handle_dump_capabilities_info(NULL); + handle_dump_capabilities_info(); } return true; } @@ -771,7 +754,7 @@ class LLAdvancedClearGroupCache : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLGroupMgr::debugClearAllGroups(NULL); + LLGroupMgr::debugClearAllGroups(nullptr); return true; } }; @@ -782,7 +765,7 @@ class LLAdvancedClearGroupCache : public view_listener_t ///////////////// // RENDER TYPE // ///////////////// -U32 render_type_from_string(std::string render_type) +U32 render_type_from_string(std::string_view render_type) { if ("simple" == render_type) { @@ -901,7 +884,7 @@ class LLAdvancedCheckRenderType : public view_listener_t ///////////// // FEATURE // ///////////// -U32 feature_from_string(std::string feature) +U32 feature_from_string(std::string_view feature) { if ("ui" == feature) { @@ -1042,7 +1025,7 @@ class LLAdvancedSetDisplayTextureDensity : public view_listener_t ////////////////// // INFO DISPLAY // ////////////////// -U64 info_display_from_string(std::string info_display) +U64 info_display_from_string(std::string_view info_display) { if ("verify" == info_display) { @@ -1271,7 +1254,7 @@ class LLAdvancedSelectedTextureInfo : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_selected_texture_info(NULL); + handle_selected_texture_info(); return true; } }; @@ -1307,7 +1290,7 @@ class LLAdvancedDumpScriptedCamera : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_dump_followcam(NULL); + handle_dump_followcam(); return true; } }; @@ -1323,7 +1306,7 @@ class LLAdvancedDumpRegionObjectCache : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_dump_region_object_cache(NULL); + handle_dump_region_object_cache(); return true; } }; @@ -1382,7 +1365,7 @@ class LLAdvancedResetInterestLists : public view_listener_t { bool handleEvent(const LLSD &userdata) { // Reset all region interest lists - handle_reset_interest_lists(NULL); + handle_reset_interest_lists(); return true; } }; @@ -1451,7 +1434,7 @@ class LLAdvancedBuyCurrencyTest : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_buy_currency_test(NULL); + handle_buy_currency_test(); return true; } }; @@ -1466,7 +1449,7 @@ class LLAdvancedDumpSelectMgr : public view_listener_t { bool handleEvent(const LLSD& userdata) { - dump_select_mgr(NULL); + dump_select_mgr(); return true; } }; @@ -1482,7 +1465,7 @@ class LLAdvancedDumpInventory : public view_listener_t { bool handleEvent(const LLSD& userdata) { - dump_inventory(NULL); + dump_inventory(); return true; } }; @@ -1498,7 +1481,7 @@ class LLAdvancedPrintSelectedObjectInfo : public view_listener_t { bool handleEvent(const LLSD& userdata) { - print_object_info(NULL); + print_object_info(); return true; } }; @@ -1514,7 +1497,7 @@ class LLAdvancedPrintAgentInfo : public view_listener_t { bool handleEvent(const LLSD& userdata) { - print_agent_nvpairs(NULL); + print_agent_nvpairs(); return true; } }; @@ -1627,7 +1610,7 @@ class LLAdvancedToggleXUINameTooltips : public view_listener_t { bool handleEvent(const LLSD& userdata) { - toggle_show_xui_names(NULL); + toggle_show_xui_names(); return true; } }; @@ -1636,7 +1619,7 @@ class LLAdvancedCheckXUINameTooltips : public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = check_show_xui_names(NULL); + bool new_value = check_show_xui_names(); return new_value; } }; @@ -1737,7 +1720,7 @@ class LLAdvancedToggleXUINames : public view_listener_t { bool handleEvent(const LLSD& userdata) { - toggle_show_xui_names(NULL); + toggle_show_xui_names(); return true; } }; @@ -1746,7 +1729,7 @@ class LLAdvancedCheckXUINames : public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = check_show_xui_names(NULL); + bool new_value = check_show_xui_names(); return new_value; } }; @@ -1764,27 +1747,27 @@ class LLAdvancedGrabBakedTexture : public view_listener_t std::string texture_type = userdata.asString(); if ("iris" == texture_type) { - handle_grab_baked_texture( (void*)BAKED_EYES ); + handle_grab_baked_texture(BAKED_EYES); } else if ("head" == texture_type) { - handle_grab_baked_texture( (void*)BAKED_HEAD ); + handle_grab_baked_texture(BAKED_HEAD); } else if ("upper" == texture_type) { - handle_grab_baked_texture( (void*)BAKED_UPPER ); + handle_grab_baked_texture(BAKED_UPPER); } else if ("lower" == texture_type) { - handle_grab_baked_texture( (void*)BAKED_LOWER ); + handle_grab_baked_texture(BAKED_LOWER); } else if ("skirt" == texture_type) { - handle_grab_baked_texture( (void*)BAKED_SKIRT ); + handle_grab_baked_texture(BAKED_SKIRT); } else if ("hair" == texture_type) { - handle_grab_baked_texture( (void*)BAKED_HAIR ); + handle_grab_baked_texture(BAKED_HAIR); } return true; @@ -1800,27 +1783,27 @@ class LLAdvancedEnableGrabBakedTexture : public view_listener_t if ("iris" == texture_type) { - new_value = enable_grab_baked_texture( (void*)BAKED_EYES ); + new_value = enable_grab_baked_texture(BAKED_EYES); } else if ("head" == texture_type) { - new_value = enable_grab_baked_texture( (void*)BAKED_HEAD ); + new_value = enable_grab_baked_texture(BAKED_HEAD); } else if ("upper" == texture_type) { - new_value = enable_grab_baked_texture( (void*)BAKED_UPPER ); + new_value = enable_grab_baked_texture(BAKED_UPPER); } else if ("lower" == texture_type) { - new_value = enable_grab_baked_texture( (void*)BAKED_LOWER ); + new_value = enable_grab_baked_texture(BAKED_LOWER); } else if ("skirt" == texture_type) { - new_value = enable_grab_baked_texture( (void*)BAKED_SKIRT ); + new_value = enable_grab_baked_texture(BAKED_SKIRT); } else if ("hair" == texture_type) { - new_value = enable_grab_baked_texture( (void*)BAKED_HAIR ); + new_value = enable_grab_baked_texture(BAKED_HAIR); } return new_value; @@ -1905,7 +1888,7 @@ class LLAdvancedToggleCharacterGeometry : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_god_request_avatar_geometry(NULL); + handle_god_request_avatar_geometry(); return true; } }; @@ -1919,7 +1902,7 @@ class LLAdvancedTestMale : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_test_male(NULL); + handle_test_male(); return true; } }; @@ -1929,7 +1912,7 @@ class LLAdvancedTestFemale : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_test_female(NULL); + handle_test_female(); return true; } }; @@ -1938,7 +1921,7 @@ class LLAdvancedForceParamsToDefault : public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLAgent::clearVisualParams(NULL); + LLAgent::clearVisualParams(nullptr); return true; } }; @@ -2001,7 +1984,7 @@ class LLAdvancedReloadVertexShader : public view_listener_t { bool handleEvent(const LLSD& userdata) { - reload_vertex_shader(NULL); + reload_vertex_shader(); return true; } }; @@ -2165,7 +2148,7 @@ class LLAdvancedDumpAttachments : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_dump_attachments(NULL); + handle_dump_attachments(); return true; } }; @@ -2181,7 +2164,7 @@ class LLAdvancedRebakeTextures : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_rebake_textures(NULL); + handle_rebake_textures(); return true; } }; @@ -2199,7 +2182,7 @@ class LLAdvancedDebugAvatarTextures : public view_listener_t { if (gAgent.isGodlike()) { - handle_debug_avatar_textures(NULL); + handle_debug_avatar_textures(); } return true; } @@ -2215,7 +2198,7 @@ class LLAdvancedDumpAvatarLocalTextures : public view_listener_t bool handleEvent(const LLSD& userdata) { #ifndef LL_RELEASE_FOR_DOWNLOAD - handle_dump_avatar_local_textures(NULL); + handle_dump_avatar_local_textures(); #endif return true; } @@ -2232,7 +2215,7 @@ class LLAdvancedEnableMessageLog : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_viewer_enable_message_log(NULL); + handle_viewer_enable_message_log(); return true; } }; @@ -2241,7 +2224,7 @@ class LLAdvancedDisableMessageLog : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_viewer_disable_message_log(NULL); + handle_viewer_disable_message_log(); return true; } }; @@ -2432,7 +2415,7 @@ class LLAdvancedCompressImage : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_compress_image(NULL); + handle_compress_image(); return true; } }; @@ -2447,7 +2430,7 @@ class LLAdvancedCompressFileTest : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_compress_file_test(NULL); + handle_compress_file_test(); return true; } }; @@ -2488,7 +2471,7 @@ class LLAdvancedToggleViewAdminOptions : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_admin_override_toggle(NULL); + handle_admin_override_toggle(); return true; } }; @@ -2497,7 +2480,7 @@ class LLAdvancedToggleVisualLeakDetector : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_visual_leak_detector_toggle(NULL); + handle_visual_leak_detector_toggle(); return true; } }; @@ -2506,7 +2489,7 @@ class LLAdvancedCheckViewAdminOptions : public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = check_admin_override(NULL) || gAgent.isGodlike(); + bool new_value = check_admin_override() || gAgent.isGodlike(); return new_value; } }; @@ -2520,7 +2503,7 @@ class LLAdvancedRequestAdminStatus : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_god_mode(NULL); + handle_god_mode(); return true; } }; @@ -2529,7 +2512,7 @@ class LLAdvancedLeaveAdminStatus : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_leave_god_mode(NULL); + handle_leave_god_mode(); return true; } }; @@ -2542,7 +2525,7 @@ class LLAdvancedForceErrorBreakpoint : public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_breakpoint(NULL); + force_error_breakpoint(); return true; } }; @@ -2551,7 +2534,7 @@ class LLAdvancedForceErrorLlerror : public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_llerror(NULL); + force_error_llerror(); return true; } }; @@ -2560,7 +2543,7 @@ class LLAdvancedForceErrorLlerrorMsg: public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_llerror_msg(NULL); + force_error_llerror_msg(); return true; } }; @@ -2569,7 +2552,7 @@ class LLAdvancedForceErrorBadMemoryAccess : public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_bad_memory_access(NULL); + force_error_bad_memory_access(); return true; } }; @@ -2584,7 +2567,7 @@ class LLAdvancedForceErrorBadMemoryAccessCoro : public view_listener_t // Wait for one mainloop() iteration, letting the enclosing // handleEvent() method return. llcoro::suspend(); - force_error_bad_memory_access(NULL); + force_error_bad_memory_access(); }); return true; } @@ -2594,7 +2577,7 @@ class LLAdvancedForceErrorInfiniteLoop : public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_infinite_loop(NULL); + force_error_infinite_loop(); return true; } }; @@ -2603,7 +2586,7 @@ class LLAdvancedForceErrorSoftwareException : public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_software_exception(NULL); + force_error_software_exception(); return true; } }; @@ -2612,7 +2595,7 @@ class LLAdvancedForceOSException: public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_os_exception(NULL); + force_error_os_exception(); return true; } }; @@ -2627,7 +2610,7 @@ class LLAdvancedForceErrorSoftwareExceptionCoro : public view_listener_t // Wait for one mainloop() iteration, letting the enclosing // handleEvent() method return. llcoro::suspend(); - force_error_software_exception(NULL); + force_error_software_exception(); }); return true; } @@ -2637,7 +2620,7 @@ class LLAdvancedForceErrorDriverCrash : public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_driver_crash(NULL); + force_error_driver_crash(); return true; } }; @@ -2646,7 +2629,7 @@ class LLAdvancedForceErrorCoroutineCrash : public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_coroutine_crash(NULL); + force_error_coroutine_crash(); return true; } }; @@ -2655,7 +2638,7 @@ class LLAdvancedForceErrorThreadCrash : public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_error_thread_crash(NULL); + force_error_thread_crash(); return true; } }; @@ -2664,7 +2647,7 @@ class LLAdvancedForceErrorDisconnectViewer : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_disconnect_viewer(NULL); + handle_disconnect_viewer(); return true; } }; @@ -2676,7 +2659,7 @@ class LLAdvancedHandleToggleHackedGodmode : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_toggle_hacked_godmode(NULL); + handle_toggle_hacked_godmode(); return true; } }; @@ -2685,7 +2668,7 @@ class LLAdvancedCheckToggleHackedGodmode : public view_listener_t { bool handleEvent(const LLSD& userdata) { - check_toggle_hacked_godmode(NULL); + check_toggle_hacked_godmode(); return true; } }; @@ -2694,7 +2677,7 @@ class LLAdvancedEnableToggleHackedGodmode : public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = enable_toggle_hacked_godmode(NULL); + bool new_value = enable_toggle_hacked_godmode(); return new_value; } }; @@ -2739,7 +2722,7 @@ class LLAdminForceTakeCopy : public view_listener_t { bool handleEvent(const LLSD& userdata) { - force_take_copy(NULL); + force_take_copy(); return true; } }; @@ -2748,7 +2731,7 @@ class LLAdminHandleObjectOwnerSelf : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_object_owner_self(NULL); + handle_object_owner_self(); return true; } }; @@ -2756,7 +2739,7 @@ class LLAdminHandleObjectOwnerPermissive : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_object_owner_permissive(NULL); + handle_object_owner_permissive(); return true; } }; @@ -2765,7 +2748,7 @@ class LLAdminHandleForceDelete : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_force_delete(NULL); + handle_force_delete(); return true; } }; @@ -2774,7 +2757,7 @@ class LLAdminHandleObjectLock : public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_object_lock(NULL); + handle_object_lock(); return true; } }; @@ -2783,7 +2766,7 @@ class LLAdminHandleObjectAssetIDs: public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_object_asset_ids(NULL); + handle_object_asset_ids(); return true; } }; @@ -2793,7 +2776,7 @@ class LLAdminHandleForceParcelOwnerToMe: public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_force_parcel_owner_to_me(NULL); + handle_force_parcel_owner_to_me(); return true; } }; @@ -2801,7 +2784,7 @@ class LLAdminHandleForceParcelToContent: public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_force_parcel_to_content(NULL); + handle_force_parcel_to_content(); return true; } }; @@ -2809,7 +2792,7 @@ class LLAdminHandleClaimPublicLand: public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_claim_public_land(NULL); + handle_claim_public_land(); return true; } }; @@ -2819,7 +2802,7 @@ class LLAdminHandleRegionDumpTempAssetData: public view_listener_t { bool handleEvent(const LLSD& userdata) { - handle_region_dump_temp_asset_data(NULL); + handle_region_dump_temp_asset_data(); return true; } }; @@ -2829,7 +2812,7 @@ class LLAdminOnSaveState: public view_listener_t { bool handleEvent(const LLSD& userdata) { - LLPanelRegionTools::onSaveState(NULL); + LLPanelRegionTools::onSaveState(nullptr); return true; } }; @@ -3315,41 +3298,11 @@ class LLLandEnableBuyPass : public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = LLPanelLandGeneral::enableBuyPass(NULL); + bool new_value = LLPanelLandGeneral::enableBuyPass(nullptr); return new_value; } }; -// BUG: Should really check if CLICK POINT is in a parcel where you can build. -bool enable_land_build(void*) -{ - if (gAgent.isGodlike()) return true; - if (gAgent.inPrelude()) return false; - - bool can_build = false; - LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - if (agent_parcel) - { - can_build = agent_parcel->getAllowModify(); - } - return can_build; -} - -// BUG: Should really check if OBJECT is in a parcel where you can build. -bool enable_object_build(void*) -{ - if (gAgent.isGodlike()) return true; - if (gAgent.inPrelude()) return false; - - bool can_build = false; - LLParcel* agent_parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); - if (agent_parcel) - { - can_build = agent_parcel->getAllowModify(); - } - return can_build; -} - bool enable_object_edit() { if (!isAgentAvatarValid()) return false; @@ -3380,12 +3333,6 @@ bool enable_mute_particle() return pick.mParticleOwnerID != LLUUID::null && pick.mParticleOwnerID != gAgent.getID(); } -// mutually exclusive - show either edit option or build in menu -bool enable_object_build() -{ - return !enable_object_edit(); -} - bool enable_object_select_in_pathfinding_linksets() { return LLPathfindingManager::getInstance()->isPathfindingEnabledForCurrentRegion() && LLSelectMgr::getInstance()->selectGetEditableLinksets(); @@ -3484,9 +3431,8 @@ class LLSelfEnableRemoveAllAttachments : public view_listener_t } }; -bool enable_has_attachments(void*) +bool enable_has_attachments() { - return false; } @@ -4092,7 +4038,7 @@ void handle_buy_contents(LLSaleInfo sale_info) LLFloaterBuyContents::show(sale_info); } -void handle_region_dump_temp_asset_data(void*) +void handle_region_dump_temp_asset_data() { LL_INFOS() << "Dumping temporary asset data to simulator logs" << LL_ENDL; std::vector strings; @@ -4100,7 +4046,7 @@ void handle_region_dump_temp_asset_data(void*) send_generic_message("dumptempassetdata", strings, invoice); } -void handle_region_clear_temp_asset_data(void*) +void handle_region_clear_temp_asset_data() { LL_INFOS() << "Clearing temporary asset data" << LL_ENDL; std::vector strings; @@ -4108,7 +4054,7 @@ void handle_region_clear_temp_asset_data(void*) send_generic_message("cleartempassetdata", strings, invoice); } -void handle_region_dump_settings(void*) +void handle_region_dump_settings() { LLViewerRegion* regionp = gAgent.getRegion(); if (regionp) @@ -4124,12 +4070,12 @@ void handle_region_dump_settings(void*) } } -void handle_dump_group_info(void *) +void handle_dump_group_info() { gAgent.dumpGroupInfo(); } -void handle_dump_capabilities_info(void *) +void handle_dump_capabilities_info() { LLViewerRegion* regionp = gAgent.getRegion(); if (regionp) @@ -4138,7 +4084,7 @@ void handle_dump_capabilities_info(void *) } } -void handle_dump_region_object_cache(void*) +void handle_dump_region_object_cache() { LLViewerRegion* regionp = gAgent.getRegion(); if (regionp) @@ -4147,7 +4093,7 @@ void handle_dump_region_object_cache(void*) } } -void handle_reset_interest_lists(void *) +void handle_reset_interest_lists() { // Check all regions and reset their interest list for (LLWorld::region_list_t::const_iterator iter = LLWorld::getInstance()->getRegionList().begin(); @@ -4290,12 +4236,12 @@ class LLTogglePanelPeopleTab : public view_listener_t } }; -bool check_admin_override(void*) +bool check_admin_override() { return gAgent.getAdminOverride(); } -void handle_admin_override_toggle(void*) +void handle_admin_override_toggle() { gAgent.setAdminOverride(!gAgent.getAdminOverride()); @@ -4303,7 +4249,7 @@ void handle_admin_override_toggle(void*) show_debug_menus(); } -void handle_visual_leak_detector_toggle(void*) +void handle_visual_leak_detector_toggle() { static bool vld_enabled = false; @@ -4332,12 +4278,12 @@ void handle_visual_leak_detector_toggle(void*) }; } -void handle_god_mode(void*) +void handle_god_mode() { gAgent.requestEnterGodMode(); } -void handle_leave_god_mode(void*) +void handle_leave_god_mode() { gAgent.requestLeaveGodMode(); } @@ -4384,18 +4330,18 @@ void set_god_level(U8 god_level) } #ifdef TOGGLE_HACKED_GODLIKE_VIEWER -void handle_toggle_hacked_godmode(void*) +void handle_toggle_hacked_godmode() { gHackGodmode = !gHackGodmode; set_god_level(gHackGodmode ? GOD_MAINTENANCE : GOD_NOT); } -bool check_toggle_hacked_godmode(void*) +bool check_toggle_hacked_godmode() { return gHackGodmode; } -bool enable_toggle_hacked_godmode(void*) +bool enable_toggle_hacked_godmode() { return !LLGridManager::getInstance()->isInProductionGrid(); } @@ -4419,41 +4365,6 @@ void process_grant_godlike_powers(LLMessageSystem* msg, void**) } } -/* -class LLHaveCallingcard : public LLInventoryCollectFunctor -{ -public: - LLHaveCallingcard(const LLUUID& agent_id); - virtual ~LLHaveCallingcard() {} - virtual bool operator()(LLInventoryCategory* cat, - LLInventoryItem* item); - bool isThere() const { return mIsThere;} -protected: - LLUUID mID; - bool mIsThere; -}; - -LLHaveCallingcard::LLHaveCallingcard(const LLUUID& agent_id) : - mID(agent_id), - mIsThere(false) -{ -} - -bool LLHaveCallingcard::operator()(LLInventoryCategory* cat, - LLInventoryItem* item) -{ - if(item) - { - if((item->getType() == LLAssetType::AT_CALLINGCARD) - && (item->getCreatorUUID() == mID)) - { - mIsThere = true; - } - } - return false; -} -*/ - bool is_agent_mappable(const LLUUID& agent_id) { const LLRelationship* buddy_info = NULL; @@ -4554,7 +4465,7 @@ bool is_object_sittable() } // only works on pie menu -void handle_object_sit(LLViewerObject *object, const LLVector3 &offset) +void handle_object_sit(LLViewerObject* object, const LLVector3& offset) { // get object selection offset @@ -4603,7 +4514,7 @@ void handle_object_sit(const LLUUID& object_id) handle_object_sit(obj, offset); } -void near_sit_down_point(bool success, void *) +void near_sit_down_point(bool success, void*) { if (success) { @@ -4653,7 +4564,7 @@ class LLLandCanSit : public view_listener_t // // Major mode switching // -void reset_view_final( bool proceed ); +void reset_view_final(bool proceed); void handle_reset_view() { @@ -4663,7 +4574,7 @@ void handle_reset_view() LLFloaterSidePanelContainer::showPanel("appearance", LLSD().with("type", "my_outfits")); } gAgentCamera.setFocusOnAvatar(true, false, false); - reset_view_final( true ); + reset_view_final(true); LLFloaterCamera::resetCameraMode(); } @@ -4677,7 +4588,7 @@ class LLViewResetView : public view_listener_t }; // Note: extra parameters allow this function to be called from dialog. -void reset_view_final( bool proceed ) +void reset_view_final(bool proceed) { if( !proceed ) { @@ -4765,54 +4676,7 @@ class LLViewToggleUI : public view_listener_t } }; -void handle_duplicate_in_place(void*) -{ - LL_INFOS() << "handle_duplicate_in_place" << LL_ENDL; - - LLVector3 offset(0.f, 0.f, 0.f); - LLSelectMgr::getInstance()->selectDuplicate(offset, true); -} - - - -/* - * No longer able to support viewer side manipulations in this way - * -void god_force_inv_owner_permissive(LLViewerObject* object, - LLInventoryObject::object_list_t* inventory, - S32 serial_num, - void*) -{ - typedef std::vector > item_array_t; - item_array_t items; - - LLInventoryObject::object_list_t::const_iterator inv_it = inventory->begin(); - LLInventoryObject::object_list_t::const_iterator inv_end = inventory->end(); - for ( ; inv_it != inv_end; ++inv_it) - { - if(((*inv_it)->getType() != LLAssetType::AT_CATEGORY)) - { - LLInventoryObject* obj = *inv_it; - LLPointer new_item = new LLViewerInventoryItem((LLViewerInventoryItem*)obj); - LLPermissions perm(new_item->getPermissions()); - perm.setMaskBase(PERM_ALL); - perm.setMaskOwner(PERM_ALL); - new_item->setPermissions(perm); - items.push_back(new_item); - } - } - item_array_t::iterator end = items.end(); - item_array_t::iterator it; - for(it = items.begin(); it != end; ++it) - { - // since we have the inventory item in the callback, it should not - // invalidate iteration through the selection manager. - object->updateInventory((*it), TASK_INVENTORY_ITEM_KEY, false); - } -} -*/ - -void handle_object_owner_permissive(void*) +void handle_object_owner_permissive() { // only send this if they're a god. if(gAgent.isGodlike()) @@ -4823,7 +4687,7 @@ void handle_object_owner_permissive(void*) } } -void handle_object_owner_self(void*) +void handle_object_owner_self() { // only send this if they're a god. if(gAgent.isGodlike()) @@ -4833,12 +4697,12 @@ void handle_object_owner_self(void*) } // Shortcut to set owner permissions to not editable. -void handle_object_lock(void*) +void handle_object_lock() { LLSelectMgr::getInstance()->selectionSetObjectPermissions(PERM_OWNER, false, PERM_MODIFY); } -void handle_object_asset_ids(void*) +void handle_object_asset_ids() { // only send this if they're a god. if (gAgent.isGodlike()) @@ -4847,17 +4711,17 @@ void handle_object_asset_ids(void*) } } -void handle_force_parcel_owner_to_me(void*) +void handle_force_parcel_owner_to_me() { LLViewerParcelMgr::getInstance()->sendParcelGodForceOwner( gAgent.getID() ); } -void handle_force_parcel_to_content(void*) +void handle_force_parcel_to_content() { LLViewerParcelMgr::getInstance()->sendParcelGodForceToContent(); } -void handle_claim_public_land(void*) +void handle_claim_public_land() { if (LLViewerParcelMgr::getInstance()->getSelectionRegion() != gAgent.getRegion()) { @@ -4899,7 +4763,7 @@ void handle_claim_public_land(void*) // HACK for easily testing new avatar geometry -void handle_god_request_avatar_geometry(void *) +void handle_god_request_avatar_geometry() { if (gAgent.isGodlike()) { @@ -5169,7 +5033,7 @@ void handle_link_objects() class LLObjectReturn : public view_listener_t { public: - LLObjectReturn() : mFirstRegion(NULL) {} + LLObjectReturn() : mFirstRegion() {} private: bool handleEvent(const LLSD& userdata) @@ -5239,7 +5103,7 @@ class LLObjectEnableReturn : public view_listener_t } }; -void force_take_copy(void*) +void force_take_copy() { if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) return; const LLUUID category_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_OBJECT); @@ -5347,7 +5211,7 @@ void handle_take(bool take_separate) } }); - if(locked_but_takeable_object || + if (locked_but_takeable_object || !you_own_everything) { if(locked_but_takeable_object && you_own_everything) @@ -5930,7 +5794,7 @@ class LLToolsSelectNextPartFace : public view_listener_t { if (gFocusMgr.childHasKeyboardFocus(gFloaterTools)) { - gFocusMgr.setKeyboardFocus(NULL); // force edit toolbox to commit any changes + gFocusMgr.setKeyboardFocus(nullptr); // force edit toolbox to commit any changes } if (fwd || prev) { @@ -6003,7 +5867,7 @@ class LLEditCut : public view_listener_t { bool handleEvent(const LLSD& userdata) { - if( LLEditMenuHandler::gEditMenuHandler ) + if (LLEditMenuHandler::gEditMenuHandler) { LLEditMenuHandler::gEditMenuHandler->cut(); } @@ -6024,7 +5888,7 @@ class LLEditCopy : public view_listener_t { bool handleEvent(const LLSD& userdata) { - if( LLEditMenuHandler::gEditMenuHandler ) + if (LLEditMenuHandler::gEditMenuHandler) { LLEditMenuHandler::gEditMenuHandler->copy(); } @@ -6045,7 +5909,7 @@ class LLEditPaste : public view_listener_t { bool handleEvent(const LLSD& userdata) { - if( LLEditMenuHandler::gEditMenuHandler ) + if (LLEditMenuHandler::gEditMenuHandler) { LLEditMenuHandler::gEditMenuHandler->paste(); } @@ -6068,7 +5932,7 @@ class LLEditDelete : public view_listener_t { // If a text field can do a deletion, it gets precedence over deleting // an object in the world. - if( LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete()) + if (LLEditMenuHandler::gEditMenuHandler && LLEditMenuHandler::gEditMenuHandler->canDoDelete()) { LLEditMenuHandler::gEditMenuHandler->doDelete(); } @@ -6179,7 +6043,7 @@ bool enable_object_delete() class LLObjectsReturnPackage { public: - LLObjectsReturnPackage() : mObjectSelection(), mReturnableObjects(), mError(), mFirstRegion(NULL) {}; + LLObjectsReturnPackage() : mObjectSelection(), mReturnableObjects(), mError(), mFirstRegion(nullptr) {}; ~LLObjectsReturnPackage() { mObjectSelection.clear(); @@ -6236,7 +6100,7 @@ void handle_object_delete() return; } -void handle_force_delete(void*) +void handle_force_delete() { LLSelectMgr::getInstance()->selectForceDelete(); } @@ -6348,12 +6212,12 @@ class LLEditRedo : public view_listener_t -void print_object_info(void*) +void print_object_info() { LLSelectMgr::getInstance()->selectionDump(); } -void print_agent_nvpairs(void*) +void print_agent_nvpairs() { LLViewerObject *objectp; @@ -6402,53 +6266,13 @@ void show_debug_menus() } } -void toggle_debug_menus(void*) +void toggle_debug_menus() { bool visible = ! gSavedSettings.getBOOL("UseDebugMenus"); gSavedSettings.setBOOL("UseDebugMenus", visible); show_debug_menus(); } - -// LLUUID gExporterRequestID; -// std::string gExportDirectory; - -// LLUploadDialog *gExportDialog = NULL; - -// void handle_export_selected( void * ) -// { -// LLObjectSelectionHandle selection = LLSelectMgr::getInstance()->getSelection(); -// if (selection->isEmpty()) -// { -// return; -// } -// LL_INFOS() << "Exporting selected objects:" << LL_ENDL; - -// gExporterRequestID.generate(); -// gExportDirectory = ""; - -// LLMessageSystem* msg = gMessageSystem; -// msg->newMessageFast(_PREHASH_ObjectExportSelected); -// msg->nextBlockFast(_PREHASH_AgentData); -// msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID()); -// msg->addUUIDFast(_PREHASH_RequestID, gExporterRequestID); -// msg->addS16Fast(_PREHASH_VolumeDetail, 4); - -// for (LLObjectSelection::root_iterator iter = selection->root_begin(); -// iter != selection->root_end(); iter++) -// { -// LLSelectNode* node = *iter; -// LLViewerObject* object = node->getObject(); -// msg->nextBlockFast(_PREHASH_ObjectData); -// msg->addUUIDFast(_PREHASH_ObjectID, object->getID()); -// LL_INFOS() << "Object: " << object->getID() << LL_ENDL; -// } -// msg->sendReliable(gAgent.getRegion()->getHost()); - -// gExportDialog = LLUploadDialog::modalUploadDialog("Exporting selected objects..."); -// } -// - class LLCommunicateNearbyChat : public view_listener_t { bool handleEvent(const LLSD& userdata) @@ -6626,7 +6450,7 @@ void handle_look_at_selection(const LLSD& param) } } -void handle_zoom_to_object(LLUUID object_id) +void handle_zoom_to_object(const LLUUID& object_id) { const F32 PADDING_FACTOR = 2.f; @@ -6937,28 +6761,28 @@ bool enable_object_sit(LLUICtrl* ctrl) return !sitting_on_sel && is_object_sittable(); } -void dump_select_mgr(void*) +void dump_select_mgr() { LLSelectMgr::getInstance()->dump(); } -void dump_inventory(void*) +void dump_inventory() { gInventory.dumpInventory(); } -void handle_dump_followcam(void*) +void handle_dump_followcam() { LLFollowCamMgr::getInstance()->dump(); } -void handle_viewer_enable_message_log(void*) +void handle_viewer_enable_message_log() { gMessageSystem->startLogging(); } -void handle_viewer_disable_message_log(void*) +void handle_viewer_disable_message_log() { gMessageSystem->stopLogging(); } @@ -7325,7 +7149,7 @@ class LLWorldEnableBuyLand : public view_listener_t } }; -bool enable_buy_land(void*) +bool enable_buy_land() { return LLViewerParcelMgr::getInstance()->canAgentBuyParcel( LLViewerParcelMgr::getInstance()->getParcelSelection()->getParcel(), false); @@ -7411,7 +7235,7 @@ void LLObjectAttachToAvatar::onNearAttachObject(bool success, void *user_data) } LLSelectMgr::getInstance()->sendAttach(cb_data->getSelection(), attachment_id, cb_data->mReplace); } - LLObjectAttachToAvatar::setObjectSelection(NULL); + LLObjectAttachToAvatar::setObjectSelection(nullptr); delete cb_data; } @@ -7990,7 +7814,7 @@ class LLToolsSelectedScriptAction : public view_listener_t } }; -void handle_selected_texture_info(void*) +void handle_selected_texture_info() { for (LLObjectSelection::valid_iterator iter = LLSelectMgr::getInstance()->getSelection()->valid_begin(); iter != LLSelectMgr::getInstance()->getSelection()->valid_end(); iter++) @@ -8078,21 +7902,22 @@ void handle_selected_material_info() } } -void handle_test_male(void*) +void handle_test_male() { LLAppearanceMgr::instance().wearOutfitByName("Male Shape & Outfit"); //gGestureList.requestResetFromServer( true ); } -void handle_test_female(void*) +void handle_test_female() { LLAppearanceMgr::instance().wearOutfitByName("Female Shape & Outfit"); //gGestureList.requestResetFromServer( false ); } -void handle_dump_attachments(void*) +void handle_dump_attachments() { - if(!isAgentAvatarValid()) return; + if (!isAgentAvatarValid()) + return; for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); iter != gAgentAvatarp->mAttachmentPoints.end(); ) @@ -8294,12 +8119,12 @@ class LLToggleShaderControl : public view_listener_t } }; -void menu_toggle_attached_lights(void* user_data) +void menu_toggle_attached_lights() { LLPipeline::sRenderAttachedLights = gSavedSettings.getBOOL("RenderAttachedLights"); } -void menu_toggle_attached_particles(void* user_data) +void menu_toggle_attached_particles() { LLPipeline::sRenderAttachedParticles = gSavedSettings.getBOOL("RenderAttachedParticles"); } @@ -8317,11 +8142,11 @@ class LLAdvancedHandleAttachedLightParticles: public view_listener_t // update internal flags if (control_name == "RenderAttachedLights") { - menu_toggle_attached_lights(NULL); + menu_toggle_attached_lights(); } else if (control_name == "RenderAttachedParticles") { - menu_toggle_attached_particles(NULL); + menu_toggle_attached_particles(); } return true; } @@ -8436,7 +8261,7 @@ bool LLHasAsset::operator()(LLInventoryCategory* cat, } -bool enable_save_into_task_inventory(void*) +bool enable_save_into_task_inventory() { LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstRootNode(); if(node && (node->mValid) && (!node->mFromTaskID.isNull())) @@ -8455,7 +8280,7 @@ class LLToolsEnableSaveToObjectInventory : public view_listener_t { bool handleEvent(const LLSD& userdata) { - bool new_value = enable_save_into_task_inventory(NULL); + bool new_value = enable_save_into_task_inventory(); return new_value; } }; @@ -8518,12 +8343,12 @@ class LLWorldEnableTeleportHome : public view_listener_t } }; -bool enable_god_full(void*) +bool enable_god_full() { return gAgent.getGodLevel() >= GOD_FULL; } -bool enable_god_liaison(void*) +bool enable_god_liaison() { return gAgent.getGodLevel() >= GOD_LIAISON; } @@ -8533,18 +8358,18 @@ bool is_god_customer_service() return gAgent.getGodLevel() >= GOD_CUSTOMER_SERVICE; } -bool enable_god_basic(void*) +bool enable_god_basic() { return gAgent.getGodLevel() > GOD_NOT; } -void toggle_show_xui_names(void *) +void toggle_show_xui_names() { gSavedSettings.setBOOL("DebugShowXUINames", !gSavedSettings.getBOOL("DebugShowXUINames")); } -bool check_show_xui_names(void *) +bool check_show_xui_names() { return gSavedSettings.getBOOL("DebugShowXUINames"); } @@ -8650,12 +8475,12 @@ class LLToolsEditLinkedParts : public view_listener_t } }; -void reload_vertex_shader(void *) +void reload_vertex_shader() { //THIS WOULD BE AN AWESOME PLACE TO RELOAD SHADERS... just a thought - DaveP } -void handle_dump_avatar_local_textures(void*) +void handle_dump_avatar_local_textures() { gAgentAvatarp->dumpLocalTextures(); } @@ -8665,7 +8490,7 @@ void handle_dump_timers() LLTrace::BlockTimer::dumpCurTimes(); } -void handle_debug_avatar_textures(void*) +void handle_debug_avatar_textures() { LLViewerObject* objectp = LLSelectMgr::getInstance()->getSelection()->getPrimaryObject(); if (objectp) @@ -8674,10 +8499,10 @@ void handle_debug_avatar_textures(void*) } } -void handle_grab_baked_texture(void* data) +void handle_grab_baked_texture(EBakedTextureIndex baked_tex_index) { - EBakedTextureIndex baked_tex_index = (EBakedTextureIndex)((intptr_t)data); - if (!isAgentAvatarValid()) return; + if (!isAgentAvatarValid()) + return; const LLUUID& asset_id = gAgentAvatarp->grabBakedTexture(baked_tex_index); LL_INFOS("texture") << "Adding baked texture " << asset_id << " to inventory." << LL_ENDL; @@ -8740,19 +8565,18 @@ void handle_grab_baked_texture(void* data) } } -bool enable_grab_baked_texture(void* data) +bool enable_grab_baked_texture(EBakedTextureIndex baked_tex_index) { - EBakedTextureIndex index = (EBakedTextureIndex)((intptr_t)data); if (isAgentAvatarValid()) { - return gAgentAvatarp->canGrabBakedTexture(index); + return gAgentAvatarp->canGrabBakedTexture(baked_tex_index); } return false; } // 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 ) +LLVOAvatar* find_avatar_from_object(LLViewerObject* object) { if (object) { @@ -8776,63 +8600,63 @@ LLVOAvatar* find_avatar_from_object( LLViewerObject* object ) // 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( const LLUUID& object_id ) +LLVOAvatar* find_avatar_from_object(const LLUUID& object_id) { return find_avatar_from_object( gObjectList.findObject(object_id) ); } -void handle_disconnect_viewer(void *) +void handle_disconnect_viewer() { LLAppViewer::instance()->forceDisconnect(LLTrans::getString("TestingDisconnect")); } -void force_error_breakpoint(void *) +void force_error_breakpoint() { LLAppViewer::instance()->forceErrorBreakpoint(); } -void force_error_llerror(void *) +void force_error_llerror() { LLAppViewer::instance()->forceErrorLLError(); } -void force_error_llerror_msg(void*) +void force_error_llerror_msg() { LLAppViewer::instance()->forceErrorLLErrorMsg(); } -void force_error_bad_memory_access(void *) +void force_error_bad_memory_access() { LLAppViewer::instance()->forceErrorBadMemoryAccess(); } -void force_error_infinite_loop(void *) +void force_error_infinite_loop() { LLAppViewer::instance()->forceErrorInfiniteLoop(); } -void force_error_software_exception(void *) +void force_error_software_exception() { LLAppViewer::instance()->forceErrorSoftwareException(); } -void force_error_os_exception(void*) +void force_error_os_exception() { LLAppViewer::instance()->forceErrorOSSpecificException(); } -void force_error_driver_crash(void *) +void force_error_driver_crash() { LLAppViewer::instance()->forceErrorDriverCrash(); } -void force_error_coroutine_crash(void *) +void force_error_coroutine_crash() { LLAppViewer::instance()->forceErrorCoroutineCrash(); } -void force_error_thread_crash(void *) +void force_error_thread_crash() { LLAppViewer::instance()->forceErrorThreadCrash(); } @@ -8857,7 +8681,7 @@ class LLToolsUseSelectionForGrid : public view_listener_t } }; -void handle_test_load_url(void*) +void handle_test_load_url() { LLWeb::loadURL(""); LLWeb::loadURL("hacker://www.google.com/"); @@ -8965,7 +8789,7 @@ void handle_report_bug(const LLSD& param) LLWeb::loadURLExternal(url); } -void handle_buy_currency_test(void*) +void handle_buy_currency_test() { std::string url = "http://sarahd-sl-13041.webdev.lindenlab.com/app/lindex/index.php?agent_id=[AGENT_ID]&secure_session_id=[SESSION_ID]&lang=[LANGUAGE]"; @@ -8982,7 +8806,7 @@ void handle_buy_currency_test(void*) } // SUNSHINE CLEANUP - is only the request update at the end needed now? -void handle_rebake_textures(void*) +void handle_rebake_textures() { if (!isAgentAvatarValid()) return; @@ -8995,15 +8819,13 @@ void handle_rebake_textures(void*) } } -void toggle_visibility(void* user_data) +void toggle_visibility(LLView* viewp) { - LLView* viewp = (LLView*)user_data; viewp->setVisible(!viewp->getVisible()); } -bool get_visibility(void* user_data) +bool get_visibility(LLView* viewp) { - LLView* viewp = (LLView*)user_data; return viewp->getVisible(); } @@ -10221,7 +10043,6 @@ void initialize_menus() enable.add("EnablePayAvatar", boost::bind(&enable_pay_avatar)); enable.add("EnableEdit", boost::bind(&enable_object_edit)); enable.add("EnableMuteParticle", boost::bind(&enable_mute_particle)); - enable.add("VisibleBuild", boost::bind(&enable_object_build)); commit.add("Pathfinding.Linksets.Select", boost::bind(&LLFloaterPathfindingLinksets::openLinksetsWithSelectedObjects)); enable.add("EnableSelectInPathfindingLinksets", boost::bind(&enable_object_select_in_pathfinding_linksets)); enable.add("VisibleSelectInPathfindingLinksets", boost::bind(&visible_object_select_in_pathfinding_linksets)); diff --git a/indra/newview/llviewermenu.h b/indra/newview/llviewermenu.h index 8c5e0705d0..68c3dbc126 100644 --- a/indra/newview/llviewermenu.h +++ b/indra/newview/llviewermenu.h @@ -44,54 +44,21 @@ void init_menus(); void cleanup_menus(); void show_debug_menus(); // checks for if menus should be shown first. -void toggle_debug_menus(void*); -void show_context_menu( S32 x, S32 y, MASK mask ); -void show_build_mode_context_menu(S32 x, S32 y, MASK mask); +void toggle_debug_menus(); void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y); void show_topinfobar_context_menu(LLView* ctrl, S32 x, S32 y); void handle_reset_view(); -void handle_cut(void*); -void handle_copy(void*); -void handle_paste(void*); -void handle_delete(void*); -void handle_redo(void*); -void handle_undo(void*); -void handle_select_all(void*); -void handle_deselect(void*); -void handle_delete_object(); -void handle_duplicate(void*); -void handle_duplicate_in_place(void*); -bool enable_not_have_card(void *userdata); void process_grant_godlike_powers(LLMessageSystem* msg, void**); -bool enable_cut(void*); -bool enable_copy(void*); -bool enable_paste(void*); -bool enable_select_all(void*); -bool enable_deselect(void*); -bool enable_undo(void*); -bool enable_redo(void*); - bool is_agent_mappable(const LLUUID& agent_id); -void confirm_replace_attachment(S32 option, void* user_data); -void handle_detach_from_avatar(const LLSD& user_data); -void attach_label(std::string& label, const LLSD&); -void detach_label(std::string& label, const LLSD&); -void handle_detach(void*); -bool enable_god_full(void* user_data); -bool enable_god_liaison(void* user_data); -bool enable_god_basic(void* user_data); +bool enable_god_full(); +bool enable_god_liaison(); +bool enable_god_basic(); void check_merchant_status(bool force = false); -void exchange_callingcard(const LLUUID& dest_id); - -void handle_gestures(void*); -void handle_sit_down(void*); -void handle_object_build(void*); void handle_object_touch(); bool enable_object_edit_gltf_material(); -bool enable_object_save_gltf_material(); bool enable_object_open(); void handle_object_open(); @@ -106,12 +73,11 @@ void handle_buy(); void handle_take(bool take_separate = false); void handle_take_copy(); void handle_look_at_selection(const LLSD& param); -void handle_zoom_to_object(LLUUID object_id); +void handle_zoom_to_object(const LLUUID& object_id); void handle_object_return(); void handle_object_delete(); void handle_object_edit(); void handle_object_edit_gltf_material(); -void handle_object_save_gltf_material(); void handle_attachment_edit(const LLUUID& inv_item_id); void handle_attachment_touch(const LLUUID& inv_item_id); @@ -144,13 +110,10 @@ bool enable_pay_object(); bool enable_buy_object(); bool handle_go_to(); -// Export to XML or Collada -void handle_export_selected( void * ); - // Convert strings to internal types -U32 render_type_from_string(std::string render_type); -U32 feature_from_string(std::string feature); -U64 info_display_from_string(std::string info_display); +U32 render_type_from_string(std::string_view render_type); +U32 feature_from_string(std::string_view feature); +U64 info_display_from_string(std::string_view info_display); class LLViewerMenuHolderGL : public LLMenuHolderGL { diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp index 83f8e96f9a..ce66dbc03f 100644 --- a/indra/newview/llviewermenufile.cpp +++ b/indra/newview/llviewermenufile.cpp @@ -990,7 +990,7 @@ class LLFileQuit : public view_listener_t }; -void handle_compress_image(void*) +void handle_compress_image() { LLFilePicker& picker = LLFilePicker::instance(); if (picker.getMultipleOpenFiles(LLFilePicker::FFLOAD_IMAGE)) @@ -1040,7 +1040,7 @@ size_t get_file_size(std::string &filename) return file_length; } -void handle_compress_file_test(void*) +void handle_compress_file_test() { LLFilePicker& picker = LLFilePicker::instance(); if (picker.getOpenFile()) diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 7b8739c7df..9b7e0e8839 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -228,7 +228,6 @@ const F32 DEFERRED_LIGHT_FALLOFF = 0.5f; const U32 DEFERRED_VB_MASK = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_TEXCOORD0 | LLVertexBuffer::MAP_TEXCOORD1; extern S32 gBoxFrame; -//extern bool gHideSelectedObjects; extern bool gDisplaySwapBuffers; extern bool gDebugGL; extern bool gCubeSnapshot; -- cgit v1.2.3 From 9ffbca2489d5a556228717c09f86c2d28b6c8d73 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Tue, 10 Sep 2024 19:15:58 +0300 Subject: Allow the in world voice indicator to be toggled in preferences --- indra/newview/app_settings/settings.xml | 11 +++ indra/newview/llvoicevisualizer.cpp | 3 +- .../default/xui/en/panel_preferences_sound.xml | 82 ++++++++++++---------- 3 files changed, 59 insertions(+), 37 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 9380b0d6f7..82eb98b06b 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -13422,6 +13422,17 @@ Value 4 + VoiceVisualizerEnabled + + Comment + Display voice dot indicator above an avatar + Persist + 1 + Type + Boolean + Value + 0 + WarningsAsChat Comment diff --git a/indra/newview/llvoicevisualizer.cpp b/indra/newview/llvoicevisualizer.cpp index 9412136272..7691ac54f3 100644 --- a/indra/newview/llvoicevisualizer.cpp +++ b/indra/newview/llvoicevisualizer.cpp @@ -337,7 +337,8 @@ void LLVoiceVisualizer::lipSyncOohAah( F32& ooh, F32& aah ) //--------------------------------------------------- void LLVoiceVisualizer::render() { - if ( ! mVoiceEnabled ) + static LLCachedControl show_visualizer(gSavedSettings, "VoiceVisualizerEnabled", false); + if (!mVoiceEnabled || !show_visualizer) { return; } diff --git a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml index eb38f8bff3..d909a56733 100644 --- a/indra/newview/skins/default/xui/en/panel_preferences_sound.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_sound.xml @@ -406,6 +406,44 @@ name="autoplay_ask" value="2"/> + + Noise Suppression + + + + + + + + - - Noise Suppression - - - - - - - - + top_pad="-15" + width="200"/>