EXT-7627 FIXED Wearing an item now doesn't open the wearable editing panel.
Fix: - Save the UUID of a newly created wearable to start editing it right after it gets worn. This approach replaces a temporary hack that invoked the editing panel whenever an item gets worn (if the Appearance SP is opened at the time). The hack only happened to work sometimes because the editing panel failed to open. Other changes: - Removed a check for inventory item completeness from LLAgentWearables::editWearable(). because the check often fails and doesn't appear to be needed at all. - Added warning messages to LLAgentWearables::editWearable() so that it's easier to debug. - Replaced duplicated code in LLPanelOutfitEdit::onEditWearableClicked() with a call to gAgentWearables.editWearable(). Reviewed by Nyx at https://codereview.productengine.com/secondlife/r/529/ --HG-- branch : product-enginemaster
parent
a53aa1fc31
commit
d17b616b1c
|
|
@ -64,6 +64,25 @@ BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE;
|
|||
|
||||
using namespace LLVOAvatarDefines;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Callback to wear and start editing an item that has just been created.
|
||||
class LLWearAndEditCallback : public LLInventoryCallback
|
||||
{
|
||||
void fire(const LLUUID& inv_item)
|
||||
{
|
||||
if (inv_item.isNull()) return;
|
||||
|
||||
// Request editing the item after it gets worn.
|
||||
gAgentWearables.requestEditingWearable(inv_item);
|
||||
|
||||
// Wear it.
|
||||
LLAppearanceMgr::instance().wearItemOnAvatar(inv_item);
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// HACK: For EXT-3923: Pants item shows in inventory with skin icon and messes with "current look"
|
||||
// Some db items are corrupted, have inventory flags = 0, implying wearable type = shape, even though
|
||||
// wearable type stored in asset is some other value.
|
||||
|
|
@ -1990,7 +2009,7 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con
|
|||
LLWearable* wearable = LLWearableList::instance().createNewWearable(type);
|
||||
LLAssetType::EType asset_type = wearable->getAssetType();
|
||||
LLInventoryType::EType inv_type = LLInventoryType::IT_WEARABLE;
|
||||
LLPointer<LLInventoryCallback> cb = wear ? new WearOnAvatarCallback : NULL;
|
||||
LLPointer<LLInventoryCallback> cb = wear ? new LLWearAndEditCallback : NULL;
|
||||
LLUUID folder_id;
|
||||
|
||||
if (parent_id.notNull())
|
||||
|
|
@ -2013,17 +2032,44 @@ void LLAgentWearables::createWearable(LLWearableType::EType type, bool wear, con
|
|||
// static
|
||||
void LLAgentWearables::editWearable(const LLUUID& item_id)
|
||||
{
|
||||
LLViewerInventoryItem* item;
|
||||
LLWearable* wearable;
|
||||
|
||||
if ((item = gInventory.getLinkedItem(item_id)) &&
|
||||
(wearable = gAgentWearables.getWearableFromAssetID(item->getAssetUUID())) &&
|
||||
gAgentWearables.isWearableModifiable(item->getUUID()) &&
|
||||
item->isFinished())
|
||||
LLViewerInventoryItem* item = gInventory.getLinkedItem(item_id);
|
||||
if (!item)
|
||||
{
|
||||
LLPanel* panel = LLSideTray::getInstance()->showPanel("panel_outfit_edit", LLSD());
|
||||
// copied from LLPanelOutfitEdit::onEditWearableClicked()
|
||||
LLSidepanelAppearance::editWearable(wearable, panel->getParent());
|
||||
llwarns << "Failed to get linked item" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
LLWearable* wearable = gAgentWearables.getWearableFromItemID(item_id);
|
||||
if (!wearable)
|
||||
{
|
||||
llwarns << "Cannot get wearable" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gAgentWearables.isWearableModifiable(item->getUUID()))
|
||||
{
|
||||
llwarns << "Cannot modify wearable" << llendl;
|
||||
return;
|
||||
}
|
||||
|
||||
LLPanel* panel = LLSideTray::getInstance()->getPanel("sidepanel_appearance");
|
||||
LLSidepanelAppearance::editWearable(wearable, panel);
|
||||
}
|
||||
|
||||
// Request editing the item after it gets worn.
|
||||
void LLAgentWearables::requestEditingWearable(const LLUUID& item_id)
|
||||
{
|
||||
mItemToEdit = gInventory.getLinkedItemID(item_id);
|
||||
}
|
||||
|
||||
// Start editing the item if previously requested.
|
||||
void LLAgentWearables::editWearableIfRequested(const LLUUID& item_id)
|
||||
{
|
||||
if (mItemToEdit.notNull() &&
|
||||
mItemToEdit == gInventory.getLinkedItemID(item_id))
|
||||
{
|
||||
LLAgentWearables::editWearable(item_id);
|
||||
mItemToEdit.setNull();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,6 +148,12 @@ public:
|
|||
static void editWearable(const LLUUID& item_id);
|
||||
bool moveWearable(const LLViewerInventoryItem* item, bool closer_to_body);
|
||||
|
||||
void requestEditingWearable(const LLUUID& item_id);
|
||||
void editWearableIfRequested(const LLUUID& item_id);
|
||||
|
||||
private:
|
||||
LLUUID mItemToEdit;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// Removing wearables
|
||||
//--------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -495,35 +495,10 @@ void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void)
|
|||
|
||||
void LLPanelOutfitEdit::onEditWearableClicked(void)
|
||||
{
|
||||
LLUUID id_to_edit = mCOFWearables->getSelectedUUID();
|
||||
LLViewerInventoryItem * item_to_edit = gInventory.getItem(id_to_edit);
|
||||
|
||||
if (item_to_edit)
|
||||
LLUUID selected_item_id = mCOFWearables->getSelectedUUID();
|
||||
if (selected_item_id.notNull())
|
||||
{
|
||||
// returns null if not a wearable (attachment, etc).
|
||||
LLWearable* wearable_to_edit = gAgentWearables.getWearableFromAssetID(item_to_edit->getAssetUUID());
|
||||
if(wearable_to_edit)
|
||||
{
|
||||
bool can_modify = false;
|
||||
bool is_complete = item_to_edit->isFinished();
|
||||
// if item_to_edit is a link, its properties are not appropriate,
|
||||
// lets get original item with actual properties
|
||||
LLViewerInventoryItem* original_item = gInventory.getItem(wearable_to_edit->getItemID());
|
||||
if(original_item)
|
||||
{
|
||||
can_modify = original_item->getPermissions().allowModifyBy(gAgentID);
|
||||
is_complete = original_item->isFinished();
|
||||
}
|
||||
|
||||
if (can_modify && is_complete)
|
||||
{
|
||||
LLSidepanelAppearance::editWearable(wearable_to_edit, getParent());
|
||||
if (mEditWearableBtn->getVisible())
|
||||
{
|
||||
mEditWearableBtn->setVisible(FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
gAgentWearables.editWearable(selected_item_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -883,12 +883,8 @@ void ModifiedCOFCallback::fire(const LLUUID& inv_item)
|
|||
{
|
||||
LLAppearanceMgr::instance().updateAppearanceFromCOF();
|
||||
|
||||
if (LLSideTray::getInstance()->isPanelActive("sidepanel_appearance"))
|
||||
{
|
||||
// *HACK: Edit the wearable that has just been worn
|
||||
// only if the Appearance SP is currently opened.
|
||||
LLAgentWearables::editWearable(inv_item);
|
||||
}
|
||||
// Start editing the item if previously requested.
|
||||
gAgentWearables.editWearableIfRequested(inv_item);
|
||||
|
||||
// TODO: camera mode may not be changed if a debug setting is tweaked
|
||||
if( gAgentCamera.cameraCustomizeAvatar() )
|
||||
|
|
|
|||
Loading…
Reference in New Issue