From 18ff702a9965ba8b9a17326b391f8edab01242f6 Mon Sep 17 00:00:00 2001 From: "prep@lindenlab.com" Date: Thu, 13 Dec 2012 16:53:38 -0600 Subject: [PATCH 01/66] Fix for SH-3591. --- indra/newview/llfloatersidepanelcontainer.cpp | 12 +- indra/newview/llpaneleditwearable.cpp | 8 + indra/newview/llpaneleditwearable.h | 1 + indra/newview/llsidepanelappearance.cpp | 1093 ++++++++--------- indra/newview/llsidepanelappearance.h | 3 +- 5 files changed, 566 insertions(+), 551 deletions(-) diff --git a/indra/newview/llfloatersidepanelcontainer.cpp b/indra/newview/llfloatersidepanelcontainer.cpp index 3c966a073f..02150819a0 100755 --- a/indra/newview/llfloatersidepanelcontainer.cpp +++ b/indra/newview/llfloatersidepanelcontainer.cpp @@ -28,6 +28,7 @@ #include "llfloaterreg.h" #include "llfloatersidepanelcontainer.h" +#include "llpaneleditwearable.h" // newview includes #include "llsidetraypanelcontainer.h" @@ -72,7 +73,16 @@ void LLFloaterSidePanelContainer::onClickCloseBtn() panel_appearance->showOutfitsInventoryPanel(); } } - + + if ( panel_outfit_edit ) + { + LLSidepanelAppearance* panel_appearance = dynamic_cast(getPanel("appearance")); + if ( panel_appearance ) + { + panel_appearance->getWearable()->onClose(); + panel_appearance->showOutfitsInventoryPanel(); + } + } LLFloater::onClickCloseBtn(); } diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 87f9e3da59..786b215fdf 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -856,6 +856,14 @@ void LLPanelEditWearable::draw() LLPanel::draw(); } +void LLPanelEditWearable::onClose() +{ + if ( isDirty() ) + { + revertChanges(); + } +} + void LLPanelEditWearable::setVisible(BOOL visible) { if (!visible) diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h index 515a9913b9..ac4344de2e 100644 --- a/indra/newview/llpaneleditwearable.h +++ b/indra/newview/llpaneleditwearable.h @@ -54,6 +54,7 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ BOOL isDirty() const; // LLUICtrl /*virtual*/ void draw(); + void onClose(); // changes camera angle to default for selected subpart void changeCamera(U8 subpart); diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 1fc10c2326..98dc2c0e09 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -1,549 +1,544 @@ -/** - * @file llsidepanelappearance.cpp - * @brief Side Bar "Appearance" panel - * - * $LicenseInfo:firstyear=2009&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$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llsidepanelappearance.h" - -#include "llaccordionctrltab.h" -#include "llagent.h" -#include "llagentcamera.h" -#include "llagentwearables.h" -#include "llappearancemgr.h" -#include "llfloatersidepanelcontainer.h" -#include "llfolderview.h" -#include "llinventorypanel.h" -#include "llfiltereditor.h" -#include "llfloaterreg.h" -#include "llfloaterworldmap.h" -#include "llfoldervieweventlistener.h" -#include "lloutfitobserver.h" -#include "llpaneleditwearable.h" -#include "llpaneloutfitsinventory.h" -#include "lltextbox.h" -#include "lluictrlfactory.h" -#include "llviewercontrol.h" -#include "llviewerregion.h" -#include "llvoavatarself.h" -#include "llviewerwearable.h" - -static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); - -class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver -{ -public: - LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, - LLSidepanelAppearance *panel) : - LLInventoryFetchItemsObserver(ids), - mPanel(panel) - {} - ~LLCurrentlyWornFetchObserver() {} - virtual void done() - { - mPanel->inventoryFetched(); - gInventory.removeObserver(this); - delete this; - } -private: - LLSidepanelAppearance *mPanel; -}; - -LLSidepanelAppearance::LLSidepanelAppearance() : - LLPanel(), - mFilterSubString(LLStringUtil::null), - mFilterEditor(NULL), - mOutfitEdit(NULL), - mCurrOutfitPanel(NULL), - mOpened(false) -{ - LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); - outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - - gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true)); - gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false)); -} - -LLSidepanelAppearance::~LLSidepanelAppearance() -{ -} - -// virtual -BOOL LLSidepanelAppearance::postBuild() -{ - mOpenOutfitBtn = getChild("openoutfit_btn"); - mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); - - mEditAppearanceBtn = getChild("editappearance_btn"); - mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this)); - - childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); - - mNewOutfitBtn = getChild("newlook_btn"); - mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this)); - mNewOutfitBtn->setEnabled(false); - - mFilterEditor = getChild("Filter"); - if (mFilterEditor) - { - mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2)); - } - - mPanelOutfitsInventory = dynamic_cast(getChild("panel_outfits_inventory")); - - mOutfitEdit = dynamic_cast(getChild("panel_outfit_edit")); - if (mOutfitEdit) - { - LLButton* back_btn = mOutfitEdit->getChild("back_btn"); - if (back_btn) - { - back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this)); - } - - } - - mEditWearable = dynamic_cast(getChild("panel_edit_wearable")); - if (mEditWearable) - { - LLButton* edit_wearable_back_btn = mEditWearable->getChild("back_btn"); - if (edit_wearable_back_btn) - { - edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); - } - } - - mCurrentLookName = getChild("currentlook_name"); - - mOutfitStatus = getChild("currentlook_status"); - - mCurrOutfitPanel = getChild("panel_currentlook"); - - - setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); - - return TRUE; -} - -// virtual -void LLSidepanelAppearance::onOpen(const LLSD& key) -{ - if (!key.has("type")) - { - // No specific panel requested. - // If we're opened for the first time then show My Outfits. - // Else do nothing. - if (!mOpened) - { - showOutfitsInventoryPanel(); - } - } - else - { - // Switch to the requested panel. - std::string type = key["type"].asString(); - if (type == "my_outfits") - { - showOutfitsInventoryPanel(); - } - else if (type == "edit_outfit") - { - showOutfitEditPanel(); - } - else if (type == "edit_shape") - { - showWearableEditPanel(); - } - } - - mOpened = true; -} - -void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) -{ - LLSD visibility; - visibility["visible"] = new_visibility.asBoolean(); - visibility["reset_accordion"] = false; - updateToVisibility(visibility); -} - -void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) -{ - if (new_visibility["visible"].asBoolean()) - { - const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); - const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); - - if (is_outfit_edit_visible || is_wearable_edit_visible) - { - const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); - if (!wearable_ptr) - { - llwarns << "Visibility change to invalid wearable" << llendl; - return; - } - // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar - // when editing its physics. - if (!gAgentCamera.cameraCustomizeAvatar()) - { - LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); - } - if (is_wearable_edit_visible) - { - if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) - { - // we're no longer wearing the wearable we were last editing, switch back to outfit editor - showOutfitEditPanel(); - } - } - - if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean()) - { - mOutfitEdit->resetAccordionState(); - } - } - } - else - { - if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) - { - gAgentCamera.changeCameraToDefault(); - gAgentCamera.resetView(); - } - - if ( mEditWearable->getVisible() ) - { - mEditWearable->revertChanges(); - } - } -} - -void LLSidepanelAppearance::onFilterEdit(const std::string& search_string) -{ - if (mFilterSubString != search_string) - { - mFilterSubString = search_string; - - // Searches are case-insensitive - // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is. - - mPanelOutfitsInventory->onSearchEdit(mFilterSubString); - } -} - -void LLSidepanelAppearance::onOpenOutfitButtonClicked() -{ - const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); - if (!outfit_link) - return; - if (!outfit_link->getIsLinkType()) - return; - - LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild("tab_outfits"); - if (tab_outfits) - { - tab_outfits->changeOpenClose(FALSE); - LLInventoryPanel *inventory_panel = tab_outfits->findChild("outfitslist_tab"); - if (inventory_panel) - { - LLFolderView* root = inventory_panel->getRootFolder(); - LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); - if (outfit_folder) - { - outfit_folder->setOpen(!outfit_folder->isOpen()); - root->setSelectionFromRoot(outfit_folder,TRUE); - root->scrollToShowSelection(); - } - } - } -} - -// *TODO: obsolete? -void LLSidepanelAppearance::onEditAppearanceButtonClicked() -{ - if (gAgentWearables.areWearablesLoaded()) - { - LLVOAvatarSelf::onCustomizeStart(); - } -} - -void LLSidepanelAppearance::onNewOutfitButtonClicked() -{ - if (!mOutfitEdit->getVisible()) - { - mPanelOutfitsInventory->onSave(); - } -} - -void LLSidepanelAppearance::showOutfitsInventoryPanel() -{ - toggleWearableEditPanel(FALSE); - toggleOutfitEditPanel(FALSE); - toggleMyOutfitsPanel(TRUE); -} - -void LLSidepanelAppearance::showOutfitEditPanel() -{ - if (mOutfitEdit && mOutfitEdit->getVisible()) return; - - // Accordion's state must be reset in all cases except the one when user - // is returning back to the mOutfitEdit panel from the mEditWearable panel. - // The simplest way to control this is to check the visibility state of the mEditWearable - // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE). - if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) - { - mOutfitEdit->resetAccordionState(); - } - - // If we're exiting the edit wearable view, and the camera was not focused on the avatar - // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since - // otherwise this would trigger the camera focus mode. - if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar()) - { - showOutfitsInventoryPanel(); - return; - } - - toggleMyOutfitsPanel(FALSE); - toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode - toggleOutfitEditPanel(TRUE); -} - -void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) -{ - toggleMyOutfitsPanel(FALSE); - toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode - toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); -} - -void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible) -{ - if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - mPanelOutfitsInventory->setVisible(visible); - - // *TODO: Move these controls to panel_outfits_inventory.xml - // so that we don't need to toggle them explicitly. - mFilterEditor->setVisible(visible); - mNewOutfitBtn->setVisible(visible); - mCurrOutfitPanel->setVisible(visible); - - if (visible) - { - mPanelOutfitsInventory->onOpen(LLSD()); - } -} - -void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) -{ - if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - mOutfitEdit->setVisible(visible); - - if (visible) - { - mOutfitEdit->onOpen(LLSD()); - LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); - } - else - { - if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. - { - LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); - } - } -} - -void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) -{ - if (!mEditWearable || mEditWearable->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - if (!wearable) - { - wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); - } - if (!wearable) - { - return; - } - - // Toggle panel visibility. - mEditWearable->setVisible(visible); - - if (visible) - { - LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); - mEditWearable->setWearable(wearable, disable_camera_switch); - mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency - } - else - { - // Save changes if closing. - mEditWearable->saveChanges(); - if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. - { - LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); - } - } -} - -void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) -{ - // Set current outfit status (wearing/unsaved). - bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); - std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); - mOutfitStatus->setText(cof_status_str); - - if (name == "") - { - std::string outfit_name; - if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) - { - mCurrentLookName->setText(outfit_name); - return; - } - - std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; - mCurrentLookName->setText(getString(string_name)); - mOpenOutfitBtn->setEnabled(FALSE); - } - else - { - mCurrentLookName->setText(name); - // Can't just call update verbs since the folder link may not have been created yet. - mOpenOutfitBtn->setEnabled(TRUE); - } -} - -//static -void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) -{ - LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); - - LLSidepanelAppearance *panel = dynamic_cast(data); - if (panel) - { - panel->showWearableEditPanel(wearable, disable_camera_switch); - } -} - -// Fetch currently worn items and only enable the New Look button after everything's been -// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. -void LLSidepanelAppearance::fetchInventory() -{ - - mNewOutfitBtn->setEnabled(false); - uuid_vec_t ids; - LLUUID item_id; - for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) - { - for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) - { - item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); - if(item_id.notNull()) - { - ids.push_back(item_id); - } - } - } - - if (isAgentAvatarValid()) - { - for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); - iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) - { - LLViewerJointAttachment* attachment = iter->second; - if (!attachment) continue; - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); - attachment_iter != attachment->mAttachedObjects.end(); - ++attachment_iter) - { - LLViewerObject* attached_object = (*attachment_iter); - if (!attached_object) continue; - const LLUUID& item_id = attached_object->getAttachmentItemID(); - if (item_id.isNull()) continue; - ids.push_back(item_id); - } - } - } - - LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); - fetch_worn->startFetch(); - // If no items to be fetched, done will never be triggered. - // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. - if (fetch_worn->isFinished()) - { - fetch_worn->done(); - } - else - { - gInventory.addObserver(fetch_worn); - } -} - -void LLSidepanelAppearance::inventoryFetched() -{ - mNewOutfitBtn->setEnabled(true); -} - -void LLSidepanelAppearance::setWearablesLoading(bool val) -{ - getChildView("wearables_loading_indicator")->setVisible( val); - getChildView("edit_outfit_btn")->setVisible( !val); - - if (!val) - { - // refresh outfit name when COF is already changed. - refreshCurrentOutfitName(); - } -} - -void LLSidepanelAppearance::showDefaultSubpart() -{ - if (mEditWearable->getVisible()) - { - mEditWearable->showDefaultSubpart(); - } -} - -void LLSidepanelAppearance::updateScrollingPanelList() -{ - if (mEditWearable->getVisible()) - { - mEditWearable->updateScrollingPanelList(); - } -} +/** + * @file llsidepanelappearance.cpp + * @brief Side Bar "Appearance" panel + * + * $LicenseInfo:firstyear=2009&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$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsidepanelappearance.h" + +#include "llaccordionctrltab.h" +#include "llagent.h" +#include "llagentcamera.h" +#include "llagentwearables.h" +#include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" +#include "llfolderview.h" +#include "llinventorypanel.h" +#include "llfiltereditor.h" +#include "llfloaterreg.h" +#include "llfloaterworldmap.h" +#include "llfoldervieweventlistener.h" +#include "lloutfitobserver.h" +#include "llpaneleditwearable.h" +#include "llpaneloutfitsinventory.h" +#include "lltextbox.h" +#include "lluictrlfactory.h" +#include "llviewercontrol.h" +#include "llviewerregion.h" +#include "llvoavatarself.h" +#include "llviewerwearable.h" + +static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); + +class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver +{ +public: + LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, + LLSidepanelAppearance *panel) : + LLInventoryFetchItemsObserver(ids), + mPanel(panel) + {} + ~LLCurrentlyWornFetchObserver() {} + virtual void done() + { + mPanel->inventoryFetched(); + gInventory.removeObserver(this); + delete this; + } +private: + LLSidepanelAppearance *mPanel; +}; + +LLSidepanelAppearance::LLSidepanelAppearance() : + LLPanel(), + mFilterSubString(LLStringUtil::null), + mFilterEditor(NULL), + mOutfitEdit(NULL), + mCurrOutfitPanel(NULL), + mOpened(false) +{ + LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); + outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + + gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true)); + gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false)); +} + +LLSidepanelAppearance::~LLSidepanelAppearance() +{ +} + +// virtual +BOOL LLSidepanelAppearance::postBuild() +{ + mOpenOutfitBtn = getChild("openoutfit_btn"); + mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); + + mEditAppearanceBtn = getChild("editappearance_btn"); + mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this)); + + childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); + + mNewOutfitBtn = getChild("newlook_btn"); + mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this)); + mNewOutfitBtn->setEnabled(false); + + mFilterEditor = getChild("Filter"); + if (mFilterEditor) + { + mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2)); + } + + mPanelOutfitsInventory = dynamic_cast(getChild("panel_outfits_inventory")); + + mOutfitEdit = dynamic_cast(getChild("panel_outfit_edit")); + if (mOutfitEdit) + { + LLButton* back_btn = mOutfitEdit->getChild("back_btn"); + if (back_btn) + { + back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this)); + } + + } + + mEditWearable = dynamic_cast(getChild("panel_edit_wearable")); + if (mEditWearable) + { + LLButton* edit_wearable_back_btn = mEditWearable->getChild("back_btn"); + if (edit_wearable_back_btn) + { + edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); + } + } + + mCurrentLookName = getChild("currentlook_name"); + + mOutfitStatus = getChild("currentlook_status"); + + mCurrOutfitPanel = getChild("panel_currentlook"); + + + setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); + + return TRUE; +} + +// virtual +void LLSidepanelAppearance::onOpen(const LLSD& key) +{ + if (!key.has("type")) + { + // No specific panel requested. + // If we're opened for the first time then show My Outfits. + // Else do nothing. + if (!mOpened) + { + showOutfitsInventoryPanel(); + } + } + else + { + // Switch to the requested panel. + std::string type = key["type"].asString(); + if (type == "my_outfits") + { + showOutfitsInventoryPanel(); + } + else if (type == "edit_outfit") + { + showOutfitEditPanel(); + } + else if (type == "edit_shape") + { + showWearableEditPanel(); + } + } + + mOpened = true; +} + +void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) +{ + LLSD visibility; + visibility["visible"] = new_visibility.asBoolean(); + visibility["reset_accordion"] = false; + updateToVisibility(visibility); +} + +void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) +{ + if (new_visibility["visible"].asBoolean()) + { + const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); + const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); + + if (is_outfit_edit_visible || is_wearable_edit_visible) + { + const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); + if (!wearable_ptr) + { + llwarns << "Visibility change to invalid wearable" << llendl; + return; + } + // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar + // when editing its physics. + if (!gAgentCamera.cameraCustomizeAvatar()) + { + LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); + } + if (is_wearable_edit_visible) + { + if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) + { + // we're no longer wearing the wearable we were last editing, switch back to outfit editor + showOutfitEditPanel(); + } + } + + if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean()) + { + mOutfitEdit->resetAccordionState(); + } + } + } + else + { + if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) + { + gAgentCamera.changeCameraToDefault(); + gAgentCamera.resetView(); + } + } +} + +void LLSidepanelAppearance::onFilterEdit(const std::string& search_string) +{ + if (mFilterSubString != search_string) + { + mFilterSubString = search_string; + + // Searches are case-insensitive + // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is. + + mPanelOutfitsInventory->onSearchEdit(mFilterSubString); + } +} + +void LLSidepanelAppearance::onOpenOutfitButtonClicked() +{ + const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); + if (!outfit_link) + return; + if (!outfit_link->getIsLinkType()) + return; + + LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild("tab_outfits"); + if (tab_outfits) + { + tab_outfits->changeOpenClose(FALSE); + LLInventoryPanel *inventory_panel = tab_outfits->findChild("outfitslist_tab"); + if (inventory_panel) + { + LLFolderView* root = inventory_panel->getRootFolder(); + LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); + if (outfit_folder) + { + outfit_folder->setOpen(!outfit_folder->isOpen()); + root->setSelectionFromRoot(outfit_folder,TRUE); + root->scrollToShowSelection(); + } + } + } +} + +// *TODO: obsolete? +void LLSidepanelAppearance::onEditAppearanceButtonClicked() +{ + if (gAgentWearables.areWearablesLoaded()) + { + LLVOAvatarSelf::onCustomizeStart(); + } +} + +void LLSidepanelAppearance::onNewOutfitButtonClicked() +{ + if (!mOutfitEdit->getVisible()) + { + mPanelOutfitsInventory->onSave(); + } +} + +void LLSidepanelAppearance::showOutfitsInventoryPanel() +{ + toggleWearableEditPanel(FALSE); + toggleOutfitEditPanel(FALSE); + toggleMyOutfitsPanel(TRUE); +} + +void LLSidepanelAppearance::showOutfitEditPanel() +{ + if (mOutfitEdit && mOutfitEdit->getVisible()) return; + + // Accordion's state must be reset in all cases except the one when user + // is returning back to the mOutfitEdit panel from the mEditWearable panel. + // The simplest way to control this is to check the visibility state of the mEditWearable + // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE). + if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) + { + mOutfitEdit->resetAccordionState(); + } + + // If we're exiting the edit wearable view, and the camera was not focused on the avatar + // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since + // otherwise this would trigger the camera focus mode. + if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar()) + { + showOutfitsInventoryPanel(); + return; + } + + toggleMyOutfitsPanel(FALSE); + toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode + toggleOutfitEditPanel(TRUE); +} + +void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) +{ + toggleMyOutfitsPanel(FALSE); + toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode + toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); +} + +void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible) +{ + if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + mPanelOutfitsInventory->setVisible(visible); + + // *TODO: Move these controls to panel_outfits_inventory.xml + // so that we don't need to toggle them explicitly. + mFilterEditor->setVisible(visible); + mNewOutfitBtn->setVisible(visible); + mCurrOutfitPanel->setVisible(visible); + + if (visible) + { + mPanelOutfitsInventory->onOpen(LLSD()); + } +} + +void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) +{ + if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + mOutfitEdit->setVisible(visible); + + if (visible) + { + mOutfitEdit->onOpen(LLSD()); + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); + } + else + { + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. + { + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); + } + } +} + +void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) +{ + if (!mEditWearable || mEditWearable->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + if (!wearable) + { + wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); + } + if (!wearable) + { + return; + } + + // Toggle panel visibility. + mEditWearable->setVisible(visible); + + if (visible) + { + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); + mEditWearable->setWearable(wearable, disable_camera_switch); + mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency + } + else + { + // Save changes if closing. + mEditWearable->saveChanges(); + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. + { + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); + } + } +} + +void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) +{ + // Set current outfit status (wearing/unsaved). + bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); + std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); + mOutfitStatus->setText(cof_status_str); + + if (name == "") + { + std::string outfit_name; + if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) + { + mCurrentLookName->setText(outfit_name); + return; + } + + std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; + mCurrentLookName->setText(getString(string_name)); + mOpenOutfitBtn->setEnabled(FALSE); + } + else + { + mCurrentLookName->setText(name); + // Can't just call update verbs since the folder link may not have been created yet. + mOpenOutfitBtn->setEnabled(TRUE); + } +} + +//static +void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) +{ + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); + + LLSidepanelAppearance *panel = dynamic_cast(data); + if (panel) + { + panel->showWearableEditPanel(wearable, disable_camera_switch); + } +} + +// Fetch currently worn items and only enable the New Look button after everything's been +// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. +void LLSidepanelAppearance::fetchInventory() +{ + + mNewOutfitBtn->setEnabled(false); + uuid_vec_t ids; + LLUUID item_id; + for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) + { + for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) + { + item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); + if(item_id.notNull()) + { + ids.push_back(item_id); + } + } + } + + if (isAgentAvatarValid()) + { + for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (!attachment) continue; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + if (!attached_object) continue; + const LLUUID& item_id = attached_object->getAttachmentItemID(); + if (item_id.isNull()) continue; + ids.push_back(item_id); + } + } + } + + LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); + fetch_worn->startFetch(); + // If no items to be fetched, done will never be triggered. + // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. + if (fetch_worn->isFinished()) + { + fetch_worn->done(); + } + else + { + gInventory.addObserver(fetch_worn); + } +} + +void LLSidepanelAppearance::inventoryFetched() +{ + mNewOutfitBtn->setEnabled(true); +} + +void LLSidepanelAppearance::setWearablesLoading(bool val) +{ + getChildView("wearables_loading_indicator")->setVisible( val); + getChildView("edit_outfit_btn")->setVisible( !val); + + if (!val) + { + // refresh outfit name when COF is already changed. + refreshCurrentOutfitName(); + } +} + +void LLSidepanelAppearance::showDefaultSubpart() +{ + if (mEditWearable->getVisible()) + { + mEditWearable->showDefaultSubpart(); + } +} + +void LLSidepanelAppearance::updateScrollingPanelList() +{ + if (mEditWearable->getVisible()) + { + mEditWearable->updateScrollingPanelList(); + } +} diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h index 32bbb8a776..762f557a80 100644 --- a/indra/newview/llsidepanelappearance.h +++ b/indra/newview/llsidepanelappearance.h @@ -47,7 +47,7 @@ public: virtual ~LLSidepanelAppearance(); /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onOpen(const LLSD& key); void refreshCurrentOutfitName(const std::string& name = ""); @@ -64,6 +64,7 @@ public: void showDefaultSubpart(); void updateScrollingPanelList(); void updateToVisibility( const LLSD& new_visibility ); + LLPanelEditWearable* getWearable(){ return mEditWearable; } private: void onFilterEdit(const std::string& search_string); From f9b235adf87819a727a6d656736111b776021ffb Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 14 Dec 2012 01:24:32 +0000 Subject: [PATCH 02/66] Attempt at fixing linux shader support on ubuntu 12.04 --- indra/llwindow/llwindowsdl.cpp | 11 +++-------- indra/newview/linux_tools/wrapper.sh | 11 ++++++++++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 39f8a36a6e..2f397c6372 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -682,12 +682,7 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B // fixme: actually, it's REALLY important for picking that we get at // least 8 bits each of red,green,blue. Alpha we can be a bit more // relaxed about if we have to. -#if LL_SOLARIS && defined(__sparc) -// again the __sparc required because Xsun support, 32bit are very pricey on SPARC - if(colorBits < 24) //HACK: on SPARC allow 24-bit color -#else - if (colorBits < 32) -#endif + if(colorBits < 24) { close(); setupFailure( @@ -697,9 +692,9 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B "You may also need to adjust the X11 setting in SMF. To do so use\n" " 'svccfg -s svc:/application/x11/x11-server setprop options/default_depth=24'\n" #else - "Second Life requires True Color (32-bit) to run in a window.\n" + "Second Life requires at least 24-bit color to run in a window.\n" "Please go to Control Panels -> Display -> Settings and\n" - "set the screen to 32-bit color.\n" + "set the screen to 24-bit color.\n" #endif "Alternately, if you choose to run fullscreen, Second Life\n" "will automatically adjust the screen each time it runs.", diff --git a/indra/newview/linux_tools/wrapper.sh b/indra/newview/linux_tools/wrapper.sh index 20936c6460..0aba4bf0d6 100755 --- a/indra/newview/linux_tools/wrapper.sh +++ b/indra/newview/linux_tools/wrapper.sh @@ -45,6 +45,7 @@ if [ "`uname -m`" = "x86_64" ]; then echo '64-bit Linux detected.' fi + ## Everything below this line is just for advanced troubleshooters. ##------------------------------------------------------------------- @@ -60,7 +61,15 @@ fi export SDL_VIDEO_X11_DGAMOUSE=0 ## - Works around a problem with misconfigured 64-bit systems not finding GL -export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}":/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri +I386_MULTIARCH="$(dpkg-architecture -ai386 -qDEB_HOST_MULTIARCH 2>/dev/null)" +MULTIARCH_ERR=$? +if [ $MULTIARCH_ERR -eq 0 ]; then + echo 'Multi-arch support detected.' + MULTIARCH_GL_DRIVERS="/usr/lib/${I386_MULTIARCH}/dri" + export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}:${MULTIARCH_GL_DRIVERS}:/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri" +else + export LIBGL_DRIVERS_PATH="${LIBGL_DRIVERS_PATH}:/usr/lib64/dri:/usr/lib32/dri:/usr/lib/dri" +fi ## - The 'scim' GTK IM module widely crashes the viewer. Avoid it. if [ "$GTK_IM_MODULE" = "scim" ]; then From ad80ebb869a8d1cdca70a726c2c46d41a6263c4e Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 14 Dec 2012 20:11:45 +0000 Subject: [PATCH 03/66] Updating shaders to not crash when compiled in llvm --- .../shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl | 2 +- .../shaders/class1/lighting/lightFullbrightWaterF.glsl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl index 99a6fe85fe..9c82056fd7 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterAlphaMaskF.glsl @@ -31,7 +31,7 @@ out vec4 frag_color; uniform float minimum_alpha; -vec4 diffuseLookup(vec2 texcoord); +/* vec4 diffuseLookup(vec2 texcoord); */ vec3 fullbrightAtmosTransport(vec3 light); vec4 applyWaterFog(vec4 color); diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl index df182168f3..d3dacf9bc4 100644 --- a/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl +++ b/indra/newview/app_settings/shaders/class1/lighting/lightFullbrightWaterF.glsl @@ -32,7 +32,7 @@ out vec4 frag_color; VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; -vec4 diffuseLookup(vec2 texcoord); +/* vec4 diffuseLookup(vec2 texcoord); */ vec3 fullbrightAtmosTransport(vec3 light); vec4 applyWaterFog(vec4 color); From ae19262bf63848af5a08ac201cf9c2ac55e85f62 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 14 Dec 2012 20:23:52 +0000 Subject: [PATCH 04/66] Reverting back to 32-bit colordepth requirement on linux --- indra/llwindow/llwindowsdl.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 2f397c6372..39f8a36a6e 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -682,7 +682,12 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B // fixme: actually, it's REALLY important for picking that we get at // least 8 bits each of red,green,blue. Alpha we can be a bit more // relaxed about if we have to. - if(colorBits < 24) +#if LL_SOLARIS && defined(__sparc) +// again the __sparc required because Xsun support, 32bit are very pricey on SPARC + if(colorBits < 24) //HACK: on SPARC allow 24-bit color +#else + if (colorBits < 32) +#endif { close(); setupFailure( @@ -692,9 +697,9 @@ BOOL LLWindowSDL::createContext(int x, int y, int width, int height, int bits, B "You may also need to adjust the X11 setting in SMF. To do so use\n" " 'svccfg -s svc:/application/x11/x11-server setprop options/default_depth=24'\n" #else - "Second Life requires at least 24-bit color to run in a window.\n" + "Second Life requires True Color (32-bit) to run in a window.\n" "Please go to Control Panels -> Display -> Settings and\n" - "set the screen to 24-bit color.\n" + "set the screen to 32-bit color.\n" #endif "Alternately, if you choose to run fullscreen, Second Life\n" "will automatically adjust the screen each time it runs.", From b86a3e39cf8d0d17d5cd30743a871e3078331077 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 17 Dec 2012 13:24:57 -0500 Subject: [PATCH 05/66] SH-3604 FIX - resolved an issue with simulated failures/retry logic --- indra/newview/llappearancemgr.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index f957aadec5..7fd7b33be4 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -217,12 +217,12 @@ public: if (ll_frand() Date: Mon, 17 Dec 2012 16:51:25 -0500 Subject: [PATCH 06/66] SH-3629 WIP - fixed out-of-order outfit items --- indra/newview/llappearancemgr.cpp | 32 +++++++++---------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 7fd7b33be4..7751da7b41 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -198,44 +198,30 @@ public: // Request or re-request operation for specified item. void addItem(const LLUUID& item_id) { - LLUUID linked_id; - if (gInventory.getItem(item_id)) - { - linked_id = gInventory.getItem(item_id)->getLinkedUUID(); - } - else if (gInventory.getCategory(item_id)) - { - linked_id = item_id; - } - else - { - llwarns << "no referent found for item_id " << item_id << llendl; - return; - } - LL_DEBUGS("Avatar") << "item_id " << item_id << " -> linked_id " << linked_id << llendl; + LL_DEBUGS("Avatar") << "item_id " << item_id << llendl; if (ll_frand()getName() << " to " << mDstCatID << llendl; // create an inventory item link. link_inventory_item(gAgent.getID(), - item_id, + item->getLinkedUUID(), mDstCatID, item->getName(), item->LLInventoryItem::getDescription(), From 42496cd672436cc4d32f5546fd04294931b8f0b6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 17 Dec 2012 18:34:13 -0500 Subject: [PATCH 07/66] SH-3629 WIP - avoid clobbering links to desired items that are already in the COF, as will be the case when wearing an outfit with required body parts missing --- indra/newview/llappearancemgr.cpp | 49 ++++++++++++++++--------------- indra/newview/llappearancemgr.h | 3 +- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 7751da7b41..1044732f4b 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -418,6 +418,11 @@ public: LLViewerInventoryItem *item = gInventory.getItem(item_id); if (item) { + if (item->getParentUUID() == mDstCatID) + { + LL_DEBUGS("Avatar") << "item " << item_id << " name " << item->getName() << " is already a child of " << mDstCatID << llendl; + return false; + } LL_DEBUGS("Avatar") << "linking item " << item_id << " name " << item->getName() << " to " << mDstCatID << llendl; // create an inventory item link. link_inventory_item(gAgent.getID(), @@ -436,7 +441,7 @@ public: LLViewerInventoryCategory *catp = gInventory.getCategory(item_id); if (!catp) { - llwarns << "id not found as inventory item or category " << item_id << llendl; + llwarns << "link request failed, id not found as inventory item or category " << item_id << llendl; return false; } const LLUUID cof = LLAppearanceMgr::instance().getCOF(); @@ -1621,7 +1626,7 @@ void LLAppearanceMgr::purgeBaseOutfitLink(const LLUUID& category) } } -void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_links) +void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_links, LLInventoryModel::item_array_t* keep_items) { LLInventoryModel::cat_array_t cats; LLInventoryModel::item_array_t items; @@ -1634,7 +1639,14 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin continue; if (item->getIsLinkType()) { - gInventory.purgeObject(item->getUUID()); + if (keep_items && keep_items->find(item) != LLInventoryModel::item_array_t::FAIL) + { + llinfos << "preserved item" << llendl; + } + else + { + gInventory.purgeObject(item->getUUID()); + } } } } @@ -1746,34 +1758,23 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) getDescendentsOfAssetType(category, gest_items, LLAssetType::AT_GESTURE, false); removeDuplicateItems(gest_items); -#ifndef LL_RELEASE_FOR_DOWNLOAD - LL_DEBUGS("Avatar") << self_av_string() << "Linking body items" << LL_ENDL; -#endif - // Create links to new COF contents. LL_DEBUGS("Avatar") << self_av_string() << "creating LLCallAfterInventoryLinkMgr" << LL_ENDL; + + LLInventoryModel::item_array_t all_items; + all_items += body_items; + all_items += wear_items; + all_items += obj_items; + all_items += gest_items; + + // Will link all the above items. bool update_base_outfit_ordering = !append; LLCallAfterInventoryLinkMgr *link_waiter = - new LLCallAfterInventoryLinkMgr(body_items,cof,"update_appearance_on_destroy", + new LLCallAfterInventoryLinkMgr(all_items,cof,"update_appearance_on_destroy", boost::bind(&LLAppearanceMgr::updateAppearanceFromCOF, LLAppearanceMgr::getInstance(), update_base_outfit_ordering)); -#ifndef LL_RELEASE_FOR_DOWNLOAD - LL_DEBUGS("Avatar") << self_av_string() << "Linking wear items" << LL_ENDL; -#endif - link_waiter->addItems(wear_items); - -#ifndef LL_RELEASE_FOR_DOWNLOAD - LL_DEBUGS("Avatar") << self_av_string() << "Linking obj items" << LL_ENDL; -#endif - link_waiter->addItems(obj_items); - -#ifndef LL_RELEASE_FOR_DOWNLOAD - LL_DEBUGS("Avatar") << self_av_string() << "Linking gesture items" << LL_ENDL; -#endif - link_waiter->addItems(gest_items); - // Add link to outfit if category is an outfit. if (!append) { @@ -1785,7 +1786,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append) // carried over (e.g. keeping old shape if the new outfit does not // contain one) bool keep_outfit_links = append; - purgeCategory(cof, keep_outfit_links); + purgeCategory(cof, keep_outfit_links, &all_items); gInventory.notifyObservers(); LL_DEBUGS("Avatar") << self_av_string() << "waiting for LLUpdateAppearanceOnDestroy" << LL_ENDL; diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index cb271cda4d..31dbce892a 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -206,8 +206,7 @@ private: LLInventoryModel::item_array_t& gest_items, bool follow_folder_links); - void purgeCategory(const LLUUID& category, bool keep_outfit_links); - + void purgeCategory(const LLUUID& category, bool keep_outfit_links, LLInventoryModel::item_array_t* keep_items = NULL); static void onOutfitRename(const LLSD& notification, const LLSD& response); void setOutfitLocked(bool locked); From 67c66a12ab0e169e9e1e86265ff57aa5aa758b2a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 18 Dec 2012 12:45:10 -0500 Subject: [PATCH 08/66] SH-3604 WIP - fixed a case with retry logic --- indra/newview/llappearancemgr.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1044732f4b..4a484f3b85 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -199,14 +199,8 @@ public: void addItem(const LLUUID& item_id) { LL_DEBUGS("Avatar") << "item_id " << item_id << llendl; - - if (ll_frand()getPermissions().getOwner(), @@ -425,6 +424,11 @@ public: } LL_DEBUGS("Avatar") << "linking item " << item_id << " name " << item->getName() << " to " << mDstCatID << llendl; // create an inventory item link. + if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateOpFailureRate")) + { + LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << llendl; + return true; + } link_inventory_item(gAgent.getID(), item->getLinkedUUID(), mDstCatID, @@ -433,7 +437,7 @@ public: LLAssetType::AT_LINK, new LLBoostFuncInventoryCallback( boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))); - request_sent = true; + return true; } else { @@ -451,6 +455,11 @@ public: if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT) { + if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateOpFailureRate")) + { + LL_DEBUGS("Avatar") << "simulating failure by not sending request for item " << item_id << llendl; + return true; + } LL_DEBUGS("Avatar") << "linking folder " << item_id << " name " << catp->getName() << " to cof " << cof << llendl; link_inventory_item(gAgent.getID(), item_id, cof, catp->getName(), "", LLAssetType::AT_LINK_FOLDER, From cd710087817909a0a83289cd1ee6a39e5e9a1a5c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 18 Dec 2012 13:07:01 -0500 Subject: [PATCH 09/66] SH-3604 WIP - more frequent polling for retries --- indra/newview/llappearancemgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 4a484f3b85..8b4adc8785 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -175,7 +175,7 @@ public: mFailCount(0), mCompletionOrFailureCalled(false), mRetryCount(0), - LLEventTimer(retry_after) + LLEventTimer(5.0) { if (!mTrackingPhase.empty()) { From 802e738b77f09a67c893825dc8699f8273cebbee Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Tue, 18 Dec 2012 23:40:31 +0000 Subject: [PATCH 10/66] Fix for alpha blending using gl fixed-functions not matching shader implementation --- indra/llappearance/lltexlayer.cpp | 16 +++++++++++++--- indra/llimage/llimage.cpp | 23 +++++++++++++++++++++++ indra/llimage/llimage.h | 5 +++++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index d1edd4f095..6e184beac8 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -150,6 +150,10 @@ BOOL LLTexLayerSetBuffer::renderTexLayerSet() gAlphaMaskProgram.bind(); gAlphaMaskProgram.setMinimumAlpha(0.004f); } + else + { + gGL.setAlphaRejectSettings(LLRender::CF_GREATER, 0.00f); + } LLVertexBuffer::unbind(); @@ -1915,9 +1919,15 @@ LLGLTexture* LLTexLayerStaticImageList::getTexture(const std::string& file_name, { if( (image_raw->getComponents() == 1) && is_mask ) { - // Note: these are static, unchanging images so it's ok to assume - // that once an image is a mask it's always a mask. - tex->setExplicitFormat( GL_ALPHA8, GL_ALPHA ); + // Convert grayscale alpha masks from single channel into RGBA. + // Fill RGB with black to allow fixed function gl calls + // to match shader implementation. + LLPointer alpha_image_raw = image_raw; + image_raw = new LLImageRaw(image_raw->getWidth(), + image_raw->getHeight(), + 4); + + image_raw->copyUnscaledAlphaMask(alpha_image_raw, LLColor4U::black); } tex->createGLTexture(0, image_raw, 0, TRUE, LLGLTexture::LOCAL); diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 916c346b7a..79949df2d0 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -673,6 +673,29 @@ void LLImageRaw::compositeUnscaled4onto3( LLImageRaw* src ) } } +void LLImageRaw::copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill) +{ + LLImageRaw* dst = this; // Just for clarity. + + llassert( 1 == src->getComponents() ); + llassert( 4 == dst->getComponents() ); + llassert( (src->getWidth() == dst->getWidth()) && (src->getHeight() == dst->getHeight()) ); + + S32 pixels = getWidth() * getHeight(); + U8* src_data = src->getData(); + U8* dst_data = dst->getData(); + for ( S32 i = 0; i < pixels; i++ ) + { + dst_data[0] = fill.mV[0]; + dst_data[1] = fill.mV[1]; + dst_data[2] = fill.mV[2]; + dst_data[3] = src_data[0]; + src_data += 1; + dst_data += 4; + } +} + + // Fill the buffer with a constant color void LLImageRaw::fill( const LLColor4U& color ) { diff --git a/indra/llimage/llimage.h b/indra/llimage/llimage.h index 5f54585005..2d98f02aa6 100644 --- a/indra/llimage/llimage.h +++ b/indra/llimage/llimage.h @@ -230,6 +230,11 @@ public: // Src and dst are same size. Src has 3 components. Dst has 4 components. void copyUnscaled3onto4( LLImageRaw* src ); + // Src and dst are same size. Src has 1 component. Dst has 4 components. + // Alpha component is set to source alpha mask component. + // RGB components are set to fill color. + void copyUnscaledAlphaMask( LLImageRaw* src, const LLColor4U& fill); + // Src and dst can be any size. Src and dst have same number of components. void copyScaled( LLImageRaw* src ); From cbf24c55d511b2390fdc4c12698682531f26f41b Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 20 Dec 2012 10:27:18 -0500 Subject: [PATCH 11/66] SH-3344 WIP - additional debugging output for avatar local textures --- indra/llrender/llgltexture.h | 19 ++++--- indra/newview/llviewertexture.cpp | 1 + indra/newview/llviewertexture.h | 2 + indra/newview/llvoavatar.cpp | 4 +- indra/newview/llvoavatarself.cpp | 85 +++++++++++++++++++++++++++++++ indra/newview/llvoavatarself.h | 1 + 6 files changed, 103 insertions(+), 9 deletions(-) diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h index b1efe77519..e69b322d60 100644 --- a/indra/llrender/llgltexture.h +++ b/indra/llrender/llgltexture.h @@ -79,6 +79,15 @@ public: MAX_GL_IMAGE_CATEGORY }; + typedef enum + { + DELETED = 0, //removed from memory + DELETION_CANDIDATE, //ready to be removed from memory + INACTIVE, //not be used for the last certain period (i.e., 30 seconds). + ACTIVE, //just being used, can become inactive if not being used for a certain time (10 seconds). + NO_DELETE = 99 //stay in memory, can not be removed. + } LLGLTextureState; + static S32 getTotalNumOfCategories() ; static S32 getIndexFromCategory(S32 category) ; static S32 getCategoryFromIndex(S32 index) ; @@ -143,6 +152,8 @@ public: U32 getTexelsInGLTexture() const ; BOOL isGLTextureCreated() const ; S32 getDiscardLevelInAtlas() const ; + LLGLTextureState getTextureState() const { return mTextureState; } + //--------------------------------------------------------------------------------------------- //end of functions to access LLImageGL //--------------------------------------------------------------------------------------------- @@ -179,14 +190,6 @@ protected: S8 mDontDiscard; // Keep full res version of this image (for UI, etc) protected: - typedef enum - { - DELETED = 0, //removed from memory - DELETION_CANDIDATE, //ready to be removed from memory - INACTIVE, //not be used for the last certain period (i.e., 30 seconds). - ACTIVE, //just being used, can become inactive if not being used for a certain time (10 seconds). - NO_DELETE = 99 //stay in memory, can not be removed. - } LLGLTextureState; LLGLTextureState mTextureState ; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 846216211e..a673862882 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -616,6 +616,7 @@ LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) : LLViewerTexture::~LLViewerTexture() { + // LL_DEBUGS("Avatar") << mID << llendl; cleanup(); sImageCount--; } diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index 3df942d922..ba6beec883 100755 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -134,6 +134,7 @@ public: void resetTextureStats(); void setMaxVirtualSizeResetInterval(S32 interval)const {mMaxVirtualSizeResetInterval = interval;} void resetMaxVirtualSizeResetCounter()const {mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval;} + S32 getMaxVirtualSizeResetCounter() const { return mMaxVirtualSizeResetCounter; } virtual F32 getMaxVirtualSize() ; @@ -306,6 +307,7 @@ public: // the priority list, and cause horrible things to happen. void setDecodePriority(F32 priority = -1.0f); F32 getDecodePriority() const { return mDecodePriority; }; + F32 getAdditionalDecodePriority() const { return mAdditionalDecodePriority; }; void setAdditionalDecodePriority(F32 priority) ; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 117f28cc36..086e4306f8 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5811,6 +5811,7 @@ void LLVOAvatar::debugColorizeSubMeshes(U32 i, const LLColor4& color) // virtual void LLVOAvatar::updateMeshTextures() { + static S32 update_counter = 0; mBakedTextureDebugText.clear(); // if user has never specified a texture, assign the default @@ -5840,7 +5841,8 @@ void LLVOAvatar::updateMeshTextures() std::vector use_lkg_baked_layer; // lkg = "last known good" use_lkg_baked_layer.resize(mBakedTextureDatas.size(), false); - mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n"; + mBakedTextureDebugText += llformat("%06d\n",update_counter++); + mBakedTextureDebugText += "indx layerset linvld ltda ilb ulkg ltid\n"; for (U32 i=0; i < mBakedTextureDatas.size(); i++) { is_layer_baked[i] = isTextureDefined(mBakedTextureDatas[i].mTextureIndex); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 77deb5e3bc..674988d94b 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -176,6 +176,17 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, lldebugs << "Marking avatar as self " << id << llendl; } +// Called periodically for diagnostics, return true when done. +bool output_texture_diagnostics() +{ + if (!isAgentAvatarValid()) + return true; // done checking + + gAgentAvatarp->outputRezDiagnostics(); + + return false; +} + void LLVOAvatarSelf::initInstance() { BOOL status = TRUE; @@ -209,6 +220,8 @@ void LLVOAvatarSelf::initInstance() llerrs << "Unable to load user's avatar" << llendl; return; } + + //doPeriodically(output_texture_diagnostics, 30.0); } // virtual @@ -2008,6 +2021,64 @@ void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, BOOL fini mDebugBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32(); } +const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const +{ + std::ostringstream outbuf; + for (LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = + LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); + ++baked_iter) + { + const EBakedTextureIndex baked_index = baked_iter->first; + if (layerset == mBakedTextureDatas[baked_index].mTexLayerSet) + { + outbuf << "baked_index: " << baked_index << "\n"; + const LLAvatarAppearanceDictionary::BakedEntry *baked_dict = baked_iter->second; + for (texture_vec_t::const_iterator local_tex_iter = baked_dict->mLocalTextures.begin(); + local_tex_iter != baked_dict->mLocalTextures.end(); + ++local_tex_iter) + { + const ETextureIndex tex_index = *local_tex_iter; + outbuf << " tex_index " << (S32) tex_index << "\n"; + const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index); + const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); + if (wearable_count > 0) + { + for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) + { + outbuf << " " << LLWearableType::getTypeName(wearable_type) << " " << wearable_index << "\n"; + const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(tex_index, wearable_index); + if (local_tex_obj) + { + LLViewerFetchedTexture* image = dynamic_cast( local_tex_obj->getImage() ); + if (tex_index >= 0 + && local_tex_obj->getID() != IMG_DEFAULT_AVATAR + && !image->isMissingAsset()) + { + outbuf << " id: " << image->getID() + << " refs: " << image->getNumRefs() + << " glocdisc: " << getLocalDiscardLevel(tex_index, wearable_index) + << " discard: " << image->getDiscardLevel() + << " desired: " << image->getDesiredDiscardLevel() + << " decode: " << image->getDecodePriority() + << " addl: " << image->getAdditionalDecodePriority() + << " ts: " << image->getTextureState() + << " bl: " << image->getBoostLevel() + << " fl: " << image->isFullyLoaded() // this is not an accessor for mFullyLoaded - see comment there. + << " mvs: " << image->getMaxVirtualSize() + << " mvsc: " << image->getMaxVirtualSizeResetCounter() + << "\n"; + } + } + } + } + } + break; + } + } + return outbuf.str(); +} + const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const { std::string text=""; @@ -2282,6 +2353,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe F32 desired_pixels; desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); + // DRANO what priority should wearable-based textures have? if (isUsingLocalAppearance()) { imagep->setBoostLevel(getAvatarBoostLevel()); @@ -2466,6 +2538,19 @@ void LLVOAvatarSelf::outputRezDiagnostics() const if (!layerset_buffer) continue; LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << llendl; } + std::string vd_text = "Local textures per baked index and wearable:\n"; + for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); + ++baked_iter) + { + const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; + const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index); + if (!layerset) continue; + const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); + if (!layerset_buffer) continue; + vd_text += verboseDebugDumpLocalTextureDataInfo(layerset); + } + LL_DEBUGS("Avatar") << vd_text << llendl; } void LLVOAvatarSelf::outputRezTiming(const std::string& msg) const diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index eeac5ddaeb..02612b83da 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -390,6 +390,7 @@ public: BOOL isAllLocalTextureDataFinal() const; const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return (LLViewerTexLayerSet*)(mBakedTextureDatas[index].mTexLayerSet); } + const std::string verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD LLSD metricsData(); From 2f7901ab929e90748e38734555cb861a2645f256 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 20 Dec 2012 21:33:30 +0000 Subject: [PATCH 12/66] Skipping rendering of unneeded morph masks --- indra/llappearance/lltexlayer.cpp | 34 ++++++++++++++++++++++--------- indra/llappearance/lltexlayer.h | 2 +- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 6e184beac8..15d531259f 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -1136,7 +1136,8 @@ BOOL LLTexLayer::render(S32 x, S32 y, S32 width, S32 height) } }//*/ - renderMorphMasks(x, y, width, height, net_color); + const bool force_render = true; + renderMorphMasks(x, y, width, height, net_color, force_render); alpha_mask_specified = TRUE; gGL.flush(); gGL.blendFunc(LLRender::BF_DEST_ALPHA, LLRender::BF_ONE_MINUS_DEST_ALPHA); @@ -1385,8 +1386,13 @@ BOOL LLTexLayer::blendAlphaTexture(S32 x, S32 y, S32 width, S32 height) } static LLFastTimer::DeclareTimer FTM_RENDER_MORPH_MASKS("renderMorphMasks"); -BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color) +void LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, bool force_render) { + if (!force_render && !hasMorph()) + { + lldebugs << "skipping renderMorphMasks for " << getUUID() << llendl; + return; + } LLFastTimer t(FTM_RENDER_MORPH_MASKS); BOOL success = TRUE; @@ -1423,6 +1429,11 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC { LLTexLayerParamAlpha* param = *iter; success &= param->render( x, y, width, height ); + if (!success && !force_render) + { + lldebugs << "Failed to render param " << param->getID() << " ; skipping morph mask." << llendl; + return; + } } // Approximates a min() function @@ -1448,25 +1459,29 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC } } - if( !getInfo()->mStaticImageFileName.empty() ) + if( !getInfo()->mStaticImageFileName.empty() && getInfo()->mStaticImageIsMask ) { LLGLTexture* tex = LLTexLayerStaticImageList::getInstance()->getTexture(getInfo()->mStaticImageFileName, getInfo()->mStaticImageIsMask); if( tex ) { - if( (tex->getComponents() == 4) || - ( (tex->getComponents() == 1) && getInfo()->mStaticImageIsMask ) ) + if( (tex->getComponents() == 4) || (tex->getComponents() == 1) ) { LLGLSNoAlphaTest gls_no_alpha_test; gGL.getTexUnit(0)->bind(tex, TRUE); gl_rect_2d_simple_tex( width, height ); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); } + else + { + llwarns << "Skipping rendering of " << getInfo()->mStaticImageFileName + << "; expected 1 or 4 components." << llendl; + } } } // Draw a rectangle with the layer color to multiply the alpha by that color's alpha. // Note: we're still using gGL.blendFunc( GL_DST_ALPHA, GL_ZERO ); - if (layer_color.mV[VW] != 1.f) + if ( !is_approx_equal(layer_color.mV[VW], 1.f) ) { LLGLDisable no_alpha(GL_ALPHA_TEST); gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE); @@ -1519,8 +1534,6 @@ BOOL LLTexLayer::renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLC mMorphMasksValid = TRUE; getTexLayerSet()->applyMorphMask(alpha_data, width, height, 1); } - - return success; } static LLFastTimer::DeclareTimer FTM_ADD_ALPHA_MASK("addAlphaMask"); @@ -1535,7 +1548,8 @@ void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 findNetColor( &net_color ); // TODO: eliminate need for layer morph mask valid flag invalidateMorphMasks(); - renderMorphMasks(originX, originY, width, height, net_color); + const bool force_render = false; + renderMorphMasks(originX, originY, width, height, net_color, force_render); alphaData = getAlphaData(); } if (alphaData) @@ -1544,7 +1558,7 @@ void LLTexLayer::addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 { U8 curAlpha = data[i]; U16 resultAlpha = curAlpha; - resultAlpha *= (alphaData[i] + 1); + resultAlpha *= ( ((U16)alphaData[i]) + 1); resultAlpha = resultAlpha >> 8; data[i] = (U8)resultAlpha; } diff --git a/indra/llappearance/lltexlayer.h b/indra/llappearance/lltexlayer.h index 405d2c7df4..959d6e499a 100644 --- a/indra/llappearance/lltexlayer.h +++ b/indra/llappearance/lltexlayer.h @@ -160,7 +160,7 @@ public: BOOL findNetColor(LLColor4* color) const; /*virtual*/ BOOL blendAlphaTexture(S32 x, S32 y, S32 width, S32 height); // Multiplies a single alpha texture against the frame buffer /*virtual*/ void gatherAlphaMasks(U8 *data, S32 originX, S32 originY, S32 width, S32 height); - BOOL renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color); + void renderMorphMasks(S32 x, S32 y, S32 width, S32 height, const LLColor4 &layer_color, bool force_render); void addAlphaMask(U8 *data, S32 originX, S32 originY, S32 width, S32 height); /*virtual*/ BOOL isInvisibleAlphaMask() const; From e1af26eaa2e3d065129821fe1e9458fa2698d72e Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Thu, 20 Dec 2012 21:39:33 +0000 Subject: [PATCH 13/66] Disabling build of headless appearance utility --- autobuild.xml | 4 ++-- indra/cmake/Variables.cmake | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 098140db85..3c503997cc 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1290,9 +1290,9 @@ archive hash - 8180c6f8d96a76c0c4b7746eb9e98964 + 17bcc2481fe362e297376d9c46888de8 url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/268052/arch/Linux/installer/llappearanceutility_source-0.1-linux-20121212.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/268501/arch/Linux/installer/llappearanceutility_source-0.1-linux-20121220.tar.bz2 name linux diff --git a/indra/cmake/Variables.cmake b/indra/cmake/Variables.cmake index 54c77da64e..6ec621632b 100644 --- a/indra/cmake/Variables.cmake +++ b/indra/cmake/Variables.cmake @@ -118,10 +118,10 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux") if (INSTALL_PROPRIETARY) # Only turn on headless if we can find osmesa libraries. include(FindPkgConfig) - pkg_check_modules(OSMESA osmesa) - if (OSMESA_FOUND) - set(BUILD_HEADLESS ON CACHE BOOL "Build headless libraries.") - endif (OSMESA_FOUND) + #pkg_check_modules(OSMESA osmesa) + #if (OSMESA_FOUND) + # set(BUILD_HEADLESS ON CACHE BOOL "Build headless libraries.") + #endif (OSMESA_FOUND) endif (INSTALL_PROPRIETARY) endif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") From 4e1eda1c3bc898ae8481b8dfcff4b29196ac835e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 7 Jan 2013 18:31:28 -0500 Subject: [PATCH 14/66] SH-3344 WIP - keep avatar local textures flagged no-delete while in use --- indra/newview/llviewertexture.cpp | 5 +- indra/newview/llvoavatar.cpp | 73 +++++++++++++++++++++++++++ indra/newview/llvoavatar.h | 3 ++ indra/newview/llvoavatarself.cpp | 82 ++++++++++++++++++------------- indra/newview/llvoavatarself.h | 1 + 5 files changed, 127 insertions(+), 37 deletions(-) diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index a673862882..8eada5c2a1 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -616,7 +616,7 @@ LLViewerTexture::LLViewerTexture(const LLImageRaw* raw, BOOL usemipmaps) : LLViewerTexture::~LLViewerTexture() { - // LL_DEBUGS("Avatar") << mID << llendl; + LL_DEBUGS("Avatar") << mID << llendl; cleanup(); sImageCount--; } @@ -1160,7 +1160,8 @@ void LLViewerFetchedTexture::destroyTexture() { return ; } - + + LL_DEBUGS("Avatar") << mID << llendl; destroyGLTexture() ; mFullyLoaded = FALSE ; } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 086e4306f8..df0b8171a6 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4004,8 +4004,81 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) //------------------------------------------------------------------------ // LLVOAvatar::updateTextures() //------------------------------------------------------------------------ +void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem) +{ + for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) + { + LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType((ETextureIndex)texture_index); + U32 num_wearables = gAgentWearables.getWearableCount(wearable_type); + + LLViewerFetchedTexture *imagep = NULL; + for (U32 wearable_index = 0; wearable_index < num_wearables; wearable_index++) + { + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index, wearable_index), TRUE); + if (imagep) + { + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); + if (texture_dict->mIsLocalTexture) + { + local_mem += imagep->getTextureMemory(); + ids.insert(imagep->getID()); + } + } + } + if (isIndexBakedTexture((ETextureIndex) texture_index)) + { + imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); + if (imagep) + { + baked_mem += imagep->getTextureMemory(); + ids.insert(imagep->getID()); + } + } + } + ids.erase(IMG_DEFAULT); + ids.erase(IMG_DEFAULT_AVATAR); + ids.erase(IMG_INVISIBLE); +} + +void LLVOAvatar::releaseOldTextures() +{ + S32 current_texture_mem = 0; + + // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE" + std::set new_texture_ids; + S32 local_mem = 0, baked_mem = 0; + collectTextureUUIDs(new_texture_ids, local_mem, baked_mem); + LL_DEBUGS("Avatar") << getFullname() << " local_mem: " << local_mem << " baked_mem: " << baked_mem << llendl; + for (std::set::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it) + { + if (new_texture_ids.find(*it) == new_texture_ids.end()) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep) + { + current_texture_mem += imagep->getTextureMemory(); + if (imagep->getTextureState() == LLGLTexture::NO_DELETE) + { + // This will allow the texture to be deleted if not in use. + imagep->forceActive(); + + // This resets the clock to being flagged as + // unused, preventing the texture from being + // deleted immediately. If other avatars or + // objects are using it, it can still be flagged + // no-delete by them. + imagep->forceUpdateBindStats(); + } + } + } + } + mTextureIDs = new_texture_ids; +} + void LLVOAvatar::updateTextures() { + releaseOldTextures(); + BOOL render_avatar = TRUE; if (mIsDummy) diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 4802476e59..5b1395e566 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -134,6 +134,8 @@ public: BOOL updateJointLODs(); void updateLODRiggedAttachments( void ); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. + void collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem); + void releaseOldTextures(); /*virtual*/ void updateTextures(); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. /*virtual*/ void onShift(const LLVector4a& shift_vector); @@ -528,6 +530,7 @@ protected: LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; BOOL mLoadedCallbacksPaused; + std::set mTextureIDs; //-------------------------------------------------------------------- // Local Textures //-------------------------------------------------------------------- diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 674988d94b..41dfe51116 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -177,7 +177,7 @@ LLVOAvatarSelf::LLVOAvatarSelf(const LLUUID& id, } // Called periodically for diagnostics, return true when done. -bool output_texture_diagnostics() +bool output_self_av_texture_diagnostics() { if (!isAgentAvatarValid()) return true; // done checking @@ -221,7 +221,7 @@ void LLVOAvatarSelf::initInstance() return; } - //doPeriodically(output_texture_diagnostics, 30.0); + doPeriodically(output_self_av_texture_diagnostics, 30.0); } // virtual @@ -2039,14 +2039,15 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV ++local_tex_iter) { const ETextureIndex tex_index = *local_tex_iter; - outbuf << " tex_index " << (S32) tex_index << "\n"; + const std::string tex_name = LLAvatarAppearanceDictionary::getInstance()->getTexture(tex_index)->mName; + outbuf << " tex_index " << (S32) tex_index << " name " << tex_name << "\n"; const LLWearableType::EType wearable_type = LLAvatarAppearanceDictionary::getTEWearableType(tex_index); const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); if (wearable_count > 0) { for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { - outbuf << " " << LLWearableType::getTypeName(wearable_type) << " " << wearable_index << "\n"; + outbuf << " " << LLWearableType::getTypeName(wearable_type) << " " << wearable_index << ":"; const LLLocalTextureObject *local_tex_obj = getLocalTextureObject(tex_index, wearable_index); if (local_tex_obj) { @@ -2055,7 +2056,7 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV && local_tex_obj->getID() != IMG_DEFAULT_AVATAR && !image->isMissingAsset()) { - outbuf << " id: " << image->getID() + outbuf << " id: " << image->getID() << " refs: " << image->getNumRefs() << " glocdisc: " << getLocalDiscardLevel(tex_index, wearable_index) << " discard: " << image->getDiscardLevel() @@ -2067,9 +2068,10 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV << " fl: " << image->isFullyLoaded() // this is not an accessor for mFullyLoaded - see comment there. << " mvs: " << image->getMaxVirtualSize() << " mvsc: " << image->getMaxVirtualSizeResetCounter() - << "\n"; + << " mem: " << image->getTextureMemory(); } } + outbuf << "\n"; } } } @@ -2079,6 +2081,23 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV return outbuf.str(); } +void LLVOAvatarSelf::dumpAllTextures() const +{ + std::string vd_text = "Local textures per baked index and wearable:\n"; + for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); + baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); + ++baked_iter) + { + const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; + const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index); + if (!layerset) continue; + const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); + if (!layerset_buffer) continue; + vd_text += verboseDebugDumpLocalTextureDataInfo(layerset); + } + LL_DEBUGS("Avatar") << vd_text << llendl; +} + const std::string LLVOAvatarSelf::debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const { std::string text=""; @@ -2348,24 +2367,28 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe { if (!isIndexLocalTexture(type)) return; - if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR && imagep->getDiscardLevel() != 0) + if (getLocalTextureID(type, index) != IMG_DEFAULT_AVATAR) { - F32 desired_pixels; - desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); + imagep->setNoDelete(); + if (imagep->getDiscardLevel() != 0) + { + F32 desired_pixels; + desired_pixels = llmin(mPixelArea, (F32)getTexImageArea()); - // DRANO what priority should wearable-based textures have? - if (isUsingLocalAppearance()) - { - imagep->setBoostLevel(getAvatarBoostLevel()); - imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ; - } - imagep->resetTextureStats(); - imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); - imagep->addTextureStats( desired_pixels / texel_area_ratio ); - imagep->forceUpdateBindStats() ; - if (imagep->getDiscardLevel() < 0) - { - mHasGrey = TRUE; // for statistics gathering + // DRANO what priority should wearable-based textures have? + if (isUsingLocalAppearance()) + { + imagep->setBoostLevel(getAvatarBoostLevel()); + imagep->setAdditionalDecodePriority(SELF_ADDITIONAL_PRI) ; + } + imagep->resetTextureStats(); + imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL); + imagep->addTextureStats( desired_pixels / texel_area_ratio ); + imagep->forceUpdateBindStats() ; + if (imagep->getDiscardLevel() < 0) + { + mHasGrey = TRUE; // for statistics gathering + } } } else @@ -2538,19 +2561,8 @@ void LLVOAvatarSelf::outputRezDiagnostics() const if (!layerset_buffer) continue; LL_DEBUGS("Avatar") << layerset_buffer->dumpTextureInfo() << llendl; } - std::string vd_text = "Local textures per baked index and wearable:\n"; - for (LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::BakedTextures::const_iterator baked_iter = LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().begin(); - baked_iter != LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::getInstance()->getBakedTextures().end(); - ++baked_iter) - { - const LLAvatarAppearanceDefines::EBakedTextureIndex baked_index = baked_iter->first; - const LLViewerTexLayerSet *layerset = debugGetLayerSet(baked_index); - if (!layerset) continue; - const LLViewerTexLayerSetBuffer *layerset_buffer = layerset->getViewerComposite(); - if (!layerset_buffer) continue; - vd_text += verboseDebugDumpLocalTextureDataInfo(layerset); - } - LL_DEBUGS("Avatar") << vd_text << llendl; + + dumpAllTextures(); } void LLVOAvatarSelf::outputRezTiming(const std::string& msg) const diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 02612b83da..74888e470d 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -391,6 +391,7 @@ public: const LLViewerTexLayerSet* debugGetLayerSet(LLAvatarAppearanceDefines::EBakedTextureIndex index) const { return (LLViewerTexLayerSet*)(mBakedTextureDatas[index].mTexLayerSet); } const std::string verboseDebugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer + void dumpAllTextures() const; const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD LLSD metricsData(); From 8e8765535f94d3084305ef7b9e4644ec92d10723 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 9 Jan 2013 12:41:51 -0500 Subject: [PATCH 15/66] SH-3620: Fix for editing a nocopy wearable being removed from the outfit --- indra/newview/llpaneleditwearable.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index 786b215fdf..606e78bd58 100644 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -882,9 +882,12 @@ void LLPanelEditWearable::setWearable(LLViewerWearable *wearable, BOOL disable_c //static void LLPanelEditWearable::onBackButtonClicked(void* userdata) -{ - LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata; - panel->saveChanges(true); +{ + LLPanelEditWearable *panel = (LLPanelEditWearable*) userdata; + if ( panel->isDirty() ) + { + LLAppearanceMgr::instance().setOutfitDirty( true ); + } } //static From 547f48eabe6b363de9b8551074b004041814ea12 Mon Sep 17 00:00:00 2001 From: prep Date: Wed, 9 Jan 2013 15:43:09 -0500 Subject: [PATCH 16/66] SH-3600. Undo change is disabled upon reentry into the appearance panel --- indra/newview/llsidepanelappearance.cpp | 1089 ++++++++++++----------- 1 file changed, 545 insertions(+), 544 deletions(-) diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index 98dc2c0e09..f0844dd9a4 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -1,544 +1,545 @@ -/** - * @file llsidepanelappearance.cpp - * @brief Side Bar "Appearance" panel - * - * $LicenseInfo:firstyear=2009&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$ - */ - -#include "llviewerprecompiledheaders.h" -#include "llsidepanelappearance.h" - -#include "llaccordionctrltab.h" -#include "llagent.h" -#include "llagentcamera.h" -#include "llagentwearables.h" -#include "llappearancemgr.h" -#include "llfloatersidepanelcontainer.h" -#include "llfolderview.h" -#include "llinventorypanel.h" -#include "llfiltereditor.h" -#include "llfloaterreg.h" -#include "llfloaterworldmap.h" -#include "llfoldervieweventlistener.h" -#include "lloutfitobserver.h" -#include "llpaneleditwearable.h" -#include "llpaneloutfitsinventory.h" -#include "lltextbox.h" -#include "lluictrlfactory.h" -#include "llviewercontrol.h" -#include "llviewerregion.h" -#include "llvoavatarself.h" -#include "llviewerwearable.h" - -static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); - -class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver -{ -public: - LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, - LLSidepanelAppearance *panel) : - LLInventoryFetchItemsObserver(ids), - mPanel(panel) - {} - ~LLCurrentlyWornFetchObserver() {} - virtual void done() - { - mPanel->inventoryFetched(); - gInventory.removeObserver(this); - delete this; - } -private: - LLSidepanelAppearance *mPanel; -}; - -LLSidepanelAppearance::LLSidepanelAppearance() : - LLPanel(), - mFilterSubString(LLStringUtil::null), - mFilterEditor(NULL), - mOutfitEdit(NULL), - mCurrOutfitPanel(NULL), - mOpened(false) -{ - LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); - outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); - - gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true)); - gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false)); -} - -LLSidepanelAppearance::~LLSidepanelAppearance() -{ -} - -// virtual -BOOL LLSidepanelAppearance::postBuild() -{ - mOpenOutfitBtn = getChild("openoutfit_btn"); - mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); - - mEditAppearanceBtn = getChild("editappearance_btn"); - mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this)); - - childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); - - mNewOutfitBtn = getChild("newlook_btn"); - mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this)); - mNewOutfitBtn->setEnabled(false); - - mFilterEditor = getChild("Filter"); - if (mFilterEditor) - { - mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2)); - } - - mPanelOutfitsInventory = dynamic_cast(getChild("panel_outfits_inventory")); - - mOutfitEdit = dynamic_cast(getChild("panel_outfit_edit")); - if (mOutfitEdit) - { - LLButton* back_btn = mOutfitEdit->getChild("back_btn"); - if (back_btn) - { - back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this)); - } - - } - - mEditWearable = dynamic_cast(getChild("panel_edit_wearable")); - if (mEditWearable) - { - LLButton* edit_wearable_back_btn = mEditWearable->getChild("back_btn"); - if (edit_wearable_back_btn) - { - edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); - } - } - - mCurrentLookName = getChild("currentlook_name"); - - mOutfitStatus = getChild("currentlook_status"); - - mCurrOutfitPanel = getChild("panel_currentlook"); - - - setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); - - return TRUE; -} - -// virtual -void LLSidepanelAppearance::onOpen(const LLSD& key) -{ - if (!key.has("type")) - { - // No specific panel requested. - // If we're opened for the first time then show My Outfits. - // Else do nothing. - if (!mOpened) - { - showOutfitsInventoryPanel(); - } - } - else - { - // Switch to the requested panel. - std::string type = key["type"].asString(); - if (type == "my_outfits") - { - showOutfitsInventoryPanel(); - } - else if (type == "edit_outfit") - { - showOutfitEditPanel(); - } - else if (type == "edit_shape") - { - showWearableEditPanel(); - } - } - - mOpened = true; -} - -void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) -{ - LLSD visibility; - visibility["visible"] = new_visibility.asBoolean(); - visibility["reset_accordion"] = false; - updateToVisibility(visibility); -} - -void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) -{ - if (new_visibility["visible"].asBoolean()) - { - const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); - const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); - - if (is_outfit_edit_visible || is_wearable_edit_visible) - { - const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); - if (!wearable_ptr) - { - llwarns << "Visibility change to invalid wearable" << llendl; - return; - } - // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar - // when editing its physics. - if (!gAgentCamera.cameraCustomizeAvatar()) - { - LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); - } - if (is_wearable_edit_visible) - { - if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) - { - // we're no longer wearing the wearable we were last editing, switch back to outfit editor - showOutfitEditPanel(); - } - } - - if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean()) - { - mOutfitEdit->resetAccordionState(); - } - } - } - else - { - if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) - { - gAgentCamera.changeCameraToDefault(); - gAgentCamera.resetView(); - } - } -} - -void LLSidepanelAppearance::onFilterEdit(const std::string& search_string) -{ - if (mFilterSubString != search_string) - { - mFilterSubString = search_string; - - // Searches are case-insensitive - // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is. - - mPanelOutfitsInventory->onSearchEdit(mFilterSubString); - } -} - -void LLSidepanelAppearance::onOpenOutfitButtonClicked() -{ - const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); - if (!outfit_link) - return; - if (!outfit_link->getIsLinkType()) - return; - - LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild("tab_outfits"); - if (tab_outfits) - { - tab_outfits->changeOpenClose(FALSE); - LLInventoryPanel *inventory_panel = tab_outfits->findChild("outfitslist_tab"); - if (inventory_panel) - { - LLFolderView* root = inventory_panel->getRootFolder(); - LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); - if (outfit_folder) - { - outfit_folder->setOpen(!outfit_folder->isOpen()); - root->setSelectionFromRoot(outfit_folder,TRUE); - root->scrollToShowSelection(); - } - } - } -} - -// *TODO: obsolete? -void LLSidepanelAppearance::onEditAppearanceButtonClicked() -{ - if (gAgentWearables.areWearablesLoaded()) - { - LLVOAvatarSelf::onCustomizeStart(); - } -} - -void LLSidepanelAppearance::onNewOutfitButtonClicked() -{ - if (!mOutfitEdit->getVisible()) - { - mPanelOutfitsInventory->onSave(); - } -} - -void LLSidepanelAppearance::showOutfitsInventoryPanel() -{ - toggleWearableEditPanel(FALSE); - toggleOutfitEditPanel(FALSE); - toggleMyOutfitsPanel(TRUE); -} - -void LLSidepanelAppearance::showOutfitEditPanel() -{ - if (mOutfitEdit && mOutfitEdit->getVisible()) return; - - // Accordion's state must be reset in all cases except the one when user - // is returning back to the mOutfitEdit panel from the mEditWearable panel. - // The simplest way to control this is to check the visibility state of the mEditWearable - // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE). - if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) - { - mOutfitEdit->resetAccordionState(); - } - - // If we're exiting the edit wearable view, and the camera was not focused on the avatar - // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since - // otherwise this would trigger the camera focus mode. - if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar()) - { - showOutfitsInventoryPanel(); - return; - } - - toggleMyOutfitsPanel(FALSE); - toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode - toggleOutfitEditPanel(TRUE); -} - -void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) -{ - toggleMyOutfitsPanel(FALSE); - toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode - toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); -} - -void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible) -{ - if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - mPanelOutfitsInventory->setVisible(visible); - - // *TODO: Move these controls to panel_outfits_inventory.xml - // so that we don't need to toggle them explicitly. - mFilterEditor->setVisible(visible); - mNewOutfitBtn->setVisible(visible); - mCurrOutfitPanel->setVisible(visible); - - if (visible) - { - mPanelOutfitsInventory->onOpen(LLSD()); - } -} - -void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) -{ - if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - mOutfitEdit->setVisible(visible); - - if (visible) - { - mOutfitEdit->onOpen(LLSD()); - LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); - } - else - { - if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. - { - LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); - } - } -} - -void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) -{ - if (!mEditWearable || mEditWearable->getVisible() == visible) - { - // visibility isn't changing, hence nothing to do - return; - } - - if (!wearable) - { - wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); - } - if (!wearable) - { - return; - } - - // Toggle panel visibility. - mEditWearable->setVisible(visible); - - if (visible) - { - LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); - mEditWearable->setWearable(wearable, disable_camera_switch); - mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency - } - else - { - // Save changes if closing. - mEditWearable->saveChanges(); - if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. - { - LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); - } - } -} - -void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) -{ - // Set current outfit status (wearing/unsaved). - bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); - std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); - mOutfitStatus->setText(cof_status_str); - - if (name == "") - { - std::string outfit_name; - if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) - { - mCurrentLookName->setText(outfit_name); - return; - } - - std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; - mCurrentLookName->setText(getString(string_name)); - mOpenOutfitBtn->setEnabled(FALSE); - } - else - { - mCurrentLookName->setText(name); - // Can't just call update verbs since the folder link may not have been created yet. - mOpenOutfitBtn->setEnabled(TRUE); - } -} - -//static -void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) -{ - LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); - - LLSidepanelAppearance *panel = dynamic_cast(data); - if (panel) - { - panel->showWearableEditPanel(wearable, disable_camera_switch); - } -} - -// Fetch currently worn items and only enable the New Look button after everything's been -// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. -void LLSidepanelAppearance::fetchInventory() -{ - - mNewOutfitBtn->setEnabled(false); - uuid_vec_t ids; - LLUUID item_id; - for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) - { - for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) - { - item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); - if(item_id.notNull()) - { - ids.push_back(item_id); - } - } - } - - if (isAgentAvatarValid()) - { - for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); - iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) - { - LLViewerJointAttachment* attachment = iter->second; - if (!attachment) continue; - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); - attachment_iter != attachment->mAttachedObjects.end(); - ++attachment_iter) - { - LLViewerObject* attached_object = (*attachment_iter); - if (!attached_object) continue; - const LLUUID& item_id = attached_object->getAttachmentItemID(); - if (item_id.isNull()) continue; - ids.push_back(item_id); - } - } - } - - LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); - fetch_worn->startFetch(); - // If no items to be fetched, done will never be triggered. - // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. - if (fetch_worn->isFinished()) - { - fetch_worn->done(); - } - else - { - gInventory.addObserver(fetch_worn); - } -} - -void LLSidepanelAppearance::inventoryFetched() -{ - mNewOutfitBtn->setEnabled(true); -} - -void LLSidepanelAppearance::setWearablesLoading(bool val) -{ - getChildView("wearables_loading_indicator")->setVisible( val); - getChildView("edit_outfit_btn")->setVisible( !val); - - if (!val) - { - // refresh outfit name when COF is already changed. - refreshCurrentOutfitName(); - } -} - -void LLSidepanelAppearance::showDefaultSubpart() -{ - if (mEditWearable->getVisible()) - { - mEditWearable->showDefaultSubpart(); - } -} - -void LLSidepanelAppearance::updateScrollingPanelList() -{ - if (mEditWearable->getVisible()) - { - mEditWearable->updateScrollingPanelList(); - } -} +/** + * @file llsidepanelappearance.cpp + * @brief Side Bar "Appearance" panel + * + * $LicenseInfo:firstyear=2009&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$ + */ + +#include "llviewerprecompiledheaders.h" +#include "llsidepanelappearance.h" + +#include "llaccordionctrltab.h" +#include "llagent.h" +#include "llagentcamera.h" +#include "llagentwearables.h" +#include "llappearancemgr.h" +#include "llfloatersidepanelcontainer.h" +#include "llfolderview.h" +#include "llinventorypanel.h" +#include "llfiltereditor.h" +#include "llfloaterreg.h" +#include "llfloaterworldmap.h" +#include "llfoldervieweventlistener.h" +#include "lloutfitobserver.h" +#include "llpaneleditwearable.h" +#include "llpaneloutfitsinventory.h" +#include "lltextbox.h" +#include "lluictrlfactory.h" +#include "llviewercontrol.h" +#include "llviewerregion.h" +#include "llvoavatarself.h" +#include "llviewerwearable.h" + +static LLRegisterPanelClassWrapper t_appearance("sidepanel_appearance"); + +class LLCurrentlyWornFetchObserver : public LLInventoryFetchItemsObserver +{ +public: + LLCurrentlyWornFetchObserver(const uuid_vec_t &ids, + LLSidepanelAppearance *panel) : + LLInventoryFetchItemsObserver(ids), + mPanel(panel) + {} + ~LLCurrentlyWornFetchObserver() {} + virtual void done() + { + mPanel->inventoryFetched(); + gInventory.removeObserver(this); + delete this; + } +private: + LLSidepanelAppearance *mPanel; +}; + +LLSidepanelAppearance::LLSidepanelAppearance() : + LLPanel(), + mFilterSubString(LLStringUtil::null), + mFilterEditor(NULL), + mOutfitEdit(NULL), + mCurrOutfitPanel(NULL), + mOpened(false) +{ + LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); + outfit_observer.addBOFReplacedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + outfit_observer.addBOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + outfit_observer.addCOFChangedCallback(boost::bind(&LLSidepanelAppearance::refreshCurrentOutfitName, this, "")); + + gAgentWearables.addLoadingStartedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, true)); + gAgentWearables.addLoadedCallback(boost::bind(&LLSidepanelAppearance::setWearablesLoading, this, false)); +} + +LLSidepanelAppearance::~LLSidepanelAppearance() +{ +} + +// virtual +BOOL LLSidepanelAppearance::postBuild() +{ + mOpenOutfitBtn = getChild("openoutfit_btn"); + mOpenOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onOpenOutfitButtonClicked, this)); + + mEditAppearanceBtn = getChild("editappearance_btn"); + mEditAppearanceBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onEditAppearanceButtonClicked, this)); + + childSetAction("edit_outfit_btn", boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); + + mNewOutfitBtn = getChild("newlook_btn"); + mNewOutfitBtn->setClickedCallback(boost::bind(&LLSidepanelAppearance::onNewOutfitButtonClicked, this)); + mNewOutfitBtn->setEnabled(false); + + mFilterEditor = getChild("Filter"); + if (mFilterEditor) + { + mFilterEditor->setCommitCallback(boost::bind(&LLSidepanelAppearance::onFilterEdit, this, _2)); + } + + mPanelOutfitsInventory = dynamic_cast(getChild("panel_outfits_inventory")); + + mOutfitEdit = dynamic_cast(getChild("panel_outfit_edit")); + if (mOutfitEdit) + { + LLButton* back_btn = mOutfitEdit->getChild("back_btn"); + if (back_btn) + { + back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitsInventoryPanel, this)); + } + + } + + mEditWearable = dynamic_cast(getChild("panel_edit_wearable")); + if (mEditWearable) + { + LLButton* edit_wearable_back_btn = mEditWearable->getChild("back_btn"); + if (edit_wearable_back_btn) + { + edit_wearable_back_btn->setClickedCallback(boost::bind(&LLSidepanelAppearance::showOutfitEditPanel, this)); + } + } + + mCurrentLookName = getChild("currentlook_name"); + + mOutfitStatus = getChild("currentlook_status"); + + mCurrOutfitPanel = getChild("panel_currentlook"); + + + setVisibleCallback(boost::bind(&LLSidepanelAppearance::onVisibilityChange,this,_2)); + + return TRUE; +} + +// virtual +void LLSidepanelAppearance::onOpen(const LLSD& key) +{ + if (!key.has("type")) + { + // No specific panel requested. + // If we're opened for the first time then show My Outfits. + // Else do nothing. + if (!mOpened) + { + showOutfitsInventoryPanel(); + } + } + else + { + // Switch to the requested panel. + std::string type = key["type"].asString(); + if (type == "my_outfits") + { + showOutfitsInventoryPanel(); + } + else if (type == "edit_outfit") + { + showOutfitEditPanel(); + } + else if (type == "edit_shape") + { + showWearableEditPanel(); + } + } + + mOpened = true; +} + +void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility) +{ + LLSD visibility; + visibility["visible"] = new_visibility.asBoolean(); + visibility["reset_accordion"] = false; + updateToVisibility(visibility); +} + +void LLSidepanelAppearance::updateToVisibility(const LLSD &new_visibility) +{ + if (new_visibility["visible"].asBoolean()) + { + const BOOL is_outfit_edit_visible = mOutfitEdit && mOutfitEdit->getVisible(); + const BOOL is_wearable_edit_visible = mEditWearable && mEditWearable->getVisible(); + + if (is_outfit_edit_visible || is_wearable_edit_visible) + { + const LLViewerWearable *wearable_ptr = mEditWearable->getWearable(); + if (!wearable_ptr) + { + llwarns << "Visibility change to invalid wearable" << llendl; + return; + } + // Disable camera switch is currently just for WT_PHYSICS type since we don't want to freeze the avatar + // when editing its physics. + if (!gAgentCamera.cameraCustomizeAvatar()) + { + LLVOAvatarSelf::onCustomizeStart(LLWearableType::getDisableCameraSwitch(wearable_ptr->getType())); + } + if (is_wearable_edit_visible) + { + if (gAgentWearables.getWearableIndex(wearable_ptr) == LLAgentWearables::MAX_CLOTHING_PER_TYPE) + { + // we're no longer wearing the wearable we were last editing, switch back to outfit editor + showOutfitEditPanel(); + } + } + + if (is_outfit_edit_visible && new_visibility["reset_accordion"].asBoolean()) + { + mOutfitEdit->resetAccordionState(); + } + } + } + else + { + if (gAgentCamera.cameraCustomizeAvatar() && gSavedSettings.getBOOL("AppearanceCameraMovement")) + { + gAgentCamera.changeCameraToDefault(); + gAgentCamera.resetView(); + } + } +} + +void LLSidepanelAppearance::onFilterEdit(const std::string& search_string) +{ + if (mFilterSubString != search_string) + { + mFilterSubString = search_string; + + // Searches are case-insensitive + // but we don't convert the typed string to upper-case so that it can be fed to the web search as-is. + + mPanelOutfitsInventory->onSearchEdit(mFilterSubString); + } +} + +void LLSidepanelAppearance::onOpenOutfitButtonClicked() +{ + const LLViewerInventoryItem *outfit_link = LLAppearanceMgr::getInstance()->getBaseOutfitLink(); + if (!outfit_link) + return; + if (!outfit_link->getIsLinkType()) + return; + + LLAccordionCtrlTab* tab_outfits = mPanelOutfitsInventory->findChild("tab_outfits"); + if (tab_outfits) + { + tab_outfits->changeOpenClose(FALSE); + LLInventoryPanel *inventory_panel = tab_outfits->findChild("outfitslist_tab"); + if (inventory_panel) + { + LLFolderView* root = inventory_panel->getRootFolder(); + LLFolderViewItem *outfit_folder = root->getItemByID(outfit_link->getLinkedUUID()); + if (outfit_folder) + { + outfit_folder->setOpen(!outfit_folder->isOpen()); + root->setSelectionFromRoot(outfit_folder,TRUE); + root->scrollToShowSelection(); + } + } + } +} + +// *TODO: obsolete? +void LLSidepanelAppearance::onEditAppearanceButtonClicked() +{ + if (gAgentWearables.areWearablesLoaded()) + { + LLVOAvatarSelf::onCustomizeStart(); + } +} + +void LLSidepanelAppearance::onNewOutfitButtonClicked() +{ + if (!mOutfitEdit->getVisible()) + { + mPanelOutfitsInventory->onSave(); + } +} + +void LLSidepanelAppearance::showOutfitsInventoryPanel() +{ + toggleWearableEditPanel(FALSE); + toggleOutfitEditPanel(FALSE); + toggleMyOutfitsPanel(TRUE); +} + +void LLSidepanelAppearance::showOutfitEditPanel() +{ + if (mOutfitEdit && mOutfitEdit->getVisible()) return; + + // Accordion's state must be reset in all cases except the one when user + // is returning back to the mOutfitEdit panel from the mEditWearable panel. + // The simplest way to control this is to check the visibility state of the mEditWearable + // BEFORE it is changed by the call to the toggleWearableEditPanel(FALSE, NULL, TRUE). + if (mEditWearable != NULL && !mEditWearable->getVisible() && mOutfitEdit != NULL) + { + mOutfitEdit->resetAccordionState(); + } + + // If we're exiting the edit wearable view, and the camera was not focused on the avatar + // (e.g. such as if we were editing a physics param), then skip the outfits edit mode since + // otherwise this would trigger the camera focus mode. + if (mEditWearable != NULL && mEditWearable->getVisible() && !gAgentCamera.cameraCustomizeAvatar()) + { + showOutfitsInventoryPanel(); + return; + } + + toggleMyOutfitsPanel(FALSE); + toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode + toggleOutfitEditPanel(TRUE); +} + +void LLSidepanelAppearance::showWearableEditPanel(LLViewerWearable *wearable /* = NULL*/, BOOL disable_camera_switch) +{ + toggleMyOutfitsPanel(FALSE); + toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode + toggleWearableEditPanel(TRUE, wearable, disable_camera_switch); +} + +void LLSidepanelAppearance::toggleMyOutfitsPanel(BOOL visible) +{ + if (!mPanelOutfitsInventory || mPanelOutfitsInventory->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + mPanelOutfitsInventory->setVisible(visible); + + // *TODO: Move these controls to panel_outfits_inventory.xml + // so that we don't need to toggle them explicitly. + mFilterEditor->setVisible(visible); + mNewOutfitBtn->setVisible(visible); + mCurrOutfitPanel->setVisible(visible); + + if (visible) + { + mPanelOutfitsInventory->onOpen(LLSD()); + } +} + +void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch) +{ + if (!mOutfitEdit || mOutfitEdit->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + mOutfitEdit->setVisible(visible); + + if (visible) + { + mOutfitEdit->onOpen(LLSD()); + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); + } + else + { + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. + { + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); + LLAppearanceMgr::getInstance()->setOutfitDirty( FALSE ); + } + } +} + +void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearable *wearable, BOOL disable_camera_switch) +{ + if (!mEditWearable || mEditWearable->getVisible() == visible) + { + // visibility isn't changing, hence nothing to do + return; + } + + if (!wearable) + { + wearable = gAgentWearables.getViewerWearable(LLWearableType::WT_SHAPE, 0); + } + if (!wearable) + { + return; + } + + // Toggle panel visibility. + mEditWearable->setVisible(visible); + + if (visible) + { + LLVOAvatarSelf::onCustomizeStart(disable_camera_switch); + mEditWearable->setWearable(wearable, disable_camera_switch); + mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency + } + else + { + // Save changes if closing. + mEditWearable->saveChanges(); + if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. + { + LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); + } + } +} + +void LLSidepanelAppearance::refreshCurrentOutfitName(const std::string& name) +{ + // Set current outfit status (wearing/unsaved). + bool dirty = LLAppearanceMgr::getInstance()->isOutfitDirty(); + std::string cof_status_str = getString(dirty ? "Unsaved Changes" : "Now Wearing"); + mOutfitStatus->setText(cof_status_str); + + if (name == "") + { + std::string outfit_name; + if (LLAppearanceMgr::getInstance()->getBaseOutfitName(outfit_name)) + { + mCurrentLookName->setText(outfit_name); + return; + } + + std::string string_name = gAgentWearables.isCOFChangeInProgress() ? "Changing outfits" : "No Outfit"; + mCurrentLookName->setText(getString(string_name)); + mOpenOutfitBtn->setEnabled(FALSE); + } + else + { + mCurrentLookName->setText(name); + // Can't just call update verbs since the folder link may not have been created yet. + mOpenOutfitBtn->setEnabled(TRUE); + } +} + +//static +void LLSidepanelAppearance::editWearable(LLViewerWearable *wearable, LLView *data, BOOL disable_camera_switch) +{ + LLFloaterSidePanelContainer::showPanel("appearance", LLSD()); + + LLSidepanelAppearance *panel = dynamic_cast(data); + if (panel) + { + panel->showWearableEditPanel(wearable, disable_camera_switch); + } +} + +// Fetch currently worn items and only enable the New Look button after everything's been +// fetched. Alternatively, we could stuff this logic into llagentwearables::makeNewOutfitLinks. +void LLSidepanelAppearance::fetchInventory() +{ + + mNewOutfitBtn->setEnabled(false); + uuid_vec_t ids; + LLUUID item_id; + for(S32 type = (S32)LLWearableType::WT_SHAPE; type < (S32)LLWearableType::WT_COUNT; ++type) + { + for (U32 index = 0; index < gAgentWearables.getWearableCount((LLWearableType::EType)type); ++index) + { + item_id = gAgentWearables.getWearableItemID((LLWearableType::EType)type, index); + if(item_id.notNull()) + { + ids.push_back(item_id); + } + } + } + + if (isAgentAvatarValid()) + { + for (LLVOAvatar::attachment_map_t::const_iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ++iter) + { + LLViewerJointAttachment* attachment = iter->second; + if (!attachment) continue; + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); + ++attachment_iter) + { + LLViewerObject* attached_object = (*attachment_iter); + if (!attached_object) continue; + const LLUUID& item_id = attached_object->getAttachmentItemID(); + if (item_id.isNull()) continue; + ids.push_back(item_id); + } + } + } + + LLCurrentlyWornFetchObserver *fetch_worn = new LLCurrentlyWornFetchObserver(ids, this); + fetch_worn->startFetch(); + // If no items to be fetched, done will never be triggered. + // TODO: Change LLInventoryFetchItemsObserver::fetchItems to trigger done() on this condition. + if (fetch_worn->isFinished()) + { + fetch_worn->done(); + } + else + { + gInventory.addObserver(fetch_worn); + } +} + +void LLSidepanelAppearance::inventoryFetched() +{ + mNewOutfitBtn->setEnabled(true); +} + +void LLSidepanelAppearance::setWearablesLoading(bool val) +{ + getChildView("wearables_loading_indicator")->setVisible( val); + getChildView("edit_outfit_btn")->setVisible( !val); + + if (!val) + { + // refresh outfit name when COF is already changed. + refreshCurrentOutfitName(); + } +} + +void LLSidepanelAppearance::showDefaultSubpart() +{ + if (mEditWearable->getVisible()) + { + mEditWearable->showDefaultSubpart(); + } +} + +void LLSidepanelAppearance::updateScrollingPanelList() +{ + if (mEditWearable->getVisible()) + { + mEditWearable->updateScrollingPanelList(); + } +} From 008e078bf5c7bd3b72eacecb200733715841afe4 Mon Sep 17 00:00:00 2001 From: prep Date: Thu, 10 Jan 2013 11:26:05 -0500 Subject: [PATCH 17/66] SH-3142: Added a debug option that circumvents the precache delay when teleporting. --- indra/newview/app_settings/settings.xml | 12 ++++++++++++ indra/newview/llviewerdisplay.cpp | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index c817579e9e..4b93cef57f 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -14170,5 +14170,17 @@ Value 0 + + DisablePrecacheDelayAfterTeleporting + + Comment + Disables the artificial delay in the viewer that precaches some incoming assets + Persist + 0 + Type + Boolean + Value + 0 + diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index bd8377e281..25abf768cb 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -417,14 +417,21 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) gAgent.setTeleportMessage( LLAgent::sTeleportProgressMessages["arriving"]); gTextureList.mForceResetTextureStats = TRUE; - gAgentCamera.resetView(TRUE, TRUE); - + gAgentCamera.resetView(TRUE, TRUE); + if ( gSavedSettings.getBOOL("DisablePrecacheDelayAfterTeleporting") ) + { + gViewerWindow->setShowProgress(FALSE); + gTeleportDisplay = FALSE; + gAgent.setTeleportState( LLAgent::TELEPORT_NONE ); + } + break; case LLAgent::TELEPORT_ARRIVING: // Make the user wait while content "pre-caches" { F32 arrival_fraction = (gTeleportArrivalTimer.getElapsedTimeF32() / TELEPORT_ARRIVAL_DELAY); + if( arrival_fraction > 1.f ) { arrival_fraction = 1.f; From 5e7f36541b503bb2bd03e121c7ef13025f69065a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 10 Jan 2013 13:22:48 -0500 Subject: [PATCH 18/66] SH-3639 WIP - increased retry interval to allow for intermittent extremely slow responses --- indra/newview/llappearancemgr.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 8b4adc8785..bf35382b7a 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -155,6 +155,11 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string } } +// We want this to be much lower (e.g. 15.0 is usually fine), bumping +// up for now until we can diagnose some cases of very slow response +// to requests. +const F32 DEFAULT_RETRY_AFTER_INTERVAL = 300.0; + class LLCallAfterInventoryBatchMgr: public LLEventTimer { public: @@ -162,7 +167,7 @@ public: const std::string& phase_name, nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, - F32 retry_after = 15.0, + F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, S32 max_retries = 2 ): mDstCatID(dst_cat_id), @@ -365,7 +370,7 @@ public: const std::string& phase_name, nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, - F32 retry_after = 15.0, + F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, S32 max_retries = 2 ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) @@ -403,7 +408,7 @@ public: const std::string& phase_name, nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, - F32 retry_after = 15.0, + F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, S32 max_retries = 2 ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) From 0f753a530b914370c7c89c198ee335833ac3e6a1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 11 Jan 2013 11:36:11 -0500 Subject: [PATCH 19/66] SH-3639 WIP - cleaned up some diagnostics and added fault injection ability. Disabled inventory retries for now. --- indra/newview/app_settings/logcontrol.xml | 2 +- indra/newview/app_settings/settings.xml | 11 ++++++ indra/newview/llappearancemgr.cpp | 43 +++++++++++++++++++---- indra/newview/llviewertexture.cpp | 2 +- indra/newview/llvoavatarself.cpp | 2 +- indra/newview/llvovolume.cpp | 3 +- 6 files changed, 53 insertions(+), 10 deletions(-) diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 64122bbb6c..1259039010 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 4b93cef57f..32b2920279 100755 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -4326,6 +4326,17 @@ Value 0.0 + InventoryDebugSimulateLateOpRate + + Comment + Rate at which we simulate late-completing copy/link requests in some operations + Persist + 1 + Type + F32 + Value + 0.0 + InventoryDisplayInbox Comment diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index bf35382b7a..7edba842b8 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -49,6 +49,7 @@ #include "llvoavatarself.h" #include "llviewerregion.h" #include "llwearablelist.h" +#include "llsdutil.h" std::string self_av_string() { @@ -160,6 +161,11 @@ LLUUID findDescendentCategoryIDByName(const LLUUID& parent_id, const std::string // to requests. const F32 DEFAULT_RETRY_AFTER_INTERVAL = 300.0; +// Given the current back-end problems, retrying is causing too many +// duplicate items. Bump this back to 2 once they are resolved (or can +// leave at 0 if the operations become actually reliable). +const S32 DEFAULT_MAX_RETRIES = 0; + class LLCallAfterInventoryBatchMgr: public LLEventTimer { public: @@ -168,7 +174,7 @@ public: nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, - S32 max_retries = 2 + S32 max_retries = DEFAULT_MAX_RETRIES ): mDstCatID(dst_cat_id), mTrackingPhase(phase_name), @@ -228,6 +234,13 @@ public: void onOp(const LLUUID& src_id, const LLUUID& dst_id, LLTimer timestamp) { + if (ll_frand() < gSavedSettings.getF32("InventoryDebugSimulateLateOpRate")) + { + llwarns << "Simulating late operation by punting handling to later" << llendl; + doAfterInterval(boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,src_id,dst_id,timestamp), + mRetryAfter); + return; + } mPendingRequests--; F32 elapsed = timestamp.getElapsedTimeF32(); LL_DEBUGS("Avatar") << "op done, src_id " << src_id << " dst_id " << dst_id << " after " << elapsed << " seconds" << llendl; @@ -371,7 +384,7 @@ public: nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, - S32 max_retries = 2 + S32 max_retries = DEFAULT_MAX_RETRIES ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) { @@ -409,7 +422,7 @@ public: nullary_func_t on_completion_func, nullary_func_t on_failure_func = no_op, F32 retry_after = DEFAULT_RETRY_AFTER_INTERVAL, - S32 max_retries = 2 + S32 max_retries = DEFAULT_MAX_RETRIES ): LLCallAfterInventoryBatchMgr(dst_cat_id, phase_name, on_completion_func, on_failure_func, retry_after, max_retries) { @@ -1653,6 +1666,7 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin continue; if (item->getIsLinkType()) { +#if 0 if (keep_items && keep_items->find(item) != LLInventoryModel::item_array_t::FAIL) { llinfos << "preserved item" << llendl; @@ -1661,7 +1675,10 @@ void LLAppearanceMgr::purgeCategory(const LLUUID& category, bool keep_outfit_lin { gInventory.purgeObject(item->getUUID()); } +#else + gInventory.purgeObject(item->getUUID()); } +#endif } } @@ -2981,13 +2998,27 @@ public: // Successful completion. /* virtual */ void result(const LLSD& content) { - llinfos << "request OK" << llendl; + LL_DEBUGS("Avatar") << "content: " << ll_pretty_print_sd(content) << LL_ENDL; + if (content["success"].asBoolean()) + { + LL_DEBUGS("Avatar") << "OK" << LL_ENDL; + } + else + { + onFailure(200); + } } // Error - /*virtual*/ void error(U32 status, const std::string& reason) + /*virtual*/ void errorWithContent(U32 status, const std::string& reason, const LLSD& content) { llwarns << "appearance update request failed, status: " << status << " reason: " << reason << llendl; + LL_DEBUGS("Avatar") << "content: " << ll_pretty_print_sd(content) << LL_ENDL; + onFailure(status); + } + + void onFailure(U32 status) + { F32 seconds_to_wait; if (mRetryPolicy->shouldRetry(status,seconds_to_wait)) { @@ -3001,7 +3032,7 @@ public: { llwarns << "giving up after too many retries" << llendl; } - } + } LLPointer mRetryPolicy; }; diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index 5763fe307e..6c773368d3 100755 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -1161,7 +1161,7 @@ void LLViewerFetchedTexture::destroyTexture() return ; } - LL_DEBUGS("Avatar") << mID << llendl; + //LL_DEBUGS("Avatar") << mID << llendl; destroyGLTexture() ; mFullyLoaded = FALSE ; } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 8f118f5110..9b43db7087 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2256,7 +2256,7 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics() if (S32_MAX == ++report_sequence) report_sequence = 0; - LL_DEBUGS("Avatar") << avString() << "message: " << ll_pretty_print_sd(msg) << LL_ENDL; +// LL_DEBUGS("Avatar") << avString() << "message: " << ll_pretty_print_sd(msg) << LL_ENDL; std::string caps_url; if (getRegion()) { diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9078cce932..3831a13f41 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1146,9 +1146,10 @@ void LLVOVolume::sculpt() } else if (current_discard > MAX_DISCARD_LEVEL) { +#if 0 llwarns << "WARNING!!: Current discard of sculpty at " << current_discard << " is more than than allowed max of " << MAX_DISCARD_LEVEL << llendl; - +#endif // corrupted volume... don't update the sculpty return; } From 6390188ff35c47c93748c6fe3023d0bad219dea6 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 14 Jan 2013 16:02:28 -0500 Subject: [PATCH 20/66] removed yet another logcontrol.xml commit --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 1259039010..64122bbb6c 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - Avatar From 85e993224cfc67830f9586c1767a860a1d0c0deb Mon Sep 17 00:00:00 2001 From: prep Date: Mon, 14 Jan 2013 17:21:13 -0500 Subject: [PATCH 21/66] SH-3632:Undo change is now disabled after you save and return to the edit out fit panel (this behavior is now make sunshine-internal consistent with 3.4.1) --- indra/newview/llsidepanelappearance.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp index f0844dd9a4..60ea675da4 100644 --- a/indra/newview/llsidepanelappearance.cpp +++ b/indra/newview/llsidepanelappearance.cpp @@ -410,6 +410,7 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLViewerWearab { // Save changes if closing. mEditWearable->saveChanges(); + LLAppearanceMgr::getInstance()->setOutfitDirty( FALSE ); if (!disable_camera_switch) // if we're just switching between outfit and wearable editing, don't end customization. { LLVOAvatarSelf::onCustomizeEnd(disable_camera_switch); From f48011e4d04f744a93a18267bf7b78ec0b717b7c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 15 Jan 2013 20:30:20 -0500 Subject: [PATCH 22/66] SH-3339 WIP, SH-3645 WIP - added getActualDescription to obviate an obnoxious and widely-used workaround, re-create COF link after wearable edit to force COF version bump --- .hgignore | 0 indra/llinventory/llinventory.cpp | 5 +++ indra/llinventory/llinventory.h | 1 + indra/newview/llappearancemgr.cpp | 49 +++++++++++++++++++++------ indra/newview/llappearancemgr.h | 3 ++ indra/newview/llpaneleditwearable.cpp | 22 +++++++++++- 6 files changed, 68 insertions(+), 12 deletions(-) mode change 100644 => 100755 .hgignore mode change 100644 => 100755 indra/llinventory/llinventory.cpp mode change 100644 => 100755 indra/llinventory/llinventory.h mode change 100644 => 100755 indra/newview/llpaneleditwearable.cpp diff --git a/.hgignore b/.hgignore old mode 100644 new mode 100755 diff --git a/indra/llinventory/llinventory.cpp b/indra/llinventory/llinventory.cpp old mode 100644 new mode 100755 index 2dbc331036..3150a99a21 --- a/indra/llinventory/llinventory.cpp +++ b/indra/llinventory/llinventory.cpp @@ -379,6 +379,11 @@ const std::string& LLInventoryItem::getDescription() const return mDescription; } +const std::string& LLInventoryItem::getActualDescription() const +{ + return mDescription; +} + time_t LLInventoryItem::getCreationDate() const { return mCreationDate; diff --git a/indra/llinventory/llinventory.h b/indra/llinventory/llinventory.h old mode 100644 new mode 100755 index a5cfe59bda..44e7c0c34d --- a/indra/llinventory/llinventory.h +++ b/indra/llinventory/llinventory.h @@ -160,6 +160,7 @@ public: virtual const LLUUID& getCreatorUUID() const; virtual const LLUUID& getAssetUUID() const; virtual const std::string& getDescription() const; + virtual const std::string& getActualDescription() const; // Does not follow links virtual const LLSaleInfo& getSaleInfo() const; virtual LLInventoryType::EType getInventoryType() const; virtual U32 getFlags() const; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 7edba842b8..d1ed82cc98 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -451,7 +451,7 @@ public: item->getLinkedUUID(), mDstCatID, item->getName(), - item->LLInventoryItem::getDescription(), + item->getActualDescription(), LLAssetType::AT_LINK, new LLBoostFuncInventoryCallback( boost::bind(&LLCallAfterInventoryBatchMgr::onOp,this,item_id,_1,LLTimer()))); @@ -1467,13 +1467,13 @@ void LLAppearanceMgr::shallowCopyCategoryContents(const LLUUID& src_id, const LL { case LLAssetType::AT_LINK: { - //LLInventoryItem::getDescription() is used for a new description + //getActualDescription() is used for a new description //to propagate ordering information saved in descriptions of links link_inventory_item(gAgent.getID(), item->getLinkedUUID(), dst_id, item->getName(), - item->LLInventoryItem::getDescription(), + item->getActualDescription(), LLAssetType::AT_LINK, cb); break; } @@ -1718,7 +1718,7 @@ void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid, item->getLinkedUUID(), cat_uuid, item->getName(), - item->LLInventoryItem::getDescription(), + item->getActualDescription(), LLAssetType::AT_LINK, cb); @@ -1910,7 +1910,7 @@ bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* it return true; } - return item1->LLInventoryItem::getDescription() < item2->LLInventoryItem::getDescription(); + return item1->getActualDescription() < item2->getActualDescription(); } void item_array_diff(LLInventoryModel::item_array_t& full_list, @@ -2486,6 +2486,33 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update return; } +LLInventoryModel::item_array_t LLAppearanceMgr::findCOFItemLinks(const LLUUID& item_id) +{ + + LLInventoryModel::item_array_t result; + const LLViewerInventoryItem *vitem = + dynamic_cast(gInventory.getItem(item_id)); + + if (vitem) + { + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(LLAppearanceMgr::getCOF(), + cat_array, + item_array, + LLInventoryModel::EXCLUDE_TRASH); + for (S32 i=0; igetLinkedUUID() == vitem->getLinkedUUID()) + { + result.put(item_array.get(i)); + } + } + } + return result; +} + void LLAppearanceMgr::removeAllClothesFromAvatar() { // Fetch worn clothes (i.e. the ones in COF). @@ -2644,7 +2671,7 @@ void LLAppearanceMgr::updateIsDirty() if (item1->getLinkedUUID() != item2->getLinkedUUID() || item1->getName() != item2->getName() || - item1->LLInventoryItem::getDescription() != item2->LLInventoryItem::getDescription()) + item1->getActualDescription() != item2->getActualDescription()) { mOutfitIsDirty = true; return; @@ -2855,8 +2882,8 @@ struct WearablesOrderComparator return true; } - const std::string& desc1 = item1->LLInventoryItem::getDescription(); - const std::string& desc2 = item2->LLInventoryItem::getDescription(); + const std::string& desc1 = item1->getActualDescription(); + const std::string& desc2 = item2->getActualDescription(); bool item1_valid = (desc1.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc1[0]); bool item2_valid = (desc2.size() == mControlSize) && (ORDER_NUMBER_SEPARATOR == desc2[0]); @@ -2914,7 +2941,7 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base if (!item) continue; std::string new_order_str = build_order_string((LLWearableType::EType)type, i); - if (new_order_str == item->LLInventoryItem::getDescription()) continue; + if (new_order_str == item->getActualDescription()) continue; item->setDescription(new_order_str); item->setComplete(TRUE); @@ -3179,8 +3206,8 @@ bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_b closer_to_body ? --it : ++it; LLViewerInventoryItem* swap_item = *it; if (!swap_item) return false; - std::string tmp = swap_item->LLInventoryItem::getDescription(); - swap_item->setDescription(item->LLInventoryItem::getDescription()); + std::string tmp = swap_item->getActualDescription(); + swap_item->setDescription(item->getActualDescription()); item->setDescription(tmp); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 31dbce892a..01a2d41458 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -132,6 +132,9 @@ public: void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer cb = NULL); void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer cb = NULL); + // Find COF entries referencing the given item. + LLInventoryModel::item_array_t findCOFItemLinks(const LLUUID& item_id); + // Remove COF entries void removeCOFItemLinks(const LLUUID& item_id); void removeCOFLinksOfType(LLWearableType::EType type); diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp old mode 100644 new mode 100755 index 606e78bd58..cca3b90329 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1065,7 +1065,27 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) } else { - gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); + LLInventoryModel::item_array_t links = + LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID()); + if (links.size()>0) + { + // Make another copy of this link, with the same description. + LLInventoryItem *item = links.get(0).get(); + if (item) + { + const std::string description = item->getIsLinkType() ? item->getActualDescription() : ""; + link_inventory_item( gAgent.getID(), + item->getLinkedUUID(), + LLAppearanceMgr::instance().getCOF(), + item->getName(), + description, + LLAssetType::AT_LINK, + NULL); + gInventory.purgeObject(item->getUUID()); + } + } + gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); + } } From 6a8947679cdb3a3d6ce9d4d175a2bdfed4b7eee3 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 16 Jan 2013 11:34:42 -0500 Subject: [PATCH 23/66] SH-3645 WIP - preserve item order after wearable save as --- indra/newview/llagentwearables.cpp | 12 ++++-- indra/newview/llagentwearables.h | 6 ++- indra/newview/llappearancemgr.cpp | 26 ++++++++----- indra/newview/llappearancemgr.h | 4 +- indra/newview/llinventorylistitem.cpp | 2 +- indra/newview/llpaneleditwearable.cpp | 55 ++++++++++++++++----------- 6 files changed, 64 insertions(+), 41 deletions(-) diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index e79fda2459..70f4de8db2 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -210,12 +210,13 @@ LLAgentWearables::sendAgentWearablesUpdateCallback::~sendAgentWearablesUpdateCal * @param todo Bitmask of actions to take on completion. */ LLAgentWearables::addWearableToAgentInventoryCallback::addWearableToAgentInventoryCallback( - LLPointer cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo) : + LLPointer cb, LLWearableType::EType type, U32 index, LLViewerWearable* wearable, U32 todo, const std::string description) : mType(type), mIndex(index), mWearable(wearable), mTodo(todo), - mCB(cb) + mCB(cb), + mDescription(description) { llinfos << "constructor" << llendl; } @@ -255,7 +256,7 @@ void LLAgentWearables::addWearableToAgentInventoryCallback::fire(const LLUUID& i } if (mTodo & CALL_WEARITEM) { - LLAppearanceMgr::instance().addCOFItemLink(inv_item, true); + LLAppearanceMgr::instance().addCOFItemLink(inv_item, true, NULL, mDescription); } } @@ -455,6 +456,7 @@ void LLAgentWearables::saveWearable(const LLWearableType::EType type, const U32 void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, + const std::string& description, BOOL save_in_lost_and_found) { if (!isWearableCopyable(type, index)) @@ -486,7 +488,9 @@ void LLAgentWearables::saveWearableAs(const LLWearableType::EType type, type, index, new_wearable, - addWearableToAgentInventoryCallback::CALL_WEARITEM); + addWearableToAgentInventoryCallback::CALL_WEARITEM, + description + ); LLUUID category_id; if (save_in_lost_and_found) { diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h index a60fbc969b..5be4648636 100755 --- a/indra/newview/llagentwearables.h +++ b/indra/newview/llagentwearables.h @@ -183,7 +183,7 @@ private: // Save Wearables //-------------------------------------------------------------------- public: - void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, BOOL save_in_lost_and_found); + void saveWearableAs(const LLWearableType::EType type, const U32 index, const std::string& new_name, const std::string& description, BOOL save_in_lost_and_found); void saveWearable(const LLWearableType::EType type, const U32 index, BOOL send_update = TRUE, const std::string new_name = ""); void saveAllWearables(); @@ -270,7 +270,8 @@ private: LLWearableType::EType type, U32 index, LLViewerWearable* wearable, - U32 todo = CALL_NONE); + U32 todo = CALL_NONE, + const std::string description = ""); virtual void fire(const LLUUID& inv_item); private: LLWearableType::EType mType; @@ -278,6 +279,7 @@ private: LLViewerWearable* mWearable; U32 mTodo; LLPointer mCB; + std::string mDescription; }; }; // LLAgentWearables diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index d1ed82cc98..2b1e78c899 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1902,7 +1902,7 @@ static void remove_non_link_items(LLInventoryModel::item_array_t &items) } //a predicate for sorting inventory items by actual descriptions -bool sort_by_description(const LLInventoryItem* item1, const LLInventoryItem* item2) +bool sort_by_actual_description(const LLInventoryItem* item1, const LLInventoryItem* item2) { if (!item1 || !item2) { @@ -2345,10 +2345,11 @@ bool areMatchingWearables(const LLViewerInventoryItem *a, const LLViewerInventor class LLDeferredCOFLinkObserver: public LLInventoryObserver { public: - LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update, LLPointer cb = NULL): + LLDeferredCOFLinkObserver(const LLUUID& item_id, bool do_update, LLPointer cb = NULL, std::string description = ""): mItemID(item_id), mDoUpdate(do_update), - mCallback(cb) + mCallback(cb), + mDescription(description) { } @@ -2370,23 +2371,24 @@ public: private: const LLUUID mItemID; bool mDoUpdate; + std::string mDescription; LLPointer mCallback; }; // BAP - note that this runs asynchronously if the item is not already loaded from inventory. // Dangerous if caller assumes link will exist after calling the function. -void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update, LLPointer cb) +void LLAppearanceMgr::addCOFItemLink(const LLUUID &item_id, bool do_update, LLPointer cb, const std::string description) { const LLInventoryItem *item = gInventory.getItem(item_id); if (!item) { - LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update, cb); + LLDeferredCOFLinkObserver *observer = new LLDeferredCOFLinkObserver(item_id, do_update, cb, description); gInventory.addObserver(observer); } else { - addCOFItemLink(item, do_update, cb); + addCOFItemLink(item, do_update, cb, description); } } @@ -2409,8 +2411,9 @@ void modified_cof_cb(const LLUUID& inv_item) } } -void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update, LLPointer cb) +void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update, LLPointer cb, const std::string description) { + std::string link_description = description; const LLViewerInventoryItem *vitem = dynamic_cast(item); if (!vitem) { @@ -2474,12 +2477,15 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update { cb = new LLBoostFuncInventoryCallback(modified_cof_cb); } - const std::string description = vitem->getIsLinkType() ? vitem->getDescription() : ""; + if (vitem->getIsLinkType()) + { + link_description = vitem->getActualDescription(); + } link_inventory_item( gAgent.getID(), vitem->getLinkedUUID(), getCOF(), vitem->getName(), - description, + link_description, LLAssetType::AT_LINK, cb); } @@ -3240,7 +3246,7 @@ void LLAppearanceMgr::sortItemsByActualDescription(LLInventoryModel::item_array_ { if (items.size() < 2) return; - std::sort(items.begin(), items.end(), sort_by_description); + std::sort(items.begin(), items.end(), sort_by_actual_description); } //#define DUMP_CAT_VERBOSE diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index 01a2d41458..bb4c9ee5a2 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -129,8 +129,8 @@ public: LLPointer cb); // Add COF link to individual item. - void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer cb = NULL); - void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer cb = NULL); + void addCOFItemLink(const LLUUID& item_id, bool do_update = true, LLPointer cb = NULL, const std::string description = ""); + void addCOFItemLink(const LLInventoryItem *item, bool do_update = true, LLPointer cb = NULL, const std::string description = ""); // Find COF entries referencing the given item. LLInventoryModel::item_array_t findCOFItemLinks(const LLUUID& item_id); diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp index 26041767fd..0601796436 100644 --- a/indra/newview/llinventorylistitem.cpp +++ b/indra/newview/llinventorylistitem.cpp @@ -231,7 +231,7 @@ const std::string& LLPanelInventoryListItemBase::getDescription() const { return LLStringUtil::null; } - return inv_item->getDescription(); + return inv_item->getActualDescription(); } time_t LLPanelInventoryListItemBase::getCreationDate() const diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp index cca3b90329..fe4b55bb5a 100755 --- a/indra/newview/llpaneleditwearable.cpp +++ b/indra/newview/llpaneleditwearable.cpp @@ -1056,36 +1056,47 @@ void LLPanelEditWearable::saveChanges(bool force_save_as) U32 index = gAgentWearables.getWearableIndex(mWearablePtr); std::string new_name = mNameEditor->getText(); + + // Find an existing link to this wearable's inventory item, if any, and its description field. + LLInventoryItem *link_item = NULL; + std::string description; + LLInventoryModel::item_array_t links = + LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID()); + if (links.size()>0) + { + link_item = links.get(0).get(); + if (link_item && link_item->getIsLinkType()) + { + description = link_item->getActualDescription(); + } + } + if (force_save_as) { - // the name of the wearable has changed, re-save wearable with new name - LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID()); - gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, FALSE); - mNameEditor->setText(mWearableItem->getName()); + // the name of the wearable has changed, re-save wearable with new name + LLAppearanceMgr::instance().removeCOFItemLinks(mWearablePtr->getItemID()); + gAgentWearables.saveWearableAs(mWearablePtr->getType(), index, new_name, description, FALSE); + mNameEditor->setText(mWearableItem->getName()); } else { - LLInventoryModel::item_array_t links = - LLAppearanceMgr::instance().findCOFItemLinks(mWearablePtr->getItemID()); - if (links.size()>0) + // Make another copy of this link, with the same + // description. This is needed to bump the COF + // version so texture baking service knows appearance has changed. + if (link_item) { - // Make another copy of this link, with the same description. - LLInventoryItem *item = links.get(0).get(); - if (item) - { - const std::string description = item->getIsLinkType() ? item->getActualDescription() : ""; - link_inventory_item( gAgent.getID(), - item->getLinkedUUID(), - LLAppearanceMgr::instance().getCOF(), - item->getName(), - description, - LLAssetType::AT_LINK, - NULL); - gInventory.purgeObject(item->getUUID()); - } + // Create new link + link_inventory_item( gAgent.getID(), + link_item->getLinkedUUID(), + LLAppearanceMgr::instance().getCOF(), + link_item->getName(), + description, + LLAssetType::AT_LINK, + NULL); + // Remove old link + gInventory.purgeObject(link_item->getUUID()); } gAgentWearables.saveWearable(mWearablePtr->getType(), index, TRUE, new_name); - } } From 06baa6bf9cf7bb8b787f10705a3109ab00866d79 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Fri, 18 Jan 2013 21:22:18 +0000 Subject: [PATCH 24/66] Moving appearance utility deb to private repo --- autobuild.xml | 4 ++-- build.sh | 54 +++++++++++++++------------------------------------ 2 files changed, 18 insertions(+), 40 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 3c503997cc..eaafc45427 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1290,9 +1290,9 @@ archive hash - 17bcc2481fe362e297376d9c46888de8 + 376738111ec9ba6f1b0d0dee0a3c784d url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/268501/arch/Linux/installer/llappearanceutility_source-0.1-linux-20121220.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/269218/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130118.tar.bz2 name linux diff --git a/build.sh b/build.sh index 307dda85eb..d779a1a34b 100755 --- a/build.sh +++ b/build.sh @@ -334,51 +334,29 @@ then done fi # Move any .deb results. - mv ${build_dir}/packages/*.deb ../ 2>/dev/null || true + mkdir -p ../packages_public + mkdir -p ../packages_private + mv ${build_dir}/packages/*.deb ../packages_public 2>/dev/null || true + mv ${build_dir}/packages/packages_private/*.deb ../packages_private 2>/dev/null || true # upload debian package and create repository begin_section "Upload Debian Repository" - for deb_file in ../*.deb; do + for deb_file in `/bin/ls ../packages_public/*.deb ../*.deb 2>/dev/null`; do upload_item debian $deb_file binary/octet-stream done - if [ -d "$build_log_dir/debian_repo" ] - then - pushd "$build_log_dir/debian_repo" - cat > Release < Packages.gz \ - && dpkg-scansources . /dev/null | gzip -9c > Sources.gz - then - begin_section Packages.gz - gunzip --stdout Packages.gz - for file in *.deb - do - stat "$file" | sed 2q - md5sum "$file" - done - end_section Packages.gz + for deb_file in `/bin/ls ../packages_private/*.deb 2>/dev/null`; do + upload_item debian_private $deb_file binary/octet-stream + done - for file in * - do - upload_item debian_repo "$file" binary/octet-stream - done - else - record_failure 'Unable to generate Packages.gz or Sources.gz' + create_deb_repo + + # Rename the local debian_repo* directories so that the master buildscript + # doesn't make a remote repo again. + for debian_repo_type in debian_repo debian_repo_private; do + if [ -d "$build_log_dir/$debian_repo_type" ]; then + mv $build_log_dir/$debian_repo_type $build_log_dir/${debian_repo_type}_pushed fi - popd - - process_pending_uploads - - # Rename the local debian_repo directory so that the master buildscript - # doesn't make a remote repo again. - - mv $build_log_dir/debian_repo $build_log_dir/debian_repo_pushed - fi + done end_section "Upload Debian Repository" else From b3cbe35532b365e223df14921532a6e587695dec Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 18 Jan 2013 16:51:03 -0500 Subject: [PATCH 25/66] SH-3344 WIP - more texture load monitoring --- indra/newview/llvoavatar.cpp | 96 ++++++++++++++++++++++++++++---- indra/newview/llvoavatar.h | 16 ++++-- indra/newview/llvoavatarself.cpp | 1 + 3 files changed, 96 insertions(+), 17 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index df0b8171a6..54bb755ad5 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2888,7 +2888,11 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) { central_bake_version = getRegion()->getCentralBakeVersion(); } - addDebugText(llformat("mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); + bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); + addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + all_local_downloaded ? "L" : "l", + all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version)); } @@ -4001,10 +4005,48 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) return 6; } -//------------------------------------------------------------------------ -// LLVOAvatar::updateTextures() -//------------------------------------------------------------------------ -void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem) +bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) +{ + for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep && imagep->getDiscardLevel()!=0) + { + return false; + } + } + return true; +} + +bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() +{ + std::set local_ids; + collectLocalTextureUUIDs(local_ids); + return allTexturesCompletelyDownloaded(local_ids); +} + +bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() +{ + std::set baked_ids; + collectLocalTextureUUIDs(baked_ids); + return allTexturesCompletelyDownloaded(baked_ids); +} + +S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) +{ + S32 result = 0; + for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + if (imagep) + { + result += imagep->getTextureMemory(); + } + } + return result; +} + +void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) { for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { @@ -4020,17 +4062,26 @@ void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = LLAvatarAppearanceDictionary::getInstance()->getTexture((ETextureIndex)texture_index); if (texture_dict->mIsLocalTexture) { - local_mem += imagep->getTextureMemory(); ids.insert(imagep->getID()); } } } + } + ids.erase(IMG_DEFAULT); + ids.erase(IMG_DEFAULT_AVATAR); + ids.erase(IMG_INVISIBLE); +} + +void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) +{ + for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) + { + LLViewerFetchedTexture *imagep = NULL; if (isIndexBakedTexture((ETextureIndex) texture_index)) { imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE); if (imagep) { - baked_mem += imagep->getTextureMemory(); ids.insert(imagep->getID()); } } @@ -4040,15 +4091,36 @@ void LLVOAvatar::collectTextureUUIDs(std::set& ids, S32& local_mem, S32& ids.erase(IMG_INVISIBLE); } +void LLVOAvatar::collectTextureUUIDs(std::set& ids) +{ + collectLocalTextureUUIDs(ids); + collectBakedTextureUUIDs(ids); +} + void LLVOAvatar::releaseOldTextures() { S32 current_texture_mem = 0; // Any textures that we used to be using but are no longer using should no longer be flagged as "NO_DELETE" + std::set baked_texture_ids; + collectBakedTextureUUIDs(baked_texture_ids); + S32 new_baked_mem = totalTextureMemForUUIDS(baked_texture_ids); + + std::set local_texture_ids; + collectLocalTextureUUIDs(local_texture_ids); + S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); + std::set new_texture_ids; - S32 local_mem = 0, baked_mem = 0; - collectTextureUUIDs(new_texture_ids, local_mem, baked_mem); - LL_DEBUGS("Avatar") << getFullname() << " local_mem: " << local_mem << " baked_mem: " << baked_mem << llendl; + new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end()); + new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end()); + S32 new_total_mem = totalTextureMemForUUIDS(new_texture_ids); + + S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); + LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; + if (!isSelf() && new_total_mem > new_baked_mem) + { + llwarns << "extra local textures stored for non-self av" << llendl; + } for (std::set::iterator it = mTextureIDs.begin(); it != mTextureIDs.end(); ++it) { if (new_texture_ids.find(*it) == new_texture_ids.end()) @@ -4062,8 +4134,8 @@ void LLVOAvatar::releaseOldTextures() // This will allow the texture to be deleted if not in use. imagep->forceActive(); - // This resets the clock to being flagged as - // unused, preventing the texture from being + // This resets the clock to texture being flagged + // as unused, preventing the texture from being // deleted immediately. If other avatars or // objects are using it, it can still be flagged // no-delete by them. diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 5b1395e566..2c64b9695e 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -124,17 +124,23 @@ protected: public: /*virtual*/ void updateGL(); /*virtual*/ LLVOAvatar* asAvatar(); - virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, + virtual U32 processUpdateMessage(LLMessageSystem *mesgsys, void **user_data, U32 block_num, const EObjectUpdateType update_type, LLDataPacker *dp); - virtual void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); + virtual void idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time); /*virtual*/ BOOL updateLOD(); - BOOL updateJointLODs(); - void updateLODRiggedAttachments( void ); + BOOL updateJointLODs(); + void updateLODRiggedAttachments( void ); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. - void collectTextureUUIDs(std::set& ids, S32& local_mem, S32& baked_mem); + S32 totalTextureMemForUUIDS(std::set& ids); + bool allTexturesCompletelyDownloaded(std::set& ids); + bool allLocalTexturesCompletelyDownloaded(); + bool allBakedTexturesCompletelyDownloaded(); + void collectLocalTextureUUIDs(std::set& ids); + void collectBakedTextureUUIDs(std::set& ids); + void collectTextureUUIDs(std::set& ids); void releaseOldTextures(); /*virtual*/ void updateTextures(); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 9b43db7087..19534bde59 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2066,6 +2066,7 @@ const std::string LLVOAvatarSelf::verboseDebugDumpLocalTextureDataInfo(const LLV << " ts: " << image->getTextureState() << " bl: " << image->getBoostLevel() << " fl: " << image->isFullyLoaded() // this is not an accessor for mFullyLoaded - see comment there. + << " cl: " << (image->isFullyLoaded() && image->getDiscardLevel()==0) // "completely loaded" << " mvs: " << image->getMaxVirtualSize() << " mvsc: " << image->getMaxVirtualSizeResetCounter() << " mem: " << image->getTextureMemory(); From b13d0b7a658784f015256576b71643827c572bb5 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sat, 19 Jan 2013 02:00:39 +0000 Subject: [PATCH 26/66] Adding stub for private artifacts --- build.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.sh b/build.sh index d779a1a34b..964f9ef0a6 100755 --- a/build.sh +++ b/build.sh @@ -312,6 +312,7 @@ then if $build_viewer_deb && [ "$last_built_variant" == "Release" ] then begin_section "Build Viewer Debian Package" + local have_private_repo=false # mangle the changelog dch --force-bad-version \ --distribution unstable \ @@ -346,6 +347,7 @@ then done for deb_file in `/bin/ls ../packages_private/*.deb 2>/dev/null`; do upload_item debian_private $deb_file binary/octet-stream + have_private_repo=true done create_deb_repo @@ -357,6 +359,14 @@ then mv $build_log_dir/$debian_repo_type $build_log_dir/${debian_repo_type}_pushed fi done + + if [ $have_private_repo = true ]; then + eval "$python_command \"$redirect\" '\${private_S3PROXY_URL}${S3PREFIX}repo/$repo/rev/$revision/index.html'"\ + >"$build_log_dir/private.html" || fatal generating redirect + upload_item global_redirect "$build_log_dir/private.html" text/html + + fi + end_section "Upload Debian Repository" else From b40fad02de170b5da179cacc22f32f5f25ffd7cb Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 22 Jan 2013 09:19:23 -0500 Subject: [PATCH 27/66] Add debug level logging for Avatar by default. Will need to turn this off before general release, but will give us better debugging info during testing --- indra/newview/app_settings/logcontrol.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml index 64122bbb6c..1259039010 100755 --- a/indra/newview/app_settings/logcontrol.xml +++ b/indra/newview/app_settings/logcontrol.xml @@ -42,8 +42,8 @@ tags - From e378effca36a0a6efd6036586c3259ba5367b012 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 22 Jan 2013 21:47:35 -0500 Subject: [PATCH 28/66] Added cof version information to DebugAvatarAppearanceMessage output --- indra/newview/llappearancemgr.cpp | 18 +++++++++++++++++- indra/newview/llappearancemgr.h | 7 +++++++ indra/newview/llvoavatar.cpp | 18 ++++++++++++++++-- 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 2b1e78c899..e7fa56466d 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1184,6 +1184,21 @@ S32 LLAppearanceMgr::getCOFVersion() const } } +S32 LLAppearanceMgr::getLastUpdateRequestCOFVersion() const +{ + return mLastUpdateRequestCOFVersion; +} + +S32 LLAppearanceMgr::getLastAppearanceUpdateCOFVersion() const +{ + return mLastAppearanceUpdateCOFVersion; +} + +void LLAppearanceMgr::setLastAppearanceUpdateCOFVersion(S32 new_val) +{ + mLastAppearanceUpdateCOFVersion = new_val; +} + const LLViewerInventoryItem* LLAppearanceMgr::getBaseOutfitLink() { const LLUUID& current_outfit_cat = getCOF(); @@ -3293,7 +3308,8 @@ LLAppearanceMgr::LLAppearanceMgr(): mOutfitIsDirty(false), mOutfitLocked(false), mIsInUpdateAppearanceFromCOF(false), - mLastUpdateRequestCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) + mLastUpdateRequestCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN), + mLastAppearanceUpdateCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { LLOutfitObserver& outfit_observer = LLOutfitObserver::instance(); diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h index bb4c9ee5a2..1a1ca1ca7d 100755 --- a/indra/newview/llappearancemgr.h +++ b/indra/newview/llappearancemgr.h @@ -94,7 +94,14 @@ public: const LLUUID getCOF() const; S32 getCOFVersion() const; + // COF version of last viewer-initiated appearance update request. S32 mLastUpdateRequestCOFVersion; + S32 getLastUpdateRequestCOFVersion() const; + + // COF version of last appearance message received for self av. + S32 mLastAppearanceUpdateCOFVersion; + S32 getLastAppearanceUpdateCOFVersion() const; + void setLastAppearanceUpdateCOFVersion(S32 new_val); // Finds the folder link to the currently worn outfit const LLViewerInventoryItem *getBaseOutfitLink(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 54bb755ad5..83667c8c55 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2890,11 +2890,23 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); - addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + S32 curr_cof_version = -1; + S32 last_request_cof_version = -1; + S32 last_received_cof_version = -1; + if (isSelf()) + { + curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); + last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + } + + addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d - cof: %d req: %d rcv:%d", all_local_downloaded ? "L" : "l", all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, - mUseServerBakes, central_bake_version)); + mUseServerBakes, central_bake_version, + curr_cof_version, last_request_cof_version, last_received_cof_version + )); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) { @@ -6613,6 +6625,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) << " last_update_request_cof_version " << last_update_request_cof_version << " my_cof_version " << LLAppearanceMgr::instance().getCOFVersion() << llendl; + LLAppearanceMgr::instance().setLastAppearanceUpdateCOFVersion(this_update_cof_version); + if (getRegion() && (getRegion()->getCentralBakeVersion()==0)) { llwarns << avString() << "Received AvatarAppearance message for self in non-server-bake region" << llendl; From d56009af85cd3807dbaaf23e4f4ce9539a637602 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 23 Jan 2013 11:04:23 -0500 Subject: [PATCH 29/66] fixes and updates to DebugAvatarAppearanceMessage status line --- indra/newview/llvoavatar.cpp | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 83667c8c55..6aad3c8918 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2890,23 +2890,20 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) } bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); - S32 curr_cof_version = -1; - S32 last_request_cof_version = -1; - S32 last_received_cof_version = -1; + std::string debug_line = llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", + all_local_downloaded ? "L" : "l", + all_baked_downloaded ? "B" : "b", + mUseLocalAppearance, mIsEditingAppearance, + mUseServerBakes, central_bake_version); if (isSelf()) { - curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); - last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); - last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); + S32 last_request_cof_version = LLAppearanceMgr::instance().getLastUpdateRequestCOFVersion(); + S32 last_received_cof_version = LLAppearanceMgr::instance().getLastAppearanceUpdateCOFVersion(); + debug_line += llformat(" - cof: %d req: %d rcv:%d", + curr_cof_version, last_request_cof_version, last_received_cof_version); } - - addDebugText(llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d - cof: %d req: %d rcv:%d", - all_local_downloaded ? "L" : "l", - all_baked_downloaded ? "B" : "b", - mUseLocalAppearance, mIsEditingAppearance, - mUseServerBakes, central_bake_version, - curr_cof_version, last_request_cof_version, last_received_cof_version - )); + addDebugText(debug_line); } if (gSavedSettings.getBOOL("DebugAvatarCompositeBaked")) { @@ -4040,7 +4037,7 @@ bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() { std::set baked_ids; - collectLocalTextureUUIDs(baked_ids); + collectBakedTextureUUIDs(baked_ids); return allTexturesCompletelyDownloaded(baked_ids); } From 878e31dce2483cea0a1a38f076d4558c04ec9642 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 23 Jan 2013 16:04:08 -0500 Subject: [PATCH 30/66] SH-3534 WIP - better encapsulation of mUseServerBakes --- indra/newview/llagent.cpp | 12 +++++------- indra/newview/llvoavatar.cpp | 7 ++++++- indra/newview/llvoavatar.h | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index e15b4d071f..5796c34e25 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4286,12 +4286,6 @@ void LLAgent::requestLeaveGodMode() //----------------------------------------------------------------------------- void LLAgent::sendAgentSetAppearance() { - // FIXME DRANO - problems around new-style appearance in an old-style region. - // - does this get called? - // - need to change mUseServerBakes->FALSE in that case - // - need to call processAvatarAppearance as if server had returned this result? - // gAgentAvatarp->mUseServerBakes = FALSE; - if (gAgentQueryManager.mNumPendingQueries > 0) { return; @@ -4308,6 +4302,10 @@ void LLAgent::sendAgentSetAppearance() if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; + // At this point we have a complete appearance to send and are in a non-baking region. + // DRANO FIXME + //gAgentAvatarp->setIsUsingServerBakes(FALSE); + LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << LL_ENDL; //dumpAvatarTEs( "sendAgentSetAppearance()" ); @@ -4408,7 +4406,7 @@ void LLAgent::sendAgentSetAppearance() } } -// llinfos << "Avatar XML num VisualParams transmitted = " << transmitted_params << llendl; + //llinfos << "Avatar XML num VisualParams transmitted = " << transmitted_params << llendl; sendReliableMessage(); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 6aad3c8918..3d58c50eba 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6651,7 +6651,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - mUseServerBakes = (appearance_version > 0); + setIsUsingServerBakes(appearance_version > 0); applyParsedTEMessage(tec); @@ -7276,6 +7276,11 @@ void LLVOAvatar::bodySizeChanged() } } +BOOL LLVOAvatar::isUsingServerBakes() const +{ + return mUseServerBakes; +} + void LLVOAvatar::setIsUsingServerBakes(BOOL newval) { mUseServerBakes = newval; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 2c64b9695e..c5064e4a52 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -653,7 +653,7 @@ public: // True if this avatar should fetch its baked textures via the new // appearance mechanism. - /*virtual*/ BOOL isUsingServerBakes() const { return mUseServerBakes; } + BOOL isUsingServerBakes() const; void setIsUsingServerBakes(BOOL newval); From 9f5e1d601c86e7036d3ecbae063ea637f0cdc7ca Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 23 Jan 2013 18:31:21 -0500 Subject: [PATCH 31/66] SH-3779 WIP - fully parse appearance message before trying to do anything with it --- indra/newview/llvoavatar.cpp | 130 +++++++++++++++++++++++++---------- indra/newview/llvoavatar.h | 2 + 2 files changed, 96 insertions(+), 36 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 3d58c50eba..cb9b1aa5cc 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6574,6 +6574,91 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, } } +struct LLAppearanceMessageContents +{ + LLAppearanceMessageContents(): + mAppearanceVersion(0), + mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) + { + } + + LLTEContents mTEContents; + U8 mAppearanceVersion; + S32 mCOFVersion; + // For future use: + //U32 appearance_flags = 0; + std::vector mParams; +}; + +void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) +{ + parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, contents.mTEContents); + + // Parse the AppearanceData field, if any. + if (mesgsys->has(_PREHASH_AppearanceData)) + { + mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, contents.mAppearanceVersion, 0); + mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0); + // For future use: + //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); + } + + // Parse visual params, if any. + S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); + bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing + if( num_blocks > 1 && !drop_visual_params_debug) + { + LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; + + LLVisualParam* param = getFirstVisualParam(); + llassert(param); // if this ever fires, we should do the same as when num_blocks<=1 + if (!param) + { + llwarns << "No visual params!" << llendl; + } + else + { + for( S32 i = 0; i < num_blocks; i++ ) + { + while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + { + param = getNextVisualParam(); + } + + if( !param ) + { + // more visual params supplied than expected - just process what we know about + break; + } + + U8 value; + mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); + F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); + contents.mParams.push_back(newWeight); + + param = getNextVisualParam(); + } + } + + const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + if (num_blocks != expected_tweakable_count) + { + llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + } + } + else + { + if (drop_visual_params_debug) + { + llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << llendl; + } + else + { + llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; + } + } +} + //----------------------------------------------------------------------------- // processAvatarAppearance() //----------------------------------------------------------------------------- @@ -6598,22 +6683,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) ESex old_sex = getSex(); - LLTEContents tec; - parseTEMessage(mesgsys, _PREHASH_ObjectData, -1, tec); + LLAppearanceMessageContents contents; + parseAppearanceMessage(mesgsys, contents); - U8 appearance_version = 0; - S32 this_update_cof_version = LLViewerInventoryCategory::VERSION_UNKNOWN; + U8 appearance_version = contents.mAppearanceVersion; + S32 this_update_cof_version = contents.mCOFVersion; S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; - // For future use: - //U32 appearance_flags = 0; - - if (mesgsys->has(_PREHASH_AppearanceData)) - { - mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, appearance_version, 0); - mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, this_update_cof_version, 0); - // For future use: - //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); - } // Only now that we have result of appearance_version can we decide whether to bail out. if( isSelf() ) @@ -6634,7 +6709,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } - // Check for stale update. if (isSelf() && (appearance_version>0) @@ -6653,7 +6727,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) setIsUsingServerBakes(appearance_version > 0); - applyParsedTEMessage(tec); + applyParsedTEMessage(contents.mTEContents); // prevent the overwriting of valid baked textures with invalid baked textures for (U8 baked_index = 0; baked_index < mBakedTextureDatas.size(); baked_index++) @@ -6667,7 +6741,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } - // runway - was // if (!is_first_appearance_message ) // which means it would be called on second appearance message - probably wrong. @@ -6680,9 +6753,8 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) gPipeline.markGLRebuild(this); // parse visual params - S32 num_blocks = mesgsys->getNumberOfBlocksFast(_PREHASH_VisualParam); - bool drop_visual_params_debug = gSavedSettings.getBOOL("BlockSomeAvatarAppearanceVisualParams") && (ll_rand(2) == 0); // pretend that ~12% of AvatarAppearance messages arrived without a VisualParam block, for testing - if( num_blocks > 1 && !drop_visual_params_debug) + S32 num_blocks = contents.mParams.size(); + if( num_blocks > 1) { LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; BOOL params_changed = FALSE; @@ -6696,7 +6768,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } else { - std::vector params_for_dump; for( S32 i = 0; i < num_blocks; i++ ) { while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT @@ -6710,14 +6781,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) break; } - U8 value; - mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); - F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); - params_for_dump.push_back(newWeight); + F32 newWeight = contents.mParams[i]; if (is_first_appearance_message || (param->getWeight() != newWeight)) { - //llinfos << "Received update for param " << param->getDisplayName() << " at value " << newWeight << llendl; params_changed = TRUE; if(is_first_appearance_message) { @@ -6732,7 +6799,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) param = getNextVisualParam(); } if (enable_verbose_dumps) - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", params_for_dump, tec); + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParams, contents.mTEContents); } if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } @@ -6764,14 +6831,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { // AvatarAppearance message arrived without visual params LL_DEBUGS("Avatar") << avString() << "no visual params" << LL_ENDL; - if (drop_visual_params_debug) - { - llinfos << "Debug-faked lack of parameters on AvatarAppearance for object: " << getID() << llendl; - } - else - { - llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; - } const F32 LOADING_TIMEOUT_SECONDS = 60.f; // this isn't really a problem if we already have a non-default shape @@ -6802,7 +6861,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); -// llinfos << "processAvatarAppearance end " << mID << llendl; } // static diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c5064e4a52..784b08a782 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -70,6 +70,7 @@ class LLHUDNameTag; class LLHUDEffectSpiral; class LLTexGlobalColor; class LLViewerJoint; +struct LLAppearanceMessageContents; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // LLVOAvatar @@ -635,6 +636,7 @@ protected: **/ public: + void parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& msg); void processAvatarAppearance(LLMessageSystem* mesgsys); void hideSkirt(); void startAppearanceAnimation(); From 67c5d567932fd825dfcf8931af595c5df6dcdeb1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 24 Jan 2013 17:28:15 -0500 Subject: [PATCH 32/66] SH-3779 WIP - handling of appearance version param --- indra/newview/llvoavatar.cpp | 107 +++++++++++++++++++++-------------- 1 file changed, 63 insertions(+), 44 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cb9b1aa5cc..a76a15671c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1796,11 +1796,13 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) return setTETextureCore(te, uuid, url); } + llinfos << "get texture from host " << uuid << llendl; LLHost target_host = getObjectHost(); return setTETextureCore(te, uuid, target_host); } else { + llinfos << "get texture from other " << uuid << llendl; return setTETextureCore(te, uuid, LLHost::invalid); } } @@ -6577,17 +6579,18 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, struct LLAppearanceMessageContents { LLAppearanceMessageContents(): - mAppearanceVersion(0), + mAppearanceVersion(-1), mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { } LLTEContents mTEContents; - U8 mAppearanceVersion; + S32 mAppearanceVersion; S32 mCOFVersion; // For future use: //U32 appearance_flags = 0; - std::vector mParams; + std::vector mParamWeights; + std::vector mParams; }; void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMessageContents& contents) @@ -6597,7 +6600,10 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe // Parse the AppearanceData field, if any. if (mesgsys->has(_PREHASH_AppearanceData)) { - mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, contents.mAppearanceVersion, 0); + U8 av_u8; + mesgsys->getU8Fast(_PREHASH_AppearanceData, _PREHASH_AppearanceVersion, av_u8, 0); + contents.mAppearanceVersion = av_u8; + llinfos << "appversion set by AppearanceData field: " << contents.mAppearanceVersion << llendl; mesgsys->getS32Fast(_PREHASH_AppearanceData, _PREHASH_CofVersion, contents.mCOFVersion, 0); // For future use: //mesgsys->getU32Fast(_PREHASH_AppearanceData, _PREHASH_Flags, appearance_flags, 0); @@ -6634,7 +6640,8 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe U8 value; mesgsys->getU8Fast(_PREHASH_VisualParam, _PREHASH_ParamValue, value, i); F32 newWeight = U8_to_F32(value, param->getMinWeight(), param->getMaxWeight()); - contents.mParams.push_back(newWeight); + contents.mParamWeights.push_back(newWeight); + contents.mParams.push_back(param); param = getNextVisualParam(); } @@ -6657,6 +6664,28 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe llinfos << "AvatarAppearance msg received without any parameters, object: " << getID() << llendl; } } + + if (contents.mAppearanceVersion < 0) // not set explicitly, try to get from visual param. + { + LLVisualParam* appearance_version_param = getVisualParam(11000); + if (appearance_version_param) + { + std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); + if (it != contents.mParams.end()) + { + S32 index = it - contents.mParams.begin(); + llinfos << "index: " << index << llendl; + S32 appearance_version = llround(contents.mParamWeights[index]); + contents.mAppearanceVersion = appearance_version; + llinfos << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; + } + } + } + if (contents.mAppearanceVersion < 0) // still not set, go with 0. + { + contents.mAppearanceVersion = 0; + llinfos << "appversion set by default: " << contents.mAppearanceVersion << llendl; + } } //----------------------------------------------------------------------------- @@ -6725,6 +6754,17 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } + S32 num_params = contents.mParamWeights.size(); + if (num_params <= 1) + { + // In this case, we have no reliable basis for knowing + // appearance version, which may cause us to look for baked + // textures in the wrong place and flag them as missing + // assets. + llinfos << "ignoring appearance message due to lack of params" << llendl; + return; + } + setIsUsingServerBakes(appearance_version > 0); applyParsedTEMessage(contents.mTEContents); @@ -6752,62 +6792,41 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) setCompositeUpdatesEnabled( FALSE ); gPipeline.markGLRebuild(this); - // parse visual params - S32 num_blocks = contents.mParams.size(); - if( num_blocks > 1) + // Apply visual params + if( num_params > 1) { - LL_DEBUGS("Avatar") << avString() << " handle visual params, num_blocks " << num_blocks << LL_ENDL; + LL_DEBUGS("Avatar") << avString() << " handle visual params, num_params " << num_params << LL_ENDL; BOOL params_changed = FALSE; BOOL interp_params = FALSE; - LLVisualParam* param = getFirstVisualParam(); - llassert(param); // if this ever fires, we should do the same as when num_blocks<=1 - if (!param) + for( S32 i = 0; i < num_params; i++ ) { - llwarns << "No visual params!" << llendl; - } - else - { - for( S32 i = 0; i < num_blocks; i++ ) + LLVisualParam* param = contents.mParams[i]; + F32 newWeight = contents.mParamWeights[i]; + + if (is_first_appearance_message || (param->getWeight() != newWeight)) { - while( param && (param->getGroup() != VISUAL_PARAM_GROUP_TWEAKABLE) ) // should not be any of group VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT + params_changed = TRUE; + if(is_first_appearance_message) { - param = getNextVisualParam(); + param->setWeight(newWeight, FALSE); } - - if( !param ) + else { - // more visual params supplied than expected - just process what we know about - break; + interp_params = TRUE; + param->setAnimationTarget(newWeight, FALSE); } - - F32 newWeight = contents.mParams[i]; - - if (is_first_appearance_message || (param->getWeight() != newWeight)) - { - params_changed = TRUE; - if(is_first_appearance_message) - { - param->setWeight(newWeight, FALSE); - } - else - { - interp_params = TRUE; - param->setAnimationTarget(newWeight, FALSE); - } - } - param = getNextVisualParam(); } - if (enable_verbose_dumps) - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParams, contents.mTEContents); } + if (enable_verbose_dumps) + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT - if (num_blocks != expected_tweakable_count) + if (num_params != expected_tweakable_count) { - llinfos << "Number of params in AvatarAppearance msg (" << num_blocks << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; + llinfos << "Number of params in AvatarAppearance msg (" << num_params << ") does not match number of tweakable params in avatar xml file (" << expected_tweakable_count << "). Processing what we can. object: " << getID() << llendl; } if (params_changed) From d2c3ee9624eed458320600860b9f84cca8b80607 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 25 Jan 2013 09:31:20 -0500 Subject: [PATCH 33/66] SH-3779 WIP - less verbose appearance dumps, keep appearance version visual param in sync with mUseServerBakes --- indra/newview/llvoavatar.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index a76a15671c..dbc80c0217 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6695,7 +6695,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; - if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } + //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } if (gSavedSettings.getBOOL("BlockAvatarAppearanceMessages")) { llwarns << "Blocking AvatarAppearance message" << llendl; @@ -6819,9 +6819,11 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } if (enable_verbose_dumps) + { dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); + } - if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } + //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_params != expected_tweakable_count) @@ -6879,7 +6881,7 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) updateMeshTextures(); - if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); + //if (enable_verbose_dumps) dumpArchetypeXML(dump_prefix + "process_end"); } // static @@ -7355,12 +7357,24 @@ void LLVOAvatar::bodySizeChanged() BOOL LLVOAvatar::isUsingServerBakes() const { +#if 1 + // Sanity check - visual param for appearance version should match mUseServerBakes + LLVisualParam* appearance_version_param = getVisualParam(11000); + llassert(appearance_version_param); + F32 wt = appearance_version_param->getWeight(); + F32 expect_wt = mUseServerBakes ? 1.0 : 0.0; + llassert(is_approx_equal(wt,expect_wt)); +#endif + return mUseServerBakes; } void LLVOAvatar::setIsUsingServerBakes(BOOL newval) { mUseServerBakes = newval; + LLVisualParam* appearance_version_param = getVisualParam(11000); + llassert(appearance_version_param); + appearance_version_param->setWeight(newval ? 1.0 : 0.0, false); } // virtual From 438ceeb008b7c4eec0fc48894935289ca352fc65 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Fri, 25 Jan 2013 17:58:11 -0500 Subject: [PATCH 34/66] BUILDFIX: merge cleanup A couple of merge issues that caused the resulting code to not build. --- indra/llappearance/llavatarappearance.cpp | 10 ---------- indra/llappearance/llpolyskeletaldistortion.h | 2 +- indra/llcommon/llfasttimer.cpp | 6 ++++++ indra/llcommon/llfasttimer.h | 2 ++ indra/newview/llworldmapview.cpp | 2 +- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/indra/llappearance/llavatarappearance.cpp b/indra/llappearance/llavatarappearance.cpp index c4ff667fa1..89e64822f8 100755 --- a/indra/llappearance/llavatarappearance.cpp +++ b/indra/llappearance/llavatarappearance.cpp @@ -169,8 +169,6 @@ LLAvatarAppearance::LLAvatarAppearance(LLWearableData* wearable_data) : mRoot(NULL), mWearableData(wearable_data) { - LLMemType mt(LLMemType::MTYPE_AVATAR); - llassert_always(mWearableData); mBakedTextureDatas.resize(LLAvatarAppearanceDefines::BAKED_NUM_INDICES); for (U32 i = 0; i < mBakedTextureDatas.size(); i++ ) @@ -495,8 +493,6 @@ void LLAvatarAppearance::computeBodySize() //----------------------------------------------------------------------------- BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename) { - LLMemType mt(LLMemType::MTYPE_AVATAR); - //------------------------------------------------------------------------- // parse the file //------------------------------------------------------------------------- @@ -538,8 +534,6 @@ BOOL LLAvatarAppearance::parseSkeletonFile(const std::string& filename) //----------------------------------------------------------------------------- BOOL LLAvatarAppearance::setupBone(const LLAvatarBoneInfo* info, LLJoint* parent, S32 &volume_num, S32 &joint_num) { - LLMemType mt(LLMemType::MTYPE_AVATAR); - LLJoint* joint = NULL; if (info->mIsJoint) @@ -621,8 +615,6 @@ BOOL LLAvatarAppearance::allocateCharacterJoints( U32 num ) //----------------------------------------------------------------------------- BOOL LLAvatarAppearance::buildSkeleton(const LLAvatarSkeletonInfo *info) { - LLMemType mt(LLMemType::MTYPE_AVATAR); - //------------------------------------------------------------------------- // allocate joints //------------------------------------------------------------------------- @@ -675,8 +667,6 @@ void LLAvatarAppearance::clearSkeleton() //----------------------------------------------------------------------------- void LLAvatarAppearance::buildCharacter() { - LLMemType mt(LLMemType::MTYPE_AVATAR); - //------------------------------------------------------------------------- // remove all references to our existing skeleton // so we can rebuild it diff --git a/indra/llappearance/llpolyskeletaldistortion.h b/indra/llappearance/llpolyskeletaldistortion.h index 170f8e8771..774bc7dfa2 100644 --- a/indra/llappearance/llpolyskeletaldistortion.h +++ b/indra/llappearance/llpolyskeletaldistortion.h @@ -119,7 +119,7 @@ public: /*virtual*/ const LLVector4a* getNextDistortion(U32 *index, LLPolyMesh **poly_mesh){index = 0; poly_mesh = NULL; return NULL;}; protected: - LL_ALIGN_16(LLVector4a>-mDefaultVec); + LL_ALIGN_16(LLVector4a mDefaultVec); typedef std::map joint_vec_map_t; joint_vec_map_t mJointScales; joint_vec_map_t mJointOffsets; diff --git a/indra/llcommon/llfasttimer.cpp b/indra/llcommon/llfasttimer.cpp index 6970c29092..9b15804e97 100644 --- a/indra/llcommon/llfasttimer.cpp +++ b/indra/llcommon/llfasttimer.cpp @@ -561,6 +561,12 @@ std::vector& LLFastTimer::NamedTimer::getChildren() return mChildren; } +// static +LLFastTimer::NamedTimer& LLFastTimer::NamedTimer::getRootNamedTimer() +{ + return *NamedTimerFactory::instance().getRootTimer(); +} + //static void LLFastTimer::nextFrame() { diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h index e42e549df5..81c4b78775 100644 --- a/indra/llcommon/llfasttimer.h +++ b/indra/llcommon/llfasttimer.h @@ -91,6 +91,8 @@ public: U32 getHistoricalCount(S32 history_index = 0) const; U32 getHistoricalCalls(S32 history_index = 0) const; + static NamedTimer& getRootNamedTimer(); + void setFrameState(FrameState* state) { mFrameState = state; state->setNamedTimer(this); } FrameState& getFrameState() const; diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp index e96906b4bb..1940cf541e 100644 --- a/indra/newview/llworldmapview.cpp +++ b/indra/newview/llworldmapview.cpp @@ -1317,7 +1317,7 @@ void LLWorldMapView::drawTrackingCircle( const LLRect& rect, S32 x, S32 y, const gGL.matrixMode(LLRender::MM_MODELVIEW); gGL.pushMatrix(); - gGL.translatef((F32)x * LLUI::sGLScaleFactor.mV[VX], (F32)y * LLUI::sGLScaleFactor.mV[VY], 0.f); + gGL.translatef((F32)x * LLUI::getScaleFactor().mV[VX], (F32)y * LLUI::getScaleFactor().mV[VY], 0.f); gl_washer_segment_2d(inner_radius, outer_radius, start_theta, end_theta, 40, color, color); gGL.popMatrix(); From cbf7de453869749abd9fead08897d1e154bb0f5e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 28 Jan 2013 13:47:00 -0500 Subject: [PATCH 35/66] SH-3779 WIP, SH-3534 WIP - more bake-status tracking --- indra/newview/llagent.cpp | 20 ++++++++++ indra/newview/llappearancemgr.cpp | 2 +- indra/newview/llvoavatar.cpp | 61 ++++++++++++++++++++++++++++++- indra/newview/llvoavatar.h | 3 ++ 4 files changed, 84 insertions(+), 2 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 5796c34e25..1760d4769a 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4305,6 +4305,26 @@ void LLAgent::sendAgentSetAppearance() // At this point we have a complete appearance to send and are in a non-baking region. // DRANO FIXME //gAgentAvatarp->setIsUsingServerBakes(FALSE); + S32 sb_count, host_count, both_count, neither_count; + gAgentAvatarp->bakedTextureOriginCounts(sb_count, host_count, both_count, neither_count); + if (both_count != 0 || neither_count != 0) + { + llwarns << "bad bake texture state " << sb_count << "," << host_count << "," << both_count << "," << neither_count << llendl; + } + if (sb_count != 0 && host_count == 0) + { + gAgentAvatarp->setIsUsingServerBakes(true); + } + else if (sb_count == 0 && host_count != 0) + { + gAgentAvatarp->setIsUsingServerBakes(false); + } + else if (sb_count + host_count > 0) + { + llwarns << "unclear baked texture state, not sending appearance" << llendl; + return; + } + LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << LL_ENDL; //dumpAvatarTEs( "sendAgentSetAppearance()" ); diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index e7fa56466d..f1ba4ad453 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2032,7 +2032,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) } // DRANO really should wait for the appearance message to set this. // verify that deleting this line doesn't break anything. - gAgentAvatarp->setIsUsingServerBakes(gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()); + //gAgentAvatarp->setIsUsingServerBakes(gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()); //dumpCat(getCOF(),"COF, start"); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index dbc80c0217..6efd1a27eb 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2897,6 +2897,8 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version); + std::string origin_string = bakedTextureOriginInfo(); + debug_line += " [" + origin_string + "]"; if (isSelf()) { S32 curr_cof_version = LLAppearanceMgr::instance().getCOFVersion(); @@ -4043,6 +4045,60 @@ bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() return allTexturesCompletelyDownloaded(baked_ids); } +void LLVOAvatar::bakedTextureOriginCounts(S32 &sb_count, // server-bake, has origin URL. + S32 &host_count, // host-based bake, has host. + S32 &both_count, // error - both host and URL set. + S32 &neither_count) // error - neither set. +{ + sb_count = host_count = both_count = neither_count = 0; + + std::set baked_ids; + collectBakedTextureUUIDs(baked_ids); + for (std::set::const_iterator it = baked_ids.begin(); it != baked_ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + bool has_url = false, has_host = false; + if (!imagep->getUrl().empty()) + { + has_url = true; + } + if (imagep->getTargetHost().isOk()) + { + has_host = true; + } + if (has_url && !has_host) sb_count++; + else if (has_host && !has_url) host_count++; + else if (has_host && has_url) both_count++; + else if (!has_host && !has_url) neither_count++; + } +} + +std::string LLVOAvatar::bakedTextureOriginInfo() +{ + std::string result; + + std::set baked_ids; + collectBakedTextureUUIDs(baked_ids); + for (std::set::const_iterator it = baked_ids.begin(); it != baked_ids.end(); ++it) + { + LLViewerFetchedTexture *imagep = gTextureList.findImage(*it); + bool has_url = false, has_host = false; + if (!imagep->getUrl().empty()) + { + has_url = true; + } + if (imagep->getTargetHost().isOk()) + { + has_host = true; + } + if (has_url && !has_host) result += "u"; // server-bake texture with url + else if (has_host && !has_url) result += "h"; // old-style texture on sim + else if (has_host && has_url) result += "?"; // both origins? + else if (!has_host && !has_url) result += "n"; // no origin? + } + return result; +} + S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) { S32 result = 0; @@ -7363,7 +7419,10 @@ BOOL LLVOAvatar::isUsingServerBakes() const llassert(appearance_version_param); F32 wt = appearance_version_param->getWeight(); F32 expect_wt = mUseServerBakes ? 1.0 : 0.0; - llassert(is_approx_equal(wt,expect_wt)); + if (!is_approx_equal(wt,expect_wt)) + { + llwarns << "wt " << wt << " differs from expected " << expect_wt << llendl; + } #endif return mUseServerBakes; diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 784b08a782..bdb477590f 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -139,6 +139,9 @@ public: bool allTexturesCompletelyDownloaded(std::set& ids); bool allLocalTexturesCompletelyDownloaded(); bool allBakedTexturesCompletelyDownloaded(); + void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count, + S32 &both_count, S32 &neither_count); + std::string bakedTextureOriginInfo(); void collectLocalTextureUUIDs(std::set& ids); void collectBakedTextureUUIDs(std::set& ids); void collectTextureUUIDs(std::set& ids); From 97acaac84dd09959642595c1676b2ad72d3e0202 Mon Sep 17 00:00:00 2001 From: "prep@lindenlab.com" Date: Tue, 29 Jan 2013 14:53:00 -0600 Subject: [PATCH 36/66] SH3530: Removed extra ServerAppearanceUpdate() --- indra/newview/llsaveoutfitcombobtn.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/indra/newview/llsaveoutfitcombobtn.cpp b/indra/newview/llsaveoutfitcombobtn.cpp index 59137f4ef7..32295cd96f 100644 --- a/indra/newview/llsaveoutfitcombobtn.cpp +++ b/indra/newview/llsaveoutfitcombobtn.cpp @@ -31,8 +31,6 @@ #include "llsidepanelappearance.h" #include "llsaveoutfitcombobtn.h" #include "llviewermenu.h" -#include "llagent.h" -#include "llviewerregion.h" static const std::string SAVE_BTN("save_btn"); static const std::string SAVE_FLYOUT_BTN("save_flyout_btn"); @@ -78,12 +76,8 @@ void LLSaveOutfitComboBtn::saveOutfit(bool as_new) if (panel_outfits_inventory) { panel_outfits_inventory->onSave(); - } - - if ( gAgent.getRegion() && gAgent.getRegion()->getCentralBakeVersion()) - { - LLAppearanceMgr::instance().requestServerAppearanceUpdate(); - } + } + //*TODO how to get to know when base outfit is updated or new outfit is created? } From 2f638300cd7e2c3ae675125ade037205403b5c54 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 10:14:16 -0500 Subject: [PATCH 37/66] SH-3780 WIP - more checking on appearance param values --- indra/newview/llvoavatar.cpp | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 90887b5861..8f5d2a6aad 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6703,26 +6703,36 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe } } - if (contents.mAppearanceVersion < 0) // not set explicitly, try to get from visual param. + LLVisualParam* appearance_version_param = getVisualParam(11000); + S32 param_appearance_version = -1; + if (appearance_version_param) { - LLVisualParam* appearance_version_param = getVisualParam(11000); - if (appearance_version_param) + std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); + if (it != contents.mParams.end()) { - std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); - if (it != contents.mParams.end()) - { - S32 index = it - contents.mParams.begin(); - llinfos << "index: " << index << llendl; - S32 appearance_version = llround(contents.mParamWeights[index]); - contents.mAppearanceVersion = appearance_version; - llinfos << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; - } + S32 index = it - contents.mParams.begin(); + llinfos << "index: " << index << llendl; + param_appearance_version = llround(contents.mParamWeights[index]); + LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mAppearanceVersion << llendl; } } + if ((contents.mAppearanceVersion) >= 0 && + (param_appearance_version >= 0) && + (contents.mAppearanceVersion != param_appearance_version)) + { + llwarns << "inconsistent appearance_version settings - field: " << + contents.mAppearanceVersion << ", param: " << param_appearance_version << llendl; + } + if (contents.mAppearanceVersion < 0 && + param_appearance_version >= 0) // not set explicitly, try to get from visual param. + { + contents.mAppearanceVersion = param_appearance_version; + LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; + } if (contents.mAppearanceVersion < 0) // still not set, go with 0. { contents.mAppearanceVersion = 0; - llinfos << "appversion set by default: " << contents.mAppearanceVersion << llendl; + LL_DEBUGS("Avatar") << "appversion set by default: " << contents.mAppearanceVersion << llendl; } } From 3a7e3eacb86989c936cd6960cfa7434f3b8232fc Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 13:56:05 -0500 Subject: [PATCH 38/66] SH-3800 WIP - flag mismatched expectations for baked texture origins --- indra/newview/llviewertexturelist.cpp | 34 +++++++++++++++++++++++++-- indra/newview/llvoavatar.cpp | 4 ++-- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index a65a90b9ab..4d79af5acc 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -374,7 +374,21 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& } LLPointer imagep = findImage(new_id); - + + if (!imagep.isNull()) + { + LLViewerFetchedTexture *texture = imagep.get(); + if (texture->getUrl().empty()) + { + llwarns << "Requested texture " << new_id << " already exists but does not have a URL" << llendl; + } + else if (texture->getUrl() != url) + { + llwarns << "Requested texture " << new_id << " already exists with a different url, requested: " + << url << " current: " << texture->getUrl() << llendl; + } + + } if (imagep.isNull()) { switch(texture_type) @@ -436,7 +450,23 @@ LLViewerFetchedTexture* LLViewerTextureList::getImage(const LLUUID &image_id, } LLPointer imagep = findImage(image_id); - + if (!imagep.isNull()) + { + LLViewerFetchedTexture *texture = imagep.get(); + if (request_from_host.isOk() && + !texture->getTargetHost().isOk()) + { + llwarns << "Requested texture " << image_id << " already exists but does not have a host" << llendl; + } + else if (request_from_host.isOk() && + texture->getTargetHost().isOk() && + request_from_host != texture->getTargetHost()) + { + llwarns << "Requested texture " << image_id << " already exists with a different target host, requested: " + << request_from_host << " current: " << texture->getTargetHost() << llendl; + } + + } if (imagep.isNull()) { imagep = createImage(image_id, usemipmaps, boost_priority, texture_type, internal_format, primary_format, request_from_host) ; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 8f5d2a6aad..c512837632 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1796,8 +1796,8 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) } else { - llinfos << "get texture from other " << uuid << llendl; - return setTETextureCore(te, uuid, LLHost::invalid); + llinfos << "ignoring texture in non-baked slot " << uuid << " - will use null " << LLUUID::null << llendl; + return setTETextureCore(te, LLUUID::null, LLHost::invalid); } } From 946d3bbcc6172a2267154670ba0bc4d0ff854efc Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 30 Jan 2013 17:35:36 -0500 Subject: [PATCH 39/66] SH-3651 FIX Beards not visible on server-generated appearances. Fixed back end to enable beards. --- autobuild.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 17d1426b22..67d1b4a27b 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1290,9 +1290,9 @@ archive hash - 376738111ec9ba6f1b0d0dee0a3c784d + 4d0fffe0780f3874cf95ef5a2f3c8489 url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/269218/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130118.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/269731/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130130.tar.bz2 name linux From c24c974cc6a7df3a1df7f7a24ad52275430b18dd Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 18:23:31 -0500 Subject: [PATCH 40/66] SH-3800 WIP - logic to detect baked textures being sought in the wrong place, avoid querying textures for which we have no authoritative data where they live --- indra/newview/llviewerobject.cpp | 27 ++++---------- indra/newview/llviewerobject.h | 3 +- indra/newview/llvoavatar.cpp | 61 ++++++++++++++++++++------------ indra/newview/llvoavatar.h | 1 + indra/newview/llvoavatarself.cpp | 10 ++++++ 5 files changed, 56 insertions(+), 46 deletions(-) mode change 100644 => 100755 indra/newview/llviewerobject.cpp mode change 100644 => 100755 indra/newview/llviewerobject.h mode change 100644 => 100755 indra/newview/llvoavatarself.cpp diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp old mode 100644 new mode 100755 index 15560be9ba..c4b370a4b4 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -4034,32 +4034,15 @@ void LLViewerObject::setTEImage(const U8 te, LLViewerTexture *imagep) } } - -S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, const std::string &url ) +S32 LLViewerObject::setTETextureCore(const U8 te, LLViewerTexture *image) { + const LLUUID& uuid = image->getID(); S32 retval = 0; if (uuid != getTE(te)->getID() || uuid == LLUUID::null) { retval = LLPrimitive::setTETexture(te, uuid); - mTEImages[te] = LLViewerTextureManager::getFetchedTextureFromUrl (url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); - setChanged(TEXTURE); - if (mDrawable.notNull()) - { - gPipeline.markTextured(mDrawable); - } - } - return retval; -} - -S32 LLViewerObject::setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host) -{ - S32 retval = 0; - if (uuid != getTE(te)->getID() || - uuid == LLUUID::null) - { - retval = LLPrimitive::setTETexture(te, uuid); - mTEImages[te] = LLViewerTextureManager::getFetchedTexture(uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + mTEImages[te] = image; setChanged(TEXTURE); if (mDrawable.notNull()) { @@ -4082,7 +4065,9 @@ void LLViewerObject::changeTEImage(S32 index, LLViewerTexture* new_image) S32 LLViewerObject::setTETexture(const U8 te, const LLUUID& uuid) { // Invalid host == get from the agent's sim - return setTETextureCore(te, uuid, LLHost::invalid); + LLViewerFetchedTexture *image = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, LLHost::invalid); + return setTETextureCore(te,image); } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h old mode 100644 new mode 100755 index 889025962c..728d279c39 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -301,8 +301,7 @@ public: /*virtual*/ void setNumTEs(const U8 num_tes); /*virtual*/ void setTE(const U8 te, const LLTextureEntry &texture_entry); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID &uuid); - S32 setTETextureCore(const U8 te, const LLUUID& uuid, LLHost host); - S32 setTETextureCore(const U8 te, const LLUUID& uuid, const std::string &url ); + S32 setTETextureCore(const U8 te, LLViewerTexture *image); /*virtual*/ S32 setTEColor(const U8 te, const LLColor3 &color); /*virtual*/ S32 setTEColor(const U8 te, const LLColor4 &color); /*virtual*/ S32 setTEScale(const U8 te, const F32 s, const F32 t); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index c512837632..f0986ac223 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1776,29 +1776,42 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, return retval; } -// virtual -S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) +LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUUID& uuid) { - // The core setTETexture() method requests images, so we need - // to redirect certain avatar texture requests to different sims. - if (isIndexBakedTexture((ETextureIndex)te)) + LLViewerFetchedTexture *result; + + const std::string url = getImageURL(te,uuid); + if (!url.empty()) { - const std::string url = getImageURL(te,uuid); - if (!url.empty()) - { - llinfos << "texture URL " << url << llendl; - return setTETextureCore(te, uuid, url); - } - - llinfos << "get texture from host " << uuid << llendl; - LLHost target_host = getObjectHost(); - return setTETextureCore(te, uuid, target_host); + llinfos << "texture URL " << url << llendl; + result = LLViewerTextureManager::getFetchedTextureFromUrl( + url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); } else { - llinfos << "ignoring texture in non-baked slot " << uuid << " - will use null " << LLUUID::null << llendl; - return setTETextureCore(te, LLUUID::null, LLHost::invalid); + llinfos << "get texture from host " << uuid << llendl; + LLHost host = getObjectHost(); + result = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); } + return result; +} + +// virtual +S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) +{ + if (!isIndexBakedTexture((ETextureIndex)te)) + { + if (!uuid.isNull()) + { + llinfos << "ignoring texture " << uuid << " in non-baked slot " << (S32)te << " - will use null " << llendl; + } + return LLViewerObject::setTETexture(te, LLUUID::null); + } + + LLViewerFetchedTexture *image = getBakedTextureImage(te,uuid); + llassert(image); + return setTETextureCore(te, image); } static LLFastTimer::DeclareTimer FTM_AVATAR_UPDATE("Avatar Update"); @@ -6070,6 +6083,8 @@ void LLVOAvatar::updateMeshTextures() last_id_string = "A"; else if (mBakedTextureDatas[i].mLastTextureID == IMG_DEFAULT) last_id_string = "D"; + else if (mBakedTextureDatas[i].mLastTextureID == IMG_INVISIBLE) + last_id_string = "I"; else last_id_string = "*"; bool is_ltda = layerset @@ -6750,12 +6765,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; - mFirstAppearanceMessageReceived = TRUE; - - LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID - << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; - ESex old_sex = getSex(); @@ -6831,6 +6840,12 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) // runway - was // if (!is_first_appearance_message ) // which means it would be called on second appearance message - probably wrong. + BOOL is_first_appearance_message = !mFirstAppearanceMessageReceived; + mFirstAppearanceMessageReceived = TRUE; + + LL_INFOS("Avatar") << avString() << "processAvatarAppearance start " << mID + << " first? " << is_first_appearance_message << " self? " << isSelf() << LL_ENDL; + if (is_first_appearance_message ) { onFirstTEMessageReceived(); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index bdb477590f..c14f18d00e 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -147,6 +147,7 @@ public: void collectTextureUUIDs(std::set& ids); void releaseOldTextures(); /*virtual*/ void updateTextures(); + LLViewerFetchedTexture* getBakedTextureImage(const U8 te, const LLUUID& uuid); /*virtual*/ S32 setTETexture(const U8 te, const LLUUID& uuid); // If setting a baked texture, need to request it from a non-local sim. /*virtual*/ void onShift(const LLVector4a& shift_vector); /*virtual*/ U32 getPartitionType() const; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp old mode 100644 new mode 100755 index 757d029513..aeac478d4e --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -759,6 +759,15 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, { U32 retval = LLVOAvatar::processUpdateMessage(mesgsys,user_data,block_num,update_type,dp); +#if 0 + // DRANO - it's not clear this does anything useful. If we wait + // until an appearance message has been received, we already have + // the texture ids. If we don't wait, we don't yet know where to + // look for baked textures, because we haven't received the + // appearance version data from the appearance message. This looks + // like an old optimization that's incompatible with server-side + // texture baking. + // FIXME DRANO - skipping in the case of !mFirstAppearanceMessageReceived prevents us from trying to // load textures before we know where they come from (ie, from baking service or not); // unknown impact on performance. @@ -783,6 +792,7 @@ U32 LLVOAvatarSelf::processUpdateMessage(LLMessageSystem *mesgsys, mInitialBakesLoaded = true; } +#endif return retval; } From 1518bc9f9add7812f0fa1f60d58c6b8f0ee462ca Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 30 Jan 2013 18:43:30 -0500 Subject: [PATCH 41/66] SH-3800 WIP - avoid complaints about source of various standard textures - IMG_DEFAULT_AVATAR etc --- indra/newview/llvoavatar.cpp | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f0986ac223..5b4f31f91a 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -1778,21 +1778,32 @@ U32 LLVOAvatar::processUpdateMessage(LLMessageSystem *mesgsys, LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUUID& uuid) { - LLViewerFetchedTexture *result; - - const std::string url = getImageURL(te,uuid); - if (!url.empty()) + LLViewerFetchedTexture *result = NULL; + + if (uuid == IMG_DEFAULT_AVATAR || + uuid == IMG_DEFAULT || + uuid == IMG_INVISIBLE) { - llinfos << "texture URL " << url << llendl; - result = LLViewerTextureManager::getFetchedTextureFromUrl( - url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + // Should already exist, don't need to find it on sim or baked-texture host. + result = gTextureList.findImage(uuid); } - else + + if (!result) { - llinfos << "get texture from host " << uuid << llendl; - LLHost host = getObjectHost(); - result = LLViewerTextureManager::getFetchedTexture( - uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + const std::string url = getImageURL(te,uuid); + if (!url.empty()) + { + llinfos << "texture URL " << url << llendl; + result = LLViewerTextureManager::getFetchedTextureFromUrl( + url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); + } + else + { + llinfos << "get texture from host " << uuid << llendl; + LLHost host = getObjectHost(); + result = LLViewerTextureManager::getFetchedTexture( + uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); + } } return result; } From 235f77b8c6194d7e6ab55a73dda4a31d19948323 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 09:13:31 -0500 Subject: [PATCH 42/66] SH-3800 WIP - reject appearance messages with contradictory appearance version info --- indra/newview/llagent.cpp | 1 + indra/newview/llviewertexturelist.cpp | 7 +++- indra/newview/llvoavatar.cpp | 54 ++++++++++++++++----------- 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 1760d4769a..06a7a2f5c3 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -816,6 +816,7 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) !gAgentAvatarp->isUsingServerBakes() && (mRegionp->getCentralBakeVersion()>0)) { + llinfos << "update requested due to region transition" << llendl; LLAppearanceMgr::instance().requestServerAppearanceUpdate(); } } diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp index 4d79af5acc..6e7f6c9b32 100755 --- a/indra/newview/llviewertexturelist.cpp +++ b/indra/newview/llviewertexturelist.cpp @@ -384,8 +384,11 @@ LLViewerFetchedTexture* LLViewerTextureList::getImageFromUrl(const std::string& } else if (texture->getUrl() != url) { - llwarns << "Requested texture " << new_id << " already exists with a different url, requested: " - << url << " current: " << texture->getUrl() << llendl; + // This is not an error as long as the images really match - + // e.g. could be two avatars wearing the same outfit. + LL_DEBUGS("Avatar") << "Requested texture " << new_id + << " already exists with a different url, requested: " << url + << " current: " << texture->getUrl() << llendl; } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5b4f31f91a..537bb70579 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6645,11 +6645,13 @@ struct LLAppearanceMessageContents { LLAppearanceMessageContents(): mAppearanceVersion(-1), + mParamAppearanceVersion(-1), mCOFVersion(LLViewerInventoryCategory::VERSION_UNKNOWN) { } LLTEContents mTEContents; S32 mAppearanceVersion; + S32 mParamAppearanceVersion; S32 mCOFVersion; // For future use: //U32 appearance_flags = 0; @@ -6730,7 +6732,6 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe } LLVisualParam* appearance_version_param = getVisualParam(11000); - S32 param_appearance_version = -1; if (appearance_version_param) { std::vector::iterator it = std::find(contents.mParams.begin(), contents.mParams.end(),appearance_version_param); @@ -6738,28 +6739,38 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe { S32 index = it - contents.mParams.begin(); llinfos << "index: " << index << llendl; - param_appearance_version = llround(contents.mParamWeights[index]); - LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mAppearanceVersion << llendl; + contents.mParamAppearanceVersion = llround(contents.mParamWeights[index]); + LL_DEBUGS("Avatar") << "appversion req by appearance_version param: " << contents.mParamAppearanceVersion << llendl; } } +} + +bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32& appearance_version) +{ if ((contents.mAppearanceVersion) >= 0 && - (param_appearance_version >= 0) && - (contents.mAppearanceVersion != param_appearance_version)) + (contents.mParamAppearanceVersion >= 0) && + (contents.mAppearanceVersion != contents.mParamAppearanceVersion)) { llwarns << "inconsistent appearance_version settings - field: " << - contents.mAppearanceVersion << ", param: " << param_appearance_version << llendl; + contents.mAppearanceVersion << ", param: " << contents.mParamAppearanceVersion << llendl; + return false; } - if (contents.mAppearanceVersion < 0 && - param_appearance_version >= 0) // not set explicitly, try to get from visual param. + if (contents.mParamAppearanceVersion >= 0) // use visual param if available. { - contents.mAppearanceVersion = param_appearance_version; - LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << contents.mAppearanceVersion << llendl; + appearance_version = contents.mParamAppearanceVersion; + LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << appearance_version << llendl; + } + if (contents.mAppearanceVersion >= 0) + { + appearance_version = contents.mAppearanceVersion; + LL_DEBUGS("Avatar") << "appversion set by appearance_version field: " << appearance_version << llendl; } if (contents.mAppearanceVersion < 0) // still not set, go with 0. { - contents.mAppearanceVersion = 0; - LL_DEBUGS("Avatar") << "appversion set by default: " << contents.mAppearanceVersion << llendl; + appearance_version = 0; + LL_DEBUGS("Avatar") << "appversion set by default: " << appearance_version << llendl; } + return true; } //----------------------------------------------------------------------------- @@ -6776,13 +6787,21 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } - ESex old_sex = getSex(); LLAppearanceMessageContents contents; parseAppearanceMessage(mesgsys, contents); + if (enable_verbose_dumps) + { + dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); + } - U8 appearance_version = contents.mAppearanceVersion; + S32 appearance_version; + if (!resolve_appearance_version(contents, appearance_version)) + { + llwarns << "bad appearance version info, discarding" << llendl; + return; + } S32 this_update_cof_version = contents.mCOFVersion; S32 last_update_request_cof_version = LLAppearanceMgr::instance().mLastUpdateRequestCOFVersion; @@ -6891,13 +6910,6 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) } } } - if (enable_verbose_dumps) - { - dumpAppearanceMsgParams(dump_prefix + "appearance_msg", contents.mParamWeights, contents.mTEContents); - } - - //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_post_set_weights"); } - const S32 expected_tweakable_count = getVisualParamCountInGroup(VISUAL_PARAM_GROUP_TWEAKABLE); // don't worry about VISUAL_PARAM_GROUP_TWEAKABLE_NO_TRANSMIT if (num_params != expected_tweakable_count) { From 3f45d5472c603e9f034161b382ce42baa3a5b3c0 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 10:53:02 -0500 Subject: [PATCH 43/66] SH-3800 WIP - log some of sent appearance msg info as well as received --- indra/newview/llagent.cpp | 49 ++++++++++++++++++++++++++++++++++++ indra/newview/llagent.h | 1 + indra/newview/llvoavatar.cpp | 8 +++--- 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 06a7a2f5c3..60873cf41f 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4282,6 +4282,49 @@ void LLAgent::requestLeaveGodMode() sendReliableMessage(); } +extern void dump_visual_param(apr_file_t* file, LLVisualParam* viewer_param, F32 value); +extern std::string get_sequential_numbered_file_name(const std::string& prefix, + const std::string& suffix); + +// For debugging, trace agent state at times appearance message are sent out. +void LLAgent::dumpSentAppearance(const std::string& dump_prefix) +{ + std::string outfilename = get_sequential_numbered_file_name(dump_prefix,".xml"); + + LLAPRFile outfile; + std::string fullpath = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,outfilename); + outfile.open(fullpath, LL_APR_WB ); + apr_file_t* file = outfile.getFileHandle(); + if (!file) + { + return; + } + else + { + LL_DEBUGS("Avatar") << "dumping sent appearance message to " << fullpath << llendl; + } + + LLVisualParam* appearance_version_param = gAgentAvatarp->getVisualParam(11000); + if (appearance_version_param) + { + F32 value = appearance_version_param->getWeight(); + dump_visual_param(file, appearance_version_param, value); + } + for (LLAvatarAppearanceDictionary::Textures::const_iterator iter = LLAvatarAppearanceDictionary::getInstance()->getTextures().begin(); + iter != LLAvatarAppearanceDictionary::getInstance()->getTextures().end(); + ++iter) + { + const ETextureIndex index = iter->first; + const LLAvatarAppearanceDictionary::TextureEntry *texture_dict = iter->second; + if (texture_dict->mIsBakedTexture) + { + LLTextureEntry* entry = gAgentAvatarp->getTE((U8) index); + const LLUUID& uuid = entry->getID(); + apr_file_printf( file, "\t\t\n", index, uuid.asString().c_str()); + } + } +} + //----------------------------------------------------------------------------- // sendAgentSetAppearance() //----------------------------------------------------------------------------- @@ -4378,6 +4421,12 @@ void LLAgent::sendAgentSetAppearance() // composites to false, and update mesh textures. if (textures_current) { + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); + std::string dump_prefix = gAgentAvatarp->getFullname() + "_sent_appearance"; + if (enable_verbose_dumps) + { + dumpSentAppearance(dump_prefix); + } LL_INFOS("Avatar") << gAgentAvatarp->avString() << "TAT: Sending cached texture data" << LL_ENDL; for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++) { diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 693c123851..306dc2d99c 100755 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -845,6 +845,7 @@ private: public: void sendMessage(); // Send message to this agent's region void sendReliableMessage(); + void dumpSentAppearance(const std::string& dump_prefix); void sendAgentSetAppearance(); void sendAgentDataUpdateRequest(); void sendAgentUserInfoRequest(); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 537bb70579..1ea1b027f0 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6617,7 +6617,7 @@ void LLVOAvatar::dumpAppearanceMsgParams( const std::string& dump_prefix, } else { - llinfos << "xmlfile write handle obtained : " << fullpath << llendl; + LL_DEBUGS("Avatar") << "dumping appearance message to " << fullpath << llendl; } @@ -6758,18 +6758,18 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 if (contents.mParamAppearanceVersion >= 0) // use visual param if available. { appearance_version = contents.mParamAppearanceVersion; - LL_DEBUGS("Avatar") << "appversion set by appearance_version param: " << appearance_version << llendl; } if (contents.mAppearanceVersion >= 0) { appearance_version = contents.mAppearanceVersion; - LL_DEBUGS("Avatar") << "appversion set by appearance_version field: " << appearance_version << llendl; } if (contents.mAppearanceVersion < 0) // still not set, go with 0. { appearance_version = 0; - LL_DEBUGS("Avatar") << "appversion set by default: " << appearance_version << llendl; } + LL_DEBUGS("Avatar") << "appearance version info - field " << contents.mAppearanceVersion + << " param: " << contents.mParamAppearanceVersion + << " final: " << appearance_version << llendl; return true; } From 44308c110f0ed4323767493c409de5d0cf4f4c4f Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 16:14:37 -0500 Subject: [PATCH 44/66] SH-3800 WIP - fixed bad case in appearance version computation --- indra/newview/llvoavatar.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 1ea1b027f0..cc1993fe40 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6747,6 +6747,8 @@ void LLVOAvatar::parseAppearanceMessage(LLMessageSystem* mesgsys, LLAppearanceMe bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32& appearance_version) { + appearance_version = -1; + if ((contents.mAppearanceVersion) >= 0 && (contents.mParamAppearanceVersion >= 0) && (contents.mAppearanceVersion != contents.mParamAppearanceVersion)) @@ -6763,7 +6765,7 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 { appearance_version = contents.mAppearanceVersion; } - if (contents.mAppearanceVersion < 0) // still not set, go with 0. + if (appearance_version < 0) // still not set, go with 0. { appearance_version = 0; } @@ -6823,6 +6825,10 @@ void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) return; } } + else + { + LL_DEBUGS("Avatar") << "appearance message received" << llendl; + } // Check for stale update. if (isSelf() From 8095292585088d277805e04d24d0d1450c5a3289 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 17:21:59 -0500 Subject: [PATCH 45/66] SH-3800 WIP - additional log line --- indra/newview/llvoavatar.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index cc1993fe40..24dd0623ef 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6780,6 +6780,8 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { + LL_DEBUGS("Avatar") << starts << llendl; + bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; //if (enable_verbose_dumps) { dumpArchetypeXML(dump_prefix + "process_start"); } From 197b12d93b01efaa545d80b6cb36989b825e029c Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 1 Feb 2013 17:22:50 -0500 Subject: [PATCH 46/66] SH-3800 WIP - additional log line --- indra/newview/llvoavatar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 24dd0623ef..483bc25b33 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6780,7 +6780,7 @@ bool resolve_appearance_version(const LLAppearanceMessageContents& contents, S32 //----------------------------------------------------------------------------- void LLVOAvatar::processAvatarAppearance( LLMessageSystem* mesgsys ) { - LL_DEBUGS("Avatar") << starts << llendl; + LL_DEBUGS("Avatar") << "starts" << llendl; bool enable_verbose_dumps = gSavedSettings.getBOOL("DebugAvatarAppearanceMessage"); std::string dump_prefix = getFullname() + "_" + (isSelf()?"s":"o") + "_"; From 1cf611b0592b1f91979bfbac7870b64f3623eef9 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Wed, 6 Feb 2013 18:38:17 -0500 Subject: [PATCH 47/66] SH-3651 FIX Beard edits not applying on server bakes Despite incrementing the COF version, beard edits were not updating the head hash. We were not applying layers/parameters to the baked texture hashes for layers that did not contain a user-defined image. However, many layers have standard morph masks, etc that are affected by wearable parameters. Edited the LLTexLayerInterface::getWearable() method to return the proper wearable type if there is no associated local texture index, and all parameters in the wearable refer to a particular wearable type. Should be safe even if some (but not all) params have no wearable type defined. --- indra/llappearance/lltexlayer.cpp | 40 ++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/indra/llappearance/lltexlayer.cpp b/indra/llappearance/lltexlayer.cpp index 15d531259f..3c23f5f293 100644 --- a/indra/llappearance/lltexlayer.cpp +++ b/indra/llappearance/lltexlayer.cpp @@ -932,7 +932,45 @@ LLWearableType::EType LLTexLayerInterface::getWearableType() const ETextureIndex te = getLocalTextureIndex(); if (TEX_INVALID == te) { - return LLWearableType::WT_INVALID; + LLWearableType::EType type = LLWearableType::WT_INVALID; + param_color_list_t::const_iterator color_iter = mParamColorList.begin(); + param_alpha_list_t::const_iterator alpha_iter = mParamAlphaList.begin(); + + for (; color_iter != mParamColorList.end(); color_iter++) + { + LLTexLayerParamColor* param = *color_iter; + if (param) + { + LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType(); + if (new_type != LLWearableType::WT_INVALID && new_type != type) + { + if (type != LLWearableType::WT_INVALID) + { + return LLWearableType::WT_INVALID; + } + type = new_type; + } + } + } + + for (; alpha_iter != mParamAlphaList.end(); alpha_iter++) + { + LLTexLayerParamAlpha* param = *alpha_iter; + if (param) + { + LLWearableType::EType new_type = (LLWearableType::EType)param->getWearableType(); + if (new_type != LLWearableType::WT_INVALID && new_type != type) + { + if (type != LLWearableType::WT_INVALID) + { + return LLWearableType::WT_INVALID; + } + type = new_type; + } + } + } + + return type; } return LLAvatarAppearanceDictionary::getTEWearableType(te); } From 0897a291d16dc4002765c5eb4ed9e310ee1ba4a4 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 7 Feb 2013 11:14:37 -0500 Subject: [PATCH 48/66] SH-3852 WIP - small tweaks --- indra/newview/llagent.cpp | 3 ++- indra/newview/llviewerstats.cpp | 14 +++++++------- indra/newview/llviewerstats.h | 4 ++-- indra/newview/llvoavatarself.cpp | 15 +++++---------- 4 files changed, 16 insertions(+), 20 deletions(-) mode change 100644 => 100755 indra/newview/llviewerstats.cpp diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 60873cf41f..abd83485af 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4341,7 +4341,7 @@ void LLAgent::sendAgentSetAppearance() gAgentAvatarp->getPhases().stopPhase("process_initial_wearables_update"); gAgentAvatarp->getPhases().stopPhase("wear_inventory_category"); } - + gAgentAvatarp->sendAppearanceChangeMetrics(); if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; @@ -4409,6 +4409,7 @@ void LLAgent::sendAgentSetAppearance() // IMG_DEFAULT_AVATAR means not baked. 0 index should be ignored for baked textures if (!gAgentAvatarp->isTextureDefined(texture_index, 0)) { + LL_DEBUGS("Avatar") << "texture not current for baked " << (S32)baked_index << " local " << (S32)texture_index << llendl; textures_current = FALSE; break; } diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp old mode 100644 new mode 100755 index 1627870262..bccd4c1a60 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -733,23 +733,23 @@ void send_stats() LLHTTPClient::post(url, body, new ViewerStatsResponder()); } -LLFrameTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) +LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) { phase_map_t::iterator iter = mPhaseMap.find(phase_name); if (iter == mPhaseMap.end()) { - LLFrameTimer timer; + LLTimer timer; mPhaseMap[phase_name] = timer; } - LLFrameTimer& timer = mPhaseMap[phase_name]; + LLTimer& timer = mPhaseMap[phase_name]; return timer; } void LLViewerStats::PhaseMap::startPhase(const std::string& phase_name) { - LLFrameTimer& timer = getPhaseTimer(phase_name); + LLTimer& timer = getPhaseTimer(phase_name); lldebugs << "startPhase " << phase_name << llendl; - timer.unpause(); + timer.start(); } void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) @@ -763,7 +763,7 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); } lldebugs << "stopPhase " << phase_name << llendl; - iter->second.pause(); + iter->second.stop(); } else { @@ -783,7 +783,7 @@ void LLViewerStats::PhaseMap::stopAllPhases() recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); } lldebugs << "stopPhase (all) " << phase_name << llendl; - iter->second.pause(); + iter->second.stop(); } } diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index e02a4ccdc7..bb11e8c5be 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -279,7 +279,7 @@ public: // Phase tracking (originally put in for avatar rezzing), tracking // progress of active/completed phases for activities like outfit changing. - typedef std::map phase_map_t; + typedef std::map phase_map_t; typedef std::map phase_stats_t; class PhaseMap { @@ -288,7 +288,7 @@ public: static phase_stats_t sStats; public: PhaseMap(); - LLFrameTimer& getPhaseTimer(const std::string& phase_name); + LLTimer& getPhaseTimer(const std::string& phase_name); void startPhase(const std::string& phase_name); void stopPhase(const std::string& phase_name); void stopAllPhases(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index aeac478d4e..a1c7cf97ff 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1462,7 +1462,9 @@ BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { - if (getLocalDiscardLevel(*local_tex_iter, wearable_index) > (S32)(desired_tex_discard_level)) + S32 local_discard_level = getLocalDiscardLevel(*local_tex_iter, wearable_index); + if ((local_discard_level > (S32)(desired_tex_discard_level)) || + (local_discard_level < 0 )) { return FALSE; } @@ -2177,20 +2179,13 @@ LLSD LLVOAvatarSelf::metricsData() // runway - add region info LLSD result; result["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus()); - std::vector rez_counts; - LLVOAvatar::getNearbyRezzedStats(rez_counts); - result["nearby"] = LLSD::emptyMap(); - for (S32 i=0; i Date: Thu, 7 Feb 2013 19:14:00 -0500 Subject: [PATCH 49/66] SH-3852 WIP - track per-timer stats --- indra/newview/llagent.cpp | 6 +- indra/newview/llagentwearables.cpp | 2 +- indra/newview/llagentwearablesfetch.cpp | 4 +- indra/newview/llappearancemgr.cpp | 2 - indra/newview/llappviewer.cpp | 6 ++ indra/newview/llviewerstats.cpp | 42 +++++----- indra/newview/llviewerstats.h | 4 +- indra/newview/llvoavatar.cpp | 101 +++++++++++++++++++++++- indra/newview/llvoavatar.h | 12 ++- indra/newview/llvoavatarself.cpp | 35 +++++--- indra/newview/llvoavatarself.h | 7 +- 11 files changed, 166 insertions(+), 55 deletions(-) mode change 100644 => 100755 indra/newview/llappviewer.cpp diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index abd83485af..c86b75791d 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4338,12 +4338,10 @@ void LLAgent::sendAgentSetAppearance() if (!gAgentWearables.changeInProgress()) { // Change is fully resolved, can close some open phases. - gAgentAvatarp->getPhases().stopPhase("process_initial_wearables_update"); - gAgentAvatarp->getPhases().stopPhase("wear_inventory_category"); + gAgentAvatarp->stopPhase("process_initial_wearables_update"); + gAgentAvatarp->stopPhase("wear_inventory_category"); } - gAgentAvatarp->sendAppearanceChangeMetrics(); - if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; // At this point we have a complete appearance to send and are in a non-baking region. diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 70f4de8db2..0c79ac0ba3 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -797,7 +797,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs if (isAgentAvatarValid()) { //gAgentAvatarp->clearPhases(); // reset phase timers for outfit loading. - gAgentAvatarp->getPhases().startPhase("process_initial_wearables_update"); + gAgentAvatarp->startPhase("process_initial_wearables_update"); gAgentAvatarp->outputRezTiming("Received initial wearables update"); } diff --git a/indra/newview/llagentwearablesfetch.cpp b/indra/newview/llagentwearablesfetch.cpp index 2d622b380a..6f1658d1cc 100644 --- a/indra/newview/llagentwearablesfetch.cpp +++ b/indra/newview/llagentwearablesfetch.cpp @@ -80,7 +80,7 @@ LLInitialWearablesFetch::LLInitialWearablesFetch(const LLUUID& cof_id) : { if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().startPhase("initial_wearables_fetch"); + gAgentAvatarp->startPhase("initial_wearables_fetch"); gAgentAvatarp->outputRezTiming("Initial wearables fetch started"); } } @@ -99,7 +99,7 @@ void LLInitialWearablesFetch::done() doOnIdleOneTime(boost::bind(&LLInitialWearablesFetch::processContents,this)); if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().stopPhase("initial_wearables_fetch"); + gAgentAvatarp->stopPhase("initial_wearables_fetch"); gAgentAvatarp->outputRezTiming("Initial wearables fetch done"); } } diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index f1ba4ad453..1a6d49c7a2 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2006,8 +2006,6 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) llwarns << "Called updateAppearanceFromCOF inside updateAppearanceFromCOF, skipping" << llendl; return; } - - LLVOAvatar::ScopedPhaseSetter(gAgentAvatarp,"update_appearance_from_cof"); BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp old mode 100644 new mode 100755 index 03b11939a9..2ee325a09e --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -3612,6 +3612,12 @@ void LLAppViewer::requestQuit() // Try to send metrics back to the grid metricsSend(!gDisconnected); + + // Try to send last batch of avatar rez metrics. + if (!gDisconnected && isAgentAvatarValid()) + { + gAgentAvatarp->updateAvatarRezMetrics(true); // force a last packet to be sent. + } LLHUDEffectSpiral *effectp = (LLHUDEffectSpiral*)LLHUDManager::getInstance()->createViewerEffect(LLHUDObject::LL_HUD_EFFECT_POINT, TRUE); effectp->setPositionGlobal(gAgent.getPositionGlobal()); diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index bccd4c1a60..28c6b59391 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -733,6 +733,10 @@ void send_stats() LLHTTPClient::post(url, body, new ViewerStatsResponder()); } +LLViewerStats::PhaseMap::PhaseMap() +{ +} + LLTimer& LLViewerStats::PhaseMap::getPhaseTimer(const std::string& phase_name) { phase_map_t::iterator iter = mPhaseMap.find(phase_name); @@ -761,32 +765,26 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) { // Going from started to paused state - record stats. recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); + iter->second.stop(); } - lldebugs << "stopPhase " << phase_name << llendl; - iter->second.stop(); + } +} + +bool LLViewerStats::PhaseMap::getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed) +{ + phase_map_t::iterator iter = mPhaseMap.find(phase_name); + if (iter != mPhaseMap.end()) + { + elapsed = iter->second.getElapsedTimeF32(); + completed = !iter->second.getStarted(); + return true; } else { - lldebugs << "stopPhase " << phase_name << " is not started, no-op" << llendl; + return false; } } - -void LLViewerStats::PhaseMap::stopAllPhases() -{ - for (phase_map_t::iterator iter = mPhaseMap.begin(); - iter != mPhaseMap.end(); ++iter) - { - const std::string& phase_name = iter->first; - if (iter->second.getStarted()) - { - // Going from started to paused state - record stats. - recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); - } - lldebugs << "stopPhase (all) " << phase_name << llendl; - iter->second.stop(); - } -} - + void LLViewerStats::PhaseMap::clearPhases() { lldebugs << "clearPhases" << llendl; @@ -810,10 +808,6 @@ LLSD LLViewerStats::PhaseMap::dumpPhases() //static LLViewerStats::phase_stats_t LLViewerStats::PhaseMap::sStats; -LLViewerStats::PhaseMap::PhaseMap() -{ -} - // static LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) { diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index bb11e8c5be..084f5ae7d1 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -289,13 +289,15 @@ public: public: PhaseMap(); LLTimer& getPhaseTimer(const std::string& phase_name); + bool getPhaseValues(const std::string& phase_name, F32& elapsed, bool& completed); void startPhase(const std::string& phase_name); void stopPhase(const std::string& phase_name); - void stopAllPhases(); void clearPhases(); LLSD dumpPhases(); static StatsAccumulator& getPhaseStats(const std::string& phase_name); static void recordPhaseStat(const std::string& phase_name, F32 value); + phase_map_t::iterator begin() { return mPhaseMap.begin(); } + phase_map_t::iterator end() { return mPhaseMap.end(); } }; private: diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 483bc25b33..f7e1944660 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5887,30 +5887,123 @@ void LLVOAvatar::updateRezzedStatusTimers() if (is_cloud && !was_cloud) { // start cloud timer. - getPhases().startPhase("cloud"); + startPhase("cloud"); } else if (was_cloud && !is_cloud) { // stop cloud timer, which will capture stats. - getPhases().stopPhase("cloud"); + stopPhase("cloud"); } // Non-cloud-or-gray to cloud-or-gray if (is_cloud_or_gray && !was_cloud_or_gray) { // start cloud-or-gray timer. - getPhases().startPhase("cloud-or-gray"); + startPhase("cloud-or-gray"); } else if (was_cloud_or_gray && !is_cloud_or_gray) { // stop cloud-or-gray timer, which will capture stats. - getPhases().stopPhase("cloud-or-gray"); + stopPhase("cloud-or-gray"); } mLastRezzedStatus = rez_status; } } +void LLVOAvatar::clearPhases() +{ + getPhases().clearPhases(); +} + +void LLVOAvatar::startPhase(const std::string& phase_name) +{ + getPhases().startPhase(phase_name); +} + +void LLVOAvatar::logPendingPhases() +{ + for (LLViewerStats::phase_map_t::iterator it = getPhases().begin(); + it != getPhases().end(); + ++it) + { + const std::string& phase_name = it->first; + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + logMetricsTimerRecord(phase_name, elapsed, completed); + } + else + { + llwarns << "ignoring " << phase_name << llendl; + } + } + } +} + +//static +void LLVOAvatar::logPendingPhasesAllAvatars() +{ + for (std::vector::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + LLVOAvatar* inst = (LLVOAvatar*) *iter; + if( inst->isDead() ) + { + continue; + } + inst->logPendingPhases(); + } +} + +void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed) +{ + LLSD record; + record["timer_name"] = phase_name; + record["agent_id"] = gAgent.getID(); + record["elapsed"] = elapsed; + record["completed"] = completed; + U32 grid_x(0), grid_y(0); + if (getRegion()) + { + record["cbv"] = getRegion()->getCentralBakeVersion(); + grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); + } + record["grid_x"] = LLSD::Integer(grid_x); + record["grid_y"] = LLSD::Integer(grid_y); + record["is_using_server_bake"] = isUsingServerBakes(); + record["is_self"] = isSelf(); + + LL_DEBUGS("Avatar") << "record\n" << ll_pretty_print_sd(record) << llendl; +} + +void LLVOAvatar::stopPhase(const std::string& phase_name) +{ + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + getPhases().stopPhase(phase_name); + completed = true; + + } + else + { + llwarns << "stop when stopped already for " << phase_name << llendl; + } + logMetricsTimerRecord(phase_name, elapsed, completed); + } + else + { + llwarns << "stop when not started for " << phase_name << llendl; + } +} + // call periodically to keep isFullyLoaded up to date. // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c14f18d00e..8babcc3ef3 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -292,12 +292,16 @@ public: S32 mLastRezzedStatus; - LLViewerStats::PhaseMap& getPhases() - { - return mPhases; - } + + void startPhase(const std::string& phase_name); + void stopPhase(const std::string& phase_name); + void clearPhases(); + void logPendingPhases(); + static void logPendingPhasesAllAvatars(); + void logMetricsTimerRecord(const std::string& phase_name, F32 elapsed, bool completed); protected: + LLViewerStats::PhaseMap& getPhases() { return mPhases; } BOOL updateIsFullyLoaded(); BOOL processFullyLoadedChange(bool loading); void updateRuthTimer(bool loading); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index a1c7cf97ff..3ae4f9bc71 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -81,7 +81,7 @@ void selfStartPhase(const std::string& phase_name) { if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().startPhase(phase_name); + gAgentAvatarp->startPhase(phase_name); } } @@ -89,7 +89,7 @@ void selfStopPhase(const std::string& phase_name) { if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().stopPhase(phase_name); + gAgentAvatarp->stopPhase(phase_name); } } @@ -97,19 +97,11 @@ void selfClearPhases() { if (isAgentAvatarValid()) { - gAgentAvatarp->getPhases().clearPhases(); + gAgentAvatarp->clearPhases(); gAgentAvatarp->mLastRezzedStatus = -1; } } -void selfStopAllPhases() -{ - if (isAgentAvatarValid()) - { - gAgentAvatarp->getPhases().stopAllPhases(); - } -} - using namespace LLAvatarAppearanceDefines; /********************************************************************************* @@ -222,6 +214,7 @@ void LLVOAvatarSelf::initInstance() } //doPeriodically(output_self_av_texture_diagnostics, 30.0); + doPeriodically(boost::bind(&LLVOAvatarSelf::updateAvatarRezMetrics, this, false), 5.0); } // virtual @@ -2238,6 +2231,22 @@ private: volatile bool & mReportingStarted; }; +bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send) +{ + F32 send_period = 30.0; + + if (force_send || mTimeSinceLastRezMessage.getElapsedTimeF32() > send_period) + { + // Stats for completed phases have been getting logged as they + // complete. This will give us stats for any timers that + // haven't finished as of the metric's being sent. + LLVOAvatar::logPendingPhasesAllAvatars(); + sendAppearanceChangeMetrics(); + } + + return false; +} + void LLVOAvatarSelf::sendAppearanceChangeMetrics() { // gAgentAvatarp->stopAllPhases(); @@ -2251,7 +2260,9 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics() msg["sequence"] = report_sequence; msg["initial"] = !reporting_started; msg["break"] = false; - + msg["duration"] = mTimeSinceLastRezMessage.getElapsedTimeF32(); + mTimeSinceLastRezMessage.reset(); + // Update sequence number if (S32_MAX == ++report_sequence) report_sequence = 0; diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 74888e470d..857c482f93 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -379,6 +379,10 @@ public: LLUUID mAvatarID; LLAvatarAppearanceDefines::ETextureIndex mIndex; }; + + LLTimer mTimeSinceLastRezMessage; + bool updateAvatarRezMetrics(bool force_send); + void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); } void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); } void outputRezDiagnostics() const; @@ -416,7 +420,8 @@ BOOL isAgentAvatarValid(); void selfStartPhase(const std::string& phase_name); void selfStopPhase(const std::string& phase_name); -void selfStopAllPhases(); void selfClearPhases(); +void update_avatar_rez_metrics(bool force_send); + #endif // LL_VO_AVATARSELF_H From 3bab0b6153b77c2b428e5f7d2a767b77a55fef68 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 8 Feb 2013 15:51:01 -0500 Subject: [PATCH 50/66] SH-3852 WIP - bucketize stats by agent_id, grid coordinates and various other criteria --- indra/newview/llvoavatar.cpp | 14 ++++- indra/newview/llvoavatarself.cpp | 89 +++++++++++++++++++++++++++++--- indra/newview/llvoavatarself.h | 6 ++- 3 files changed, 99 insertions(+), 10 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index f7e1944660..e911e01420 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -99,6 +99,7 @@ #include "lldebugmessagebox.h" #include "llsdutil.h" +#include "llsdserialize.h" extern F32 SPEED_ADJUST_MAX; extern F32 SPEED_ADJUST_MAX_SEC; @@ -5964,12 +5965,13 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse LLSD record; record["timer_name"] = phase_name; record["agent_id"] = gAgent.getID(); + record["avatar_id"] = getID(); record["elapsed"] = elapsed; record["completed"] = completed; U32 grid_x(0), grid_y(0); if (getRegion()) { - record["cbv"] = getRegion()->getCentralBakeVersion(); + record["central_bake_version"] = getRegion()->getCentralBakeVersion(); grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); } record["grid_x"] = LLSD::Integer(grid_x); @@ -5977,7 +5979,15 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse record["is_using_server_bake"] = isUsingServerBakes(); record["is_self"] = isSelf(); - LL_DEBUGS("Avatar") << "record\n" << ll_pretty_print_sd(record) << llendl; + + std::ostringstream ostr; + ostr << LLSDNotationStreamer(record); + LL_DEBUGS("Avatar") << "record\n" << ostr.str() << llendl; + + if (isAgentAvatarValid()) + { + gAgentAvatarp->addMetricsTimerRecord(record); + } } void LLVOAvatar::stopPhase(const std::string& phase_name) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 3ae4f9bc71..4461ba32c5 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -62,6 +62,7 @@ #include "llvovolume.h" #include "llsdutil.h" #include "llstartup.h" +#include "llsdserialize.h" #if LL_MSVC // disable boost::lexical_cast warning @@ -2166,6 +2167,8 @@ const std::string LLVOAvatarSelf::debugDumpAllLocalTextureDataInfo() const return text; } + +#if 0 // Dump avatar metrics data. LLSD LLVOAvatarSelf::metricsData() { @@ -2178,10 +2181,10 @@ LLSD LLVOAvatarSelf::metricsData() result["timers"]["invisible"] = mInvisibleTimer.getElapsedTimeF32(); result["timers"]["fully_loaded"] = mFullyLoadedTimer.getElapsedTimeF32(); result["startup"] = LLStartUp::getPhases().dumpPhases(); - result["phases"] = getPhases().dumpPhases(); return result; } +#endif class ViewerAppearanceChangeMetricsResponder: public LLCurl::Responder { @@ -2241,19 +2244,65 @@ bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send) // complete. This will give us stats for any timers that // haven't finished as of the metric's being sent. LLVOAvatar::logPendingPhasesAllAvatars(); - sendAppearanceChangeMetrics(); + sendViewerAppearanceChangeMetrics(); } return false; } -void LLVOAvatarSelf::sendAppearanceChangeMetrics() +void LLVOAvatarSelf::addMetricsTimerRecord(const LLSD& record) +{ + mPendingTimerRecords.push_back(record); +} + +bool operator<(const LLSD& a, const LLSD& b) +{ + std::ostringstream aout, bout; + aout << LLSDNotationStreamer(a); + bout << LLSDNotationStreamer(b); + return aout.str() < bout.str(); + +} + +// Given a vector of LLSD records, return an LLSD array of bucketed stats for val_field. +LLSD summarize_by_buckets(std::vector in_records, + std::vector by_fields, + std::string& val_field) +{ + LLSD result = LLSD::emptyArray(); + std::map accum; + for (std::vector::iterator in_record_iter = in_records.begin(); + in_record_iter != in_records.end(); ++in_record_iter) + { + LLSD& record = *in_record_iter; + LLSD key; + for (std::vector::iterator field_iter = by_fields.begin(); + field_iter != by_fields.end(); ++field_iter) + { + const std::string& field = *field_iter; + key[field] = record[field]; + LLViewerStats::StatsAccumulator& stats = accum[key]; + F32 value = record[val_field].asReal(); + stats.push(value); + } + } + for (std::map::iterator accum_it = accum.begin(); + accum_it != accum.end(); ++accum_it) + { + LLSD out_record = accum_it->first; + out_record["stats"] = accum_it->second.getData(); + result.append(out_record); + } + return result; +} + +void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() { // gAgentAvatarp->stopAllPhases(); static volatile bool reporting_started(false); static volatile S32 report_sequence(0); - LLSD msg = metricsData(); + LLSD msg; // = metricsData(); msg["message"] = "ViewerAppearanceChangeMetrics"; msg["session_id"] = gAgentSessionID; msg["agent_id"] = gAgentID; @@ -2261,8 +2310,35 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics() msg["initial"] = !reporting_started; msg["break"] = false; msg["duration"] = mTimeSinceLastRezMessage.getElapsedTimeF32(); - mTimeSinceLastRezMessage.reset(); - + + // Status of our own rezzing. + msg["rez_status"] = LLVOAvatar::rezStatusToString(getRezzedStatus()); + + // Status of all nearby avs including ourself. + msg["nearby"] = LLSD::emptyArray(); + std::vector rez_counts; + LLVOAvatar::getNearbyRezzedStats(rez_counts); + for (S32 rez_stat=0; rez_stat < rez_counts.size(); ++rez_stat) + { + std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat); + msg["nearby"][rez_status_name] = rez_counts[rez_stat]; + } + + // std::vector bucket_fields("timer_name","agent_id","is_self","grid_x","grid_y","is_using_server_bake"); + std::vector by_fields; + by_fields.push_back("timer_name"); + by_fields.push_back("agent_id"); + by_fields.push_back("completed"); + by_fields.push_back("grid_x"); + by_fields.push_back("grid_y"); + by_fields.push_back("is_using_server_bake"); + by_fields.push_back("is_self"); + by_fields.push_back("cbv"); + LLSD summary = summarize_by_buckets(mPendingTimerRecords, by_fields, std::string("elapsed")); + msg["timers"] = summary; + + mPendingTimerRecords.clear(); + // Update sequence number if (S32_MAX == ++report_sequence) report_sequence = 0; @@ -2282,6 +2358,7 @@ void LLVOAvatarSelf::sendAppearanceChangeMetrics() new ViewerAppearanceChangeMetricsResponder(report_sequence, report_sequence, reporting_started)); + mTimeSinceLastRezMessage.reset(); } } diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 857c482f93..04b0fb760c 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -382,6 +382,9 @@ public: LLTimer mTimeSinceLastRezMessage; bool updateAvatarRezMetrics(bool force_send); + + std::vector mPendingTimerRecords; + void addMetricsTimerRecord(const LLSD& record); void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); } void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); } @@ -398,8 +401,7 @@ public: void dumpAllTextures() const; const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD - LLSD metricsData(); - void sendAppearanceChangeMetrics(); // send data associated with completing a change. + void sendViewerAppearanceChangeMetrics(); // send data associated with completing a change. private: LLFrameTimer mDebugSelfLoadTimer; F32 mDebugTimeWearablesLoaded; From b342b96b3a80757f8772e921442f68c23dea592f Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sat, 9 Feb 2013 00:43:56 +0000 Subject: [PATCH 51/66] Updating appearance utility --- autobuild.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 67d1b4a27b..35c31fbe39 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1290,9 +1290,9 @@ archive hash - 4d0fffe0780f3874cf95ef5a2f3c8489 + 16f094573285f4bb6eb53fd7db20970b url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/269731/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130130.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/270202/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130209.tar.bz2 name linux From 93f07d4e2721d8bf163545ba2600aa5c3cd1c506 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Sat, 9 Feb 2013 01:18:36 +0000 Subject: [PATCH 52/66] Updating appearance utility --- autobuild.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 35c31fbe39..41f9176f30 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1290,9 +1290,9 @@ archive hash - 16f094573285f4bb6eb53fd7db20970b + 606926d8b873328149313ace29f5ab64 url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/270202/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130209.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/270205/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130209.tar.bz2 name linux From f3e407ae3f05e897de0b0d7daea4d31f09e73048 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Feb 2013 13:50:26 -0500 Subject: [PATCH 53/66] SH-3852 WIP - removed avatar metrics from ViewerAssetMetrics --- indra/newview/llappviewer.cpp | 1 - indra/newview/llappviewerwin32.cpp | 2 +- indra/newview/llviewerassetstats.cpp | 42 +---------------- indra/newview/llviewerassetstats.h | 10 ---- indra/newview/llviewerstats.cpp | 25 ---------- indra/newview/llviewerstats.h | 3 -- indra/newview/llvoavatar.cpp | 4 +- indra/newview/llvoavatarself.cpp | 22 ++++++--- .../newview/tests/llviewerassetstats_test.cpp | 47 ++++--------------- 9 files changed, 29 insertions(+), 127 deletions(-) diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 2ee325a09e..9a5010c781 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -4410,7 +4410,6 @@ void LLAppViewer::idle() // The 5-second interval is nice for this purpose. If the object debug // bit moves or is disabled, please give this a suitable home. LLViewerAssetStatsFF::record_fps_main(gFPSClamped); - LLViewerAssetStatsFF::record_avatar_stats(); } } diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index 8326be433e..82b93b52a2 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -92,7 +92,7 @@ void nvapi_error(NvAPI_Status status) llwarns << szDesc << llendl; //should always trigger when asserts are enabled - llassert(status == NVAPI_OK); + //llassert(status == NVAPI_OK); } // Create app mutex creates a unique global windows object. diff --git a/indra/newview/llviewerassetstats.cpp b/indra/newview/llviewerassetstats.cpp index 4c59fd0371..ed768eb093 100755 --- a/indra/newview/llviewerassetstats.cpp +++ b/indra/newview/llviewerassetstats.cpp @@ -30,7 +30,6 @@ #include "llregionhandle.h" #include "stdtypes.h" -#include "llvoavatar.h" /* * Classes and utility functions for per-thread and per-region @@ -127,8 +126,6 @@ LLViewerAssetStats::PerRegionStats::merge(const LLViewerAssetStats::PerRegionSta mFPS.merge(src.mFPS); } - // Avatar stats - data all comes from main thread, so leave alone. - // Requests for (int i = 0; i < LL_ARRAY_SIZE(mRequests); ++i) { @@ -160,9 +157,7 @@ LLViewerAssetStats::LLViewerAssetStats() LLViewerAssetStats::LLViewerAssetStats(const LLViewerAssetStats & src) : mRegionHandle(src.mRegionHandle), - mResetTimestamp(src.mResetTimestamp), - mPhaseStats(src.mPhaseStats), - mAvatarRezStates(src.mAvatarRezStates) + mResetTimestamp(src.mResetTimestamp) { const PerRegionContainer::const_iterator it_end(src.mRegionStats.end()); for (PerRegionContainer::const_iterator it(src.mRegionStats.begin()); it_end != it; ++it) @@ -258,17 +253,6 @@ LLViewerAssetStats::recordFPS(F32 fps) mCurRegionStats->mFPS.record(fps); } -void -LLViewerAssetStats::recordAvatarStats() -{ - std::vector rez_counts; - LLVOAvatar::getNearbyRezzedStats(rez_counts); - mAvatarRezStates = rez_counts; - mPhaseStats.clear(); - mPhaseStats["cloud"] = LLViewerStats::PhaseMap::getPhaseStats("cloud"); - mPhaseStats["cloud-or-gray"] = LLViewerStats::PhaseMap::getPhaseStats("cloud-or-gray"); -} - LLSD LLViewerAssetStats::asLLSD(bool compact_output) { @@ -299,11 +283,6 @@ LLViewerAssetStats::asLLSD(bool compact_output) static const LLSD::String max_tag("max"); static const LLSD::String mean_tag("mean"); - // Avatar sub-tags - static const LLSD::String avatar_tag("avatar"); - static const LLSD::String avatar_nearby_tag("nearby"); - static const LLSD::String avatar_phase_stats_tag("phase_stats"); - const duration_t now = LLViewerAssetStatsFF::get_timestamp(); mCurRegionStats->accumulateTime(now); @@ -362,16 +341,6 @@ LLViewerAssetStats::asLLSD(bool compact_output) LLSD ret = LLSD::emptyMap(); ret["regions"] = regions; ret["duration"] = LLSD::Real((now - mResetTimestamp) * 1.0e-6); - LLSD avatar_info; - avatar_info[avatar_nearby_tag] = LLSD::emptyArray(); - for (S32 rez_stat=0; rez_stat < mAvatarRezStates.size(); ++rez_stat) - { - std::string rez_status_name = LLVOAvatar::rezStatusToString(rez_stat); - avatar_info[avatar_nearby_tag][rez_status_name] = mAvatarRezStates[rez_stat]; - } - avatar_info[avatar_phase_stats_tag]["cloud"] = mPhaseStats["cloud"].getData(); - avatar_info[avatar_phase_stats_tag]["cloud-or-gray"] = mPhaseStats["cloud-or-gray"].getData(); - ret[avatar_tag] = avatar_info; return ret; } @@ -470,15 +439,6 @@ record_fps_main(F32 fps) gViewerAssetStatsMain->recordFPS(fps); } -void -record_avatar_stats() -{ - if (! gViewerAssetStatsMain) - return; - - gViewerAssetStatsMain->recordAvatarStats(); -} - // 'thread1' - should be for TextureFetch thread void diff --git a/indra/newview/llviewerassetstats.h b/indra/newview/llviewerassetstats.h index 8319752230..3381c01ed5 100755 --- a/indra/newview/llviewerassetstats.h +++ b/indra/newview/llviewerassetstats.h @@ -36,7 +36,6 @@ #include "llviewerassetstorage.h" #include "llsimplestat.h" #include "llsd.h" -#include "llvoavatar.h" /** * @class LLViewerAssetStats @@ -182,9 +181,6 @@ public: // Frames-Per-Second Samples void recordFPS(F32 fps); - // Avatar-related statistics - void recordAvatarStats(); - // Merge a source instance into a destination instance. This is // conceptually an 'operator+=()' method: // - counts are added @@ -256,10 +252,6 @@ protected: // Time of last reset duration_t mResetTimestamp; - - // Nearby avatar stats - std::vector mAvatarRezStates; - LLViewerStats::phase_stats_t mPhaseStats; }; @@ -318,8 +310,6 @@ void record_response_main(LLViewerAssetType::EType at, bool with_http, bool is_t void record_fps_main(F32 fps); -void record_avatar_stats(); - /** * Region context, event and duration loggers for Thread 1. */ diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 28c6b59391..65cae9b338 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -764,7 +764,6 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) if (iter->second.getStarted()) { // Going from started to paused state - record stats. - recordPhaseStat(phase_name,iter->second.getElapsedTimeF32()); iter->second.stop(); } } @@ -803,27 +802,3 @@ LLSD LLViewerStats::PhaseMap::dumpPhases() } return result; } - -// static initializer -//static -LLViewerStats::phase_stats_t LLViewerStats::PhaseMap::sStats; - -// static -LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) -{ - phase_stats_t::iterator it = sStats.find(phase_name); - if (it == sStats.end()) - { - LLViewerStats::StatsAccumulator new_stats; - sStats[phase_name] = new_stats; - } - return sStats[phase_name]; -} - -// static -void LLViewerStats::PhaseMap::recordPhaseStat(const std::string& phase_name, F32 value) -{ - LLViewerStats::StatsAccumulator& stats = getPhaseStats(phase_name); - stats.push(value); -} - diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h index 084f5ae7d1..e74fb36e97 100755 --- a/indra/newview/llviewerstats.h +++ b/indra/newview/llviewerstats.h @@ -285,7 +285,6 @@ public: { private: phase_map_t mPhaseMap; - static phase_stats_t sStats; public: PhaseMap(); LLTimer& getPhaseTimer(const std::string& phase_name); @@ -294,8 +293,6 @@ public: void stopPhase(const std::string& phase_name); void clearPhases(); LLSD dumpPhases(); - static StatsAccumulator& getPhaseStats(const std::string& phase_name); - static void recordPhaseStat(const std::string& phase_name, F32 value); phase_map_t::iterator begin() { return mPhaseMap.begin(); } phase_map_t::iterator end() { return mPhaseMap.end(); } }; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e911e01420..e298ccdb9c 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5971,12 +5971,12 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse U32 grid_x(0), grid_y(0); if (getRegion()) { - record["central_bake_version"] = getRegion()->getCentralBakeVersion(); + record["central_bake_version"] = LLSD::Integer(getRegion()->getCentralBakeVersion()); grid_from_region_handle(getRegion()->getHandle(), &grid_x, &grid_y); } record["grid_x"] = LLSD::Integer(grid_x); record["grid_y"] = LLSD::Integer(grid_y); - record["is_using_server_bake"] = isUsingServerBakes(); + record["is_using_server_bakes"] = ((bool) isUsingServerBakes()); record["is_self"] = isSelf(); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 4461ba32c5..55e927652e 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2236,7 +2236,12 @@ private: bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send) { - F32 send_period = 30.0; + const F32 AV_METRICS_INTERVAL_QA = 30.0; + F32 send_period = 300.0; + if (gSavedSettings.getBOOL("QAModeMetrics")) + { + send_period = AV_METRICS_INTERVAL_QA; + } if (force_send || mTimeSinceLastRezMessage.getElapsedTimeF32() > send_period) { @@ -2260,7 +2265,10 @@ bool operator<(const LLSD& a, const LLSD& b) std::ostringstream aout, bout; aout << LLSDNotationStreamer(a); bout << LLSDNotationStreamer(b); - return aout.str() < bout.str(); + std::string astring = aout.str(); + std::string bstring = bout.str(); + + return astring < bstring; } @@ -2281,10 +2289,10 @@ LLSD summarize_by_buckets(std::vector in_records, { const std::string& field = *field_iter; key[field] = record[field]; - LLViewerStats::StatsAccumulator& stats = accum[key]; - F32 value = record[val_field].asReal(); - stats.push(value); } + LLViewerStats::StatsAccumulator& stats = accum[key]; + F32 value = record[val_field].asReal(); + stats.push(value); } for (std::map::iterator accum_it = accum.begin(); accum_it != accum.end(); ++accum_it) @@ -2331,9 +2339,9 @@ void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() by_fields.push_back("completed"); by_fields.push_back("grid_x"); by_fields.push_back("grid_y"); - by_fields.push_back("is_using_server_bake"); + by_fields.push_back("is_using_server_bakes"); by_fields.push_back("is_self"); - by_fields.push_back("cbv"); + by_fields.push_back("central_bake_version"); LLSD summary = summarize_by_buckets(mPendingTimerRecords, by_fields, std::string("elapsed")); msg["timers"] = summary; diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index f8923b9868..b55b6c13d4 100755 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -35,31 +35,6 @@ #include "lluuid.h" #include "llsdutil.h" #include "llregionhandle.h" -#include "../llvoavatar.h" - -void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) -{ - counts.resize(3); - counts[0] = 0; - counts[1] = 0; - counts[2] = 1; -} - -// static -std::string LLVOAvatar::rezStatusToString(S32 rez_status) -{ - if (rez_status==0) return "cloud"; - if (rez_status==1) return "gray"; - if (rez_status==2) return "textured"; - return "unknown"; -} - -// static -LLViewerStats::StatsAccumulator& LLViewerStats::PhaseMap::getPhaseStats(const std::string& phase_name) -{ - static LLViewerStats::StatsAccumulator junk; - return junk; -} static const char * all_keys[] = { @@ -117,7 +92,6 @@ static const U64 region2_handle(0x0000030000004200ULL); static const std::string region1_handle_str("0000040000003f00"); static const std::string region2_handle_str("0000030000004200"); -#if 0 static bool is_empty_map(const LLSD & sd) { @@ -135,7 +109,6 @@ is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & { return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2); } -#endif static bool is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & key2, const std::string& key3) @@ -147,7 +120,7 @@ is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & static bool is_no_stats_map(const LLSD & sd) { - return is_triple_key_map(sd, "duration", "regions", "avatar"); + return is_double_key_map(sd, "duration", "regions"); } static bool @@ -258,7 +231,7 @@ namespace tut // Once the region is set, we will get a response even with no data collection it->setRegion(region1_handle); sd_full = it->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd_full, "duration", "regions", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd_full, "duration", "regions")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd_full["regions"], region1_handle)); LLSD sd = sd_full["regions"][0]; @@ -299,7 +272,7 @@ namespace tut it->setRegion(region1_handle); LLSD sd = it->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd[0]; @@ -324,7 +297,7 @@ namespace tut LLViewerAssetStatsFF::record_dequeue_main(LLViewerAssetType::AT_BODYPART, false, false); LLSD sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd["regions"][0]; @@ -364,7 +337,7 @@ namespace tut LLSD sd = gViewerAssetStatsThread1->asLLSD(false); ensure("Other collector is empty", is_no_stats_map(sd)); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = sd["regions"][0]; @@ -414,7 +387,7 @@ namespace tut // std::cout << sd << std::endl; - ensure("Correct double-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); + ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); LLSD sd1 = get_region(sd, region1_handle); LLSD sd2 = get_region(sd, region2_handle); @@ -437,7 +410,7 @@ namespace tut // Reset leaves current region in place gViewerAssetStatsMain->reset(); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = sd["regions"][0]; @@ -486,7 +459,7 @@ namespace tut LLSD sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct double-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); + ensure("Correct double-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct double-slot LLSD array regions", is_double_slot_array(sd["regions"], region1_handle, region2_handle)); LLSD sd1 = get_region(sd, region1_handle); LLSD sd2 = get_region(sd, region2_handle); @@ -509,7 +482,7 @@ namespace tut // Reset leaves current region in place gViewerAssetStatsMain->reset(); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "duration", "regions", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "duration", "regions")); ensure("Correct single-slot LLSD array regions (p2)", is_single_slot_array(sd["regions"], region2_handle)); sd2 = get_region(sd, region2_handle); ensure("Region2 is present in results", sd2.isMap()); @@ -555,7 +528,7 @@ namespace tut LLSD sd = gViewerAssetStatsThread1->asLLSD(false); ensure("Other collector is empty", is_no_stats_map(sd)); sd = gViewerAssetStatsMain->asLLSD(false); - ensure("Correct single-key LLSD map root", is_triple_key_map(sd, "regions", "duration", "avatar")); + ensure("Correct single-key LLSD map root", is_double_key_map(sd, "regions", "duration")); ensure("Correct single-slot LLSD array regions", is_single_slot_array(sd["regions"], region1_handle)); sd = get_region(sd, region1_handle); ensure("Region1 is present in results", sd.isMap()); From be21b989c5a6d0353c868abc80d5c88f25033eb6 Mon Sep 17 00:00:00 2001 From: Don Kjer Date: Mon, 11 Feb 2013 19:52:07 +0000 Subject: [PATCH 54/66] Updating appearance util --- autobuild.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index 41f9176f30..67092cb04b 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1290,9 +1290,9 @@ archive hash - 606926d8b873328149313ace29f5ab64 + e0dbab27a77d6a864658da4526d7a9c8 url - http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/270205/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130209.tar.bz2 + http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/llappearanceutility-source/rev/270227/arch/Linux/installer/llappearanceutility_source-0.1-linux-20130211.tar.bz2 name linux From f6698ad956d7c168a997e91fc5bc7e9a9b7aba64 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Feb 2013 15:09:53 -0500 Subject: [PATCH 55/66] fix for mac build failure --- indra/newview/llvoavatarself.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 55e927652e..21798d5774 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2275,7 +2275,7 @@ bool operator<(const LLSD& a, const LLSD& b) // Given a vector of LLSD records, return an LLSD array of bucketed stats for val_field. LLSD summarize_by_buckets(std::vector in_records, std::vector by_fields, - std::string& val_field) + std::string val_field) { LLSD result = LLSD::emptyArray(); std::map accum; From 25edeb91385a227290b7892b2290e33431fb8737 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 11 Feb 2013 16:43:23 -0500 Subject: [PATCH 56/66] fix for build failure on test w/linux --- indra/newview/tests/llviewerassetstats_test.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/indra/newview/tests/llviewerassetstats_test.cpp b/indra/newview/tests/llviewerassetstats_test.cpp index b55b6c13d4..e72fa0fa70 100755 --- a/indra/newview/tests/llviewerassetstats_test.cpp +++ b/indra/newview/tests/llviewerassetstats_test.cpp @@ -92,17 +92,21 @@ static const U64 region2_handle(0x0000030000004200ULL); static const std::string region1_handle_str("0000040000003f00"); static const std::string region2_handle_str("0000030000004200"); +#if 0 static bool is_empty_map(const LLSD & sd) { return sd.isMap() && 0 == sd.size(); } +#endif +#if 0 static bool is_single_key_map(const LLSD & sd, const std::string & key) { return sd.isMap() && 1 == sd.size() && sd.has(key); } +#endif static bool is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & key2) @@ -110,11 +114,13 @@ is_double_key_map(const LLSD & sd, const std::string & key1, const std::string & return sd.isMap() && 2 == sd.size() && sd.has(key1) && sd.has(key2); } +#if 0 static bool is_triple_key_map(const LLSD & sd, const std::string & key1, const std::string & key2, const std::string& key3) { return sd.isMap() && 3 == sd.size() && sd.has(key1) && sd.has(key2) && sd.has(key3); } +#endif static bool From e11fd0a7eb9e5aa39aa719f6d349506348a06d18 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 10:58:04 -0500 Subject: [PATCH 57/66] SH-3852 WIP - added more specific logging of completenesss of texture loading --- indra/newview/llappearancemgr.cpp | 2 +- indra/newview/llvoavatar.cpp | 112 +++++++++++++++++++----------- indra/newview/llvoavatar.h | 12 ++-- indra/newview/llvoavatarself.cpp | 7 +- 4 files changed, 84 insertions(+), 49 deletions(-) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index 1a6d49c7a2..caeaf0970b 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2006,7 +2006,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) llwarns << "Called updateAppearanceFromCOF inside updateAppearanceFromCOF, skipping" << llendl; return; } - + BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF); LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e298ccdb9c..0cd97283e9 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -818,6 +818,7 @@ BOOL LLVOAvatar::hasGray() const S32 LLVOAvatar::getRezzedStatus() const { if (getIsCloud()) return 0; + if (isFullyTextured() && allBakedTexturesCompletelyDownloaded()) return 3; if (isFullyTextured()) return 2; llassert(hasGray()); return 1; // gray @@ -873,7 +874,7 @@ BOOL LLVOAvatar::areAllNearbyInstancesBaked(S32& grey_avatars) void LLVOAvatar::getNearbyRezzedStats(std::vector& counts) { counts.clear(); - counts.resize(3); + counts.resize(4); for (std::vector::iterator iter = LLCharacter::sInstances.begin(); iter != LLCharacter::sInstances.end(); ++iter) { @@ -891,6 +892,7 @@ std::string LLVOAvatar::rezStatusToString(S32 rez_status) if (rez_status==0) return "cloud"; if (rez_status==1) return "gray"; if (rez_status==2) return "textured"; + if (rez_status==3) return "textured_and_downloaded"; return "unknown"; } @@ -1814,10 +1816,7 @@ S32 LLVOAvatar::setTETexture(const U8 te, const LLUUID& uuid) { if (!isIndexBakedTexture((ETextureIndex)te)) { - if (!uuid.isNull()) - { - llinfos << "ignoring texture " << uuid << " in non-baked slot " << (S32)te << " - will use null " << llendl; - } + // Sim still sends some uuids for non-baked slots sometimes - ignore. return LLViewerObject::setTETexture(te, LLUUID::null); } @@ -4034,7 +4033,7 @@ U32 LLVOAvatar::renderImpostor(LLColor4U color, S32 diffuse_channel) return 6; } -bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) +bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) const { for (std::set::const_iterator it = ids.begin(); it != ids.end(); ++it) { @@ -4047,14 +4046,14 @@ bool LLVOAvatar::allTexturesCompletelyDownloaded(std::set& ids) return true; } -bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() +bool LLVOAvatar::allLocalTexturesCompletelyDownloaded() const { std::set local_ids; collectLocalTextureUUIDs(local_ids); return allTexturesCompletelyDownloaded(local_ids); } -bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() +bool LLVOAvatar::allBakedTexturesCompletelyDownloaded() const { std::set baked_ids; collectBakedTextureUUIDs(baked_ids); @@ -4129,7 +4128,7 @@ S32 LLVOAvatar::totalTextureMemForUUIDS(std::set& ids) return result; } -void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) +void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) const { for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { @@ -4155,7 +4154,7 @@ void LLVOAvatar::collectLocalTextureUUIDs(std::set& ids) ids.erase(IMG_INVISIBLE); } -void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) +void LLVOAvatar::collectBakedTextureUUIDs(std::set& ids) const { for (U32 texture_index = 0; texture_index < getNumTEs(); texture_index++) { @@ -5873,8 +5872,9 @@ BOOL LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers() { - // State machine for rezzed status. Statuses are 0 = cloud, 1 = gray, 2 = textured. + // State machine for rezzed status. Statuses are -1 on startup, 0 = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. // Purpose is to collect time data for each period of cloud or cloud+gray. + S32 rez_status = getRezzedStatus(); if (rez_status != mLastRezzedStatus) { @@ -5907,7 +5907,32 @@ void LLVOAvatar::updateRezzedStatusTimers() // stop cloud-or-gray timer, which will capture stats. stopPhase("cloud-or-gray"); } - + + if (mLastRezzedStatus == -1 && rez_status != -1) + { + // First time initialization, start all timers. + for (S32 i = 1; i < 4; i++) + { + startPhase("load_" + LLVOAvatar::rezStatusToString(i)); + } + } + if (rez_status < mLastRezzedStatus) + { + // load level has decreased. start phase timers for higher load levels. + for (S32 i = rez_status+1; i <= mLastRezzedStatus; i++) + { + startPhase("load_" + LLVOAvatar::rezStatusToString(i)); + } + } + else if (rez_status > mLastRezzedStatus) + { + // load level has increased. stop phase timers for lower and equal load levels. + for (S32 i = llmax(mLastRezzedStatus+1,1); i <= rez_status; i++) + { + stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); + } + } + mLastRezzedStatus = rez_status; } } @@ -5919,9 +5944,44 @@ void LLVOAvatar::clearPhases() void LLVOAvatar::startPhase(const std::string& phase_name) { + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + LL_DEBUGS("Avatar") << "start when started already for " << phase_name << llendl; + return; + } + } + LL_DEBUGS("Avatar") << "started phase " << phase_name << llendl; getPhases().startPhase(phase_name); } +void LLVOAvatar::stopPhase(const std::string& phase_name) +{ + F32 elapsed; + bool completed; + if (getPhases().getPhaseValues(phase_name, elapsed, completed)) + { + if (!completed) + { + LL_DEBUGS("Avatar") << "stopped phase " << phase_name << llendl; + getPhases().stopPhase(phase_name); + completed = true; + logMetricsTimerRecord(phase_name, elapsed, completed); + } + else + { + LL_DEBUGS("Avatar") << "stop when stopped already for " << phase_name << llendl; + } + } + else + { + LL_DEBUGS("Avatar") << "stop when not started for " << phase_name << llendl; + } +} + void LLVOAvatar::logPendingPhases() { for (LLViewerStats::phase_map_t::iterator it = getPhases().begin(); @@ -5937,10 +5997,6 @@ void LLVOAvatar::logPendingPhases() { logMetricsTimerRecord(phase_name, elapsed, completed); } - else - { - llwarns << "ignoring " << phase_name << llendl; - } } } } @@ -5990,30 +6046,6 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse } } -void LLVOAvatar::stopPhase(const std::string& phase_name) -{ - F32 elapsed; - bool completed; - if (getPhases().getPhaseValues(phase_name, elapsed, completed)) - { - if (!completed) - { - getPhases().stopPhase(phase_name); - completed = true; - - } - else - { - llwarns << "stop when stopped already for " << phase_name << llendl; - } - logMetricsTimerRecord(phase_name, elapsed, completed); - } - else - { - llwarns << "stop when not started for " << phase_name << llendl; - } -} - // call periodically to keep isFullyLoaded up to date. // returns true if the value has changed. BOOL LLVOAvatar::updateIsFullyLoaded() diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index 8babcc3ef3..c8915383ca 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -136,14 +136,14 @@ public: void updateLODRiggedAttachments( void ); /*virtual*/ BOOL isActive() const; // Whether this object needs to do an idleUpdate. S32 totalTextureMemForUUIDS(std::set& ids); - bool allTexturesCompletelyDownloaded(std::set& ids); - bool allLocalTexturesCompletelyDownloaded(); - bool allBakedTexturesCompletelyDownloaded(); + bool allTexturesCompletelyDownloaded(std::set& ids) const; + bool allLocalTexturesCompletelyDownloaded() const; + bool allBakedTexturesCompletelyDownloaded() const; void bakedTextureOriginCounts(S32 &sb_count, S32 &host_count, S32 &both_count, S32 &neither_count); std::string bakedTextureOriginInfo(); - void collectLocalTextureUUIDs(std::set& ids); - void collectBakedTextureUUIDs(std::set& ids); + void collectLocalTextureUUIDs(std::set& ids) const; + void collectBakedTextureUUIDs(std::set& ids) const; void collectTextureUUIDs(std::set& ids); void releaseOldTextures(); /*virtual*/ void updateTextures(); @@ -287,7 +287,7 @@ public: virtual BOOL getIsCloud() const; BOOL isFullyTextured() const; BOOL hasGray() const; - S32 getRezzedStatus() const; // 0 = cloud, 1 = gray, 2 = fully textured. + S32 getRezzedStatus() const; // 0 = cloud, 1 = gray, 2 = textured, 3 = textured and fully downloaded. void updateRezzedStatusTimers(); S32 mLastRezzedStatus; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 21798d5774..fedab5cd06 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -99,7 +99,7 @@ void selfClearPhases() if (isAgentAvatarValid()) { gAgentAvatarp->clearPhases(); - gAgentAvatarp->mLastRezzedStatus = -1; + //gAgentAvatarp->mLastRezzedStatus = -1; } } @@ -1426,7 +1426,9 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type); for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++) { - if (getLocalDiscardLevel(*local_tex_iter, wearable_index) > (S32)(desired_tex_discard_level)) + S32 local_discard_level = getLocalDiscardLevel(*local_tex_iter, wearable_index); + if ((local_discard_level > (S32)(desired_tex_discard_level)) || + (local_discard_level < 0 )) { return FALSE; } @@ -1439,6 +1441,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLViewerTexLayerSet* layerset return FALSE; } + BOOL LLVOAvatarSelf::isAllLocalTextureDataFinal() const { const U32 desired_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel"); From 02e9afd0e5d727ea0729fb2242b3a89247ae5b1a Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 14:26:48 -0500 Subject: [PATCH 58/66] SH-2852 WIP - track avatar loading via load_ timers, added distinction between partially and fully loaded textures --- indra/newview/llvoavatar.cpp | 2 +- indra/newview/llvoavatarself.cpp | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 0cd97283e9..e2f455258d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -2908,7 +2908,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) bool all_baked_downloaded = allBakedTexturesCompletelyDownloaded(); bool all_local_downloaded = allLocalTexturesCompletelyDownloaded(); std::string debug_line = llformat("%s%s - mLocal: %d, mEdit: %d, mUSB: %d, CBV: %d", - all_local_downloaded ? "L" : "l", + isSelf() ? (all_local_downloaded ? "L" : "l") : "-", all_baked_downloaded ? "B" : "b", mUseLocalAppearance, mIsEditingAppearance, mUseServerBakes, central_bake_version); diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index fedab5cd06..8b29622fdb 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -99,7 +99,6 @@ void selfClearPhases() if (isAgentAvatarValid()) { gAgentAvatarp->clearPhases(); - //gAgentAvatarp->mLastRezzedStatus = -1; } } From 550ff94d6a30367c3ea3d2c597b9fea2911039c8 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 16:49:50 -0500 Subject: [PATCH 59/66] removed some redundant or deprecated timers --- indra/newview/llvoavatar.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index e2f455258d..346c55e589 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5879,6 +5879,7 @@ void LLVOAvatar::updateRezzedStatusTimers() if (rez_status != mLastRezzedStatus) { LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL; +#if 0 bool is_cloud_or_gray = (rez_status==0 || rez_status==1); bool was_cloud_or_gray = (mLastRezzedStatus==0 || mLastRezzedStatus==1); bool is_cloud = (rez_status==0); @@ -5907,6 +5908,7 @@ void LLVOAvatar::updateRezzedStatusTimers() // stop cloud-or-gray timer, which will capture stats. stopPhase("cloud-or-gray"); } +#endif if (mLastRezzedStatus == -1 && rez_status != -1) { @@ -6020,7 +6022,6 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse { LLSD record; record["timer_name"] = phase_name; - record["agent_id"] = gAgent.getID(); record["avatar_id"] = getID(); record["elapsed"] = elapsed; record["completed"] = completed; From 78016f4a8d9aea748a367da73b3aac0bd1690eec Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 12 Feb 2013 17:59:00 -0500 Subject: [PATCH 60/66] SH-3852 WIP - removed agent_id from summary packets --- indra/newview/llvoavatarself.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 8b29622fdb..e30d62869f 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2334,10 +2334,9 @@ void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() msg["nearby"][rez_status_name] = rez_counts[rez_stat]; } - // std::vector bucket_fields("timer_name","agent_id","is_self","grid_x","grid_y","is_using_server_bake"); + // std::vector bucket_fields("timer_name","is_self","grid_x","grid_y","is_using_server_bake"); std::vector by_fields; by_fields.push_back("timer_name"); - by_fields.push_back("agent_id"); by_fields.push_back("completed"); by_fields.push_back("grid_x"); by_fields.push_back("grid_y"); From fe9fb67aea52b0c8ef900915ad41bb9728f23010 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Tue, 12 Feb 2013 18:37:01 -0500 Subject: [PATCH 61/66] SH-3859 FIX adding or removing clothing in appearance edit mode are visible Added check to cancel any appearance update requests that occur while in appearance edit mode. Closing appearance edit mode does trigger an update, so should be safe to cancel intermediate requests without further changes. --- indra/newview/llappearancemgr.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index caeaf0970b..ecbb922adc 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -3085,6 +3085,12 @@ public: void LLAppearanceMgr::requestServerAppearanceUpdate(LLCurl::ResponderPtr responder_ptr) { + if (gAgentAvatarp->isEditingAppearance()) + { + // don't send out appearance updates if in appearance editing mode + return; + } + if (!gAgent.getRegion()) { llwarns << "Region not set, cannot request server appearance update" << llendl; From 9ef4c33772b3d358fd90125ea82a05ae70c01643 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Feb 2013 07:47:24 -0500 Subject: [PATCH 62/66] SH-3852 WIP - modified metrics for update_appearance_from_cof and wear_inventory_category, end when bakes are fully loaded --- indra/newview/llagent.cpp | 1 - indra/newview/llappearancemgr.cpp | 1 + indra/newview/llviewerstats.cpp | 2 +- indra/newview/llvoavatar.cpp | 6 ++++++ 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index c86b75791d..d10f76ea55 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -4339,7 +4339,6 @@ void LLAgent::sendAgentSetAppearance() { // Change is fully resolved, can close some open phases. gAgentAvatarp->stopPhase("process_initial_wearables_update"); - gAgentAvatarp->stopPhase("wear_inventory_category"); } if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index caeaf0970b..e4686ffeed 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -2008,6 +2008,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering) } BoolSetter setIsInUpdateAppearanceFromCOF(mIsInUpdateAppearanceFromCOF); + selfStartPhase("update_appearance_from_cof"); LL_INFOS("Avatar") << self_av_string() << "starting" << LL_ENDL; diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index 65cae9b338..17bb03b889 100755 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -763,7 +763,7 @@ void LLViewerStats::PhaseMap::stopPhase(const std::string& phase_name) { if (iter->second.getStarted()) { - // Going from started to paused state - record stats. + // Going from started to stopped state - record stats. iter->second.stop(); } } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 346c55e589..20d598d35b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -5933,6 +5933,12 @@ void LLVOAvatar::updateRezzedStatusTimers() { stopPhase("load_" + LLVOAvatar::rezStatusToString(i)); } + if (rez_status == 3) + { + // "fully loaded", mark any pending appearance change complete. + selfStopPhase("update_appearance_from_cof"); + selfStopPhase("wear_inventory_category"); + } } mLastRezzedStatus = rez_status; From 72dfb2abce5d5635e7f81436d65c8689d161eb37 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Feb 2013 17:28:05 -0500 Subject: [PATCH 63/66] SH-3812 WIP, SH-3852 WIP - some metrics cleanup, added rebake when needed and sb system is unavailable, to avoid stale appearance problems --- indra/llprimitive/llprimitive.cpp | 1 + indra/newview/llagent.cpp | 16 +++--- indra/newview/llagentwearables.cpp | 1 - indra/newview/llvoavatar.cpp | 61 ++++++++-------------- indra/newview/llvoavatar.h | 20 +------- indra/newview/llvoavatarself.cpp | 81 ++++++++++++++++++++++++++++-- indra/newview/llvoavatarself.h | 5 +- 7 files changed, 114 insertions(+), 71 deletions(-) mode change 100644 => 100755 indra/llprimitive/llprimitive.cpp diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp old mode 100644 new mode 100755 index 4e36723eec..faf98883d9 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -1246,6 +1246,7 @@ S32 LLPrimitive::parseTEMessage(LLMessageSystem* mesgsys, char const* block_name if (tec.size == 0) { + tec.face_count = 0; return retval; } diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index d10f76ea55..e15c1a5104 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -812,6 +812,8 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) { llinfos << "called" << llendl; + + // Old-style appearance entering a server-bake region. if (isAgentAvatarValid() && !gAgentAvatarp->isUsingServerBakes() && (mRegionp->getCentralBakeVersion()>0)) @@ -819,6 +821,14 @@ void LLAgent::handleServerBakeRegionTransition(const LLUUID& region_id) llinfos << "update requested due to region transition" << llendl; LLAppearanceMgr::instance().requestServerAppearanceUpdate(); } + // new-style appearance entering a non-bake region, + // need to check for existence of the baking service. + else if (isAgentAvatarValid() && + gAgentAvatarp->isUsingServerBakes() && + mRegionp->getCentralBakeVersion()==0) + { + gAgentAvatarp->checkForUnsupportedServerBakeAppearance(); + } } //----------------------------------------------------------------------------- @@ -4335,12 +4345,6 @@ void LLAgent::sendAgentSetAppearance() return; } - if (!gAgentWearables.changeInProgress()) - { - // Change is fully resolved, can close some open phases. - gAgentAvatarp->stopPhase("process_initial_wearables_update"); - } - if (!isAgentAvatarValid() || (getRegion() && getRegion()->getCentralBakeVersion())) return; // At this point we have a complete appearance to send and are in a non-baking region. diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp index 0c79ac0ba3..ba04991a02 100755 --- a/indra/newview/llagentwearables.cpp +++ b/indra/newview/llagentwearables.cpp @@ -796,7 +796,6 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs if (isAgentAvatarValid()) { - //gAgentAvatarp->clearPhases(); // reset phase timers for outfit loading. gAgentAvatarp->startPhase("process_initial_wearables_update"); gAgentAvatarp->outputRezTiming("Received initial wearables update"); } diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 20d598d35b..5b4d57986b 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -4456,6 +4456,7 @@ void LLVOAvatar::setTexEntry(const U8 index, const LLTextureEntry &te) const std::string LLVOAvatar::getImageURL(const U8 te, const LLUUID &uuid) { + llassert(isIndexBakedTexture(ETextureIndex(te))); std::string url = ""; if (isUsingServerBakes()) { @@ -5872,43 +5873,15 @@ BOOL LLVOAvatar::getIsCloud() const void LLVOAvatar::updateRezzedStatusTimers() { - // State machine for rezzed status. Statuses are -1 on startup, 0 = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. - // Purpose is to collect time data for each period of cloud or cloud+gray. + // State machine for rezzed status. Statuses are -1 on startup, 0 + // = cloud, 1 = gray, 2 = textured, 3 = textured_and_downloaded. + // Purpose is to collect time data for each it takes avatar to reach + // various loading landmarks: gray, textured (partial), textured fully. S32 rez_status = getRezzedStatus(); if (rez_status != mLastRezzedStatus) { LL_DEBUGS("Avatar") << avString() << "rez state change: " << mLastRezzedStatus << " -> " << rez_status << LL_ENDL; -#if 0 - bool is_cloud_or_gray = (rez_status==0 || rez_status==1); - bool was_cloud_or_gray = (mLastRezzedStatus==0 || mLastRezzedStatus==1); - bool is_cloud = (rez_status==0); - bool was_cloud = (mLastRezzedStatus==0); - - // Non-cloud to cloud - if (is_cloud && !was_cloud) - { - // start cloud timer. - startPhase("cloud"); - } - else if (was_cloud && !is_cloud) - { - // stop cloud timer, which will capture stats. - stopPhase("cloud"); - } - - // Non-cloud-or-gray to cloud-or-gray - if (is_cloud_or_gray && !was_cloud_or_gray) - { - // start cloud-or-gray timer. - startPhase("cloud-or-gray"); - } - else if (was_cloud_or_gray && !is_cloud_or_gray) - { - // stop cloud-or-gray timer, which will capture stats. - stopPhase("cloud-or-gray"); - } -#endif if (mLastRezzedStatus == -1 && rez_status != -1) { @@ -5937,7 +5910,8 @@ void LLVOAvatar::updateRezzedStatusTimers() { // "fully loaded", mark any pending appearance change complete. selfStopPhase("update_appearance_from_cof"); - selfStopPhase("wear_inventory_category"); + selfStopPhase("wear_inventory_category", false); + selfStopPhase("process_initial_wearables_update", false); } } @@ -5958,7 +5932,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << "start when started already for " << phase_name << llendl; + LL_DEBUGS("Avatar") << "no-op, start when started already for " << phase_name << llendl; return; } } @@ -5966,7 +5940,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name) getPhases().startPhase(phase_name); } -void LLVOAvatar::stopPhase(const std::string& phase_name) +void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) { F32 elapsed; bool completed; @@ -5974,19 +5948,25 @@ void LLVOAvatar::stopPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << "stopped phase " << phase_name << llendl; getPhases().stopPhase(phase_name); completed = true; logMetricsTimerRecord(phase_name, elapsed, completed); + LL_DEBUGS("Avatar") << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; } else { - LL_DEBUGS("Avatar") << "stop when stopped already for " << phase_name << llendl; + if (err_check) + { + LL_DEBUGS("Avatar") << "no-op, stop when stopped already for " << phase_name << llendl; + } } } else { - LL_DEBUGS("Avatar") << "stop when not started for " << phase_name << llendl; + if (err_check) + { + LL_DEBUGS("Avatar") << "no-op, stop when not started for " << phase_name << llendl; + } } } @@ -6043,9 +6023,11 @@ void LLVOAvatar::logMetricsTimerRecord(const std::string& phase_name, F32 elapse record["is_self"] = isSelf(); +#if 0 // verbose logging std::ostringstream ostr; ostr << LLSDNotationStreamer(record); LL_DEBUGS("Avatar") << "record\n" << ostr.str() << llendl; +#endif if (isAgentAvatarValid()) { @@ -6264,7 +6246,8 @@ void LLVOAvatar::updateMeshTextures() #ifndef LL_RELEASE_FOR_DOWNLOAD LLViewerFetchedTexture* existing_baked_img = LLViewerTextureManager::getFetchedTexture(mBakedTextureDatas[i].mLastTextureID); #endif - const std::string url = getImageURL(i, mBakedTextureDatas[i].mLastTextureID); + ETextureIndex te = ETextureIndex(mBakedTextureDatas[i].mTextureIndex); + const std::string url = getImageURL(te, mBakedTextureDatas[i].mLastTextureID); if (!url.empty()) { baked_img = LLViewerTextureManager::getFetchedTextureFromUrl(url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, mBakedTextureDatas[i].mLastTextureID); diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index c8915383ca..c989673cdf 100755 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -294,7 +294,7 @@ public: void startPhase(const std::string& phase_name); - void stopPhase(const std::string& phase_name); + void stopPhase(const std::string& phase_name, bool err_check = true); void clearPhases(); void logPendingPhases(); static void logPendingPhasesAllAvatars(); @@ -316,24 +316,6 @@ private: LLFrameTimer mFullyLoadedTimer; LLFrameTimer mRuthTimer; -public: - class ScopedPhaseSetter - { - public: - ScopedPhaseSetter(LLVOAvatar *avatarp, std::string phase_name): - mAvatar(avatarp), mPhaseName(phase_name) - { - if (mAvatar) { mAvatar->getPhases().startPhase(mPhaseName); } - } - ~ScopedPhaseSetter() - { - if (mAvatar) { mAvatar->getPhases().stopPhase(mPhaseName); } - } - private: - std::string mPhaseName; - LLVOAvatar* mAvatar; - }; - private: LLViewerStats::PhaseMap mPhases; diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index e30d62869f..2775c9442a 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -86,11 +86,11 @@ void selfStartPhase(const std::string& phase_name) } } -void selfStopPhase(const std::string& phase_name) +void selfStopPhase(const std::string& phase_name, bool err_check) { if (isAgentAvatarValid()) { - gAgentAvatarp->stopPhase(phase_name); + gAgentAvatarp->stopPhase(phase_name, err_check); } } @@ -179,6 +179,24 @@ bool output_self_av_texture_diagnostics() return false; } +bool update_avatar_rez_metrics() +{ + if (!isAgentAvatarValid()) + return true; + + gAgentAvatarp->updateAvatarRezMetrics(false); + return false; +} + +bool check_for_unsupported_baked_appearance() +{ + if (!isAgentAvatarValid()) + return true; + + gAgentAvatarp->checkForUnsupportedServerBakeAppearance(); + return false; +} + void LLVOAvatarSelf::initInstance() { BOOL status = TRUE; @@ -214,7 +232,8 @@ void LLVOAvatarSelf::initInstance() } //doPeriodically(output_self_av_texture_diagnostics, 30.0); - doPeriodically(boost::bind(&LLVOAvatarSelf::updateAvatarRezMetrics, this, false), 5.0); + doPeriodically(update_avatar_rez_metrics, 5.0); + doPeriodically(check_for_unsupported_baked_appearance, 120.0); } // virtual @@ -2371,6 +2390,62 @@ void LLVOAvatarSelf::sendViewerAppearanceChangeMetrics() } } +class CheckAgentAppearanceServiceResponder: public LLHTTPClient::Responder +{ +public: + CheckAgentAppearanceServiceResponder() + { + } + + virtual ~CheckAgentAppearanceServiceResponder() + { + } + + /* virtual */ void result(const LLSD& content) + { + LL_DEBUGS("Avatar") << "status OK" << llendl; + } + + // Error + /*virtual*/ void error(U32 status, const std::string& reason) + { + if (isAgentAvatarValid()) + { + LL_DEBUGS("Avatar") << "failed, will rebake" << llendl; + forceAppearanceUpdate(); + } + } + + static void forceAppearanceUpdate() + { + // Trying to rebake immediately after crossing region boundary + // seems to be failure prone; adding a delay factor. Yes, this + // fix is ad-hoc and not guaranteed to work in all cases. + doAfterInterval(boost::bind(&LLVOAvatarSelf::forceBakeAllTextures, + gAgentAvatarp.get(), true), 5.0); + } +}; + +void LLVOAvatarSelf::checkForUnsupportedServerBakeAppearance() +{ + // Need to check only if we have a server baked appearance and are + // in a non-baking region. + if (!gAgentAvatarp->isUsingServerBakes()) + return; + if (!gAgent.getRegion() || gAgent.getRegion()->getCentralBakeVersion()!=0) + return; + + // if baked image service is unknown, need to refresh. + if (gSavedSettings.getString("AgentAppearanceServiceURL").empty()) + { + CheckAgentAppearanceServiceResponder::forceAppearanceUpdate(); + } + // query baked image service to check status. + std::string image_url = gAgentAvatarp->getImageURL(TEX_HEAD_BAKED, + getTE(TEX_HEAD_BAKED)->getID()); + LLHTTPClient::head(image_url, new CheckAgentAppearanceServiceResponder); +} + const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) const { if (canGrabBakedTexture(baked_index)) diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h index 04b0fb760c..78728cff20 100755 --- a/indra/newview/llvoavatarself.h +++ b/indra/newview/llvoavatarself.h @@ -402,6 +402,7 @@ public: const std::string debugDumpLocalTextureDataInfo(const LLViewerTexLayerSet* layerset) const; // Lists out state of this particular baked texture layer const std::string debugDumpAllLocalTextureDataInfo() const; // Lists out which baked textures are at highest LOD void sendViewerAppearanceChangeMetrics(); // send data associated with completing a change. + void checkForUnsupportedServerBakeAppearance(); private: LLFrameTimer mDebugSelfLoadTimer; F32 mDebugTimeWearablesLoaded; @@ -421,9 +422,7 @@ extern LLPointer gAgentAvatarp; BOOL isAgentAvatarValid(); void selfStartPhase(const std::string& phase_name); -void selfStopPhase(const std::string& phase_name); +void selfStopPhase(const std::string& phase_name, bool err_check = true); void selfClearPhases(); -void update_avatar_rez_metrics(bool force_send); - #endif // LL_VO_AVATARSELF_H From c99e206374f6afdcc038a97934314dec1a742b2e Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 13 Feb 2013 18:37:15 -0500 Subject: [PATCH 64/66] SH-3852 WIP - send non-complete timers only on av destruction or last message, so they don't get multiply counted --- indra/newview/llvoavatar.cpp | 16 +++++++++------- indra/newview/llvoavatarself.cpp | 6 +++++- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 5b4d57986b..735589414d 100755 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -729,6 +729,8 @@ LLVOAvatar::~LLVOAvatar() debugAvatarRezTime("AvatarRezLeftNotification","left sometime after declouding"); } + logPendingPhases(); + lldebugs << "LLVOAvatar Destructor (0x" << this << ") id:" << mID << llendl; std::for_each(mAttachmentPoints.begin(), mAttachmentPoints.end(), DeletePairedPointer()); @@ -1796,13 +1798,13 @@ LLViewerFetchedTexture *LLVOAvatar::getBakedTextureImage(const U8 te, const LLUU const std::string url = getImageURL(te,uuid); if (!url.empty()) { - llinfos << "texture URL " << url << llendl; + LL_DEBUGS("Avatar") << avString() << "from URL " << url << llendl; result = LLViewerTextureManager::getFetchedTextureFromUrl( url, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, uuid); } else { - llinfos << "get texture from host " << uuid << llendl; + LL_DEBUGS("Avatar") << avString() << "from host " << uuid << llendl; LLHost host = getObjectHost(); result = LLViewerTextureManager::getFetchedTexture( uuid, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE, 0, 0, host); @@ -4190,15 +4192,15 @@ void LLVOAvatar::releaseOldTextures() std::set local_texture_ids; collectLocalTextureUUIDs(local_texture_ids); - S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); + //S32 new_local_mem = totalTextureMemForUUIDS(local_texture_ids); std::set new_texture_ids; new_texture_ids.insert(baked_texture_ids.begin(),baked_texture_ids.end()); new_texture_ids.insert(local_texture_ids.begin(),local_texture_ids.end()); S32 new_total_mem = totalTextureMemForUUIDS(new_texture_ids); - S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); - LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; + //S32 old_total_mem = totalTextureMemForUUIDS(mTextureIDs); + //LL_DEBUGS("Avatar") << getFullname() << " old_total_mem: " << old_total_mem << " new_total_mem (L/B): " << new_total_mem << " (" << new_local_mem <<", " << new_baked_mem << ")" << llendl; if (!isSelf() && new_total_mem > new_baked_mem) { llwarns << "extra local textures stored for non-self av" << llendl; @@ -5932,7 +5934,7 @@ void LLVOAvatar::startPhase(const std::string& phase_name) { if (!completed) { - LL_DEBUGS("Avatar") << "no-op, start when started already for " << phase_name << llendl; + LL_DEBUGS("Avatar") << avString() << "no-op, start when started already for " << phase_name << llendl; return; } } @@ -5951,7 +5953,7 @@ void LLVOAvatar::stopPhase(const std::string& phase_name, bool err_check) getPhases().stopPhase(phase_name); completed = true; logMetricsTimerRecord(phase_name, elapsed, completed); - LL_DEBUGS("Avatar") << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; + LL_DEBUGS("Avatar") << avString() << "stopped phase " << phase_name << " elapsed " << elapsed << llendl; } else { diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index 2775c9442a..1a1564e1a8 100755 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -2269,7 +2269,11 @@ bool LLVOAvatarSelf::updateAvatarRezMetrics(bool force_send) // Stats for completed phases have been getting logged as they // complete. This will give us stats for any timers that // haven't finished as of the metric's being sent. - LLVOAvatar::logPendingPhasesAllAvatars(); + + if (force_send) + { + LLVOAvatar::logPendingPhasesAllAvatars(); + } sendViewerAppearanceChangeMetrics(); } From 705a23ac0d80da44e61b0b78515dca0768909b32 Mon Sep 17 00:00:00 2001 From: Nyx Linden Date: Thu, 14 Feb 2013 13:41:36 -0500 Subject: [PATCH 65/66] SH-3803 FIX Missing Wearable reported in sunshine viewer Newly refactored wearable parsing did not account for extra whitespace cleanly. Updated the code to handle extra blank lines in the wearable assets. --- indra/llappearance/llwearable.cpp | 50 ++++++++++++++++++------------- indra/llappearance/llwearable.h | 1 + 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/indra/llappearance/llwearable.cpp b/indra/llappearance/llwearable.cpp index b33adb254d..9fb8b7749f 100755 --- a/indra/llappearance/llwearable.cpp +++ b/indra/llappearance/llwearable.cpp @@ -191,7 +191,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // We are using a local max buffer size here to avoid issues // if MAX_STRING size changes. const U32 PARSE_BUFFER_SIZE = 2048; - char buffer[2048]; /* Flawfinder: ignore */ + char buffer[PARSE_BUFFER_SIZE]; /* Flawfinder: ignore */ char uuid_buffer[37]; /* Flawfinder: ignore */ // This data is being generated on the viewer. @@ -205,12 +205,11 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, } // read header and version - if (!input_stream.good()) + if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { llwarns << "Failed to read wearable asset input stream." << llendl; return LLWearable::FAILURE; } - input_stream.getline(buffer, PARSE_BUFFER_SIZE); if ( 1 != sscanf( /* Flawfinder: ignore */ buffer, "LLWearable version %d\n", @@ -230,8 +229,8 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, return LLWearable::FAILURE; } - // name - if (!input_stream.good()) + // name may be empty + if (!input_stream.good()) { llwarns << "Bad Wearable asset: early end of input stream " << "while reading name" << llendl; @@ -240,7 +239,7 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, input_stream.getline(buffer, PARSE_BUFFER_SIZE); mName = buffer; - // description + // description may be empty if (!input_stream.good()) { llwarns << "Bad Wearable asset: early end of input stream " @@ -250,14 +249,13 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, input_stream.getline(buffer, PARSE_BUFFER_SIZE); mDescription = buffer; - // permissions - if (!input_stream.good()) + // permissions may have extra empty lines before the correct line + if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { llwarns << "Bad Wearable asset: early end of input stream " << "while reading permissions" << llendl; return LLWearable::FAILURE; } - input_stream.getline(buffer, PARSE_BUFFER_SIZE); S32 perm_version = -1; if ( 1 != sscanf( buffer, " permissions %d\n", &perm_version ) || perm_version != 0 ) @@ -271,13 +269,12 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, } // sale info - if (!input_stream.good()) + if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { llwarns << "Bad Wearable asset: early end of input stream " << "while reading sale info" << llendl; return LLWearable::FAILURE; } - input_stream.getline(buffer, PARSE_BUFFER_SIZE); S32 sale_info_version = -1; if ( 1 != sscanf( buffer, " sale_info %d\n", &sale_info_version ) || sale_info_version != 0 ) @@ -306,13 +303,12 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, } // wearable type - if (!input_stream.good()) + if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { llwarns << "Bad Wearable asset: early end of input stream " << "while reading type" << llendl; return LLWearable::FAILURE; } - input_stream.getline(buffer, PARSE_BUFFER_SIZE); S32 type = -1; if ( 1 != sscanf( buffer, "type %d\n", &type ) ) { @@ -331,13 +327,12 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, } // parameters header - if (!input_stream.good()) + if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { llwarns << "Bad Wearable asset: early end of input stream " << "while reading parameters header" << llendl; return LLWearable::FAILURE; } - input_stream.getline(buffer, PARSE_BUFFER_SIZE); S32 num_parameters = -1; if ( 1 != sscanf( buffer, "parameters %d\n", &num_parameters ) ) { @@ -363,13 +358,12 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, S32 i; for( i = 0; i < num_parameters; i++ ) { - if (!input_stream.good()) + if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { llwarns << "Bad Wearable asset: early end of input stream " << "while reading parameter #" << i << llendl; return LLWearable::FAILURE; } - input_stream.getline(buffer, PARSE_BUFFER_SIZE); S32 param_id = 0; F32 param_weight = 0.f; if ( 2 != sscanf( buffer, "%d %f\n", ¶m_id, ¶m_weight ) ) @@ -381,13 +375,12 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, } // textures header - if (!input_stream.good()) + if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { llwarns << "Bad Wearable asset: early end of input stream " << "while reading textures header" << i << llendl; return LLWearable::FAILURE; } - input_stream.getline(buffer, PARSE_BUFFER_SIZE); S32 num_textures = -1; if ( 1 != sscanf( buffer, "textures %d\n", &num_textures) ) { @@ -404,13 +397,12 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, // textures for( i = 0; i < num_textures; i++ ) { - if (!input_stream.good()) + if (!getNextPopulatedLine(input_stream, buffer, PARSE_BUFFER_SIZE)) { llwarns << "Bad Wearable asset: early end of input stream " << "while reading textures #" << i << llendl; return LLWearable::FAILURE; } - input_stream.getline(buffer, PARSE_BUFFER_SIZE); S32 te = 0; if ( 2 != sscanf( /* Flawfinder: ignore */ buffer, @@ -450,6 +442,22 @@ LLWearable::EImportResult LLWearable::importStream( std::istream& input_stream, return LLWearable::SUCCESS; } +BOOL LLWearable::getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size) +{ + if (!input_stream.good()) + { + return FALSE; + } + + do + { + input_stream.getline(buffer, buffer_size); + } + while (input_stream.good() && buffer[0]=='\0'); + + return input_stream.good(); +} + void LLWearable::setType(LLWearableType::EType type, LLAvatarAppearance *avatarp) { diff --git a/indra/llappearance/llwearable.h b/indra/llappearance/llwearable.h index 4a59811795..6f5a1e14e8 100644 --- a/indra/llappearance/llwearable.h +++ b/indra/llappearance/llwearable.h @@ -119,6 +119,7 @@ protected: void destroyTextures(); void createVisualParams(LLAvatarAppearance *avatarp); void createLayers(S32 te, LLAvatarAppearance *avatarp); + BOOL getNextPopulatedLine(std::istream& input_stream, char* buffer, U32 buffer_size); static S32 sCurrentDefinitionVersion; // Depends on the current state of the avatar_lad.xml. S32 mDefinitionVersion; // Depends on the state of the avatar_lad.xml when this asset was created. From f5a705c73754a07982c9a156e18ceec2531627ca Mon Sep 17 00:00:00 2001 From: Kitty Barnett Date: Wed, 20 Feb 2013 14:27:09 +0100 Subject: [PATCH 66/66] Updated patch branch dependencies --HG-- branch : .RLVa --- .hgpatchinfo/.RLVa.dep | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.hgpatchinfo/.RLVa.dep b/.hgpatchinfo/.RLVa.dep index 5dc12bb2a7..de56ef75fe 100644 --- a/.hgpatchinfo/.RLVa.dep +++ b/.hgpatchinfo/.RLVa.dep @@ -1,2 +1,2 @@ -db4f80bf75c83fa193d361f84f3dfca39b045adb -72265032c8e13ebdb9e2b4a80b10e9e804ef9a63 \ No newline at end of file +42a8488a18e787a7e801671a4a522d2383484ddd +bc935b340692666dc2e1dc528f125832ac1095a3 \ No newline at end of file