diff --git a/indra/llaudio/llwindgen.h b/indra/llaudio/llwindgen.h
index 1908b2545fdf4e7eb2d9eb11963c99e8932363e9..0e6d0aa2ca78b700bb78c12163d495e21a3eef05 100644
--- a/indra/llaudio/llwindgen.h
+++ b/indra/llaudio/llwindgen.h
@@ -52,7 +52,8 @@ class LLWindGen
 		mY1(0.0f),
 		mCurrentGain(0.f),
 		mCurrentFreq(100.f),
-		mCurrentPanGainR(0.5f)
+		mCurrentPanGainR(0.5f),
+		mLastSample(0.f)
 	{
 		mSamplePeriod = (F32)mSubSamples / (F32)mInputSamplingRate;
 		mB2 = expf(-F_TWO_PI * mFilterBandWidth * mSamplePeriod);
diff --git a/indra/llcharacter/llkeyframewalkmotion.cpp b/indra/llcharacter/llkeyframewalkmotion.cpp
index 0587e5642c6e093a838dd71e17a6c7c10f538c57..4a1aca62bc439b2f455cd3570b6f90ad1d67af6e 100644
--- a/indra/llcharacter/llkeyframewalkmotion.cpp
+++ b/indra/llcharacter/llkeyframewalkmotion.cpp
@@ -289,7 +289,8 @@ BOOL LLWalkAdjustMotion::onUpdate(F32 time, U8* joint_mask)
 		F32 foot_speed = speed - ((foot_slip_vector * avatar_movement_dir) / delta_time);
 
 		// multiply animation playback rate so that foot speed matches avatar speed
-		F32 desired_speed_multiplier = llclamp(speed / foot_speed, 0.f, ANIM_SPEED_MAX);
+		F32 min_speed_multiplier = clamp_rescale(speed, 0.f, 1.f, 0.f, 0.1f);
+		F32 desired_speed_multiplier = llclamp(speed / foot_speed, min_speed_multiplier, ANIM_SPEED_MAX);
 
 		// blend towards new speed adjustment value
 		F32 new_speed_adjust = lerp(mAdjustedSpeed, desired_speed_multiplier, LLCriticalDamp::getInterpolant(SPEED_ADJUST_TIME_CONSTANT));
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index d9e1976341a23840deca771fd8aada9ffbd8f886..6eb5e0eff41c6876c4a729cc4c9ce89c267b927b 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -118,6 +118,32 @@ BOOL LLFontGL::loadFace(const std::string& filename, F32 point_size, F32 vert_dp
 
 static LLFastTimer::DeclareTimer FTM_RENDER_FONTS("Fonts");
 
+S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, const LLRect& rect, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, 
+					 ShadowType shadow, S32 max_chars, F32* right_x, BOOL use_ellipses) const
+{
+	F32 x = rect.mLeft;
+	F32 y = 0.f;
+
+	switch(valign)
+	{
+	case TOP:
+		y = rect.mTop;
+		break;
+	case VCENTER:
+		y = rect.getCenterY();
+		break;
+	case BASELINE:
+	case BOTTOM:
+		y = rect.mBottom;
+		break;
+	default:
+		y = rect.mBottom;
+		break;
+	}
+	return render(wstr, begin_offset, x, y, color, halign, valign, style, shadow, max_chars, rect.getWidth(), right_x, use_ellipses);
+}
+
+
 S32 LLFontGL::render(const LLWString &wstr, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign, VAlign valign, U8 style, 
 					 ShadowType shadow, S32 max_chars, S32 max_pixels, F32* right_x, BOOL use_ellipses) const
 {
diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h
index dfa4cf8ce550f6853b3c3a94bfbf123ba2747a7e..f29ac5165c534a32764a82a9b75863a91de093c0 100644
--- a/indra/llrender/llfontgl.h
+++ b/indra/llrender/llfontgl.h
@@ -95,8 +95,24 @@ class LLFontGL
 
 	BOOL loadFace(const std::string& filename, F32 point_size, const F32 vert_dpi, const F32 horz_dpi, const S32 components, BOOL is_fallback);
 
-	S32 render(const LLWString &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color, HAlign halign = LEFT,  VAlign valign = BASELINE, U8 style = NORMAL,
-	           ShadowType shadow = NO_SHADOW, S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, F32* right_x=NULL, BOOL use_ellipses = FALSE) const;
+	S32 render(const LLWString &text, S32 begin_offset, 
+				const LLRect& rect, 
+				const LLColor4 &color, 
+				HAlign halign = LEFT,  VAlign valign = BASELINE, 
+				U8 style = NORMAL, ShadowType shadow = NO_SHADOW, 
+				S32 max_chars = S32_MAX,
+				F32* right_x=NULL, 
+				BOOL use_ellipses = FALSE) const;
+
+	S32 render(const LLWString &text, S32 begin_offset, 
+				F32 x, F32 y, 
+				const LLColor4 &color, 
+				HAlign halign = LEFT,  VAlign valign = BASELINE, 
+				U8 style = NORMAL, ShadowType shadow = NO_SHADOW, 
+				S32 max_chars = S32_MAX, S32 max_pixels = S32_MAX, 
+				F32* right_x=NULL, 
+				BOOL use_ellipses = FALSE) const;
+
 	S32 render(const LLWString &text, S32 begin_offset, F32 x, F32 y, const LLColor4 &color) const;
 
 	// renderUTF8 does a conversion, so is slower!
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 584d45612e4dd2aa6fd99185b9b993453ffaa71a..37fc571bbdc4778fa53ab2b0355dd4530f64db23 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -259,6 +259,15 @@ void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::reshape(S32 width, S32 height
 	LLRect textboxRect(HEADER_TEXT_LEFT_OFFSET,(height+header_height)/2 ,width,(height-header_height)/2);
 	mHeaderTextbox->reshape(textboxRect.getWidth(), textboxRect.getHeight());
 	mHeaderTextbox->setRect(textboxRect);
+
+	if (mHeaderTextbox->getTextPixelWidth() > mHeaderTextbox->getRect().getWidth())
+	{
+		setToolTip(mHeaderTextbox->getText());
+	}
+	else
+	{
+		setToolTip(LLStringUtil::null);
+	}
 }
 
 void LLAccordionCtrlTab::LLAccordionCtrlTabHeader::onMouseEnter(S32 x, S32 y, MASK mask)
@@ -1008,6 +1017,7 @@ BOOL LLAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask)
 	{
 		//inside tab header
 		//fix for EXT-6619
+		mHeader->handleToolTip(x, y, mask);
 		return TRUE;
 	}
 	return LLUICtrl::handleToolTip(x, y, mask);
diff --git a/indra/llui/llloadingindicator.cpp b/indra/llui/llloadingindicator.cpp
index f8b029e19c9458e7c5d4f0d13d1f5b678763be6a..2ad5c5a5309695f54000e3a4e110b9b7444fdd5c 100644
--- a/indra/llui/llloadingindicator.cpp
+++ b/indra/llui/llloadingindicator.cpp
@@ -41,7 +41,8 @@
 #include "lluictrlfactory.h"
 #include "lluiimage.h"
 
-static LLDefaultChildRegistry::Register<LLLoadingIndicator> r("loading_indicator");
+// registered in llui.cpp to avoid being left out by MS linker
+//static LLDefaultChildRegistry::Register<LLLoadingIndicator> r("loading_indicator");
 
 ///////////////////////////////////////////////////////////////////////////////
 // LLLoadingIndicator::Data class
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index e2f1d44f3e9f7bae8a9c3fa58a319951f17ed9f5..223998569b929dc0ce19f459dab6f2479809715c 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -194,6 +194,7 @@ LLTextBase::LLTextBase(const LLTextBase::Params &p)
 	mHPad(p.h_pad),
 	mVPad(p.v_pad),
 	mHAlign(p.font_halign),
+	mVAlign(p.font_valign),
 	mLineSpacingMult(p.line_spacing.multiple),
 	mLineSpacingPixels(p.line_spacing.pixels),
 	mClipPartial(p.clip_partial && !p.allow_scroll),
@@ -483,9 +484,9 @@ void LLTextBase::drawCursor()
 					text_color = mFgColor.get();
 					fontp = mDefaultFont;
 				}
-				fontp->render(text, mCursorPos, cursor_rect.mLeft, cursor_rect.mTop, 
+				fontp->render(text, mCursorPos, cursor_rect, 
 					LLColor4(1.f - text_color.mV[VRED], 1.f - text_color.mV[VGREEN], 1.f - text_color.mV[VBLUE], alpha),
-					LLFontGL::LEFT, LLFontGL::TOP,
+					LLFontGL::LEFT, mVAlign,
 					LLFontGL::NORMAL,
 					LLFontGL::NO_SHADOW,
 					1);
@@ -2430,12 +2431,12 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
 		S32 end = llmin( selection_start, seg_end );
 		S32 length =  end - start;
 		font->render(text, start, 
-			     rect.mLeft, rect.mTop, 
+			     rect, 
 			     color, 
-			     LLFontGL::LEFT, LLFontGL::TOP, 
+			     LLFontGL::LEFT, mEditor.mVAlign, 
 			     LLFontGL::NORMAL, 
 			     mStyle->getShadowType(), 
-			     length, rect.getWidth(), 
+			     length,
 			     &right_x, 
 			     mEditor.getUseEllipses());
 	}
@@ -2449,12 +2450,12 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
 		S32 length = end - start;
 
 		font->render(text, start, 
-			     rect.mLeft, rect.mTop,
+			     rect,
 			     LLColor4( 1.f - color.mV[0], 1.f - color.mV[1], 1.f - color.mV[2], 1.f ),
-			     LLFontGL::LEFT, LLFontGL::TOP, 
+			     LLFontGL::LEFT, mEditor.mVAlign, 
 			     LLFontGL::NORMAL, 
 			     LLFontGL::NO_SHADOW, 
-			     length, rect.getWidth(), 
+			     length,
 			     &right_x, 
 			     mEditor.getUseEllipses());
 	}
@@ -2466,12 +2467,12 @@ F32 LLNormalTextSegment::drawClippedSegment(S32 seg_start, S32 seg_end, S32 sele
 		S32 end = seg_end;
 		S32 length = end - start;
 		font->render(text, start, 
-			     rect.mLeft, rect.mTop, 
+			     rect, 
 			     color, 
-			     LLFontGL::LEFT, LLFontGL::TOP, 
+			     LLFontGL::LEFT, mEditor.mVAlign, 
 			     LLFontGL::NORMAL, 
 			     mStyle->getShadowType(), 
-			     length, rect.getWidth(), 
+			     length,
 			     &right_x, 
 			     mEditor.getUseEllipses());
 	}
diff --git a/indra/llui/lltextbase.h b/indra/llui/lltextbase.h
index 920833de3931d801c5529e0b8ea1563adc0c54af..300ee0f05f84ed4945fa0692dc6e29e9533d7ede 100644
--- a/indra/llui/lltextbase.h
+++ b/indra/llui/lltextbase.h
@@ -520,6 +520,7 @@ class LLTextBase
 	S32							mHPad;				// padding on left of text
 	S32							mVPad;				// padding above text
 	LLFontGL::HAlign			mHAlign;
+	LLFontGL::VAlign			mVAlign;
 	F32							mLineSpacingMult;	// multiple of line height used as space for a single line of text (e.g. 1.5 to get 50% padding)
 	S32							mLineSpacingPixels;	// padding between lines
 	const LLFontGL*				mDefaultFont;		// font that is used when none specified
diff --git a/indra/llui/llui.cpp b/indra/llui/llui.cpp
index dff1cb93e73a6f1822fc0c20e630794285d0df9d..7f9dca08d2e845b0f94a79fa22ee510ee81c3705 100644
--- a/indra/llui/llui.cpp
+++ b/indra/llui/llui.cpp
@@ -97,7 +97,6 @@ static LLDefaultChildRegistry::Register<LLFlyoutButton> register_flyout_button("
 static LLDefaultChildRegistry::Register<LLSearchEditor> register_search_editor("search_editor");
 
 // register other widgets which otherwise may not be linked in
-static LLDefaultChildRegistry::Register<LLMenuButton> register_menu_button("menu_button");
 static LLDefaultChildRegistry::Register<LLLoadingIndicator> register_loading_indicator("loading_indicator");
 
 
diff --git a/indra/llui/lluictrl.h b/indra/llui/lluictrl.h
index b9a4f61e15a34778c421fef4fd366adbefbcebc2..1f9d2c90494542ec752bfa4e3f731d0859069227 100644
--- a/indra/llui/lluictrl.h
+++ b/indra/llui/lluictrl.h
@@ -47,14 +47,10 @@
 const BOOL TAKE_FOCUS_YES = TRUE;
 const BOOL TAKE_FOCUS_NO  = FALSE;
 
-// NOTE: the LLFocusableElement class declaration has been moved from here to llfocusmgr.h.
-
 class LLUICtrl
 	: public LLView, public boost::signals2::trackable
 {
 public:
-
-
 	typedef boost::function<void (LLUICtrl* ctrl, const LLSD& param)> commit_callback_t;
 	typedef boost::signals2::signal<void (LLUICtrl* ctrl, const LLSD& param)> commit_signal_t;
 	// *TODO: add xml support for this type of signal in the future
@@ -111,8 +107,8 @@ class LLUICtrl
 										commit_callback;
 		Optional<EnableCallbackParam>	validate_callback;
 		
-		Optional<CommitCallbackParam>	mouseenter_callback;
-		Optional<CommitCallbackParam>	mouseleave_callback;
+		Optional<CommitCallbackParam>	mouseenter_callback,
+										mouseleave_callback;
 		
 		Optional<std::string>			control_name;
 		Optional<EnableControls>		enabled_controls;
diff --git a/indra/llui/lluictrlfactory.cpp b/indra/llui/lluictrlfactory.cpp
index 6b337e0d74c89ae01522370c168556f5224f50f4..a46d961709f9f98d41b2b6e18d07ee3ad7fe9501 100644
--- a/indra/llui/lluictrlfactory.cpp
+++ b/indra/llui/lluictrlfactory.cpp
@@ -452,14 +452,22 @@ void LLUICtrlFactory::registerWidget(const std::type_info* widget_type, const st
 {
 	// associate parameter block type with template .xml file
 	std::string* existing_tag = LLWidgetNameRegistry::instance().getValue(param_block_type);
-	if (existing_tag != NULL && *existing_tag != tag)
+	if (existing_tag != NULL)
 	{
-		std::cerr << "Duplicate entry for T::Params, try creating empty param block in derived classes that inherit T::Params" << std::endl;
-		// forcing crash here
-		char* foo = 0;
-		*foo = 1;
+		if(*existing_tag != tag)
+		{
+			std::cerr << "Duplicate entry for T::Params, try creating empty param block in derived classes that inherit T::Params" << std::endl;
+			// forcing crash here
+			char* foo = 0;
+			*foo = 1;
+		}
+		else
+		{
+			// widget already registered
+			return;
+		}
 	}
-	LLWidgetNameRegistry ::instance().defaultRegistrar().add(param_block_type, tag);
+	LLWidgetNameRegistry::instance().defaultRegistrar().add(param_block_type, tag);
 	// associate widget type with factory function
 	LLDefaultWidgetRegistry::instance().defaultRegistrar().add(widget_type, creator_func);
 	//FIXME: comment this in when working on schema generation
diff --git a/indra/llui/lluictrlfactory.h b/indra/llui/lluictrlfactory.h
index 7da96ffce3d7a8d4027b4dfdc7a30067ba9229cb..c99acee48e1a0e29c18ccd423650e04ca941650f 100644
--- a/indra/llui/lluictrlfactory.h
+++ b/indra/llui/lluictrlfactory.h
@@ -373,8 +373,9 @@ LLChildRegistry<DERIVED>::Register<T>::Register(const char* tag, LLWidgetCreator
 	LLUICtrlFactory::instance().registerWidget(&typeid(T), &typeid(typename T::Params), &LLUICtrlFactory::createDefaultWidget<T>, tag);
 	
 	// since registry_t depends on T, do this in line here
-	typedef typename T::child_registry_t registry_t;
-	LLChildRegistryRegistry::instance().defaultRegistrar().add(&typeid(T), registry_t::instance());
+	// TODO: uncomment this for schema generation
+	//typedef typename T::child_registry_t registry_t;
+	//LLChildRegistryRegistry::instance().defaultRegistrar().add(&typeid(T), registry_t::instance());
 }
 
 
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index e1a01624410afe8d7f0eb97395e027093411315e..ec3c7452e5d1eeb82889599bb11b7d6bc5b81024 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -85,7 +85,7 @@ const F32 MAX_CAMERA_SMOOTH_DISTANCE = 50.0f;
 
 const F32 HEAD_BUFFER_SIZE = 0.3f;
 
-const F32 CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP = 0.2f;
+const F32 CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP = 0.1f;
 
 const F32 LAND_MIN_ZOOM = 0.15f;
 
@@ -2169,12 +2169,7 @@ void LLAgentCamera::changeCameraToFollow(BOOL animate)
 		// unpause avatar animation
 		gAgent.unpauseAnimation();
 
-		const U32 old_flags = gAgent.getControlFlags();
 		gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
-		if (old_flags != gAgent.getControlFlags())
-		{
-			gAgent.setFlagsDirty();
-		}
 
 		if (animate)
 		{
@@ -2233,13 +2228,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
 		}
 		updateLastCamera();
 		mCameraMode = CAMERA_MODE_THIRD_PERSON;
-		const U32 old_flags = gAgent.getControlFlags();
 		gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
-		if (old_flags != gAgent.getControlFlags())
-		{
-			gAgent.setFlagsDirty();
-		}
-
 	}
 
 	// Remove any pitch from the avatar
@@ -2274,7 +2263,7 @@ void LLAgentCamera::changeCameraToThirdPerson(BOOL animate)
 //-----------------------------------------------------------------------------
 // changeCameraToCustomizeAvatar()
 //-----------------------------------------------------------------------------
-void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL camera_animate)
+void LLAgentCamera::changeCameraToCustomizeAvatar()
 {
 	if (LLViewerJoystick::getInstance()->getOverrideCamera())
 	{
@@ -2289,44 +2278,21 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came
 		LLToolMgr::getInstance()->setCurrentToolset(gFaceEditToolset);
 	}
 
-	if (camera_animate)
-	{
-		startCameraAnimation();
-	}
+	startCameraAnimation();
 
 	if (mCameraMode != CAMERA_MODE_CUSTOMIZE_AVATAR)
 	{
 		updateLastCamera();
 		mCameraMode = CAMERA_MODE_CUSTOMIZE_AVATAR;
-		const U32 old_flags = gAgent.getControlFlags();
 		gAgent.clearControlFlags(AGENT_CONTROL_MOUSELOOK);
-		if (old_flags != gAgent.getControlFlags())
-		{
-			gAgent.setFlagsDirty();
-		}
 
 		gFocusMgr.setKeyboardFocus( NULL );
 		gFocusMgr.setMouseCapture( NULL );
 
 		LLVOAvatarSelf::onCustomizeStart();
-	}
-
-
-	// default focus point for customize avatar
-	LLVector3 focus_target;
-	if (isAgentAvatarValid())
-	{
-		focus_target = gAgentAvatarp->mHeadp->getWorldPosition();
-	}
-	else
-	{
-		focus_target = gAgent.getPositionAgent();
-	}
 
-	if (isAgentAvatarValid())
-	{
-		if(avatar_animate)
-		{	
+		if (isAgentAvatarValid())
+		{
 			// Remove any pitch or rotation from the avatar
 			LLVector3 at = gAgent.getAtAxis();
 			at.mV[VZ] = 0.f;
@@ -2340,33 +2306,30 @@ void LLAgentCamera::changeCameraToCustomizeAvatar(BOOL avatar_animate, BOOL came
 
 			if (turn_motion)
 			{
+				// delay camera animation long enough to play through turn animation
 				setAnimationDuration(turn_motion->getDuration() + CUSTOMIZE_AVATAR_CAMERA_ANIM_SLOP);
-
-			}
-			else
-			{
-				setAnimationDuration(gSavedSettings.getF32("ZoomTime"));
 			}
+
+			gAgentAvatarp->updateMeshTextures();
 		}
+	}
 
-		LLVector3 agent_at = gAgent.getAtAxis();
-		agent_at.mV[VZ] = 0.f;
-		agent_at.normalize();
+	LLVector3 agent_at = gAgent.getAtAxis();
+	agent_at.mV[VZ] = 0.f;
+	agent_at.normalize();
 
-		LLVector3d camera_offset(agent_at * -1.0);
-		// push camera up and out from avatar
-		camera_offset.mdV[VZ] = 0.1f; 
-		camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST;
-		LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target);
-		setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID());
-		
-		gAgentAvatarp->updateMeshTextures();
-	}
-	else
-	{
-		mCameraAnimating = FALSE;
-		gAgent.endAnimationUpdateUI();
-	}
+	// default focus point for customize avatar
+	LLVector3 focus_target = isAgentAvatarValid() 
+		? gAgentAvatarp->mHeadp->getWorldPosition()
+		: gAgent.getPositionAgent();
+
+	LLVector3d camera_offset(agent_at * -1.0);
+	// push camera up and out from avatar
+	camera_offset.mdV[VZ] = 0.1f; 
+	camera_offset *= CUSTOMIZE_AVATAR_CAMERA_DEFAULT_DIST;
+	LLVector3d focus_target_global = gAgent.getPosGlobalFromAgent(focus_target);
+	setAnimationDuration(gSavedSettings.getF32("ZoomTime"));
+	setCameraPosAndFocusGlobal(focus_target_global + camera_offset, focus_target_global, gAgent.getID());
 }
 
 
@@ -2550,7 +2513,7 @@ void LLAgentCamera::setFocusGlobal(const LLVector3d& focus, const LLUUID &object
 //-----------------------------------------------------------------------------
 void LLAgentCamera::setCameraPosAndFocusGlobal(const LLVector3d& camera_pos, const LLVector3d& focus, const LLUUID &object_id)
 {
-	LLVector3d old_focus = mFocusTargetGlobal;
+	LLVector3d old_focus = mFocusTargetGlobal.isExactlyZero() ? focus : mFocusTargetGlobal;
 
 	F64 focus_delta_squared = (old_focus - focus).magVecSquared();
 	const F64 ANIM_EPSILON_SQUARED = 0.0001;
diff --git a/indra/newview/llagentcamera.h b/indra/newview/llagentcamera.h
index fc78fef6d04dd9a4cce0f6c14992b041fea209f7..6cee21fd8a9e811f27a9943dad4c3fd68cb032b3 100644
--- a/indra/newview/llagentcamera.h
+++ b/indra/newview/llagentcamera.h
@@ -94,7 +94,7 @@ class LLAgentCamera
 	void			changeCameraToDefault();
 	void			changeCameraToMouselook(BOOL animate = TRUE);
 	void			changeCameraToThirdPerson(BOOL animate = TRUE);
-	void			changeCameraToCustomizeAvatar(BOOL avatar_animate = TRUE, BOOL camera_animate = TRUE); // Trigger transition animation
+	void			changeCameraToCustomizeAvatar(); // Trigger transition animation
 	void			changeCameraToFollow(BOOL animate = TRUE); 	// Ventrella
 	BOOL			cameraThirdPerson() const		{ return (mCameraMode == CAMERA_MODE_THIRD_PERSON && mLastCameraMode == CAMERA_MODE_THIRD_PERSON); }
 	BOOL			cameraMouselook() const			{ return (mCameraMode == CAMERA_MODE_MOUSELOOK && mLastCameraMode == CAMERA_MODE_MOUSELOOK); }
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 547dfd7006886c2ba75335e0acdbd7d0d6c5e7c7..b5ad5c7a1121a7498e08d54df5e3884f8a2999ba 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -207,8 +207,9 @@ class LLUpdateDirtyState: public LLInventoryCallback
 };
 
 
-LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy():
-	mFireCount(0)
+LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy(bool update_base_outfit_ordering):
+	mFireCount(0),
+	mUpdateBaseOrder(update_base_outfit_ordering)
 {
 }
 
@@ -218,7 +219,7 @@ LLUpdateAppearanceOnDestroy::~LLUpdateAppearanceOnDestroy()
 	
 	if (!LLApp::isExiting())
 	{
-		LLAppearanceMgr::instance().updateAppearanceFromCOF();
+		LLAppearanceMgr::instance().updateAppearanceFromCOF(mUpdateBaseOrder);
 	}
 }
 
@@ -1436,7 +1437,7 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
 
 	// Create links to new COF contents.
 	llinfos << "creating LLUpdateAppearanceOnDestroy" << llendl;
-	LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
+	LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy(!append);
 
 #ifndef LL_RELEASE_FOR_DOWNLOAD
 	llinfos << "Linking body items" << llendl;
@@ -1617,7 +1618,7 @@ void LLAppearanceMgr::enforceItemCountLimits()
 	}
 }
 
-void LLAppearanceMgr::updateAppearanceFromCOF()
+void LLAppearanceMgr::updateAppearanceFromCOF(bool update_base_outfit_ordering)
 {
 	if (mIsInUpdateAppearanceFromCOF)
 	{
@@ -1631,7 +1632,7 @@ void LLAppearanceMgr::updateAppearanceFromCOF()
 
 	//checking integrity of the COF in terms of ordering of wearables, 
 	//checking and updating links' descriptions of wearables in the COF (before analyzed for "dirty" state)
-	updateClothingOrderingInfo();
+	updateClothingOrderingInfo(LLUUID::null, update_base_outfit_ordering);
 
 	// Remove duplicate or excess wearables. Should normally be enforced at the UI level, but
 	// this should catch anything that gets through.
@@ -1657,6 +1658,9 @@ void LLAppearanceMgr::updateAppearanceFromCOF()
 	remove_non_link_items(obj_items);
 	remove_non_link_items(gest_items);
 
+	dumpItemArray(wear_items,"asset_dump: wear_item");
+	dumpItemArray(obj_items,"asset_dump: obj_item");
+
 	if(!wear_items.count())
 	{
 		LLNotificationsUtil::add("CouldNotPutOnOutfit");
@@ -2336,11 +2340,19 @@ struct WearablesOrderComparator
 	U32 mControlSize;
 };
 
-void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id)
+void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id, bool update_base_outfit_ordering)
 {
 	if (cat_id.isNull())
 	{
 		cat_id = getCOF();
+		if (update_base_outfit_ordering)
+		{
+			const LLUUID base_outfit_id = getBaseOutfitUUID();
+			if (base_outfit_id.notNull())
+			{
+				updateClothingOrderingInfo(base_outfit_id,false);
+			}
+		}
 	}
 
 	// COF is processed if cat_id is not specified
@@ -2373,6 +2385,7 @@ void LLAppearanceMgr::updateClothingOrderingInfo(LLUUID cat_id)
 			item->setComplete(TRUE);
  			item->updateServer(FALSE);
 			gInventory.updateItem(item);
+			
 			inventory_changed = true;
 		}
 	}
@@ -2574,11 +2587,16 @@ void LLAppearanceMgr::dumpCat(const LLUUID& cat_id, const std::string& msg)
 void LLAppearanceMgr::dumpItemArray(const LLInventoryModel::item_array_t& items,
 										const std::string& msg)
 {
-	llinfos << msg << llendl;
 	for (S32 i=0; i<items.count(); i++)
 	{
 		LLViewerInventoryItem *item = items.get(i);
-		llinfos << i <<" " << item->getName() << llendl;
+		LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
+		LLUUID asset_id;
+		if (linked_item)
+		{
+			asset_id = linked_item->getAssetUUID();
+		}
+		llinfos << msg << " " << i <<" " << item->getName() << " " << asset_id.asString() << llendl;
 	}
 	llinfos << llendl;
 }
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index afd1bf3ade098124c1040a63ce966d78629372a0..8834f8c395ab81ded8c1c476f19c7b1e98bea14c 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -54,7 +54,7 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 public:
 	typedef std::vector<LLInventoryModel::item_array_t> wearables_by_type_t;
 
-	void updateAppearanceFromCOF();
+	void updateAppearanceFromCOF(bool update_base_outfit_ordering = false);
 	bool needToSaveCOF();
 	void updateCOF(const LLUUID& category, bool append = false);
 	void wearInventoryCategory(LLInventoryCategory* category, bool copy, bool append);
@@ -171,7 +171,7 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 
 	//Check ordering information on wearables stored in links' descriptions and update if it is invalid
 	// COF is processed if cat_id is not specified
-	void updateClothingOrderingInfo(LLUUID cat_id = LLUUID::null);
+	void updateClothingOrderingInfo(LLUUID cat_id = LLUUID::null, bool update_base_outfit_ordering = false);
 
 	bool isOutfitLocked() { return mOutfitLocked; }
 
@@ -226,12 +226,13 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 class LLUpdateAppearanceOnDestroy: public LLInventoryCallback
 {
 public:
-	LLUpdateAppearanceOnDestroy();
+	LLUpdateAppearanceOnDestroy(bool update_base_outfit_ordering = false);
 	virtual ~LLUpdateAppearanceOnDestroy();
 	/* virtual */ void fire(const LLUUID& inv_item);
 
 private:
 	U32 mFireCount;
+	bool mUpdateBaseOrder;
 };
 
 
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 19cdccb630e533da0e31af94accbf8caafd73cf5..68809b09266d4ca18602f959b024e108fe5101c7 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -147,8 +147,9 @@ void LLStandardBumpmap::restoreGL()
 										LLViewerTexture::BOOST_NONE, 
 										LLViewerTexture::LOD_TEXTURE,
 										0, 
-										0);																								
-		gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL );
+										0);									
+		gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
+		gStandardBumpmapList[LLStandardBumpmap::sStandardBumpmapCount].mImage->setLoadedCallback(LLBumpImageList::onSourceStandardLoaded, 0, TRUE, FALSE, NULL, NULL, NULL );
 		LLStandardBumpmap::sStandardBumpmapCount++;
 	}
 
@@ -817,7 +818,7 @@ void LLBumpImageList::addTextureStats(U8 bump, const LLUUID& base_image_id, F32
 	bump &= TEM_BUMP_MASK;
 	LLViewerFetchedTexture* bump_image = gStandardBumpmapList[bump].mImage;
 	if( bump_image )
-	{
+	{		
 		bump_image->addTextureStats(virtual_size);
 	}
 }
@@ -921,7 +922,8 @@ LLViewerTexture* LLBumpImageList::getBrightnessDarknessImage(LLViewerFetchedText
 			(*entries_list)[src_image->getID()]->setExplicitFormat(GL_ALPHA8, GL_ALPHA);			
 
 			// Note: this may create an LLImageGL immediately
-			src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()) );
+			src_image->setBoostLevel(LLViewerTexture::BOOST_BUMP) ;
+			src_image->setLoadedCallback( callback_func, 0, TRUE, FALSE, new LLUUID(src_image->getID()), NULL, NULL );
 			bump = (*entries_list)[src_image->getID()]; // In case callback was called immediately and replaced the image
 
 //			bump_total++;
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 2cc61a69c178ed3c1b749011d33ec536d56dd71e..96dba5717ad61a96b3f1f023c3802f1dd3cf2bac 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -4055,13 +4055,13 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 
 			if( get_is_item_worn( mUUID ) )
 			{
-				items.push_back(std::string("Attach Separator"));
+				items.push_back(std::string("Wearable And Object Separator"));
 				items.push_back(std::string("Detach From Yourself"));
 			}
 			else if (!isItemInTrash() && !isLinkedObjectInTrash() && !isLinkedObjectMissing() && !isCOFFolder())
 			{
-				items.push_back(std::string("Attach Separator"));
-				items.push_back(std::string("Object Wear"));
+				items.push_back(std::string("Wearable And Object Separator"));
+				items.push_back(std::string("Wearable And Object Wear"));
 				items.push_back(std::string("Attach To"));
 				items.push_back(std::string("Attach To HUD"));
 				// commented out for DEV-32347
@@ -4069,7 +4069,7 @@ void LLObjectBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 
 				if (!gAgentAvatarp->canAttachMoreObjects())
 				{
-					disabled_items.push_back(std::string("Object Wear"));
+					disabled_items.push_back(std::string("Wearable And Object Wear"));
 					disabled_items.push_back(std::string("Attach To"));
 					disabled_items.push_back(std::string("Attach To HUD"));
 				}
@@ -4411,7 +4411,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 
 		getClipboardEntries(true, items, disabled_items, flags);
 
-		items.push_back(std::string("Wearable Separator"));
+		items.push_back(std::string("Wearable And Object Separator"));
 
 		items.push_back(std::string("Wearable Edit"));
 
@@ -4422,7 +4422,7 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 		// Don't allow items to be worn if their baseobj is in the trash.
 		if (isLinkedObjectInTrash() || isLinkedObjectMissing() || isCOFFolder())
 		{
-			disabled_items.push_back(std::string("Wearable Wear"));
+			disabled_items.push_back(std::string("Wearable And Object Wear"));
 			disabled_items.push_back(std::string("Wearable Add"));
 			disabled_items.push_back(std::string("Wearable Edit"));
 		}
@@ -4438,12 +4438,12 @@ void LLWearableBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 				case LLAssetType::AT_BODYPART:
 					if (get_is_item_worn(item->getUUID()))
 					{
-						disabled_items.push_back(std::string("Wearable Wear"));
+						disabled_items.push_back(std::string("Wearable And Object Wear"));
 						disabled_items.push_back(std::string("Wearable Add"));
 					}
 					else
 					{
-						items.push_back(std::string("Wearable Wear"));
+						items.push_back(std::string("Wearable And Object Wear"));
 						items.push_back(std::string("Wearable Add"));
 						disabled_items.push_back(std::string("Take Off"));
 						disabled_items.push_back(std::string("Wearable Edit"));
diff --git a/indra/newview/llinventoryfilter.cpp b/indra/newview/llinventoryfilter.cpp
index 6e829f2dc2f0afea0232917d47725f2c24c4d3fb..5dcf0680dbbdb11cf81ef617cdb23521afb6725b 100644
--- a/indra/newview/llinventoryfilter.cpp
+++ b/indra/newview/llinventoryfilter.cpp
@@ -57,7 +57,7 @@ LLInventoryFilter::FilterOps::FilterOps() :
 	mPermissions(PERM_NONE),
 	mFilterTypes(FILTERTYPE_OBJECT),
 	mFilterUUID(LLUUID::null),
-	mIncludeLinks(TRUE)
+	mFilterLinks(FILTERLINK_INCLUDE_LINKS)
 {
 }
 
@@ -104,8 +104,10 @@ BOOL LLInventoryFilter::check(const LLFolderViewItem* item)
 
 	const BOOL passed_filtertype = checkAgainstFilterType(item);
 	const BOOL passed_permissions = checkAgainstPermissions(item);
+	const BOOL passed_filterlink = checkAgainstFilterLinks(item);
 	const BOOL passed = (passed_filtertype &&
-						 passed_permissions && 
+						 passed_permissions &&
+						 passed_filterlink &&
 						 (mFilterSubString.size() == 0 || mSubStringMatchOffset != std::string::npos));
 
 	return passed;
@@ -229,6 +231,23 @@ BOOL LLInventoryFilter::checkAgainstPermissions(const LLFolderViewItem* item) co
 	return (perm & mFilterOps.mPermissions) == mFilterOps.mPermissions;
 }
 
+BOOL LLInventoryFilter::checkAgainstFilterLinks(const LLFolderViewItem* item) const
+{
+	const LLFolderViewEventListener* listener = item->getListener();
+	if (!listener) return TRUE;
+
+	const LLUUID object_id = listener->getUUID();
+	const LLInventoryObject *object = gInventory.getObject(object_id);
+	if (!object) return TRUE;
+
+	const BOOL is_link = object->getIsLinkType();
+	if (is_link && (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS))
+		return FALSE;
+	if (!is_link && (mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS))
+		return FALSE;
+	return TRUE;
+}
+
 const std::string& LLInventoryFilter::getFilterSubString(BOOL trim) const
 {
 	return mFilterSubString;
@@ -246,6 +265,7 @@ BOOL LLInventoryFilter::isNotDefault() const
 		|| mFilterOps.mFilterCategoryTypes != mDefaultFilterOps.mFilterCategoryTypes 
 		|| mFilterOps.mFilterWearableTypes != mDefaultFilterOps.mFilterWearableTypes 
 		|| mFilterOps.mFilterTypes != FILTERTYPE_OBJECT
+		|| mFilterOps.mFilterLinks != FILTERLINK_INCLUDE_LINKS
 		|| mFilterSubString.size() 
 		|| mFilterOps.mPermissions != mDefaultFilterOps.mPermissions
 		|| mFilterOps.mMinDate != mDefaultFilterOps.mMinDate 
@@ -259,6 +279,7 @@ BOOL LLInventoryFilter::isActive() const
 		|| mFilterOps.mFilterCategoryTypes != 0xffffffffffffffffULL
 		|| mFilterOps.mFilterWearableTypes != 0xffffffffffffffffULL
 		|| mFilterOps.mFilterTypes != FILTERTYPE_OBJECT
+		|| mFilterOps.mFilterLinks != FILTERLINK_INCLUDE_LINKS
 		|| mFilterSubString.size() 
 		|| mFilterOps.mPermissions != PERM_NONE 
 		|| mFilterOps.mMinDate != time_min()
@@ -410,6 +431,11 @@ void LLInventoryFilter::setFilterSubString(const std::string& string)
 			mFilterOps.mFilterUUID == LLUUID::null;
 			setModified(FILTER_RESTART);
 		}
+
+		// Cancel out filter links once the search string is modified
+		{
+			mFilterOps.mFilterLinks = FILTERLINK_INCLUDE_LINKS;
+		}
 	}
 }
 
@@ -508,16 +534,17 @@ void LLInventoryFilter::setHoursAgo(U32 hours)
 	mFilterOps.mFilterTypes |= FILTERTYPE_DATE;
 }
 
-void LLInventoryFilter::setIncludeLinks(BOOL include_links)
+void LLInventoryFilter::setFilterLinks(U64 filter_links)
 {
-	if (mFilterOps.mIncludeLinks != include_links)
+	if (mFilterOps.mFilterLinks != filter_links)
 	{
-		if (!mFilterOps.mIncludeLinks)
-			setModified(FILTER_LESS_RESTRICTIVE);
-		else
+		if (mFilterOps.mFilterLinks == FILTERLINK_EXCLUDE_LINKS ||
+			mFilterOps.mFilterLinks == FILTERLINK_ONLY_LINKS)
 			setModified(FILTER_MORE_RESTRICTIVE);
+		else
+			setModified(FILTER_LESS_RESTRICTIVE);
 	}
-	mFilterOps.mIncludeLinks = include_links;
+	mFilterOps.mFilterLinks = filter_links;
 }
 
 void LLInventoryFilter::setShowFolderState(EFolderShow state)
@@ -895,9 +922,9 @@ U32 LLInventoryFilter::getHoursAgo() const
 { 
 	return mFilterOps.mHoursAgo; 
 }
-BOOL LLInventoryFilter::getIncludeLinks() const
+U64 LLInventoryFilter::getFilterLinks() const
 {
-	return mFilterOps.mIncludeLinks;
+	return mFilterOps.mFilterLinks;
 }
 LLInventoryFilter::EFolderShow LLInventoryFilter::getShowFolderState() const
 { 
diff --git a/indra/newview/llinventoryfilter.h b/indra/newview/llinventoryfilter.h
index f740a6b333119a21fa8016f8857b0cc474c92640..3d476e479519de3ceeaaed935c732abe54ccba59 100644
--- a/indra/newview/llinventoryfilter.h
+++ b/indra/newview/llinventoryfilter.h
@@ -56,8 +56,7 @@ class LLInventoryFilter
 		FILTER_MORE_RESTRICTIVE		// if you didn't pass the previous filter, you definitely won't pass this one
 	};
 
-	enum EFilterType
-	{
+	enum EFilterType	{
 		FILTERTYPE_NONE = 0,
 		FILTERTYPE_OBJECT = 0x1 << 0,	// normal default search-by-object-type
 		FILTERTYPE_CATEGORY = 0x1 << 1,	// search by folder type
@@ -66,6 +65,13 @@ class LLInventoryFilter
 		FILTERTYPE_WEARABLE = 0x1 << 4	// search by wearable type
 	};
 
+	enum EFilterLink
+	{
+		FILTERLINK_INCLUDE_LINKS,	// show links too
+		FILTERLINK_EXCLUDE_LINKS,	// don't show links
+		FILTERLINK_ONLY_LINKS		// only show links
+	};
+
 	// REFACTOR: Change this to an enum.
 	static const U32 SO_DATE = 1;
 	static const U32 SO_FOLDERS_BY_NAME = 2;
@@ -100,8 +106,8 @@ class LLInventoryFilter
 	void 				setHoursAgo(U32 hours);
 	U32 				getHoursAgo() const;
 
-	void 				setIncludeLinks(BOOL include_links);
-	BOOL				getIncludeLinks() const;
+	void 				setFilterLinks(U64 filter_link);
+	U64					getFilterLinks() const;
 
 	// +-------------------------------------------------------------------+
 	// + Execution And Results
@@ -109,6 +115,8 @@ class LLInventoryFilter
 	BOOL 				check(const LLFolderViewItem* item);
 	BOOL 				checkAgainstFilterType(const LLFolderViewItem* item) const;
 	BOOL 				checkAgainstPermissions(const LLFolderViewItem* item) const;
+	BOOL 				checkAgainstFilterLinks(const LLFolderViewItem* item) const;
+
 	std::string::size_type getStringMatchOffset() const;
 
 	// +-------------------------------------------------------------------+
@@ -179,7 +187,7 @@ class LLInventoryFilter
 		U32				mHoursAgo;
 		EFolderShow		mShowFolderState;
 		PermissionMask	mPermissions;
-		BOOL			mIncludeLinks;
+		U64				mFilterLinks;
 	};
 
 	U32						mOrder;
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 72d35af3b770aa91a22e64fccc9dbd58b9de9a8f..5af99f3c8ff242533f054df50d664fbf4868694b 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -256,9 +256,9 @@ void LLInventoryPanel::setHoursAgo(U32 hours)
 	getFilter()->setHoursAgo(hours);
 }
 
-void LLInventoryPanel::setIncludeLinks(BOOL include_links)
+void LLInventoryPanel::setFilterLinks(U64 filter_links)
 {
-	getFilter()->setIncludeLinks(include_links);
+	getFilter()->setFilterLinks(filter_links);
 }
 
 void LLInventoryPanel::setShowFolderState(LLInventoryFilter::EFolderShow show)
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 84603e8b4ffad8b479b50f95c628c68430d0e569..c9e317f816fb95f3d4a1318ba50adb917e757b3f 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -145,7 +145,7 @@ class LLInventoryPanel : public LLPanel
 	void setSinceLogoff(BOOL sl);
 	void setHoursAgo(U32 hours);
 	BOOL getSinceLogoff();
-	void setIncludeLinks(BOOL include_links);
+	void setFilterLinks(U64 filter_links);
 
 	void setShowFolderState(LLInventoryFilter::EFolderShow show);
 	LLInventoryFilter::EFolderShow getShowFolderState();
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 7412812c62ee0bb4c96cfcdd89167d3ce4b903a8..29ce3449d17ef9559b42f7fa556e82fb04df8bef 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -394,6 +394,7 @@ void LLPanelMainInventory::onClearSearch()
 	{
 		mActivePanel->setFilterSubString(LLStringUtil::null);
 		mActivePanel->setFilterTypes(0xffffffff);
+		mActivePanel->setFilterLinks(LLInventoryFilter::FILTERLINK_INCLUDE_LINKS);
 	}
 
 	if (finder)
@@ -1070,6 +1071,7 @@ void LLPanelMainInventory::onCustomAction(const LLSD& userdata)
 		mFilterEditor->setFocus(TRUE);
 		filter->setFilterUUID(item_id);
 		filter->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+		filter->setFilterLinks(LLInventoryFilter::FILTERLINK_ONLY_LINKS);
 	}
 }
 
@@ -1136,7 +1138,10 @@ BOOL LLPanelMainInventory::isActionEnabled(const LLSD& userdata)
 
 	if (command_name == "find_links")
 	{
-		LLFolderViewItem* current_item = getActivePanel()->getRootFolder()->getCurSelectedItem();
+		LLFolderView* root = getActivePanel()->getRootFolder();
+		std::set<LLUUID> selection_set = root->getSelectionList();
+		if (selection_set.size() != 1) return FALSE;
+		LLFolderViewItem* current_item = root->getCurSelectedItem();
 		if (!current_item) return FALSE;
 		const LLUUID& item_id = current_item->getListener()->getUUID();
 		const LLInventoryObject *obj = gInventory.getObject(item_id);
diff --git a/indra/newview/llpreviewtexture.cpp b/indra/newview/llpreviewtexture.cpp
index 22a1ef94a7fbaa54a5ad505d1f64d880f1727fcc..bf18c9e5e7c1b4e5acddce3a9e8d9a4de1e9412b 100644
--- a/indra/newview/llpreviewtexture.cpp
+++ b/indra/newview/llpreviewtexture.cpp
@@ -87,6 +87,8 @@ LLPreviewTexture::LLPreviewTexture(const LLSD& key)
 
 LLPreviewTexture::~LLPreviewTexture()
 {
+	LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList, this) ;
+
 	if( mLoadingFullImage )
 	{
 		getWindow()->decBusyCount();
@@ -278,7 +280,7 @@ void LLPreviewTexture::saveAs()
 	mLoadingFullImage = TRUE;
 	getWindow()->incBusyCount();
 	mImage->setLoadedCallback( LLPreviewTexture::onFileLoadedForSave, 
-								0, TRUE, FALSE, new LLUUID( mItemUUID ) );
+								0, TRUE, FALSE, new LLUUID( mItemUUID ), this, &mCallbackTextureList );
 }
 
 // virtual
diff --git a/indra/newview/llpreviewtexture.h b/indra/newview/llpreviewtexture.h
index 7cd2adad56f574438869481bfc19f8f534775e2c..0f29a741c11deff173cc4d4bbfeacba05cc498c7 100644
--- a/indra/newview/llpreviewtexture.h
+++ b/indra/newview/llpreviewtexture.h
@@ -99,5 +99,7 @@ class LLPreviewTexture : public LLPreview
 	S32 mLastWidth;
 	F32 mAspectRatio;
 	BOOL mUpdateDimensions;
+
+	LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; 
 };
 #endif  // LL_LLPREVIEWTEXTURE_H
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp
index 6f5238f0a17878b9eff1cadf10181bef8afd6e18..36d581a41a928d9a5acfc32daec9664508e19f99 100644
--- a/indra/newview/llscrollingpanelparam.cpp
+++ b/indra/newview/llscrollingpanelparam.cpp
@@ -209,6 +209,7 @@ void LLScrollingPanelParam::onSliderMoved(LLUICtrl* ctrl, void* userdata)
 	if (current_weight != new_weight )
 	{
 		self->mWearable->setVisualParamWeight( param->getID(), new_weight, FALSE );
+		self->mWearable->writeToAvatar();
 		gAgentAvatarp->updateVisualParams();
 	}
 }
@@ -298,6 +299,7 @@ void LLScrollingPanelParam::onHintHeldDown( LLVisualParamHint* hint )
 				&& new_percent < slider->getMaxValue())
 			{
 				mWearable->setVisualParamWeight( hint->getVisualParam()->getID(), new_weight, FALSE);
+				mWearable->writeToAvatar();
 				gAgentAvatarp->updateVisualParams();
 
 				slider->setValue( weightToPercent( new_weight ) );
@@ -330,6 +332,7 @@ void LLScrollingPanelParam::onHintMinMouseUp( void* userdata )
 				&& new_percent < slider->getMaxValue())
 			{
 				self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight, FALSE);
+				self->mWearable->writeToAvatar();
 				slider->setValue( self->weightToPercent( new_weight ) );
 			}
 		}
@@ -363,6 +366,7 @@ void LLScrollingPanelParam::onHintMaxMouseUp( void* userdata )
 					&& new_percent < slider->getMaxValue())
 				{
 					self->mWearable->setVisualParamWeight(hint->getVisualParam()->getID(), new_weight, FALSE);
+					self->mWearable->writeToAvatar();
 					slider->setValue( self->weightToPercent( new_weight ) );
 				}
 			}
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 951323551c0ae61e766b48e978e0e209b53d738b..7a7ffb998382c95c8ab082576ad70d6c0f9062e6 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -196,6 +196,15 @@ void LLSidepanelAppearance::onVisibilityChange(const LLSD &new_visibility)
 			{
 				gAgentCamera.changeCameraToCustomizeAvatar();
 			}
+			if (mEditWearable && mEditWearable->getVisible())
+			{
+				LLWearable *wearable_ptr = mEditWearable->getWearable();
+				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();
+				}
+			}
 		}
 	}
 	else
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index 6ccd89dddb948d871352337f03eb995b04cca6c9..d9870e81c5ee92139c6bb0193be06cd0be89045e 100644
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -323,6 +323,19 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 		childSetText("LabelOwnerName",getString("public"));
 	}
 	
+	////////////
+	// ORIGIN //
+	////////////
+
+	if (object)
+	{
+		childSetText("origin",getString("origin_inworld"));
+	}
+	else
+	{
+		childSetText("origin",getString("origin_inventory"));
+	}
+
 	//////////////////
 	// ACQUIRE DATE //
 	//////////////////
@@ -341,9 +354,9 @@ void LLSidepanelItemInfo::refreshFromItem(LLViewerInventoryItem* item)
 		childSetText ("LabelAcquiredDate", timeStr);
 	}
 	
-	/////////////////////////////////////
-	// PERMISSIONS AND SALE ITEM HIDING
-	/////////////////////////////////////
+	//////////////////////////////////////
+	// PERMISSIONS AND SALE ITEM HIDING //
+	//////////////////////////////////////
 	
 	const std::string perm_and_sale_items[]={
 		"perms_inv",
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 9b5b210bf7297abf99aae621d3287cf97179635a..0afbce7d513de0fd8f9efdeec761d120c1a3e473 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -112,15 +112,57 @@ const F64 log_2 = log(2.0);
 LLLoadedCallbackEntry::LLLoadedCallbackEntry(loaded_callback_func cb,
 					  S32 discard_level,
 					  BOOL need_imageraw, // Needs image raw for the callback
-					  void* userdata ) 
+					  void* userdata,
+					  LLLoadedCallbackEntry::source_callback_list_t* src_callback_list,
+					  void* source,
+					  LLViewerFetchedTexture* target,
+					  BOOL pause) 
 	: mCallback(cb),
 	  mLastUsedDiscard(MAX_DISCARD_LEVEL+1),
 	  mDesiredDiscard(discard_level),
 	  mNeedsImageRaw(need_imageraw),
-	  mUserData(userdata)
+	  mUserData(userdata),
+	  mSourceCallbackList(src_callback_list),
+	  mSource(source),
+	  mPaused(pause)
+{
+	if(mSourceCallbackList)
+	{
+		mSourceCallbackList->insert(target->getID());
+	}
+}
+
+LLLoadedCallbackEntry::~LLLoadedCallbackEntry()
 {
 }
 
+void LLLoadedCallbackEntry::removeTexture(LLViewerFetchedTexture* tex)
+{
+	if(mSourceCallbackList)
+	{
+		mSourceCallbackList->erase(tex->getID()) ;
+	}
+}
+
+//static 
+void LLLoadedCallbackEntry::cleanUpCallbackList(LLLoadedCallbackEntry::source_callback_list_t* callback_list, void* src)
+{
+	//clear texture callbacks.
+	if(!callback_list->empty())
+	{
+		for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = callback_list->begin();
+				iter != callback_list->end(); ++iter)
+		{
+			LLViewerFetchedTexture* tex = gTextureList.findImage(*iter) ;
+			if(tex)
+			{
+				tex->deleteCallbackEntry(src) ;			
+			}
+		}
+		callback_list->clear() ;
+	}
+}
+
 LLViewerMediaTexture* LLViewerTextureManager::createMediaTexture(const LLUUID &media_id, BOOL usemipmaps, LLImageGL* gl_image)
 {
 	return new LLViewerMediaTexture(media_id, usemipmaps, gl_image) ;		
@@ -324,9 +366,7 @@ void LLViewerTextureManager::cleanup()
 	LLViewerFetchedTexture::sMissingAssetImagep = NULL;
 	LLViewerFetchedTexture::sWhiteImagep = NULL;
 
-	LLViewerMediaTexture::cleanup() ;	
-
-	LLViewerTexture::cleanupClass() ;
+	LLViewerMediaTexture::cleanUpClass() ;	
 }
 
 //----------------------------------------------------------------------------------------------
@@ -344,11 +384,6 @@ void LLViewerTexture::initClass()
 	}
 }
 
-// static
-void LLViewerTexture::cleanupClass()
-{
-}
-
 // static
 S32 LLViewerTexture::getTotalNumOfCategories() 
 {
@@ -492,10 +527,10 @@ void LLViewerTexture::init(bool firstinit)
 
 	mTextureState = NO_DELETE ;
 	mDontDiscard = FALSE;
-	mCanResetMaxVirtualSize = true ;
 	mMaxVirtualSize = 0.f;
 	mNeedsGLTexture = FALSE ;
-	mNeedsResetMaxVirtualSize = FALSE ;
+	mMaxVirtualSizeResetInterval = 1;
+	mMaxVirtualSizeResetCounter = 1 ;
 	mAdditionalDecodePriority = 0.f ;	
 	mParcelMedia = NULL ;
 	mNumFaces = 0 ;
@@ -510,6 +545,7 @@ S8 LLViewerTexture::getType() const
 	return LLViewerTexture::LOCAL_TEXTURE ;
 }
 
+//virtual
 void LLViewerTexture::cleanup()
 {
 	mFaceList.clear() ;
@@ -591,11 +627,6 @@ void LLViewerTexture::forceImmediateUpdate()
 {
 }
 
-void LLViewerTexture::setResetMaxVirtualSizeFlag(bool flag) 
-{
-	mCanResetMaxVirtualSize = flag ;
-}
-
 void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) const 
 {
 	if(needs_gltexture)
@@ -603,10 +634,10 @@ void LLViewerTexture::addTextureStats(F32 virtual_size, BOOL needs_gltexture) co
 		mNeedsGLTexture = TRUE ;
 	}
 
-	if(mNeedsResetMaxVirtualSize)
+	if(!mMaxVirtualSizeResetCounter)
 	{
 		//flag to reset the values because the old values are used.
-		mNeedsResetMaxVirtualSize = FALSE ;
+		resetMaxVirtualSizeResetCounter() ;
 		mMaxVirtualSize = virtual_size;		
 		mAdditionalDecodePriority = 0.f ;	
 		mNeedsGLTexture = needs_gltexture ;
@@ -621,7 +652,7 @@ void LLViewerTexture::resetTextureStats()
 {
 	mMaxVirtualSize = 0.0f ;
 	mAdditionalDecodePriority = 0.f ;	
-	mNeedsResetMaxVirtualSize = FALSE ;
+	mMaxVirtualSizeResetCounter = 0 ;
 }
 
 //virtual 
@@ -1098,6 +1129,7 @@ void LLViewerFetchedTexture::init(bool firstinit)
 	mIsMissingAsset = FALSE;
 
 	mLoadedCallbackDesiredDiscardLevel = 0;
+	mPauseLoadedCallBacks = TRUE ;
 
 	mNeedsCreateTexture = FALSE;
 	
@@ -1144,6 +1176,7 @@ S8 LLViewerFetchedTexture::getType() const
 	return LLViewerTexture::FETCHED_TEXTURE ;
 }
 
+//virtual
 void LLViewerFetchedTexture::cleanup()
 {
 	for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
@@ -1153,6 +1186,7 @@ void LLViewerFetchedTexture::cleanup()
 		// We never finished loading the image.  Indicate failure.
 		// Note: this allows mLoadedCallbackUserData to be cleaned up.
 		entryp->mCallback( FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData );
+		entryp->removeTexture(this) ;
 		delete entryp;
 	}
 	mLoadedCallbackList.clear();
@@ -1164,6 +1198,8 @@ void LLViewerFetchedTexture::cleanup()
 	mCachedRawDiscardLevel = -1 ;
 	mCachedRawImageReady = FALSE ;
 	mSavedRawImage = NULL ;
+
+	LLViewerTexture::cleanup();
 }
 
 void LLViewerFetchedTexture::setForSculpt()
@@ -1529,6 +1565,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
 	F32 pixel_priority = fsqrtf(mMaxVirtualSize);
 
 	F32 priority = 0.f;
+
 	if (mIsMissingAsset)
 	{
 		priority = 0.0f;
@@ -1550,7 +1587,7 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
 	{
 		priority = 1.f;
 	}
-	else if (pixel_priority <= 0.f && !have_all_data)
+	else if (pixel_priority < 0.001f && !have_all_data)
 	{
 		// Not on screen but we might want some data
 		if (mBoostLevel > BOOST_HIGH)
@@ -1558,11 +1595,6 @@ F32 LLViewerFetchedTexture::calcDecodePriority()
 			// Always want high boosted images
 			priority = 1.f;
 		}
-		else if(mForceToSaveRawImage)
-		{
-			//force to fetch the raw image.
-			priority = 1.f;
-		}
 		else
 		{
 			priority = -5.f; //stop fetching
@@ -1665,7 +1697,7 @@ void LLViewerFetchedTexture::setAdditionalDecodePriority(F32 priority)
 
 void LLViewerFetchedTexture::updateVirtualSize() 
 {	
-	if(mNeedsResetMaxVirtualSize)
+	if(!mMaxVirtualSizeResetCounter)
 	{
 		addTextureStats(0.f, FALSE) ;//reset
 	}
@@ -1685,9 +1717,9 @@ void LLViewerFetchedTexture::updateVirtualSize()
 		}
 	}
 
-	if(mCanResetMaxVirtualSize)
+	if(mMaxVirtualSizeResetCounter > 0)
 	{
-		mNeedsResetMaxVirtualSize = TRUE ;
+		mMaxVirtualSizeResetCounter--;
 	}
 	reorganizeFaceList() ;
 	reorganizeVolumeList();
@@ -1765,6 +1797,7 @@ bool LLViewerFetchedTexture::updateFetch()
 		if (finished)
 		{
 			mIsFetching = FALSE;
+			mLastPacketTimer.reset() ;
 		}
 		else
 		{
@@ -1794,6 +1827,7 @@ bool LLViewerFetchedTexture::updateFetch()
 					setIsMissingAsset();
 					mRawDiscardLevel = INVALID_DISCARD_LEVEL ;
 					mIsFetching = FALSE ;
+					mLastPacketTimer.reset();
 				}
 				else
 				{
@@ -1961,6 +1995,7 @@ void LLViewerFetchedTexture::setIsMissingAsset()
 		LLAppViewer::getTextureFetch()->deleteRequest(getID(), true);
 		mHasFetcher = FALSE;
 		mIsFetching = FALSE;
+		mLastPacketTimer.reset();
 		mFetchState = 0;
 		mFetchPriority = 0;
 	}
@@ -1968,7 +2003,8 @@ void LLViewerFetchedTexture::setIsMissingAsset()
 }
 
 void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_callback,
-									   S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* userdata)
+									   S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* userdata, void* src,
+									   LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause)
 {
 	//
 	// Don't do ANYTHING here, just add it to the global callback list
@@ -1984,12 +2020,17 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call
 		mLoadedCallbackDesiredDiscardLevel = llmin(mLoadedCallbackDesiredDiscardLevel, (S8)discard_level) ;
 	}
 
-	LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata);
-	mLoadedCallbackList.push_back(entryp);
+	if(mPauseLoadedCallBacks && !pause)
+	{
+		unpauseLoadedCallbacks(src) ;
+	}
+	LLLoadedCallbackEntry* entryp = new LLLoadedCallbackEntry(loaded_callback, discard_level, keep_imageraw, userdata, src_callback_list, src, this, pause);
+	mLoadedCallbackList.push_back(entryp);	
+
 	mNeedsAux |= needs_aux;
 	if(keep_imageraw)
 	{
-		forceToSaveRawImage(discard_level) ;
+		forceToSaveRawImage(discard_level, true) ;
 	}
 	if (mNeedsAux && mAuxRawImage.isNull() && getDiscardLevel() >= 0)
 	{
@@ -1998,6 +2039,113 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call
 	}
 }
 
+void LLViewerFetchedTexture::deleteCallbackEntry(void* src)
+{
+	if(mLoadedCallbackList.empty())
+	{
+		return ;
+	}
+
+	S32 desired_discard = INVALID_DISCARD_LEVEL ;
+	S32 desired_raw_discard = INVALID_DISCARD_LEVEL ;
+	for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+			iter != mLoadedCallbackList.end(); )
+	{
+		LLLoadedCallbackEntry *entryp = *iter;
+		if(entryp->mSource == src)
+		{
+			// We never finished loading the image.  Indicate failure.
+			// Note: this allows mLoadedCallbackUserData to be cleaned up.
+			entryp->mCallback(FALSE, this, NULL, NULL, 0, TRUE, entryp->mUserData);
+			delete entryp;
+			iter = mLoadedCallbackList.erase(iter) ;
+		}
+		else
+		{
+			++iter;
+
+			desired_discard = llmin(desired_discard, entryp->mDesiredDiscard) ;
+			if(entryp->mNeedsImageRaw)
+			{
+				desired_raw_discard = llmin(desired_raw_discard, entryp->mDesiredDiscard) ;
+			}
+		}
+	}
+
+	mLoadedCallbackDesiredDiscardLevel = desired_discard;
+	if (mLoadedCallbackList.empty())
+	{
+		// If we have no callbacks, take us off of the image callback list.
+		gTextureList.mCallbackList.erase(this);
+		mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
+
+		if(mForceToSaveRawImage)
+		{
+			destroySavedRawImage() ;
+		}
+	}
+	else if(mForceToSaveRawImage && mBoostLevel != LLViewerTexture::BOOST_PREVIEW)
+	{
+		if(desired_raw_discard != INVALID_DISCARD_LEVEL)
+		{
+			mDesiredSavedRawDiscardLevel = desired_raw_discard ;
+		}
+		else
+		{
+			destroySavedRawImage() ;
+		}
+	}
+}
+
+void LLViewerFetchedTexture::unpauseLoadedCallbacks(void* src)
+{
+	BOOL need_raw = FALSE ;
+	for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+			iter != mLoadedCallbackList.end(); )
+	{
+		LLLoadedCallbackEntry *entryp = *iter++;
+		if(entryp->mSource == src)
+		{
+			entryp->mPaused = FALSE ;
+			if(entryp->mNeedsImageRaw)
+			{
+				need_raw = TRUE ;
+			}
+		}
+	}
+	mPauseLoadedCallBacks = FALSE ;
+	if(need_raw)
+	{
+		mForceToSaveRawImage = TRUE ;
+	}
+}
+
+void LLViewerFetchedTexture::pauseLoadedCallbacks(void* src)
+{
+	bool paused = true ;
+
+	for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
+			iter != mLoadedCallbackList.end(); )
+	{
+		LLLoadedCallbackEntry *entryp = *iter++;
+		if(entryp->mSource == src)
+		{
+			entryp->mPaused = TRUE ;
+		}
+		else if(!entryp->mPaused)
+		{
+			paused = false ;
+		}
+	}
+
+	if(paused)
+	{
+		mPauseLoadedCallBacks = TRUE ;//when set, loaded callback is paused.
+		resetTextureStats();
+		mForceToSaveRawImage = FALSE ;
+	}
+}
+
 bool LLViewerFetchedTexture::doLoadedCallbacks()
 {
 	if (mNeedsCreateTexture)
@@ -2023,6 +2171,11 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
 		// Remove ourself from the global list of textures with callbacks
 		gTextureList.mCallbackList.erase(this);
 	}
+	if(mPauseLoadedCallBacks)
+	{
+		destroyRawImage();
+		return res; //paused
+	}
 
 	S32 gl_discard = getDiscardLevel();
 
@@ -2432,10 +2585,12 @@ void LLViewerFetchedTexture::saveRawImage()
 	mLastReferencedSavedRawImageTime = sCurrentTime ;
 }
 
-void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard) 
+void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, bool from_callback) 
 { 
 	if(!mForceToSaveRawImage || mDesiredSavedRawDiscardLevel < 0 || mDesiredSavedRawDiscardLevel > desired_discard)
 	{
+		llassert_always(from_callback || mBoostLevel == LLViewerTexture::BOOST_PREVIEW) ;
+
 		mForceToSaveRawImage = TRUE ;
 		mDesiredSavedRawDiscardLevel = desired_discard ;
 	
@@ -2882,7 +3037,7 @@ void LLViewerMediaTexture::removeMediaImplFromTexture(const LLUUID& media_id)
 }
 
 //static
-void LLViewerMediaTexture::cleanup()
+void LLViewerMediaTexture::cleanUpClass()
 {
 	sMediaMap.clear() ;
 }
@@ -3291,7 +3446,7 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
 	}
 	mUpdateVirtualSizeTime = LLFrameTimer::getFrameCount() ;
 
-	if(mNeedsResetMaxVirtualSize)
+	if(!mMaxVirtualSizeResetCounter)
 	{
 		addTextureStats(0.f, FALSE) ;//reset
 	}
@@ -3324,9 +3479,9 @@ F32 LLViewerMediaTexture::getMaxVirtualSize()
 		}
 	}
 
-	if(mCanResetMaxVirtualSize)
+	if(mMaxVirtualSizeResetCounter > 0)
 	{
-		mNeedsResetMaxVirtualSize = TRUE ;
+		mMaxVirtualSizeResetCounter--;
 	}
 	reorganizeFaceList() ;
 	reorganizeVolumeList();
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 361f56e02f48a4830ac42c3cbb34a070626cf453..8b69408e4bdfa52dcafc482739ab94a7fbc2fcf6 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -66,17 +66,32 @@ class LLVOVolume ;
 
 class LLLoadedCallbackEntry
 {
+public:
+	typedef std::set< LLUUID > source_callback_list_t;
+
 public:
 	LLLoadedCallbackEntry(loaded_callback_func cb,
 						  S32 discard_level,
 						  BOOL need_imageraw, // Needs image raw for the callback
-						  void* userdata );
+						  void* userdata,
+						  source_callback_list_t* src_callback_list,
+						  void* source,
+						  LLViewerFetchedTexture* target,
+						  BOOL pause);
+	~LLLoadedCallbackEntry();
+	void removeTexture(LLViewerFetchedTexture* tex) ;
 
 	loaded_callback_func	mCallback;
 	S32						mLastUsedDiscard;
 	S32						mDesiredDiscard;
 	BOOL					mNeedsImageRaw;
+	BOOL                    mPaused;
 	void*					mUserData;
+	source_callback_list_t* mSourceCallbackList;
+	void*                   mSource;
+	
+public:
+	static void cleanUpCallbackList(LLLoadedCallbackEntry::source_callback_list_t* callback_list, void* src) ;
 };
 
 class LLTextureBar;
@@ -103,22 +118,23 @@ class LLViewerTexture : public LLTexture
 	enum EBoostLevel
 	{
 		BOOST_NONE 			= 0,
-		BOOST_AVATAR_BAKED	= 1,
-		BOOST_AVATAR		= 2,
-		BOOST_CLOUDS		= 3,
-		BOOST_SCULPTED      = 4,
+		BOOST_AVATAR_BAKED	,
+		BOOST_AVATAR		,
+		BOOST_CLOUDS		,
+		BOOST_SCULPTED      ,
 		
 		BOOST_HIGH 			= 10,
-		BOOST_TERRAIN		= 11, // has to be high priority for minimap / low detail
-		BOOST_SELECTED		= 12,
-		BOOST_HUD			= 13,
-		BOOST_AVATAR_BAKED_SELF	= 14,
-		BOOST_ICON			= 15,
-		BOOST_UI			= 16,
-		BOOST_PREVIEW		= 17,
-		BOOST_MAP			= 18,
-		BOOST_MAP_VISIBLE	= 19,
-		BOOST_AVATAR_SELF	= 20, // needed for baking avatar
+		BOOST_BUMP          ,
+		BOOST_TERRAIN		, // has to be high priority for minimap / low detail
+		BOOST_SELECTED		,
+		BOOST_HUD			,
+		BOOST_AVATAR_BAKED_SELF	,
+		BOOST_ICON			,
+		BOOST_UI			,
+		BOOST_PREVIEW		,
+		BOOST_MAP			,
+		BOOST_MAP_VISIBLE	,
+		BOOST_AVATAR_SELF	, // needed for baking avatar
 		BOOST_MAX_LEVEL,
 
 		//other texture Categories
@@ -144,7 +160,6 @@ class LLViewerTexture : public LLTexture
 
 public:	
 	static void initClass();
-	static void cleanupClass();
 	static void updateClass(const F32 velocity, const F32 angular_velocity) ;
 	
 	LLViewerTexture(BOOL usemipmaps = TRUE);
@@ -166,7 +181,8 @@ class LLViewerTexture : public LLTexture
 
 	void addTextureStats(F32 virtual_size, BOOL needs_gltexture = TRUE) const;
 	void resetTextureStats();	
-	void setResetMaxVirtualSizeFlag(bool flag) ;
+	void setMaxVirtualSizeResetInterval(S32 interval)const {mMaxVirtualSizeResetInterval = interval;}
+	void resetMaxVirtualSizeResetCounter()const {mMaxVirtualSizeResetCounter = mMaxVirtualSizeResetInterval;}
 
 	virtual F32  getMaxVirtualSize() ;
 
@@ -248,7 +264,7 @@ class LLViewerTexture : public LLTexture
 
 	/*virtual*/ void updateBindStatsForTester() ;
 protected:
-	void cleanup() ;
+	virtual void cleanup() ;
 	void init(bool firstinit) ;	
 	void reorganizeFaceList() ;
 	void reorganizeVolumeList() ;
@@ -264,10 +280,10 @@ class LLViewerTexture : public LLTexture
 	S32 mFullHeight;
 	BOOL  mUseMipMaps ;
 	S8  mComponents;
-	bool mCanResetMaxVirtualSize;
-	mutable F32 mMaxVirtualSize;	// The largest virtual size of the image, in pixels - how much data to we need?
 	mutable S8  mNeedsGLTexture;
-	mutable BOOL mNeedsResetMaxVirtualSize ;
+	mutable F32 mMaxVirtualSize;	// The largest virtual size of the image, in pixels - how much data to we need?	
+	mutable S32  mMaxVirtualSizeResetCounter ;
+	mutable S32  mMaxVirtualSizeResetInterval;
 	mutable F32 mAdditionalDecodePriority;  // priority add to mDecodePriority.
 	LLFrameTimer mLastReferencedTimer;	
 
@@ -368,10 +384,13 @@ class LLViewerFetchedTexture : public LLViewerTexture
 	// Set callbacks to get called when the image gets updated with higher 
 	// resolution versions.
 	void setLoadedCallback(loaded_callback_func cb,
-						   S32 discard_level, BOOL keep_imageraw, BOOL needs_aux,
-						   void* userdata);
+						   S32 discard_level, BOOL keep_imageraw, BOOL needs_aux, void* src,
+						   void* userdata, LLLoadedCallbackEntry::source_callback_list_t* src_callback_list, BOOL pause = FALSE);
 	bool hasCallbacks() { return mLoadedCallbackList.empty() ? false : true; }	
+	void pauseLoadedCallbacks(void* src);
+	void unpauseLoadedCallbacks(void* src);
 	bool doLoadedCallbacks();
+	void deleteCallbackEntry(void* src);
 
 	void addToCreateTexture();
 
@@ -449,7 +468,7 @@ class LLViewerFetchedTexture : public LLViewerTexture
 	S32         getCachedRawImageLevel() const {return mCachedRawDiscardLevel;}
 	BOOL        isCachedRawImageReady() const {return mCachedRawImageReady ;}
 	BOOL        isRawImageValid()const { return mIsRawImageValid ; }	
-	void        forceToSaveRawImage(S32 desired_discard = 0) ;
+	void        forceToSaveRawImage(S32 desired_discard = 0, bool from_callback = false) ;
 	/*virtual*/ void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ;
 	void        destroySavedRawImage() ;
 	LLImageRaw* getSavedRawImage() ;
@@ -466,7 +485,7 @@ class LLViewerFetchedTexture : public LLViewerTexture
 
 private:
 	void init(bool firstinit) ;
-	void cleanup() ;
+	/*virtual*/ void cleanup() ;
 
 	void saveRawImage() ;
 	void setCachedRawImage() ;
@@ -515,6 +534,7 @@ class LLViewerFetchedTexture : public LLViewerTexture
 
 	typedef std::list<LLLoadedCallbackEntry*> callback_list_t;
 	S8              mLoadedCallbackDesiredDiscardLevel;
+	BOOL            mPauseLoadedCallBacks;
 	callback_list_t mLoadedCallbackList;
 
 	LLPointer<LLImageRaw> mRawImage;
@@ -638,7 +658,7 @@ class LLViewerMediaTexture : public LLViewerTexture
 
 public:
 	static void updateClass() ;
-	static void cleanup() ;	
+	static void cleanUpClass() ;	
 
 	static LLViewerMediaTexture* findMediaTexture(const LLUUID& media_id) ;
 	static void removeMediaImplFromTexture(const LLUUID& media_id) ;
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index 1e3311dafeb77585cff6675b17f06963fb4a64fc..b3aff303244a93269ecffe539eab383fc7add585 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -1219,7 +1219,7 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d
 		delete [] data;
 		return;
 	}
-	image->getLastPacketTimer()->reset();
+	//image->getLastPacketTimer()->reset();
 	bool res = LLAppViewer::getTextureFetch()->receiveImageHeader(msg->getSender(), id, codec, packets, totalbytes, data_size, data);
 	if (!res)
 	{
@@ -1283,7 +1283,7 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d
 		delete [] data;
 		return;
 	}
-	image->getLastPacketTimer()->reset();
+	//image->getLastPacketTimer()->reset();
 	bool res = LLAppViewer::getTextureFetch()->receiveImagePacket(msg->getSender(), id, packet_num, data_size, data);
 	if (!res)
 	{
@@ -1406,7 +1406,7 @@ LLUIImagePtr LLUIImageList::loadUIImage(LLViewerFetchedTexture* imagep, const st
 	datap->mImageName = name;
 	datap->mImageScaleRegion = scale_rect;
 
-	imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap);
+	imagep->setLoadedCallback(onUIImageLoaded, 0, FALSE, FALSE, datap, NULL, NULL);
 
 	return new_imagep;
 }
diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp
index 316588c9824ec58536a5df8a101f7074dc6ade65..1954a573d4a3f3d98c17695482d507c6a40c47fb 100644
--- a/indra/newview/llvoavatar.cpp
+++ b/indra/newview/llvoavatar.cpp
@@ -677,7 +677,8 @@ LLVOAvatar::LLVOAvatar(const LLUUID& id,
 	mFullyLoaded(FALSE),
 	mPreviousFullyLoaded(FALSE),
 	mFullyLoadedInitialized(FALSE),
-	mSupportsAlphaLayers(FALSE)
+	mSupportsAlphaLayers(FALSE),
+	mLoadedCallbacksPaused(FALSE)
 {
 	LLMemType mt(LLMemType::MTYPE_AVATAR);
 	//VTResume();  // VTune
@@ -847,6 +848,7 @@ void LLVOAvatar::markDead()
 		sNumVisibleChatBubbles--;
 	}
 	mVoiceVisualizer->markDead();
+	LLLoadedCallbackEntry::cleanUpCallbackList(&mCallbackTextureList, this) ;
 	LLViewerObject::markDead();
 }
 
@@ -2227,12 +2229,14 @@ BOOL LLVOAvatar::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 	{
 		llinfos << "Warning!  Idle on dead avatar" << llendl;
 		return TRUE;
-	}
+	}	
 
  	if (!(gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_AVATAR)))
 	{
 		return TRUE;
 	}
+
+	checkTextureLoading() ;
 	
 	// force immediate pixel area update on avatars using last frames data (before drawable or camera updates)
 	setPixelAreaAndAngle(gAgent);
@@ -4138,6 +4142,7 @@ void LLVOAvatar::updateTextures()
 	{
 		render_avatar = isVisible() && !mCulled;
 	}
+	checkTextureLoading() ;
 
 	std::vector<BOOL> layer_baked;
 	// GL NOT ACTIVE HERE - *TODO
@@ -4178,7 +4183,7 @@ void LLVOAvatar::updateTextures()
 				}
 			}
 		}
-		if (isIndexBakedTexture((ETextureIndex) texture_index))
+		if (isIndexBakedTexture((ETextureIndex) texture_index) && render_avatar)
 		{
 			const S32 boost_level = getAvatarBakedBoostLevel();
 			imagep = LLViewerTextureManager::staticCastToFetchedTexture(getImage(texture_index,0), TRUE);
@@ -4194,7 +4199,7 @@ void LLVOAvatar::updateTextures()
 										 << " on host " << getRegion()->getHost() << llendl;
 			}
 
-			addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level );
+			addBakedTextureStats( imagep, mPixelArea, texel_area_ratio, boost_level );			
 		}
 	}
 
@@ -4218,13 +4223,66 @@ void LLVOAvatar::addLocalTextureStats( ETextureIndex idx, LLViewerFetchedTexture
 }
 
 			    
+void LLVOAvatar::checkTextureLoading()
+{
+	static const F32 MAX_INVISIBLE_WAITING_TIME = 30.f ; //seconds
+
+	BOOL pause = !isVisible() ;
+	if(!pause)
+	{
+		mInvisibleTimer.reset() ;
+	}
+	if(mLoadedCallbacksPaused == pause)
+	{
+		return ; 
+	}
+	
+	if(mCallbackTextureList.empty()) //when is self or no callbacks. Note: this list for self is always empty.
+	{
+		mLoadedCallbacksPaused = pause ;
+		return ; //nothing to check.
+	}
+	
+	if(pause && mInvisibleTimer.getElapsedTimeF32() < MAX_INVISIBLE_WAITING_TIME)
+	{
+		return ;
+	}
+	
+	for(LLLoadedCallbackEntry::source_callback_list_t::iterator iter = mCallbackTextureList.begin();
+		iter != mCallbackTextureList.end(); ++iter)
+	{
+		LLViewerFetchedTexture* tex = gTextureList.findImage(*iter) ;
+		if(tex)
+		{
+			if(pause)//pause texture fetching.
+			{
+				tex->pauseLoadedCallbacks(this) ;
+			}
+			else//unpause
+			{
+				static const F32 START_AREA = 100.f ;
+
+				tex->unpauseLoadedCallbacks(this) ;
+				tex->addTextureStats(START_AREA); //jump start the fetching again
+			}
+		}		
+	}			
+	
+	mLoadedCallbacksPaused = pause ;
+	return ;
+}
+
 void LLVOAvatar::addBakedTextureStats( LLViewerFetchedTexture* imagep, F32 pixel_area, F32 texel_area_ratio, S32 boost_level)
 {
-	mMaxPixelArea = llmax(pixel_area, mMaxPixelArea);
-	mMinPixelArea = llmin(pixel_area, mMinPixelArea);
+	//if this function is not called for the last 512 frames, the texture pipeline will stop fetching this texture.
+	static const S32  MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL = 512 ; //frames	
+
 	imagep->resetTextureStats();
-	imagep->setResetMaxVirtualSizeFlag(false) ;
 	imagep->setCanUseHTTP(false) ; //turn off http fetching for baked textures.
+	imagep->setMaxVirtualSizeResetInterval(MAX_TEXTURE_VIRTURE_SIZE_RESET_INTERVAL);
+
+	mMaxPixelArea = llmax(pixel_area, mMaxPixelArea);
+	mMinPixelArea = llmin(pixel_area, mMinPixelArea);	
 	imagep->addTextureStats(pixel_area / texel_area_ratio);
 	imagep->setBoostLevel(boost_level);
 	if(boost_level == LLViewerTexture::BOOST_AVATAR_BAKED_SELF)
@@ -6144,6 +6202,15 @@ void LLVOAvatar::updateMeshTextures()
 
 	const BOOL self_customizing = isSelf() && gAgentCamera.cameraCustomizeAvatar(); // During face edit mode, we don't use baked textures
 	const BOOL other_culled = !isSelf() && mCulled;
+	LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ;
+	void* callback_src = NULL ;
+	BOOL paused = FALSE;
+	if(!isSelf())
+	{
+		callback_src = this ;
+		src_callback_list = &mCallbackTextureList ;
+		paused = mLoadedCallbacksPaused ;
+	}
 
 	std::vector<BOOL> is_layer_baked;
 	is_layer_baked.resize(mBakedTextureDatas.size(), false);
@@ -6214,10 +6281,12 @@ void LLVOAvatar::updateMeshTextures()
 			{
 				mBakedTextureDatas[i].mIsLoaded = FALSE;
 				if ( (baked_img->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) )
-				{
-					baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ));	
+				{			
+					baked_img->setLoadedCallback(onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), 
+						callback_src, src_callback_list, paused);	
 				}
-				baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ) );
+				baked_img->setLoadedCallback(onBakedTextureLoaded, SWITCH_TO_BAKED_DISCARD, FALSE, FALSE, new LLUUID( mID ), 
+					callback_src, src_callback_list, paused );
 			}
 		}
 		else if (mBakedTextureDatas[i].mTexLayerSet 
@@ -6677,6 +6746,16 @@ void LLVOAvatar::onFirstTEMessageReceived()
 	{
 		mFirstTEMessageReceived = TRUE;
 
+		LLLoadedCallbackEntry::source_callback_list_t* src_callback_list = NULL ;
+		void* callback_src = NULL ;
+		BOOL paused = FALSE ;
+		if(!isSelf())
+		{
+			callback_src = this ;
+			src_callback_list = &mCallbackTextureList ;
+			paused = mLoadedCallbacksPaused ;
+		}
+
 		for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 		{
 			const BOOL layer_baked = isTextureDefined(mBakedTextureDatas[i].mTextureIndex);
@@ -6690,9 +6769,11 @@ void LLVOAvatar::onFirstTEMessageReceived()
 				// If we have more than one texture for the other baked layers, we'll want to call this for them too.
 				if ( (image->getID() != IMG_INVISIBLE) && ((i == BAKED_HEAD) || (i == BAKED_UPPER) || (i == BAKED_LOWER)) )
 				{
-					image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ));
+					image->setLoadedCallback( onBakedTextureMasksLoaded, MORPH_MASK_REQUESTED_DISCARD, TRUE, TRUE, new LLTextureMaskData( mID ), 
+						callback_src, src_callback_list, paused);
 				}
-				image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ) );
+				image->setLoadedCallback( onInitialBakedTextureLoaded, MAX_DISCARD_LEVEL, FALSE, FALSE, new LLUUID( mID ), 
+					callback_src, src_callback_list, paused );
 			}
 		}
 
diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h
index 4259bb8e7382018c5b79e7a1593f49d723aa24d2..3dad9198750c5807535d9b3f7245c5c6a722dd2f 100644
--- a/indra/newview/llvoavatar.h
+++ b/indra/newview/llvoavatar.h
@@ -263,6 +263,8 @@ class LLVOAvatar :
 	S32				mFullyLoadedFrameCounter;
 	LLFrameTimer	mFullyLoadedTimer;
 	LLFrameTimer	mRuthTimer;
+protected:
+	LLFrameTimer    mInvisibleTimer;
 	
 /**                    State
  **                                                                            **
@@ -499,7 +501,8 @@ class LLVOAvatar :
 	};
 	typedef std::vector<BakedTextureData> 	bakedtexturedata_vec_t;
 	bakedtexturedata_vec_t 					mBakedTextureDatas;
-
+	LLLoadedCallbackEntry::source_callback_list_t mCallbackTextureList ; 
+	BOOL mLoadedCallbacksPaused;
 	//--------------------------------------------------------------------
 	// Local Textures
 	//--------------------------------------------------------------------
@@ -519,7 +522,7 @@ class LLVOAvatar :
 	virtual const LLTextureEntry* getTexEntry(const U8 te_num) const;
 	virtual void setTexEntry(const U8 index, const LLTextureEntry &te);
 
-
+	void checkTextureLoading() ;
 	//--------------------------------------------------------------------
 	// Layers
 	//--------------------------------------------------------------------
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index 982d9c375cdb999aae652965d6c487a7e55258da..4edbbb7402ada511837fa4fa8601043f215860e5 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -1632,8 +1632,8 @@ void LLVOAvatarSelf::setLocalTexture(ETextureIndex type, LLViewerTexture* src_te
 					}
 				}
 				else
-				{
-					tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type));
+				{					
+					tex->setLoadedCallback(onLocalTextureLoaded, desired_discard, TRUE, FALSE, new LLAvatarTexData(getID(), type), NULL, NULL);
 				}
 			}
 			tex->setMinDiscardLevel(desired_discard);
@@ -2032,7 +2032,7 @@ void LLVOAvatarSelf::addLocalTextureStats( ETextureIndex type, LLViewerFetchedTe
 			imagep->setBoostLevel(getAvatarBoostLevel());
 
 			imagep->resetTextureStats();
-			imagep->setResetMaxVirtualSizeFlag(false) ;
+			imagep->setMaxVirtualSizeResetInterval(16);
 			imagep->addTextureStats( desired_pixels / texel_area_ratio );
 			imagep->setAdditionalDecodePriority(1.0f) ;
 			imagep->forceUpdateBindStats() ;
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index 2eb233ddd9e7cdba083cbe5f34ff7b6913bdc5dc..ec9c78ee5317cc0d51cc75b19e48a147e547df0b 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -444,8 +444,8 @@ BOOL LLWearable::importFile( LLFILE* file )
 			delete mSavedTEMap[te];
 		}
 
-		image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te));
-
+		image->setBoostLevel(LLViewerTexture::BOOST_AVATAR_SELF) ;
+		image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te), NULL, NULL);
 
 		LLUUID textureid(text_buffer);
 		mTEMap[te] = new LLLocalTextureObject(image, textureid);
diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h
index 6b6067fd27cee241b5faca2419beb5a645294928..9ca8a9c3f9c468e20eada3d2b651028e0e1d6bfb 100644
--- a/indra/newview/llwearable.h
+++ b/indra/newview/llwearable.h
@@ -164,7 +164,7 @@ class LLWearable
 
 	te_map_t mTEMap;				// maps TE to LocalTextureObject
 	te_map_t mSavedTEMap;			// last saved version of TEMap
-	LLUUID				mItemID;  // ID of the inventory item in the agent's inventory
+	LLUUID				mItemID;  // ID of the inventory item in the agent's inventory	
 };
 
 #endif  // LL_LLWEARABLE_H
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index cf165f8f660845a75278d15074cfdf304b568dea..868322699ef4438e50aad0feb02d359ebc5a8614 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -621,6 +621,7 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
 	U32 mask = 0;					// mask of selected items' types
 	U32 n_items = ids.size();		// number of selected items
 	U32 n_worn = 0;					// number of worn items among the selected ones
+	U32 n_already_worn = 0;			// number of items worn of same type as selected items
 	U32 n_links = 0;				// number of links among the selected items
 	U32 n_editable = 0;				// number of editable items among the selected ones
 
@@ -638,10 +639,11 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
 
 		updateMask(mask, item->getType());
 
-		bool is_link = item->getIsLinkType();
-		bool is_worn = get_is_item_worn(id);
-		bool is_editable = gAgentWearables.isWearableModifiable(id);
-
+		const LLWearableType::EType wearable_type = item->getWearableType();
+		const bool is_link = item->getIsLinkType();
+		const bool is_worn = get_is_item_worn(id);
+		const bool is_editable = gAgentWearables.isWearableModifiable(id);
+		const bool is_already_worn = gAgentWearables.selfHasWearable(wearable_type);
 		if (is_worn)
 		{
 			++n_worn;
@@ -654,14 +656,20 @@ void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu
 		{
 			++n_links;
 		}
+		if (is_already_worn)
+		{
+			++n_already_worn;
+		}
 	} // for
 
 	bool standalone = mParent ? mParent->isStandalone() : false;
 
 	// *TODO: eliminate multiple traversals over the menu items
-	setMenuItemVisible(menu, "wear_add",			mask == MASK_CLOTHING && n_worn == 0);
-	setMenuItemEnabled(menu, "wear_add",			n_items == 1 && canAddWearable(ids.front()));
-	setMenuItemVisible(menu, "wear",				n_worn == 0);
+	setMenuItemVisible(menu, "wear_wear", 			n_already_worn == 0);
+	setMenuItemEnabled(menu, "wear_wear", 			n_already_worn == 0);
+	setMenuItemVisible(menu, "wear_add",			mask == MASK_CLOTHING && n_worn == 0 && n_already_worn != 0);
+	setMenuItemEnabled(menu, "wear_add",			n_items == 1 && canAddWearable(ids.front()) && n_already_worn != 0);
+	setMenuItemVisible(menu, "wear_replace",		n_worn == 0 && n_already_worn != 0);
 	//visible only when one item selected and this item is worn
 	setMenuItemVisible(menu, "edit",				!standalone && mask & (MASK_CLOTHING|MASK_BODYPART) && n_worn == n_items && n_worn == 1);
 	setMenuItemEnabled(menu, "edit",				n_editable == 1 && n_worn == 1 && n_items == 1);
diff --git a/indra/newview/skins/default/xui/da/sidepanel_item_info.xml b/indra/newview/skins/default/xui/da/sidepanel_item_info.xml
index ff20e21999123090e6b62e92d384e0e2536bc5a0..46f7c74a9aa2d0fdd050527ee2518b56f3c5ae86 100644
--- a/indra/newview/skins/default/xui/da/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/da/sidepanel_item_info.xml
@@ -16,7 +16,7 @@
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
 	<text name="title" value="Profil for genstand"/>
-	<text name="where" value="(Beholdning)"/>
+	<text name="origin" value="(Beholdning)"/>
 	<panel label="">
 		<text name="LabelItemNameTitle">
 			Navn:
diff --git a/indra/newview/skins/default/xui/da/strings.xml b/indra/newview/skins/default/xui/da/strings.xml
index 66c75aca4c1f376e2b082014f7279998cfc78f49..32f37c038e24fac21def4b821c0b643da16dabd0 100644
--- a/indra/newview/skins/default/xui/da/strings.xml
+++ b/indra/newview/skins/default/xui/da/strings.xml
@@ -1065,7 +1065,7 @@
 	<string name="InvFolder Gestures">
 		Bevægelser
 	</string>
-	<string name="InvFolder favorite">
+	<string name="InvFolder Favorite">
 		Favoritter
 	</string>
 	<string name="InvFolder Current Outfit">
diff --git a/indra/newview/skins/default/xui/de/sidepanel_item_info.xml b/indra/newview/skins/default/xui/de/sidepanel_item_info.xml
index 09935019ab8aec90311efb4852c1e0760a8611f3..77b607680991d24dd8545c8cd53e992043725258 100644
--- a/indra/newview/skins/default/xui/de/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/de/sidepanel_item_info.xml
@@ -16,7 +16,7 @@
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
 	<text name="title" value="Objektprofil"/>
-	<text name="where" value="(Inventar)"/>
+	<text name="origin" value="(Inventar)"/>
 	<panel label="">
 		<text name="LabelItemNameTitle">
 			Name:
diff --git a/indra/newview/skins/default/xui/de/strings.xml b/indra/newview/skins/default/xui/de/strings.xml
index 67b7d6c1d2bf29cc5ee1ffa105f3f30f73f6377c..f6ae17239a9cc4df5d49e9dd8f4782c7f0d8a271 100644
--- a/indra/newview/skins/default/xui/de/strings.xml
+++ b/indra/newview/skins/default/xui/de/strings.xml
@@ -1095,7 +1095,7 @@
 	<string name="InvFolder Gestures">
 		Gesten
 	</string>
-	<string name="InvFolder favorite">
+	<string name="InvFolder Favorite">
 		Favoriten
 	</string>
 	<string name="InvFolder Current Outfit">
diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml
index 14aacafa9f21498f150373ce8efbf85049ebb198..68e36ff0b37a787797995317d92625ba8d22217b 100644
--- a/indra/newview/skins/default/xui/en/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_about_land.xml
@@ -191,9 +191,10 @@
              type="string"
              length="1"
              follows="left|top"
-             height="16"
+             height="20"
              layout="topleft"
              left_pad="2"
+             valign="center" 
              name="ContentRatingText"
              top_delta="0"
              width="250">
@@ -207,7 +208,7 @@
              layout="topleft"
              left="10"
              name="Owner:"
-             top_pad="5"
+             top_pad="1"
              width="100">
                 Owner:
             </text>
@@ -729,8 +730,10 @@ Leyla Linden               </text>
              height="16"
              layout="topleft"
              left_pad="10"
+             top_delta="-3" 
              mouse_opaque="false"
              name="region_maturity_text"
+             valign="center" 
              width="150">
                 Adult
             </text>
@@ -743,6 +746,7 @@ Leyla Linden               </text>
              left="10"
              mouse_opaque="false"
              name="resellable_lbl"
+             top_pad="9" 
              width="100">
                 Resale:
             </text>
@@ -1924,6 +1928,8 @@ Only large parcels can be listed in search.
              left_delta="0"
              name="public_access"
              top_pad="5"
+             label_text.valign="center"
+             label_text.v_pad="-7" 
              width="278" />
             <text
              type="string"
diff --git a/indra/newview/skins/default/xui/en/menu_inventory.xml b/indra/newview/skins/default/xui/en/menu_inventory.xml
index 221457ac1fa577a5b6367ea0dfaecd59894562e4..5c19f1932d334c2979644e4b08873fee0f043406 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory.xml
@@ -606,7 +606,7 @@
     </menu_item_call>
     <menu_item_separator
      layout="topleft" 
-     name="Attach Separator"/>
+     name="Wearable And Object Separator"/>
     <menu_item_call
      label="Detach From Yourself"
      layout="topleft"
@@ -629,10 +629,10 @@
     <menu_item_call
      label="Wear"
      layout="topleft"
-     name="Object Wear">
+     name="Wearable And Object Wear">
         <menu_item_call.on_click
          function="Inventory.DoToSelected"
-         parameter="attach" />
+         parameter="wear" />
     </menu_item_call>
     <menu
      label="Attach To"
@@ -642,9 +642,6 @@
      label="Attach To HUD"
      layout="topleft"
      name="Attach To HUD" />
-    <menu_item_separator
-     layout="topleft" 
-     name="Wearable Separator"/>
     <menu_item_call
      label="Edit"
      layout="topleft"
@@ -653,14 +650,6 @@
          function="Inventory.DoToSelected"
          parameter="edit" />
     </menu_item_call>
-    <menu_item_call
-     label="Wear"
-     layout="topleft"
-     name="Wearable Wear">
-        <menu_item_call.on_click
-         function="Inventory.DoToSelected"
-         parameter="wear" />
-    </menu_item_call>
     <menu_item_call
      label="Add"
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
index 23eb89e448af8297ffe7355e470e23a9da8bc749..c3adbb7904e10029cb31ac13110d55082adccdf9 100644
--- a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
+++ b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
@@ -4,10 +4,17 @@
     <menu_item_call
      label="Replace"
      layout="topleft"
-     name="wear">
+     name="wear_replace">
         <on_click
          function="Wearable.Wear" />
     </menu_item_call>
+    <menu_item_call
+     label="Wear"
+     layout="topleft"
+     name="wear_wear">
+        <on_click
+         function="Wearable.Add" />
+    </menu_item_call>
     <menu_item_call
      label="Add"
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
index f3912b513302cd55f131e2d3a04d8ef6ee81c7f1..50df227fbf09d3e18cfeb0dc2cab826dda29f237 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
@@ -26,6 +26,14 @@
     	 name="acquiredDate">
         [wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
+	<panel.string
+		 name="origin_inventory">
+        (Inventory)
+	</panel.string>
+	<panel.string
+		 name="origin_inworld">
+        (Inworld)
+	</panel.string>
 	<icon
      	 follows="top|right"
      	 height="18"
@@ -65,7 +73,7 @@
      height="13"
      layout="topleft"
      left="45"
-     name="where"
+     name="origin"
      text_color="LtGray_50"
      value="(Inventory)"
      width="150" />
diff --git a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
index ef7ec74b5a2fd5bad9cd727d9acf5e9f193366ad..843015cb8bc546314e050657344a74313c8433f5 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
@@ -85,7 +85,7 @@
      left="45"
      name="where"
      text_color="LtGray_50"
-     value="(inworld)"
+     value="(Inworld)"
      width="150" />
 	<panel
          follows="all"
diff --git a/indra/newview/skins/default/xui/en/widgets/textbase.xml b/indra/newview/skins/default/xui/en/widgets/textbase.xml
index f4dc192bc3280ed2043e458466a964944e004abf..b2da2147c1682442298cd3ae8f57500b1321fbe1 100644
--- a/indra/newview/skins/default/xui/en/widgets/textbase.xml
+++ b/indra/newview/skins/default/xui/en/widgets/textbase.xml
@@ -1,3 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <textbase clip_partial="false"
+          halign="left" 
+          valign="top" 
           font="SansSerif"/>
diff --git a/indra/newview/skins/default/xui/es/sidepanel_item_info.xml b/indra/newview/skins/default/xui/es/sidepanel_item_info.xml
index d647f361254f2310db5c1e2e0d4d0bde05d56687..d2c1295c765c7fa23be34f552ad17cd0b3ae7637 100644
--- a/indra/newview/skins/default/xui/es/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/es/sidepanel_item_info.xml
@@ -16,7 +16,7 @@
 		[wkday,datetime,local][day,datetime,local] [mth,datetime,local] [year,datetime,local][hour,datetime,local]:[min,datetime,local]:[second,datetime,local]
 	</panel.string>
 	<text name="title" value="Perfil del elemento"/>
-	<text name="where" value="(Inventario)"/>
+	<text name="origin" value="(Inventario)"/>
 	<panel label="">
 		<text name="LabelItemNameTitle">
 			Nombre:
diff --git a/indra/newview/skins/default/xui/es/strings.xml b/indra/newview/skins/default/xui/es/strings.xml
index 1697b297183df60f9e8dcfe1f8545951f397eced..717665f4d9af3814d5711077e5b16f907d20d2b7 100644
--- a/indra/newview/skins/default/xui/es/strings.xml
+++ b/indra/newview/skins/default/xui/es/strings.xml
@@ -1068,7 +1068,7 @@
 	<string name="InvFolder Gestures">
 		Gestos
 	</string>
-	<string name="InvFolder favorite">
+	<string name="InvFolder Favorite">
 		Favoritos
 	</string>
 	<string name="InvFolder Current Outfit">
diff --git a/indra/newview/skins/default/xui/fr/sidepanel_item_info.xml b/indra/newview/skins/default/xui/fr/sidepanel_item_info.xml
index 297cdd28397be6887d0499a11424a7bfabb260e8..db7e6a936571dafbc6f4e39cca331b98b4257d38 100644
--- a/indra/newview/skins/default/xui/fr/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/fr/sidepanel_item_info.xml
@@ -16,7 +16,7 @@
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
 	<text name="title" value="Profil de l&apos;article"/>
-	<text name="where" value="(inventaire)"/>
+	<text name="origin" value="(inventaire)"/>
 	<panel label="">
 		<text name="LabelItemNameTitle">
 			Nom :
diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml
index 95e081b574b3e414c79b738a47925000931a6a3c..604398a6580c732429b7a56b5a47b8ab935febe9 100644
--- a/indra/newview/skins/default/xui/fr/strings.xml
+++ b/indra/newview/skins/default/xui/fr/strings.xml
@@ -1095,7 +1095,7 @@
 	<string name="InvFolder Gestures">
 		Gestes
 	</string>
-	<string name="InvFolder favorite">
+	<string name="InvFolder Favorite">
 		Favoris
 	</string>
 	<string name="InvFolder Current Outfit">
diff --git a/indra/newview/skins/default/xui/it/sidepanel_item_info.xml b/indra/newview/skins/default/xui/it/sidepanel_item_info.xml
index 9886cbcf04c0e4ce690552a1f64ddb9ec04e2077..37a19b2e5039b28c8b31e9c76b98fc32a8ed74a7 100644
--- a/indra/newview/skins/default/xui/it/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/it/sidepanel_item_info.xml
@@ -16,7 +16,7 @@
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
 	<text name="title" value="Profilo articolo"/>
-	<text name="where" value="(Inventario)"/>
+	<text name="origin" value="(Inventario)"/>
 	<panel label="">
 		<text name="LabelItemNameTitle">
 			Nome:
diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml
index 03747abb59e457c274c79b00c7f2779e29a443c2..aeaf8098b97e1b7834775e8a34ef7145917bbfb9 100644
--- a/indra/newview/skins/default/xui/it/strings.xml
+++ b/indra/newview/skins/default/xui/it/strings.xml
@@ -1074,7 +1074,7 @@
 	<string name="InvFolder Gestures">
 		Gesture
 	</string>
-	<string name="InvFolder favorite">
+	<string name="InvFolder Favorite">
 		Preferiti
 	</string>
 	<string name="InvFolder Current Outfit">
diff --git a/indra/newview/skins/default/xui/ja/sidepanel_item_info.xml b/indra/newview/skins/default/xui/ja/sidepanel_item_info.xml
index 584524e3b1a5056778d330cc665c19e02616dc58..b1946081810b4338d54da0b89211815faeec14a0 100644
--- a/indra/newview/skins/default/xui/ja/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/ja/sidepanel_item_info.xml
@@ -16,7 +16,7 @@
 		[year,datetime,local] [mth,datetime,local] [day,datetime,local] [wkday,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local]
 	</panel.string>
 	<text name="title" value="アイテムのプロフィール"/>
-	<text name="where" value="(持ち物)"/>
+	<text name="origin" value="(持ち物)"/>
 	<panel label="">
 		<text name="LabelItemNameTitle">
 			名前:
diff --git a/indra/newview/skins/default/xui/ja/strings.xml b/indra/newview/skins/default/xui/ja/strings.xml
index bf8541a73d7fa05ac951897bf7d5993508bca75f..619f9fc9efb6a30e4f8c442470252e2ca5afad95 100644
--- a/indra/newview/skins/default/xui/ja/strings.xml
+++ b/indra/newview/skins/default/xui/ja/strings.xml
@@ -1095,7 +1095,7 @@
 	<string name="InvFolder Gestures">
 		ジェスチャー
 	</string>
-	<string name="InvFolder favorite">
+	<string name="InvFolder Favorite">
 		お気に入り
 	</string>
 	<string name="InvFolder Current Outfit">
diff --git a/indra/newview/skins/default/xui/nl/strings.xml b/indra/newview/skins/default/xui/nl/strings.xml
index ae8d3b89dc134f3520623100f39d7507576589f3..25071b5460f11f6845f52a8b69af8d92988c7084 100644
--- a/indra/newview/skins/default/xui/nl/strings.xml
+++ b/indra/newview/skins/default/xui/nl/strings.xml
@@ -909,7 +909,7 @@
 	<string name="InvFolder Gestures">
 		Gebaren
 	</string>
-	<string name="InvFolder favorite">
+	<string name="InvFolder Favorite">
 		Favoriten
 	</string>
 	<string name="InvFolder Current Outfit">
diff --git a/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml b/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml
index 3b038a71028a4f8b06f0b24c588250f9982b5528..5f324490c240d38244164365130bd9237cec257f 100644
--- a/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/pl/sidepanel_item_info.xml
@@ -16,7 +16,7 @@
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
 	<text name="title" value="Profil Obiektu"/>
-	<text name="where" value="(Szafa)"/>
+	<text name="origin" value="(Szafa)"/>
 	<panel label="">
 		<text name="LabelItemNameTitle">
 			Nazwa:
diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml
index c72f783a5189840a5b01f7efdf7bfa69882578c6..f110052f6830a2e7e0f06c54c032006c96579af1 100644
--- a/indra/newview/skins/default/xui/pl/strings.xml
+++ b/indra/newview/skins/default/xui/pl/strings.xml
@@ -986,7 +986,7 @@
 	<string name="InvFolder Gestures">
 		Gesturki
 	</string>
-	<string name="InvFolder favorite">
+	<string name="InvFolder Favorite">
 		Ulubione
 	</string>
 	<string name="InvFolder Current Outfit">
diff --git a/indra/newview/skins/default/xui/pt/sidepanel_item_info.xml b/indra/newview/skins/default/xui/pt/sidepanel_item_info.xml
index 92895b10438f5284f092a002b407a813165ced0a..8189da5efbf2c8b50b6afe77b259c949670bf72c 100644
--- a/indra/newview/skins/default/xui/pt/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/pt/sidepanel_item_info.xml
@@ -16,7 +16,7 @@
 		[wkday,datetime,local] [mth,datetime,local] [day,datetime,local] [hour,datetime,local]:[min,datetime,local]:[second,datetime,local] [year,datetime,local]
 	</panel.string>
 	<text name="title" value="Perfil do item"/>
-	<text name="where" value="(Inventário)"/>
+	<text name="origin" value="(Inventário)"/>
 	<panel label="">
 		<text name="LabelItemNameTitle">
 			Nome:
diff --git a/indra/newview/skins/default/xui/pt/strings.xml b/indra/newview/skins/default/xui/pt/strings.xml
index 74ba7888e9c2c27d94580b0d565544e579bbc50e..ca32412058ca8d28901ee22cced56f4eb48202bf 100644
--- a/indra/newview/skins/default/xui/pt/strings.xml
+++ b/indra/newview/skins/default/xui/pt/strings.xml
@@ -1068,7 +1068,7 @@
 	<string name="InvFolder Gestures">
 		Gestos
 	</string>
-	<string name="InvFolder favorite">
+	<string name="InvFolder Favorite">
 		Favoritos
 	</string>
 	<string name="InvFolder Current Outfit">