summaryrefslogtreecommitdiff
path: root/indra/newview/llagentwearables.cpp
diff options
context:
space:
mode:
authorIgor Borovkov <iborovkov@productengine.com>2010-04-23 14:35:24 +0300
committerIgor Borovkov <iborovkov@productengine.com>2010-04-23 14:35:24 +0300
commit181315db32165d71f2e1baec66caca24cd74ced7 (patch)
tree5765ee786ca43ef69413eeb44e81552981d5c246 /indra/newview/llagentwearables.cpp
parent40df6a5c868876e935428399db8fe325e11b5178 (diff)
completed EXT-6721 (Enable UI for user modification of wearable order)
- added functionality to change order of wearables - added ad-hoc up and down buttons on a button bar ("up" means closer to the body) - https://jira.secondlife.com/secure/attachment/38464/screenshot-1.jpg - added displaying wearables as sorted by order on the Edit Outfit panel (top list) Reviewed by Neal Orman at https://codereview.productengine.com/secondlife/r/280/ --HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llagentwearables.cpp')
-rw-r--r--indra/newview/llagentwearables.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 466f2d499d..8a880e5ace 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -2031,6 +2031,39 @@ void LLAgentWearables::animateAllWearableParams(F32 delta, BOOL upload_bake)
}
}
+bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool closer_to_body)
+{
+ if (!item) return false;
+ if (!item->isWearableType()) return false;
+
+ wearableentry_map_t::iterator wearable_iter = mWearableDatas.find(item->getWearableType());
+ if (wearable_iter == mWearableDatas.end()) return false;
+
+ wearableentry_vec_t& wearable_vec = wearable_iter->second;
+ if (wearable_vec.empty()) return false;
+
+ const LLUUID& asset_id = item->getAssetUUID();
+
+ //nowhere to move if the wearable is already on any boundary (closest to the body/furthest from the body)
+ if (closer_to_body && asset_id == wearable_vec.front()->getAssetID()) return false;
+ if (!closer_to_body && asset_id == wearable_vec.back()->getAssetID()) return false;
+
+ for (U32 i = 0; i < wearable_vec.size(); ++i)
+ {
+ LLWearable* wearable = wearable_vec[i];
+ if (!wearable) continue;
+ if (wearable->getAssetID() != asset_id) continue;
+
+ //swapping wearables
+ U32 swap_i = closer_to_body ? i-1 : i+1;
+ wearable_vec[i] = wearable_vec[swap_i];
+ wearable_vec[swap_i] = wearable;
+ return true;
+ }
+
+ return false;
+}
+
void LLAgentWearables::updateServer()
{
sendAgentWearablesUpdate();