From 6c7653c65bd3f9907bcd4a8a54e4e5c1d172d15e Mon Sep 17 00:00:00 2001 From: seth_productengine Date: Thu, 28 Jul 2011 18:41:43 +0300 Subject: SH-2169 FIXED New object weights floater added. --- indra/newview/llfloaterobjectweights.cpp | 99 ++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 indra/newview/llfloaterobjectweights.cpp (limited to 'indra/newview/llfloaterobjectweights.cpp') diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp new file mode 100644 index 0000000000..93aa8dcf08 --- /dev/null +++ b/indra/newview/llfloaterobjectweights.cpp @@ -0,0 +1,99 @@ +/** + * @file llfloaterobjectweights.cpp + * @brief Object weights advanced view floater + * + * $LicenseInfo:firstyear=2011&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2011, 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$ + */ +#include "llviewerprecompiledheaders.h" + +#include "llfloaterobjectweights.h" + +#include "lltextbox.h" + +LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key) +: LLFloater(key), + mSelectedObjects(NULL), + mSelectedPrims(NULL), + mSelectedDownloadWeight(NULL), + mSelectedPhysicsWeight(NULL), + mSelectedServerWeight(NULL), + mSelectedDisplayWeight(NULL), + mSelectedOnLand(NULL), + mRezzedOnLand(NULL), + mRemainingCapacity(NULL), + mTotalCapacity(NULL) +{ +} + +LLFloaterObjectWeights::~LLFloaterObjectWeights() +{ +} + +// virtual +BOOL LLFloaterObjectWeights::postBuild() +{ + mSelectedObjects = getChild("objects"); + mSelectedPrims = getChild("prims"); + + mSelectedDownloadWeight = getChild("download"); + mSelectedPhysicsWeight = getChild("physics"); + mSelectedServerWeight = getChild("server"); + mSelectedDisplayWeight = getChild("display"); + + mSelectedOnLand = getChild("used_download_weight"); + mRezzedOnLand = getChild("used_download_weight"); + mRemainingCapacity = getChild("used_download_weight"); + mTotalCapacity = getChild("used_download_weight"); + + return TRUE; +} + +// virtual +void LLFloaterObjectWeights::onOpen(const LLSD& key) +{ + updateIfNothingSelected(); +} + +void LLFloaterObjectWeights::toggleLoadingIndicators(bool visible) +{ + childSetVisible("download_loading_indicator", visible); + childSetVisible("physics_loading_indicator", visible); + childSetVisible("server_loading_indicator", visible); + childSetVisible("display_loading_indicator", visible); +} + +void LLFloaterObjectWeights::updateIfNothingSelected() +{ + const std::string text = getString("nothing_selected"); + + mSelectedObjects->setText(text); + mSelectedPrims->setText(text); + + mSelectedDownloadWeight->setText(text); + mSelectedPhysicsWeight->setText(text); + mSelectedServerWeight->setText(text); + mSelectedDisplayWeight->setText(text); + + mSelectedOnLand->setText(text); + + toggleLoadingIndicators(false); +} -- cgit v1.2.3 From 1b7b319ae22ac7598b7b3d75ccbec75263450e07 Mon Sep 17 00:00:00 2001 From: seth_productengine Date: Tue, 2 Aug 2011 00:16:13 +0300 Subject: SH-2170 WIP Object and land data added to new weights floater. The data is updated upon object selection change. The land data is displayed for the land containing the primary selected object. Loading indicators added for land impacts. --- indra/newview/llfloaterobjectweights.cpp | 135 +++++++++++++++++++++++++++++-- 1 file changed, 127 insertions(+), 8 deletions(-) (limited to 'indra/newview/llfloaterobjectweights.cpp') diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index 93aa8dcf08..80a753757e 100644 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -27,8 +27,34 @@ #include "llfloaterobjectweights.h" +#include "llparcel.h" + +#include "llfloaterreg.h" #include "lltextbox.h" +#include "llselectmgr.h" +#include "llviewerparcelmgr.h" + +/** + * Class LLLandImpactsObserver + * + * An observer class to monitor parcel selection and update + * the land impacts data from a parcel containing the selected object. + */ +class LLLandImpactsObserver : public LLParcelObserver +{ +public: + virtual void changed() + { + LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::getTypedInstance("object_weights"); + if(object_weights_floater) + { + object_weights_floater->updateLandImpacts(); + } + } +}; + + LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key) : LLFloater(key), mSelectedObjects(NULL), @@ -40,12 +66,22 @@ LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key) mSelectedOnLand(NULL), mRezzedOnLand(NULL), mRemainingCapacity(NULL), - mTotalCapacity(NULL) + mTotalCapacity(NULL), + mLandImpactsObserver(NULL) { + mLandImpactsObserver = new LLLandImpactsObserver(); + LLViewerParcelMgr::getInstance()->addObserver(mLandImpactsObserver); } LLFloaterObjectWeights::~LLFloaterObjectWeights() { + mObjectSelection = NULL; + mParcelSelection = NULL; + + mSelectMgrConnection.disconnect(); + + LLViewerParcelMgr::getInstance()->removeObserver(mLandImpactsObserver); + delete mLandImpactsObserver; } // virtual @@ -59,10 +95,10 @@ BOOL LLFloaterObjectWeights::postBuild() mSelectedServerWeight = getChild("server"); mSelectedDisplayWeight = getChild("display"); - mSelectedOnLand = getChild("used_download_weight"); - mRezzedOnLand = getChild("used_download_weight"); - mRemainingCapacity = getChild("used_download_weight"); - mTotalCapacity = getChild("used_download_weight"); + mSelectedOnLand = getChild("selected"); + mRezzedOnLand = getChild("rezzed_on_land"); + mRemainingCapacity = getChild("remaining_capacity"); + mTotalCapacity = getChild("total_capacity"); return TRUE; } @@ -70,15 +106,94 @@ BOOL LLFloaterObjectWeights::postBuild() // virtual void LLFloaterObjectWeights::onOpen(const LLSD& key) { - updateIfNothingSelected(); + mSelectMgrConnection = LLSelectMgr::instance().mUpdateSignal.connect(boost::bind(&LLFloaterObjectWeights::refresh, this)); + + mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); + mParcelSelection = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection(); + + refresh(); +} + +// virtual +void LLFloaterObjectWeights::onClose(bool app_quitting) +{ + mSelectMgrConnection.disconnect(); + + mObjectSelection = NULL; + mParcelSelection = NULL; } -void LLFloaterObjectWeights::toggleLoadingIndicators(bool visible) +void LLFloaterObjectWeights::updateLandImpacts() +{ + LLParcel *parcel = mParcelSelection->getParcel(); + if (!parcel || LLSelectMgr::getInstance()->getSelection()->isEmpty()) + { + updateIfNothingSelected(); + } + else + { + S32 selected_prims = parcel->getSelectedPrimCount(); + S32 rezzed_prims = parcel->getSimWidePrimCount(); + S32 total_capacity = parcel->getSimWideMaxPrimCapacity(); + + mSelectedOnLand->setText(llformat("%d", selected_prims)); + mRezzedOnLand->setText(llformat("%d", rezzed_prims)); + mRemainingCapacity->setText(llformat("%d", total_capacity - rezzed_prims)); + mTotalCapacity->setText(llformat("%d", total_capacity)); + + toggleLandImpactsLoadingIndicators(false); + } +} + +void LLFloaterObjectWeights::refresh() +{ + if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) + { + updateIfNothingSelected(); + } + else + { + S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); + S32 link_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); + + mSelectedObjects->setText(llformat("%d", link_count)); + mSelectedPrims->setText(llformat("%d", prim_count)); + + LLViewerObject* selected_object = mObjectSelection->getPrimaryObject(); + if (selected_object) + { + // Select a parcel at the currently selected object's position. + LLViewerParcelMgr::getInstance()->selectParcelAt(selected_object->getPositionGlobal()); + + toggleLandImpactsLoadingIndicators(true); + } + } +} + +void LLFloaterObjectWeights::toggleWeightsLoadingIndicators(bool visible) { childSetVisible("download_loading_indicator", visible); childSetVisible("physics_loading_indicator", visible); childSetVisible("server_loading_indicator", visible); childSetVisible("display_loading_indicator", visible); + + mSelectedDownloadWeight->setVisible(!visible); + mSelectedPhysicsWeight->setVisible(!visible); + mSelectedServerWeight->setVisible(!visible); + mSelectedDisplayWeight->setVisible(!visible); +} + +void LLFloaterObjectWeights::toggleLandImpactsLoadingIndicators(bool visible) +{ + childSetVisible("selected_loading_indicator", visible); + childSetVisible("rezzed_on_land_loading_indicator", visible); + childSetVisible("remaining_capacity_loading_indicator", visible); + childSetVisible("total_capacity_loading_indicator", visible); + + mSelectedOnLand->setVisible(!visible); + mRezzedOnLand->setVisible(!visible); + mRemainingCapacity->setVisible(!visible); + mTotalCapacity->setVisible(!visible); } void LLFloaterObjectWeights::updateIfNothingSelected() @@ -94,6 +209,10 @@ void LLFloaterObjectWeights::updateIfNothingSelected() mSelectedDisplayWeight->setText(text); mSelectedOnLand->setText(text); + mRezzedOnLand->setText(text); + mRemainingCapacity->setText(text); + mTotalCapacity->setText(text); - toggleLoadingIndicators(false); + toggleWeightsLoadingIndicators(false); + toggleLandImpactsLoadingIndicators(false); } -- cgit v1.2.3 From ef6e51db22ad3aec42b19bcf3e077ff000ba8929 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Sat, 6 Aug 2011 14:28:53 +0300 Subject: SH-2170 FIXED Detecting selection of objects that cross parcel bounds added. In this case the land impacts data is not displayed for such selection. --- indra/newview/llfloaterobjectweights.cpp | 36 +++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) (limited to 'indra/newview/llfloaterobjectweights.cpp') diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index 80a753757e..d39a93991f 100644 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -34,6 +34,15 @@ #include "llselectmgr.h" #include "llviewerparcelmgr.h" +#include "llviewerregion.h" + +struct LLCrossParcelFunctor : public LLSelectedObjectFunctor +{ + /*virtual*/ bool apply(LLViewerObject* obj) + { + return obj->crossesParcelBounds(); + } +}; /** * Class LLLandImpactsObserver @@ -159,13 +168,30 @@ void LLFloaterObjectWeights::refresh() mSelectedObjects->setText(llformat("%d", link_count)); mSelectedPrims->setText(llformat("%d", prim_count)); - LLViewerObject* selected_object = mObjectSelection->getPrimaryObject(); - if (selected_object) + LLCrossParcelFunctor func; + if (LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, true)) { - // Select a parcel at the currently selected object's position. - LLViewerParcelMgr::getInstance()->selectParcelAt(selected_object->getPositionGlobal()); + // Some of the selected objects cross parcel bounds. + // We don't display land impacts in this case. + const std::string text = getString("nothing_selected"); + + mSelectedOnLand->setText(text); + mRezzedOnLand->setText(text); + mRemainingCapacity->setText(text); + mTotalCapacity->setText(text); - toggleLandImpactsLoadingIndicators(true); + toggleLandImpactsLoadingIndicators(false); + } + else + { + LLViewerObject* selected_object = mObjectSelection->getFirstObject(); + if (selected_object) + { + // Select a parcel at the currently selected object's position. + LLViewerParcelMgr::getInstance()->selectParcelAt(selected_object->getPositionGlobal()); + + toggleLandImpactsLoadingIndicators(true); + } } } } -- cgit v1.2.3 From 543df6736fb0ae312b9a5e056a35bf8fffd2b6c9 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Wed, 17 Aug 2011 01:42:21 +0300 Subject: SH-2171 FIXED New prim weights added to weights detail floater. - Fixed detecting cross-parcel objects selection. - Various fixes in LLAccountingCostManager. - getSelectedObjectRenderCost() moved from LLFloaterTools to LLObjectSelection where it used to reside. Previous commented out implementation of this method removed. --- indra/newview/llfloaterobjectweights.cpp | 102 ++++++++++++++++++++++++++++--- 1 file changed, 93 insertions(+), 9 deletions(-) (limited to 'indra/newview/llfloaterobjectweights.cpp') diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index d39a93991f..7ad34431fb 100644 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -32,16 +32,48 @@ #include "llfloaterreg.h" #include "lltextbox.h" +#include "llagent.h" #include "llselectmgr.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" +/** + * struct LLCrossParcelFunctor + * + * A functor that checks whether a bounding box for all + * selected objects crosses a region or parcel bounds. + */ struct LLCrossParcelFunctor : public LLSelectedObjectFunctor { /*virtual*/ bool apply(LLViewerObject* obj) { - return obj->crossesParcelBounds(); + // Add the root object box. + mBoundingBox.addBBoxAgent(LLBBox(obj->getPositionRegion(), obj->getRotationRegion(), obj->getScale() * -0.5f, obj->getScale() * 0.5f).getAxisAligned()); + + // Extend the bounding box across all the children. + LLViewerObject::const_child_list_t children = obj->getChildren(); + for (LLViewerObject::const_child_list_t::const_iterator iter = children.begin(); + iter != children.end(); iter++) + { + LLViewerObject* child = *iter; + mBoundingBox.addBBoxAgent(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); + } + + bool result = false; + + LLViewerRegion* region = obj->getRegion(); + if (region) + { + std::vector boxes; + boxes.push_back(mBoundingBox); + result = region->objectsCrossParcel(boxes); + } + + return result; } + +private: + LLBBox mBoundingBox; }; /** @@ -132,6 +164,32 @@ void LLFloaterObjectWeights::onClose(bool app_quitting) mParcelSelection = NULL; } +// virtual +void LLFloaterObjectWeights::onWeightsUpdate(const SelectionCost& selection_cost) +{ + mSelectedDownloadWeight->setText(llformat("%.1f", selection_cost.mNetworkCost)); + mSelectedPhysicsWeight->setText(llformat("%.1f", selection_cost.mPhysicsCost)); + mSelectedServerWeight->setText(llformat("%.1f", selection_cost.mSimulationCost)); + + S32 render_cost = LLSelectMgr::getInstance()->getSelection()->getSelectedObjectRenderCost(); + mSelectedDisplayWeight->setText(llformat("%d", render_cost)); + + toggleWeightsLoadingIndicators(false); +} + +//virtual +void LLFloaterObjectWeights::setErrorStatus(U32 status, const std::string& reason) +{ + const std::string text = getString("nothing_selected"); + + mSelectedDownloadWeight->setText(text); + mSelectedPhysicsWeight->setText(text); + mSelectedServerWeight->setText(text); + mSelectedDisplayWeight->setText(text); + + toggleWeightsLoadingIndicators(false); +} + void LLFloaterObjectWeights::updateLandImpacts() { LLParcel *parcel = mParcelSelection->getParcel(); @@ -141,11 +199,9 @@ void LLFloaterObjectWeights::updateLandImpacts() } else { - S32 selected_prims = parcel->getSelectedPrimCount(); S32 rezzed_prims = parcel->getSimWidePrimCount(); S32 total_capacity = parcel->getSimWideMaxPrimCapacity(); - mSelectedOnLand->setText(llformat("%d", selected_prims)); mRezzedOnLand->setText(llformat("%d", rezzed_prims)); mRemainingCapacity->setText(llformat("%d", total_capacity - rezzed_prims)); mTotalCapacity->setText(llformat("%d", total_capacity)); @@ -156,26 +212,29 @@ void LLFloaterObjectWeights::updateLandImpacts() void LLFloaterObjectWeights::refresh() { - if (LLSelectMgr::getInstance()->getSelection()->isEmpty()) + LLSelectMgr* sel_mgr = LLSelectMgr::getInstance(); + + if (sel_mgr->getSelection()->isEmpty()) { updateIfNothingSelected(); } else { - S32 prim_count = LLSelectMgr::getInstance()->getSelection()->getObjectCount(); - S32 link_count = LLSelectMgr::getInstance()->getSelection()->getRootObjectCount(); + S32 prim_count = sel_mgr->getSelection()->getObjectCount(); + S32 link_count = sel_mgr->getSelection()->getRootObjectCount(); + F32 prim_equiv = sel_mgr->getSelection()->getSelectedLinksetCost(); mSelectedObjects->setText(llformat("%d", link_count)); mSelectedPrims->setText(llformat("%d", prim_count)); + mSelectedOnLand->setText(llformat("%.1d", (S32)prim_equiv)); LLCrossParcelFunctor func; - if (LLSelectMgr::getInstance()->getSelection()->applyToRootObjects(&func, true)) + if (sel_mgr->getSelection()->applyToRootObjects(&func, true)) { // Some of the selected objects cross parcel bounds. - // We don't display land impacts in this case. + // We don't display object weights and land impacts in this case. const std::string text = getString("nothing_selected"); - mSelectedOnLand->setText(text); mRezzedOnLand->setText(text); mRemainingCapacity->setText(text); mTotalCapacity->setText(text); @@ -192,6 +251,31 @@ void LLFloaterObjectWeights::refresh() toggleLandImpactsLoadingIndicators(true); } + else + { + llwarns << "Failed to get selected object" << llendl; + } + } + + LLViewerRegion* region = gAgent.getRegion(); + if (region && region->capabilitiesReceived()) + { + for (LLObjectSelection::valid_root_iterator iter = sel_mgr->getSelection()->valid_root_begin(); + iter != sel_mgr->getSelection()->valid_root_end(); ++iter) + { + LLAccountingCostManager::getInstance()->addObject((*iter)->getObject()->getID()); + } + + std::string url = region->getCapability("ResourceCostSelected"); + if (!url.empty()) + { + LLAccountingCostManager::getInstance()->fetchCosts(Roots, url, getObserverHandle()); + toggleWeightsLoadingIndicators(true); + } + } + else + { + llwarns << "Failed to get region capabilities" << llendl; } } } -- cgit v1.2.3 From ca8a484f0ee4bcb9b68268f871082d4200062f0e Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Mon, 22 Aug 2011 19:18:36 +0300 Subject: SH-2169 FIXED Land impacts data added to build tools floater. Land selection moved from advanced weights floater to build tools floater. Removed selection observer from weights floater, selection data update in it is initiated from build floater. --- indra/newview/llfloaterobjectweights.cpp | 115 ++++++------------------------- 1 file changed, 22 insertions(+), 93 deletions(-) (limited to 'indra/newview/llfloaterobjectweights.cpp') diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index 7ad34431fb..7bfa8454b6 100644 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -33,68 +33,36 @@ #include "lltextbox.h" #include "llagent.h" -#include "llselectmgr.h" #include "llviewerparcelmgr.h" #include "llviewerregion.h" -/** - * struct LLCrossParcelFunctor - * - * A functor that checks whether a bounding box for all - * selected objects crosses a region or parcel bounds. - */ -struct LLCrossParcelFunctor : public LLSelectedObjectFunctor +// virtual +bool LLCrossParcelFunctor::apply(LLViewerObject* obj) { - /*virtual*/ bool apply(LLViewerObject* obj) - { - // Add the root object box. - mBoundingBox.addBBoxAgent(LLBBox(obj->getPositionRegion(), obj->getRotationRegion(), obj->getScale() * -0.5f, obj->getScale() * 0.5f).getAxisAligned()); + // Add the root object box. + mBoundingBox.addBBoxAgent(LLBBox(obj->getPositionRegion(), obj->getRotationRegion(), obj->getScale() * -0.5f, obj->getScale() * 0.5f).getAxisAligned()); - // Extend the bounding box across all the children. - LLViewerObject::const_child_list_t children = obj->getChildren(); - for (LLViewerObject::const_child_list_t::const_iterator iter = children.begin(); - iter != children.end(); iter++) - { - LLViewerObject* child = *iter; - mBoundingBox.addBBoxAgent(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); - } - - bool result = false; - - LLViewerRegion* region = obj->getRegion(); - if (region) - { - std::vector boxes; - boxes.push_back(mBoundingBox); - result = region->objectsCrossParcel(boxes); - } - - return result; + // Extend the bounding box across all the children. + LLViewerObject::const_child_list_t children = obj->getChildren(); + for (LLViewerObject::const_child_list_t::const_iterator iter = children.begin(); + iter != children.end(); iter++) + { + LLViewerObject* child = *iter; + mBoundingBox.addBBoxAgent(LLBBox(child->getPositionRegion(), child->getRotationRegion(), child->getScale() * -0.5f, child->getScale() * 0.5f).getAxisAligned()); } -private: - LLBBox mBoundingBox; -}; + bool result = false; -/** - * Class LLLandImpactsObserver - * - * An observer class to monitor parcel selection and update - * the land impacts data from a parcel containing the selected object. - */ -class LLLandImpactsObserver : public LLParcelObserver -{ -public: - virtual void changed() + LLViewerRegion* region = obj->getRegion(); + if (region) { - LLFloaterObjectWeights* object_weights_floater = LLFloaterReg::getTypedInstance("object_weights"); - if(object_weights_floater) - { - object_weights_floater->updateLandImpacts(); - } + std::vector boxes; + boxes.push_back(mBoundingBox); + result = region->objectsCrossParcel(boxes); } -}; + return result; +} LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key) : LLFloater(key), @@ -107,22 +75,12 @@ LLFloaterObjectWeights::LLFloaterObjectWeights(const LLSD& key) mSelectedOnLand(NULL), mRezzedOnLand(NULL), mRemainingCapacity(NULL), - mTotalCapacity(NULL), - mLandImpactsObserver(NULL) + mTotalCapacity(NULL) { - mLandImpactsObserver = new LLLandImpactsObserver(); - LLViewerParcelMgr::getInstance()->addObserver(mLandImpactsObserver); } LLFloaterObjectWeights::~LLFloaterObjectWeights() { - mObjectSelection = NULL; - mParcelSelection = NULL; - - mSelectMgrConnection.disconnect(); - - LLViewerParcelMgr::getInstance()->removeObserver(mLandImpactsObserver); - delete mLandImpactsObserver; } // virtual @@ -147,21 +105,8 @@ BOOL LLFloaterObjectWeights::postBuild() // virtual void LLFloaterObjectWeights::onOpen(const LLSD& key) { - mSelectMgrConnection = LLSelectMgr::instance().mUpdateSignal.connect(boost::bind(&LLFloaterObjectWeights::refresh, this)); - - mObjectSelection = LLSelectMgr::getInstance()->getEditSelection(); - mParcelSelection = LLViewerParcelMgr::getInstance()->getFloatingParcelSelection(); - refresh(); -} - -// virtual -void LLFloaterObjectWeights::onClose(bool app_quitting) -{ - mSelectMgrConnection.disconnect(); - - mObjectSelection = NULL; - mParcelSelection = NULL; + updateLandImpacts(LLViewerParcelMgr::getInstance()->getFloatingParcelSelection()->getParcel()); } // virtual @@ -190,9 +135,8 @@ void LLFloaterObjectWeights::setErrorStatus(U32 status, const std::string& reaso toggleWeightsLoadingIndicators(false); } -void LLFloaterObjectWeights::updateLandImpacts() +void LLFloaterObjectWeights::updateLandImpacts(const LLParcel* parcel) { - LLParcel *parcel = mParcelSelection->getParcel(); if (!parcel || LLSelectMgr::getInstance()->getSelection()->isEmpty()) { updateIfNothingSelected(); @@ -241,21 +185,6 @@ void LLFloaterObjectWeights::refresh() toggleLandImpactsLoadingIndicators(false); } - else - { - LLViewerObject* selected_object = mObjectSelection->getFirstObject(); - if (selected_object) - { - // Select a parcel at the currently selected object's position. - LLViewerParcelMgr::getInstance()->selectParcelAt(selected_object->getPositionGlobal()); - - toggleLandImpactsLoadingIndicators(true); - } - else - { - llwarns << "Failed to get selected object" << llendl; - } - } LLViewerRegion* region = gAgent.getRegion(); if (region && region->capabilitiesReceived()) -- cgit v1.2.3 From 056015963290e47e03972e17ce6d603f8f940fe3 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Mon, 22 Aug 2011 23:41:54 +0300 Subject: SH-2171 ADDITIONAL FIX Added transaction ID to object weights requests to avoid updating the floater upon outdated or mixed up replies arrival. --- indra/newview/llfloaterobjectweights.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'indra/newview/llfloaterobjectweights.cpp') diff --git a/indra/newview/llfloaterobjectweights.cpp b/indra/newview/llfloaterobjectweights.cpp index 7bfa8454b6..0862cd2897 100644 --- a/indra/newview/llfloaterobjectweights.cpp +++ b/indra/newview/llfloaterobjectweights.cpp @@ -198,6 +198,9 @@ void LLFloaterObjectWeights::refresh() std::string url = region->getCapability("ResourceCostSelected"); if (!url.empty()) { + // Update the transaction id before the new fetch request + generateTransactionID(); + LLAccountingCostManager::getInstance()->fetchCosts(Roots, url, getObserverHandle()); toggleWeightsLoadingIndicators(true); } @@ -209,6 +212,12 @@ void LLFloaterObjectWeights::refresh() } } +// virtual +void LLFloaterObjectWeights::generateTransactionID() +{ + mTransactionID.generate(); +} + void LLFloaterObjectWeights::toggleWeightsLoadingIndicators(bool visible) { childSetVisible("download_loading_indicator", visible); -- cgit v1.2.3