From 2aecd42d1ffc2ee056b60a66d5c39f09312e1fbe Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Tue, 1 Aug 2023 15:51:18 -0700 Subject: First commit of code to investigate how we might do bulk uploads of inventory item thumbnails - both from a code and a UI perspective --- indra/newview/CMakeLists.txt | 2 + indra/newview/llfloaterbulkythumbs.cpp | 63 ++++++++++++++++++++++ indra/newview/llfloaterbulkythumbs.h | 49 +++++++++++++++++ indra/newview/llviewerfloaterreg.cpp | 2 + .../skins/default/xui/en/floater_bulky_thumbs.xml | 42 +++++++++++++++ indra/newview/skins/default/xui/en/menu_viewer.xml | 8 +++ 6 files changed, 166 insertions(+) create mode 100644 indra/newview/llfloaterbulkythumbs.cpp create mode 100644 indra/newview/llfloaterbulkythumbs.h create mode 100644 indra/newview/skins/default/xui/en/floater_bulky_thumbs.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index c37d03221c..4c6e37f82f 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -185,6 +185,7 @@ set(viewer_SOURCE_FILES llfloaterbigpreview.cpp llfloaterbuildoptions.cpp llfloaterbulkpermission.cpp + llfloaterbulkythumbs.cpp llfloaterbump.cpp llfloaterbuy.cpp llfloaterbuycontents.cpp @@ -831,6 +832,7 @@ set(viewer_HEADER_FILES llfloaterbigpreview.h llfloaterbuildoptions.h llfloaterbulkpermission.h + llfloaterbulkythumbs.h llfloaterbump.h llfloaterbuy.h llfloaterbuycontents.h diff --git a/indra/newview/llfloaterbulkythumbs.cpp b/indra/newview/llfloaterbulkythumbs.cpp new file mode 100644 index 0000000000..14ecc32c40 --- /dev/null +++ b/indra/newview/llfloaterbulkythumbs.cpp @@ -0,0 +1,63 @@ +/** + * @file llfloaterbulkythumbs.cpp + * @author Callum Prentice + * @brief LLFloaterBulkyThumbs class implementation + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +/** + * Floater that appears when buying an object, giving a preview + * of its contents and their permissions. + */ + +#include "llviewerprecompiledheaders.h" + +#include "llfloaterbulkythumbs.h" +#include "lluictrlfactory.h" + + +LLFloaterBulkyThumbs::LLFloaterBulkyThumbs(const LLSD &key) + : LLFloater("floater_bulky_thumbs") +{ +} + +LLFloaterBulkyThumbs::~LLFloaterBulkyThumbs() {} + +BOOL LLFloaterBulkyThumbs::postBuild() +{ + mPasteFromInventoryBtn = getChild("paste_from_inventory"); + mPasteFromInventoryBtn->setCommitCallback(boost::bind(&LLFloaterBulkyThumbs::onPasteFromInventory, this)); + + mProcessBulkyThumbsBtn = getChild("process_bulky_thumbs"); + mProcessBulkyThumbsBtn->setCommitCallback(boost::bind(&LLFloaterBulkyThumbs::onProcessBulkyThumbs, this)); + mProcessBulkyThumbsBtn->setEnabled(false); + + return true; +} + + +void LLFloaterBulkyThumbs::onPasteFromInventory() +{ std::cout << "onPasteFromInventory" << std::endl; } + +void LLFloaterBulkyThumbs::onProcessBulkyThumbs() +{ std::cout << "onProcessBulkyThumbs" << std::endl; } diff --git a/indra/newview/llfloaterbulkythumbs.h b/indra/newview/llfloaterbulkythumbs.h new file mode 100644 index 0000000000..9c951211d7 --- /dev/null +++ b/indra/newview/llfloaterbulkythumbs.h @@ -0,0 +1,49 @@ +/** + * @file llfloaterbulkythumbs.h + * @author Callum Prentice + * @brief Helper floater for bulk processing of inventory thumbnails + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLFLOATERBULKYTHUMBS_H +#define LL_LLFLOATERBULKYTHUMBS_H + +#include "llfloater.h" + +class LLFloaterBulkyThumbs: + public LLFloater +{ + friend class LLFloaterReg; +private: + LLFloaterBulkyThumbs(const LLSD &key); + BOOL postBuild() override; + ~LLFloaterBulkyThumbs(); + + LLUICtrl *mPasteFromInventoryBtn; + void onPasteFromInventory(); + + LLUICtrl *mProcessBulkyThumbsBtn; + void onProcessBulkyThumbs(); +}; + +#endif // LL_LLFLOATERBULKYTHUMBS_H diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 060bdb6995..459101317b 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -47,6 +47,7 @@ #include "llfloaterbeacons.h" #include "llfloaterbuildoptions.h" #include "llfloaterbulkpermission.h" +#include "llfloaterbulkythumbs.h" #include "llfloaterbump.h" #include "llfloaterbuy.h" #include "llfloaterbuycontents.h" @@ -328,6 +329,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("build", "floater_tools.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("build_options", "floater_build_options.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("bulky_thumbs", "floater_bulky_thumbs.xml", (LLFloaterBuildFunc) &LLFloaterReg::build); LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("camera_presets", "floater_camera_presets.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/skins/default/xui/en/floater_bulky_thumbs.xml b/indra/newview/skins/default/xui/en/floater_bulky_thumbs.xml new file mode 100644 index 0000000000..867c8fdc20 --- /dev/null +++ b/indra/newview/skins/default/xui/en/floater_bulky_thumbs.xml @@ -0,0 +1,42 @@ + + + + + diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 6444ea2540..b3bf977df2 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -3633,6 +3633,14 @@ function="World.EnvPreset" + + + + -- cgit v1.2.3 From f815b015cecda18098dd2d16f65682a37e1bff7c Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Tue, 26 Mar 2024 03:19:06 +0100 Subject: secondlife/jira-archive-internal#69593 Avatar is upside down when viewed from below --- indra/newview/llagent.cpp | 30 ++++---- indra/newview/llfloatercamera.cpp | 81 ++++++++++++++-------- .../skins/default/xui/en/floater_camera.xml | 6 +- 3 files changed, 72 insertions(+), 45 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index d1e1815a79..13501833b2 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1468,23 +1468,27 @@ void LLAgent::pitch(F32 angle) LLVector3 skyward = getReferenceUpVector(); - // SL-19286 Avatar is upside down when viewed from below - // after left-clicking the mouse on the avatar and dragging down - // - // The issue is observed on angle below 10 degrees - const F32 look_down_limit = 179.f * DEG_TO_RAD; - const F32 look_up_limit = 10.f * DEG_TO_RAD; - - F32 angle_from_skyward = acos(mFrameAgent.getAtAxis() * skyward); - // clamp pitch to limits - if ((angle >= 0.f) && (angle_from_skyward + angle > look_down_limit)) + if (angle >= 0.f) { - angle = look_down_limit - angle_from_skyward; + const F32 look_down_limit = 179.f * DEG_TO_RAD; + F32 angle_from_skyward = acos(mFrameAgent.getAtAxis() * skyward); + if (angle_from_skyward + angle > look_down_limit) + { + angle = look_down_limit - angle_from_skyward; + } } - else if ((angle < 0.f) && (angle_from_skyward + angle < look_up_limit)) + else if (angle < 0.f) { - angle = look_up_limit - angle_from_skyward; + const F32 look_up_limit = 5.f * DEG_TO_RAD; + const LLVector3& viewer_camera_pos = LLViewerCamera::getInstance()->getOrigin(); + LLVector3 agent_focus_pos = getPosAgentFromGlobal(gAgentCamera.calcFocusPositionTargetGlobal()); + LLVector3 look_dir = agent_focus_pos - viewer_camera_pos; + F32 angle_from_skyward = angle_between(look_dir, skyward); + if (angle_from_skyward + angle < look_up_limit) + { + angle = look_up_limit - angle_from_skyward; + } } if (fabs(angle) > 1e-4) diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp index 177e2a8567..7985ce447f 100644 --- a/indra/newview/llfloatercamera.cpp +++ b/indra/newview/llfloatercamera.cpp @@ -248,23 +248,25 @@ void activate_camera_tool() class LLCameraInfoPanel : public LLPanel { - const S32 MARGIN { 10 }; - - const char* mTitle; - const LLCoordFrame* mCamera; - const LLFontGL* mFont; - public: - LLCameraInfoPanel(const LLView* parent, const LLCoordFrame* camera, const char* title) - : LLPanel([&]() -> LLPanel::Params - { - LLPanel::Params params; - params.rect = LLRect(parent->getLocalRect()); - return params; - }()) - , mTitle(title) - , mCamera(camera) - , mFont(LLFontGL::getFontSansSerifBig()) + typedef std::function get_vector_t; + + LLCameraInfoPanel( + const LLView* parent, + const char* title, + const LLCoordFrame& camera, + const get_vector_t get_focus + ) + : LLPanel([&]() -> LLPanel::Params + { + LLPanel::Params params; + params.rect = LLRect(parent->getLocalRect()); + return params; + }()) + , mTitle(title) + , mCamera(camera) + , mGetFocus(get_focus) + , mFont(LLFontGL::getFontSansSerifBig()) { } @@ -272,25 +274,44 @@ public: { LLPanel::draw(); + static const U32 HPADDING = 10; + static const U32 VPADDING = 5; + LLVector3 focus = mGetFocus(); + LLVector3 sight = focus - mCamera.mOrigin; + std::pair const data[] = + { + { "Origin:", mCamera.mOrigin }, + { "X Axis:", mCamera.mXAxis }, + { "Y Axis:", mCamera.mYAxis }, + { "Z Axis:", mCamera.mZAxis }, + { "Focus:", focus }, + { "Sight:", sight } + }; S32 width = getRect().getWidth(); S32 height = getRect().getHeight(); - S32 top = MARGIN / 2 + (height - MARGIN) / 10 * 9; - mFont->renderUTF8(mTitle, 0, MARGIN, top, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER); - const LLVector3* const vectors[] = { &mCamera->getOrigin(), &mCamera->getXAxis(), &mCamera->getYAxis(), &mCamera->getZAxis() }; - for (int row = 0; row < 4; ++row) + S32 row_count = 1 + sizeof(data) / sizeof(*data); + S32 row_height = (height - VPADDING * 2) / row_count; + S32 top = height - VPADDING - row_height / 2; + mFont->renderUTF8(mTitle, 0, HPADDING, top, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER); + for (const auto& row : data) { - top -= (height - MARGIN) / 5; - static const char* const labels[] = { "Origin:", "X Axis:", "Y Axis:", "Z Axis:" }; - mFont->renderUTF8(labels[row], 0, MARGIN, top, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER); - const LLVector3& vector = *vectors[row]; - for (int col = 0; col < 3; ++col) + top -= row_height; + mFont->renderUTF8(row.first, 0, HPADDING, top, LLColor4::white, LLFontGL::LEFT, LLFontGL::VCENTER); + const LLVector3& vector = row.second; + for (S32 i = 0; i < 3; ++i) { - std::string text = llformat("%.6f", vector[col]); - S32 right = width / 4 * (col + 2) - MARGIN; + std::string text = llformat("%.6f", vector[i]); + S32 right = width / 4 * (i + 2) - HPADDING; mFont->renderUTF8(text, 0, right, top, LLColor4::white, LLFontGL::RIGHT, LLFontGL::VCENTER); } } } + +private: + const char* mTitle; + const LLCoordFrame& mCamera; + const get_vector_t mGetFocus; + const LLFontGL* mFont; }; // @@ -344,8 +365,10 @@ void LLFloaterCamera::showDebugInfo(bool show) // Initially LLPanel contains 1 child "view_border" if (show && mViewerCameraInfo->getChildCount() < 2) { - mViewerCameraInfo->addChild(new LLCameraInfoPanel(mViewerCameraInfo, LLViewerCamera::getInstance(), "Viewer Camera")); - mAgentCameraInfo->addChild(new LLCameraInfoPanel(mAgentCameraInfo, &gAgent.getFrameAgent(), "Agent Camera")); + mViewerCameraInfo->addChild(new LLCameraInfoPanel(mViewerCameraInfo, "Viewer Camera", *LLViewerCamera::getInstance(), + []() { return LLViewerCamera::getInstance()->getPointOfInterest(); })); + mAgentCameraInfo->addChild(new LLCameraInfoPanel(mAgentCameraInfo, "Agent Camera", gAgent.getFrameAgent(), + []() { return gAgent.getPosAgentFromGlobal(gAgentCamera.calcFocusPositionTargetGlobal()); })); } mAgentCameraInfo->setVisible(show); diff --git a/indra/newview/skins/default/xui/en/floater_camera.xml b/indra/newview/skins/default/xui/en/floater_camera.xml index 8774b12e2b..93cfdf6030 100644 --- a/indra/newview/skins/default/xui/en/floater_camera.xml +++ b/indra/newview/skins/default/xui/en/floater_camera.xml @@ -258,16 +258,16 @@ left="0" top="135" width="400" - height="130" + height="150" border="true" visible="false" background_visible="true"/> -- cgit v1.2.3 From 11bffc8252d169d84bf5066ad4cd34cad535f5e8 Mon Sep 17 00:00:00 2001 From: Bennett Goble Date: Thu, 11 Apr 2024 13:32:48 -0700 Subject: CI: adopt xz compression Move towards packaging artifacts with xz, which offers higher compression ratios and faster decode time. --- indra/newview/CMakeLists.txt | 12 ++++++------ indra/newview/viewer_manifest.py | 14 +++++++------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 5408d03509..a6ae041935 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1804,7 +1804,7 @@ if (WINDOWS) if (PACKAGE) add_custom_command( - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2 + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.xz COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/event_host_manifest.py @@ -1848,7 +1848,7 @@ if (WINDOWS) ) # temporarily disable packaging of event_host until hg subrepos get # sorted out on the parabuild cluster... - #${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.bz2) + #${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/event_host.tar.xz) endif (PACKAGE) elseif (DARWIN) @@ -1968,7 +1968,7 @@ if (LINUX) #endif (NOT USE_BUGSPLAT) add_custom_command( - OUTPUT ${product}.tar.bz2 + OUTPUT ${product}.tar.xz COMMAND ${PYTHON_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py @@ -2022,7 +2022,7 @@ if (LINUX) add_custom_target(copy_l_viewer_manifest ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/.${product}.copy_touched) if (PACKAGE) - add_custom_target(llpackage ALL DEPENDS ${product}.tar.bz2) + add_custom_target(llpackage ALL DEPENDS ${product}.tar.xz) # Make sure we don't run two instances of viewer_manifest.py at the same time. add_dependencies(llpackage copy_l_viewer_manifest) check_message_template(llpackage) @@ -2153,12 +2153,12 @@ if (PACKAGE AND (RELEASE_CRASH_REPORTING OR NON_RELEASE_CRASH_REPORTING) AND VIE OUTPUT_VARIABLE PARENT_DIRECTORY_CYGWIN OUTPUT_STRIP_TRAILING_WHITESPACE) add_custom_command(OUTPUT "${VIEWER_SYMBOL_FILE}" - # Use of 'tar ...j' here assumes VIEWER_SYMBOL_FILE endswith .tar.bz2; + # Use of 'tar ...j' here assumes VIEWER_SYMBOL_FILE endswith .tar.xz; # testing a string suffix is painful enough in CMake language that # we'll continue assuming it until forced to generalize. COMMAND "tar" ARGS - "cjf" + "cJf" "${VIEWER_SYMBOL_FILE_CYGWIN}" "-C" "${PARENT_DIRECTORY_CYGWIN}" diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index c7f32d0da9..4de4dc8fc5 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -525,7 +525,7 @@ class Windows_x86_64_Manifest(ViewerManifest): 'secondlife-bin.*', '*_Setup.exe', '*.bat', - '*.tar.bz2'))) + '*.tar.xz'))) with self.prefix(src=os.path.join(pkgdir, "VMP")): # include the compiled launcher scripts so that it gets included in the file_list @@ -1183,9 +1183,9 @@ class Darwin_x86_64_Manifest(ViewerManifest): # causes problems, especially with frameworks: a framework's top # level must contain symlinks into its Versions/Current, which # must itself be a symlink to some specific Versions subdir. - tarpath = os.path.join(RUNNER_TEMP, "viewer.tar.bz2") + tarpath = os.path.join(RUNNER_TEMP, "viewer.tar.xz") print(f'Creating {tarpath} from {self.get_dst_prefix()}') - with tarfile.open(tarpath, mode="w:bz2") as tarball: + with tarfile.open(tarpath, mode="w:xz") as tarball: # Store in the tarball as just 'Second Life Mumble.app' # instead of 'Users/someone/.../newview/Release/Second...' # It's at this point that we rename 'Second Life Release.app' @@ -1272,7 +1272,7 @@ class LinuxManifest(ViewerManifest): self.run_command(['find', self.get_dst_prefix(), '-type', 'f', '-perm', old, '-exec', 'chmod', new, '{}', ';']) - self.package_file = installer_name + '.tar.bz2' + self.package_file = installer_name + '.tar.xz' # temporarily move directory tree so that it has the right # name in the tarfile @@ -1285,10 +1285,10 @@ class LinuxManifest(ViewerManifest): # --numeric-owner hides the username of the builder for # security etc. self.run_command(['tar', '-C', self.get_build_prefix(), - '--numeric-owner', '-cjf', - tempname + '.tar.bz2', installer_name]) + '--numeric-owner', '-cJf', + tempname + '.tar.xz', installer_name]) else: - print("Skipping %s.tar.bz2 for non-Release build (%s)" % \ + print("Skipping %s.tar.xz for non-Release build (%s)" % \ (installer_name, self.args['buildtype'])) finally: self.run_command(["mv", tempname, realname]) -- cgit v1.2.3 From 5e40b5e64433b224be4dc220e4496dcd0a43f3f6 Mon Sep 17 00:00:00 2001 From: Andrey Lihatskiy Date: Mon, 15 Apr 2024 18:39:23 +0300 Subject: Revert "SL-20140 Setting shape hand size to 36 won't save" This reverts commit 810a3d24c2e3671f926091c062b101bdec6a1517. (secondlife/jira-archive-internal#70482) --- indra/newview/character/avatar_lad.xml | 17 ++++---- indra/newview/llscrollingpanelparam.cpp | 63 ++++++++++++++++++++--------- indra/newview/llscrollingpanelparam.h | 3 ++ indra/newview/llscrollingpanelparambase.cpp | 29 +++++++------ indra/newview/llscrollingpanelparambase.h | 7 +--- 5 files changed, 72 insertions(+), 47 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml index aef402d4db..2cdd86267e 100644 --- a/indra/newview/character/avatar_lad.xml +++ b/indra/newview/character/avatar_lad.xml @@ -2021,7 +2021,7 @@ value_min="-1" value_max="1"> - + - - @@ -2041,7 +2042,7 @@ name="mFaceEyeAltRight" scale="0 0 0" offset="-.005 0 0" /> - + - @@ -2061,17 +2062,17 @@ name="mFaceEyeLidUpperLeft" scale="0 0.3 0.7" offset=" 0 0 0" /> - + - + - + diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp index efd84eaa6d..bfa453a0ae 100644 --- a/indra/newview/llscrollingpanelparam.cpp +++ b/indra/newview/llscrollingpanelparam.cpp @@ -259,15 +259,19 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint ) // Make sure we're not taking the slider out of bounds // (this is where some simple UI limits are stored) - F32 new_percent = weightToSlider(new_weight); - if (mSlider->getMinValue() < new_percent - && new_percent < mSlider->getMaxValue()) + F32 new_percent = weightToPercent(new_weight); + LLSliderCtrl* slider = getChild("param slider"); + if (slider) { - mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight); - mWearable->writeToAvatar(gAgentAvatarp); - gAgentAvatarp->updateVisualParams(); + if (slider->getMinValue() < new_percent + && new_percent < slider->getMaxValue()) + { + mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight); + mWearable->writeToAvatar(gAgentAvatarp); + gAgentAvatarp->updateVisualParams(); - mSlider->setValue( weightToSlider( new_weight ) ); + slider->setValue( weightToPercent( new_weight ) ); + } } } } @@ -288,13 +292,17 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata ) F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight(); // step a fraction in the negative directiona F32 new_weight = current_weight - (range / 10.f); - F32 new_percent = self->weightToSlider(new_weight); - if (self->mSlider->getMinValue() < new_percent - && new_percent < self->mSlider->getMaxValue()) + F32 new_percent = self->weightToPercent(new_weight); + LLSliderCtrl* slider = self->getChild("param slider"); + if (slider) { - self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); - self->mWearable->writeToAvatar(gAgentAvatarp); - self->mSlider->setValue( self->weightToSlider( new_weight ) ); + if (slider->getMinValue() < new_percent + && new_percent < slider->getMaxValue()) + { + self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); + self->mWearable->writeToAvatar(gAgentAvatarp); + slider->setValue( self->weightToPercent( new_weight ) ); + } } } @@ -318,16 +326,33 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata ) F32 range = self->mHintMax->getVisualParamWeight() - self->mHintMin->getVisualParamWeight(); // step a fraction in the negative direction F32 new_weight = current_weight + (range / 10.f); - F32 new_percent = self->weightToSlider(new_weight); - if (self->mSlider->getMinValue() < new_percent - && new_percent < self->mSlider->getMaxValue()) + F32 new_percent = self->weightToPercent(new_weight); + LLSliderCtrl* slider = self->getChild("param slider"); + if (slider) { - self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); - self->mWearable->writeToAvatar(gAgentAvatarp); - self->mSlider->setValue( self->weightToSlider( new_weight ) ); + if (slider->getMinValue() < new_percent + && new_percent < slider->getMaxValue()) + { + self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight); + self->mWearable->writeToAvatar(gAgentAvatarp); + slider->setValue( self->weightToPercent( new_weight ) ); + } } } } LLVisualParamHint::requestHintUpdates( self->mHintMin, self->mHintMax ); } + + +F32 LLScrollingPanelParam::weightToPercent( F32 weight ) +{ + LLViewerVisualParam* param = mParam; + return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f; +} + +F32 LLScrollingPanelParam::percentToWeight( F32 percent ) +{ + LLViewerVisualParam* param = mParam; + return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight(); +} diff --git a/indra/newview/llscrollingpanelparam.h b/indra/newview/llscrollingpanelparam.h index dc344486fc..c7a47d5c7a 100644 --- a/indra/newview/llscrollingpanelparam.h +++ b/indra/newview/llscrollingpanelparam.h @@ -61,6 +61,9 @@ public: void onHintMouseDown( LLVisualParamHint* hint ); void onHintHeldDown( LLVisualParamHint* hint ); + F32 weightToPercent( F32 weight ); + F32 percentToWeight( F32 percent ); + public: // Constants for LLPanelVisualParam const static F32 PARAM_STEP_TIME_THRESHOLD; diff --git a/indra/newview/llscrollingpanelparambase.cpp b/indra/newview/llscrollingpanelparambase.cpp index 2a6c25235d..fe7a362723 100644 --- a/indra/newview/llscrollingpanelparambase.cpp +++ b/indra/newview/llscrollingpanelparambase.cpp @@ -43,7 +43,6 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan LLViewerJointMesh* mesh, LLViewerVisualParam* param, BOOL allow_modify, LLWearable* wearable, LLJoint* jointp, BOOL use_hints) : LLScrollingPanel( panel_params ), mParam(param), - mSlider(nullptr), mAllowModify(allow_modify), mWearable(wearable) { @@ -51,15 +50,13 @@ LLScrollingPanelParamBase::LLScrollingPanelParamBase( const LLPanel::Params& pan buildFromFile( "panel_scrolling_param.xml"); else buildFromFile( "panel_scrolling_param_base.xml"); - - mSlider = getChild("param slider"); - mSlider->setMaxValue(100.f * (mParam->getMaxWeight() - mParam->getMinWeight())); - mSlider->setValue(weightToSlider(param->getWeight())); + + getChild("param slider")->setValue(weightToPercent(param->getWeight())); std::string display_name = LLTrans::getString(param->getDisplayName()); - mSlider->setLabelArg("[DESC]", display_name); - mSlider->setEnabled(mAllowModify); - mSlider->setCommitCallback(boost::bind(LLScrollingPanelParamBase::onSliderMoved, mSlider, this)); + getChild("param slider")->setLabelArg("[DESC]", display_name); + getChildView("param slider")->setEnabled(mAllowModify); + childSetCommitCallback("param slider", LLScrollingPanelParamBase::onSliderMoved, this); setVisible(FALSE); setBorderVisible( FALSE ); @@ -80,9 +77,9 @@ void LLScrollingPanelParamBase::updatePanel(BOOL allow_modify) } F32 current_weight = mWearable->getVisualParamWeight( param->getID() ); - mSlider->setValue(weightToSlider( current_weight ) ); + getChild("param slider")->setValue(weightToPercent( current_weight ) ); mAllowModify = allow_modify; - mSlider->setEnabled(mAllowModify); + getChildView("param slider")->setEnabled(mAllowModify); } // static @@ -93,7 +90,7 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata) LLViewerVisualParam* param = self->mParam; F32 current_weight = self->mWearable->getVisualParamWeight( param->getID() ); - F32 new_weight = self->sliderToWeight( (F32)slider->getValue().asReal() ); + F32 new_weight = self->percentToWeight( (F32)slider->getValue().asReal() ); if (current_weight != new_weight ) { self->mWearable->setVisualParamWeight( param->getID(), new_weight); @@ -102,12 +99,14 @@ void LLScrollingPanelParamBase::onSliderMoved(LLUICtrl* ctrl, void* userdata) } } -F32 LLScrollingPanelParamBase::weightToSlider(F32 weight) +F32 LLScrollingPanelParamBase::weightToPercent( F32 weight ) { - return (weight - mParam->getMinWeight()) * 100.f; + LLViewerVisualParam* param = mParam; + return (weight - param->getMinWeight()) / (param->getMaxWeight() - param->getMinWeight()) * 100.f; } -F32 LLScrollingPanelParamBase::sliderToWeight(F32 slider) +F32 LLScrollingPanelParamBase::percentToWeight( F32 percent ) { - return slider / 100.f + mParam->getMinWeight(); + LLViewerVisualParam* param = mParam; + return percent / 100.f * (param->getMaxWeight() - param->getMinWeight()) + param->getMinWeight(); } diff --git a/indra/newview/llscrollingpanelparambase.h b/indra/newview/llscrollingpanelparambase.h index e7f88a21bd..9538826251 100644 --- a/indra/newview/llscrollingpanelparambase.h +++ b/indra/newview/llscrollingpanelparambase.h @@ -36,7 +36,6 @@ class LLViewerVisualParam; class LLWearable; class LLVisualParamHint; class LLViewerVisualParam; -class LLSliderCtrl; class LLJoint; class LLScrollingPanelParamBase : public LLScrollingPanel @@ -50,13 +49,11 @@ public: static void onSliderMoved(LLUICtrl* ctrl, void* userdata); - F32 weightToSlider(F32 weight); - F32 sliderToWeight(F32 slider); + F32 weightToPercent( F32 weight ); + F32 percentToWeight( F32 percent ); public: LLViewerVisualParam* mParam; - LLSliderCtrl* mSlider; - protected: BOOL mAllowModify; LLWearable *mWearable; -- cgit v1.2.3 From d98fc504a1d4bc292ba86acdda053c8b4598a193 Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Wed, 24 Apr 2024 09:43:07 -0400 Subject: Increment viewer version to 7.1.7 following promotion of secondlife/viewer #736 --- indra/newview/VIEWER_VERSION.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview') diff --git a/indra/newview/VIEWER_VERSION.txt b/indra/newview/VIEWER_VERSION.txt index 14627a7c8c..2380dcfd47 100644 --- a/indra/newview/VIEWER_VERSION.txt +++ b/indra/newview/VIEWER_VERSION.txt @@ -1 +1 @@ -7.1.6 +7.1.7 -- cgit v1.2.3