Scott Lawrence avatar Scott Lawrence committed 5aabb04 Draft Merge

merge changes for DRTVWR-276

Comments (0)

Files changed (47)

 eb539c65e6ee26eea2bf373af2d0f4b52dc91289 DRTVWR-177
 a8057e1b9a1246b434a27405be35e030f7d28b0c 3.3.4-beta3
 888768f162d2c0a8de1dcc5fb9a08bd8bd120a6b DRTVWR-175
-4ad8a3afe40e0200309e3ada68932c4295ac2795 DRTVWR-179
 4281aa899fb2cedb7a9ca7ce91c5c29d4aa69594 DRTVWR-180
 5c08e1d8edd871807153603b690e3ee9dbb548aa DRTVWR-183
 6c75f220b103db1420919c8b635fe53e2177f318 3.3.4-beta4
 dd23d4da3bcb2ffda58569e759feb7c119982973 DRTVWR-224
 0bd3744ff060452aa13ff4992eafb381df7b1012 3.4.1-beta5
 29075f8c1abed53dcf195a59f61744e27a91108f DRTVWR-226
+fba99f381b8d4ad1b7b42fa4993b29998d95be18 DRTVWR-179
 49ed253c80bed7410e238eeab35a9f14cb034364 3.4.1-beta6
 468ca3268229011a59df99229b24315844b33d34 DRTVWR-227
 524da902713e8b60322640b9825101add4a7c497 3.4.1-beta7
 05d9f1dd7a954069af2a33abedb7713fa36a04cb 3.4.4-beta4
 7c6dfdc1b7a2ce0d8e3a8f3ce3058547ea065c0f DRTVWR-250
 b9ff9730daa53a541925300cbd02bb14575a5705 DRTVWR-277
+af6b711a97073431953b55ee808aaa09900c27e5 DRTVWR-276
           </map>
         </map>
       </map>
+      <key>nvapi</key>
+      <map>
+        <key>license</key>
+        <string>NVAPI</string>
+        <key>license_file</key>
+        <string>LICENSES/NVAPI_SDK_License_Agreement.pdf</string>
+        <key>name</key>
+        <string>nvapi</string>
+        <key>platforms</key>
+        <map>
+          <key>windows</key>
+          <map>
+            <key>archive</key>
+            <map>
+              <key>hash</key>
+              <string>baf519d36dffe4e4a59471450e391d01</string>
+              <key>url</key>
+              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/hg/repo/3p-nvapi/rev/267102/arch/CYGWIN/installer/nvapi-304-windows-20121116.tar.bz2</string>
+            </map>
+            <key>name</key>
+            <string>windows</string>
+          </map>
+        </map>
+      </map>
       <key>ogg-vorbis</key>
       <map>
         <key>license</key>

doc/contributions.txt

 	MAINT-873
 Nicky Dasmijn
 	VWR-29228
+	MAINT-873
 Nicky Perian
 	OPEN-1
 	STORM-1087

indra/cmake/NVAPI.cmake

+# -*- cmake -*-
+include(Prebuilt)
+
+set(NVAPI ON CACHE BOOL "Use NVAPI.")
+
+if (NVAPI)
+  if (WINDOWS)
+    use_prebuilt_binary(nvapi)
+    set(NVAPI_LIBRARY nvapi)
+  else (WINDOWS)
+    set(NVAPI_LIBRARY "")
+  endif (WINDOWS)
+else (NVAPI)
+  set(NVAPI_LIBRARY "")
+endif (NVAPI)
+

indra/llcharacter/llbvhconsts.h

 #ifndef LL_LLBVHCONSTS_H
 #define LL_LLBVHCONSTS_H
 
-const F32 MAX_ANIM_DURATION = 30.f;
+const F32 MAX_ANIM_DURATION = 60.f;
 
 typedef enum e_constraint_type
 	{

indra/llcharacter/llmotioncontroller.cpp

 //-----------------------------------------------------------------------------
 // Constants and statics
 //-----------------------------------------------------------------------------
+F32 LLMotionController::sCurrentTimeFactor = 1.f;
 LLMotionRegistry LLMotionController::sRegistry;
 
 //-----------------------------------------------------------------------------
 // Class Constructor
 //-----------------------------------------------------------------------------
 LLMotionController::LLMotionController()
-	: mTimeFactor(1.f),
+	: mTimeFactor(sCurrentTimeFactor),
 	  mCharacter(NULL),
 	  mAnimTime(0.f),
 	  mPrevTimerElapsed(0.f),

indra/llcharacter/llmotioncontroller.h

 
 	const LLFrameTimer& getFrameTimer() { return mTimer; }
 
+	static F32	getCurrentTimeFactor()				{ return sCurrentTimeFactor;	};
+	static void setCurrentTimeFactor(F32 factor)	{ sCurrentTimeFactor = factor;	};
+
 protected:
 	// internal operations act on motion instances directly
 	// as there can be duplicate motions per id during blending overlap
 	void deactivateStoppedMotions();
 
 protected:
-	F32					mTimeFactor;
+	F32					mTimeFactor;			// 1.f for normal speed
+	static F32			sCurrentTimeFactor;		// Value to use for initialization
 	static LLMotionRegistry	sRegistry;
 	LLPoseBlender		mPoseBlender;
 

indra/llmessage/llurlrequest.cpp

 			}
 		}
 
-		while(1)
+		bool keep_looping = true;
+		while(keep_looping)
 		{
 			CURLcode result;
 
 				case CURLE_FAILED_INIT:
 				case CURLE_COULDNT_CONNECT:
 					status = STATUS_NO_CONNECTION;
+					keep_looping = false;
 					break;
-				default:
+				default:			// CURLE_URL_MALFORMAT
 					llwarns << "URLRequest Error: " << result
 							<< ", "
 							<< LLCurl::strerror(result)
 							<< (mDetail->mURL.empty() ? "<EMPTY URL>" : mDetail->mURL)
 							<< llendl;
 					status = STATUS_ERROR;
+					keep_looping = false;
 					break;
 			}
 		}

indra/llwindow/llwindow.cpp

 BOOL gDebugClicks = FALSE;
 BOOL gDebugWindowProc = FALSE;
 
-const S32 gURLProtocolWhitelistCount = 3;
-const std::string gURLProtocolWhitelist[] = { "file:", "http:", "https:" };
+const S32 gURLProtocolWhitelistCount = 4;
+const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", "data:" };
 
 // CP: added a handler list - this is what's used to open the protocol and is based on registry entry
 //	   only meaningful difference currently is that file: protocols are opened using http:
 //	   since no protocol handler exists in registry for file:
 //     Important - these lists should match - protocol to handler
-const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" };	
+// Maestro: This list isn't referenced anywhere that I could find
+//const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" };	
 
 
 S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)

indra/llwindow/llwindow.h

 // Protocols, like "http" and "https" we support in URLs
 extern const S32 gURLProtocolWhitelistCount;
 extern const std::string gURLProtocolWhitelist[];
-extern const std::string gURLProtocolWhitelistHandler[];
+//extern const std::string gURLProtocolWhitelistHandler[];
 
 void simpleEscapeString ( std::string& stringIn  );
 

indra/llwindow/llwindowsdl.cpp

 // Must begin with protocol identifier.
 void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
 {
+	bool found = false;
+	S32 i;
+	for (i = 0; i < gURLProtocolWhitelistCount; i++)
+	{
+		if (escaped_url.find(gURLProtocolWhitelist[i]) != std::string::npos)
+		{
+			found = true;
+			break;
+		}
+	}
+
+	if (!found)
+	{
+		llwarns << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << llendl;
+		return;
+	}
+
 	llinfos << "spawn_web_browser: " << escaped_url << llendl;
 	
 #if LL_LINUX || LL_SOLARIS

indra/newview/CMakeLists.txt

 include(LScript)
 include(Linking)
 include(NDOF)
+include(NVAPI)
 include(GooglePerfTools)
 include(TemplateCheck)
 include(UI)
     ${LLCOREHTTP_LIBRARIES}
     ${LLCOMMON_LIBRARIES}
     ${NDOF_LIBRARY}
+    ${NVAPI_LIBRARY}
     ${HUNSPELL_LIBRARY}
     ${viewer_LIBRARIES}
     ${BOOST_PROGRAM_OPTIONS_LIBRARY}

indra/newview/app_settings/settings.xml

         <real>1.0</real>
       </array>
     </map>
+    
+    <key>HideUIControls</key>
+    <map>
+      <key>Comment</key>
+      <string>Hide all menu items and buttons</string>
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
 
   <key>SimulateFBOFailure</key>
   <map>

indra/newview/app_settings/shaders/class1/objects/previewF.glsl

+/** 
+ * @file previewF.glsl
+ *
+ * $LicenseInfo:firstyear=2011&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2011, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+uniform sampler2D diffuseMap;
+
+VARYING vec4 vertex_color;
+VARYING vec2 vary_texcoord0;
+
+void main()
+{
+	vec4 color = texture2D(diffuseMap,vary_texcoord0.xy) * vertex_color;
+	frag_color = color;
+}

indra/newview/app_settings/shaders/class1/objects/previewV.glsl

  * $/LicenseInfo$
  */
 
+float calcDirectionalLight(vec3 n, vec3 l);
+float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
+
 uniform mat3 normal_matrix;
 uniform mat4 texture_matrix0;
 uniform mat4 modelview_matrix;
 ATTRIBUTE vec3 normal;
 ATTRIBUTE vec2 texcoord0;
 
+uniform vec4 color;
+
 VARYING vec4 vertex_color;
 VARYING vec2 vary_texcoord0;
 
-
-vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
-void calcAtmospherics(vec3 inPositionEye);
+uniform vec4 light_position[8];
+uniform vec3 light_direction[8];
+uniform vec3 light_attenuation[8]; 
+uniform vec3 light_diffuse[8];
 
 void main()
 {
 	vec4 pos = (modelview_matrix * vec4(position.xyz, 1.0));
 	gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0);
 	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
-		
+	
 	vec3 norm = normalize(normal_matrix * normal);
 
-	calcAtmospherics(pos.xyz);
+	vec4 col = vec4(0,0,0,1);
 
-	vec4 color = calcLighting(pos.xyz, norm, vec4(1,1,1,1), vec4(0.));
-	vertex_color = color;
-
-	
+	// Collect normal lights (need to be divided by two, as we later multiply by 2)
+	col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
+	col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
+	col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
+		
+	vertex_color = col*color;
 }
Add a comment to this file

indra/newview/gpu_table.txt

File contents unchanged.

indra/newview/llagentcamera.cpp

 #include "llfloaterreg.h"
 #include "llhudmanager.h"
 #include "lljoystickbutton.h"
+#include "llmoveview.h"
 #include "llselectmgr.h"
 #include "llsmoothstep.h"
 #include "lltoolmgr.h"
 	{
 		changeCameraToThirdPerson();
 	}
+	if (gSavedSettings.getBOOL("HideUIControls"))
+	{
+		gViewerWindow->setUIVisibility(false);
+		LLPanelStandStopFlying::getInstance()->setVisible(false);
+	}
 }
 
 

indra/newview/llappviewer.cpp

 	}
 
 #if LL_WINDOWS
-	if (gGLManager.mIsIntel && 
-		LLFeatureManager::getInstance()->getGPUClass() > 0 &&
-		gGLManager.mGLVersion <= 3.f)
-	{
-		LLNotificationsUtil::add("IntelOldDriver");
+	if (gGLManager.mGLVersion < LLFeatureManager::getInstance()->getExpectedGLVersion())
+	{
+		if (gGLManager.mIsIntel)
+		{
+			LLNotificationsUtil::add("IntelOldDriver");
+		}
+		else if (gGLManager.mIsNVIDIA)
+		{
+			LLNotificationsUtil::add("NVIDIAOldDriver");
+		}
+		else if (gGLManager.mIsATI)
+		{
+			LLNotificationsUtil::add("AMDOldDriver");
+		}
 	}
 #endif
 

indra/newview/llappviewerwin32.cpp

 #include "llviewercontrol.h"
 #include "lldxhardware.h"
 
+#include "nvapi/nvapi.h"
+#include "nvapi/NvApiDriverSettings.h"
+
+#include <stdlib.h>
+
 #include "llweb.h"
 #include "llsecondlifeurls.h"
 
 #include "llwindebug.h"
 #endif
 
+
 // *FIX:Mani - This hack is to fix a linker issue with libndofdev.lib
 // The lib was compiled under VS2005 - in VS2003 we need to remap assert
 #ifdef LL_DEBUG
 
 const std::string LLAppViewerWin32::sWindowClass = "Second Life";
 
+/*
+    This function is used to print to the command line a text message 
+    describing the nvapi error and quits
+*/
+void nvapi_error(NvAPI_Status status)
+{
+    NvAPI_ShortString szDesc = {0};
+	NvAPI_GetErrorMessage(status, szDesc);
+	llwarns << szDesc << llendl;
+
+	//should always trigger when asserts are enabled
+	llassert(status == NVAPI_OK);
+}
+
 // Create app mutex creates a unique global windows object. 
 // If the object can be created it returns true, otherwise
 // it returns false. The false result can be used to determine 
 	return result;
 }
 
+void ll_nvapi_init(NvDRSSessionHandle hSession)
+{
+	// (2) load all the system settings into the session
+	NvAPI_Status status = NvAPI_DRS_LoadSettings(hSession);
+	if (status != NVAPI_OK) 
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	NvAPI_UnicodeString profile_name;
+	std::string app_name = LLTrans::getString("APP_NAME");
+	llutf16string w_app_name = utf8str_to_utf16str(app_name);
+	wsprintf(profile_name, L"%s", w_app_name.c_str());
+	status = NvAPI_DRS_SetCurrentGlobalProfile(hSession, profile_name);
+	if (status != NVAPI_OK)
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	// (3) Obtain the current profile. 
+	NvDRSProfileHandle hProfile = 0;
+	status = NvAPI_DRS_GetCurrentGlobalProfile(hSession, &hProfile);
+	if (status != NVAPI_OK) 
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	// load settings for querying 
+	status = NvAPI_DRS_LoadSettings(hSession);
+	if (status != NVAPI_OK)
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	//get the preferred power management mode for Second Life
+	NVDRS_SETTING drsSetting = {0};
+	drsSetting.version = NVDRS_SETTING_VER;
+	status = NvAPI_DRS_GetSetting(hSession, hProfile, PREFERRED_PSTATE_ID, &drsSetting);
+	if (status == NVAPI_SETTING_NOT_FOUND)
+	{ //only override if the user hasn't specifically set this setting
+		// (4) Specify that we want the VSYNC disabled setting
+		// first we fill the NVDRS_SETTING struct, then we call the function
+		drsSetting.version = NVDRS_SETTING_VER;
+		drsSetting.settingId = PREFERRED_PSTATE_ID;
+		drsSetting.settingType = NVDRS_DWORD_TYPE;
+		drsSetting.u32CurrentValue = PREFERRED_PSTATE_PREFER_MAX;
+		status = NvAPI_DRS_SetSetting(hSession, hProfile, &drsSetting);
+		if (status != NVAPI_OK) 
+		{
+			nvapi_error(status);
+			return;
+		}
+	}
+	else if (status != NVAPI_OK)
+	{
+		nvapi_error(status);
+		return;
+	}
+
+	
+
+	// (5) Now we apply (or save) our changes to the system
+	status = NvAPI_DRS_SaveSettings(hSession);
+	if (status != NVAPI_OK) 
+	{
+		nvapi_error(status);
+	}
+}
+
 //#define DEBUGGING_SEH_FILTER 1
 #if DEBUGGING_SEH_FILTER
 #	define WINMAIN DebuggingWinMain
 		return -1;
 	}
 	
+	NvAPI_Status status;
+    
+	// Initialize NVAPI
+	status = NvAPI_Initialize();
+	NvDRSSessionHandle hSession = 0;
+
+    if (status == NVAPI_OK) 
+	{
+		// Create the session handle to access driver settings
+		status = NvAPI_DRS_CreateSession(&hSession);
+		if (status != NVAPI_OK) 
+		{
+			nvapi_error(status);
+		}
+		else
+		{
+			//override driver setting as needed
+			ll_nvapi_init(hSession);
+		}
+	}
+
 	// Have to wait until after logging is initialized to display LFH info
 	if (num_heaps > 0)
 	{
 		LLAppViewer::sUpdaterInfo = NULL ;
 	}
 
+
+
+	// (NVAPI) (6) We clean up. This is analogous to doing a free()
+	if (hSession)
+	{
+		NvAPI_DRS_DestroySession(hSession);
+		hSession = 0;
+	}
+	
 	return 0;
 }
 

indra/newview/lldrawable.cpp

 			}
 		}
 	}
+	else
+	{
+		dist_squared = dist_vec_squared(old_pos, target_pos);
+	}
 
 	LLVector3 vec = mCurrentScale-target_scale;
 	

indra/newview/llfeaturemanager.cpp

 			mGPUString = label;
 			mGPUClass = (EGPUClass) strtol(cls.c_str(), NULL, 10);
 			mGPUSupported = (BOOL) strtol(supported.c_str(), NULL, 10);
+			sscanf(expected_gl_version.c_str(), "%f", &mExpectedGLVersion);
 		}
 	}
 #if LL_EXPORT_GPU_TABLE

indra/newview/llfeaturemanager.h

 		mTableVersion(0),
 		mSafe(FALSE),
 		mGPUClass(GPU_CLASS_UNKNOWN),
-		mGPUSupported(FALSE)
+		mExpectedGLVersion(0.f),
+		mGPUSupported(FALSE)		
 	{
 	}
 	~LLFeatureManager() {cleanupFeatureTables();}
 	EGPUClass getGPUClass() 			{ return mGPUClass; }
 	std::string& getGPUString() 		{ return mGPUString; }
 	BOOL isGPUSupported()				{ return mGPUSupported; }
+	F32 getExpectedGLVersion()			{ return mExpectedGLVersion; }
 	
 	void cleanupFeatureTables();
 
 	S32			mTableVersion;
 	BOOL		mSafe;					// Reinitialize everything to the "safe" mask
 	EGPUClass	mGPUClass;
+	F32			mExpectedGLVersion;		//expected GL version according to gpu table
 	std::string	mGPUString;
 	BOOL		mGPUSupported;
 };

indra/newview/llfloaterbuycontents.cpp

 
 LLFloaterBuyContents::~LLFloaterBuyContents()
 {
+	removeVOInventoryListener();
 }
 
 
 		return;
 	}
 
-	if (!inv)
-	{
-		llwarns << "No inventory in LLFloaterBuyContents::inventoryChanged"
-			<< llendl;
-		removeVOInventoryListener();
-		return;
-	}
-
-	LLCtrlListInterface *item_list = childGetListInterface("item_list");
+	LLScrollListCtrl* item_list = getChild<LLScrollListCtrl>("item_list");
 	if (!item_list)
 	{
 		removeVOInventoryListener();
 		return;
 	}
 
+	item_list->deleteAllItems();
+	
+	if (!inv)
+	{
+		llwarns << "No inventory in LLFloaterBuyContents::inventoryChanged"
+			<< llendl;
+
+		return;
+	}
+
 	// default to turning off the buy button.
-	getChildView("buy_btn")->setEnabled(FALSE);
+	LLView* buy_btn = getChildView("buy_btn");
+	buy_btn->setEnabled(FALSE);
 
 	LLUUID owner_id;
 	BOOL is_group_owned;
 
 		// There will be at least one item shown in the display, so go
 		// ahead and enable the buy button.
-		getChildView("buy_btn")->setEnabled(TRUE);
+		buy_btn->setEnabled(TRUE);
 
 		// Create the line in the list
 		LLSD row;
 		getChildView("wear_check")->setEnabled(TRUE);
 		getChild<LLUICtrl>("wear_check")->setValue(LLSD(false) );
 	}
-	
-	removeVOInventoryListener();
 }
 
 

indra/newview/llfloaterimagepreview.cpp

 	{
 		gObjectPreviewProgram.bind();
 	}
+	gPipeline.enableLightsPreview();
+
 	gGL.pushMatrix();
 	const F32 SCALE = 1.25f;
 	gGL.scalef(SCALE, SCALE, SCALE);
 	const F32 BRIGHTNESS = 0.9f;
-	gGL.color3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
+	gGL.diffuseColor3f(BRIGHTNESS, BRIGHTNESS, BRIGHTNESS);
 
 	mVertexBuffer->setBuffer(LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0);
 	mVertexBuffer->draw(LLRender::TRIANGLES, num_indices, 0);

indra/newview/llfloatermodelpreview.cpp

 
 	U32 triangle_count = 0;
 
-	for (LLModelLoader::model_list::iterator iter = mBaseModel.begin(); iter != mBaseModel.end(); ++iter)
-	{
-		LLModel* mdl = *iter;
-		for (S32 i = 0; i < mdl->getNumVolumeFaces(); ++i)
+	U32 instanced_triangle_count = 0;
+
+	//get the triangle count for the whole scene
+	for (LLModelLoader::scene::iterator iter = mBaseScene.begin(), endIter = mBaseScene.end(); iter != endIter; ++iter)
+	{
+		for (LLModelLoader::model_instance_list::iterator instance = iter->second.begin(), end_instance = iter->second.end(); instance != end_instance; ++instance)
 		{
-			triangle_count += mdl->getVolumeFace(i).mNumIndices/3;
+			LLModel* mdl = instance->mModel;
+			if (mdl)
+			{
+				instanced_triangle_count += mdl->getNumTriangles();
+			}
 		}
 	}
 
+	//get the triangle count for the non-instanced set of models
+	for (U32 i = 0; i < mBaseModel.size(); ++i)
+	{
+		triangle_count += mBaseModel[i]->getNumTriangles();
+	}
+	
+	//get ratio of uninstanced triangles to instanced triangles
+	F32 triangle_ratio = (F32) triangle_count / (F32) instanced_triangle_count;
+
 	U32 base_triangle_count = triangle_count;
 
 	U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
 		if (which_lod > -1 && which_lod < NUM_LOD)
 		{
 			limit = mFMP->childGetValue("lod_triangle_limit_" + lod_name[which_lod]).asInteger();
+			//convert from "scene wide" to "non-instanced" triangle limit
+			limit = (S32) ( (F32) limit*triangle_ratio );
 		}
 	}
 	else
 		U32 actual_verts = 0;
 		U32 submeshes = 0;
 
-		mRequestedTriangleCount[lod] = triangle_count;
+		mRequestedTriangleCount[lod] = (S32) ( (F32) triangle_count / triangle_ratio );
 		mRequestedErrorThreshold[lod] = lod_error_threshold;
 
 		glodGroupParameteri(mGroup, GLOD_ADAPT_MODE, lod_mode);
 		//initialize total for this lod to 0
 		total_tris[lod] = total_verts[lod] = total_submeshes[lod] = 0;
 
-		for (U32 i = 0; i < mModel[lod].size(); ++i)
-		{ //for each model in the lod
-			S32 cur_tris = 0;
-			S32 cur_verts = 0;
-			S32 cur_submeshes = mModel[lod][i]->getNumVolumeFaces();
-
-			for (S32 j = 0; j < cur_submeshes; ++j)
-			{ //for each submesh (face), add triangles and vertices to current total
-				const LLVolumeFace& face = mModel[lod][i]->getVolumeFace(j);
-				cur_tris += face.mNumIndices/3;
-				cur_verts += face.mNumVertices;
+		for (LLModelLoader::scene::iterator iter = mScene[lod].begin(), endIter = mScene[lod].end(); iter != endIter; ++iter)
+		{
+			for (LLModelLoader::model_instance_list::iterator instance = iter->second.begin(), end_instance = iter->second.end(); instance != end_instance; ++instance)
+			{
+				LLModel* model = instance->mModel;
+				if (model)
+				{
+					 //for each model in the lod
+					S32 cur_tris = 0;
+					S32 cur_verts = 0;
+					S32 cur_submeshes = model->getNumVolumeFaces();
+
+					for (S32 j = 0; j < cur_submeshes; ++j)
+					{ //for each submesh (face), add triangles and vertices to current total
+						const LLVolumeFace& face = model->getVolumeFace(j);
+						cur_tris += face.mNumIndices/3;
+						cur_verts += face.mNumVertices;
+					}
+
+					//add this model to the lod total
+					total_tris[lod] += cur_tris;
+					total_verts[lod] += cur_verts;
+					total_submeshes[lod] += cur_submeshes;
+
+					//store this model's counts to asset data
+					tris[lod].push_back(cur_tris);
+					verts[lod].push_back(cur_verts);
+					submeshes[lod].push_back(cur_submeshes);
+				}
 			}
-
-			//add this model to the lod total
-			total_tris[lod] += cur_tris;
-			total_verts[lod] += cur_verts;
-			total_submeshes[lod] += cur_submeshes;
-
-			//store this model's counts to asset data
-			tris[lod].push_back(cur_tris);
-			verts[lod].push_back(cur_verts);
-			submeshes[lod].push_back(cur_submeshes);
 		}
 	}
 
 	}
 	
 	//add up physics triangles etc
-	S32 start = 0;
-	S32 end = mModel[LLModel::LOD_PHYSICS].size();
-
 	S32 phys_tris = 0;
 	S32 phys_hulls = 0;
 	S32 phys_points = 0;
 
-	for (S32 i = start; i < end; ++i)
-	{ //add up hulls and points and triangles for selected mesh(es)
-		LLModel* model = mModel[LLModel::LOD_PHYSICS][i];
-		S32 cur_submeshes = model->getNumVolumeFaces();
-
-		LLModel::convex_hull_decomposition& decomp = model->mPhysics.mHull;
-
-		if (!decomp.empty())
+	//get the triangle count for the whole scene
+	for (LLModelLoader::scene::iterator iter = mScene[LLModel::LOD_PHYSICS].begin(), endIter = mScene[LLModel::LOD_PHYSICS].end(); iter != endIter; ++iter)
+	{
+		for (LLModelLoader::model_instance_list::iterator instance = iter->second.begin(), end_instance = iter->second.end(); instance != end_instance; ++instance)
 		{
-			phys_hulls += decomp.size();
-			for (U32 i = 0; i < decomp.size(); ++i)
+			LLModel* model = instance->mModel;
+			if (model)
 			{
-				phys_points += decomp[i].size();
-			}
-		}
-		else
-		{ //choose physics shape OR decomposition, can't use both
-			for (S32 j = 0; j < cur_submeshes; ++j)
-			{ //for each submesh (face), add triangles and vertices to current total
-				const LLVolumeFace& face = model->getVolumeFace(j);
-				phys_tris += face.mNumIndices/3;
+				S32 cur_submeshes = model->getNumVolumeFaces();
+
+				LLModel::convex_hull_decomposition& decomp = model->mPhysics.mHull;
+
+				if (!decomp.empty())
+				{
+					phys_hulls += decomp.size();
+					for (U32 i = 0; i < decomp.size(); ++i)
+					{
+						phys_points += decomp[i].size();
+					}
+				}
+				else
+				{ //choose physics shape OR decomposition, can't use both
+					for (S32 j = 0; j < cur_submeshes; ++j)
+					{ //for each submesh (face), add triangles and vertices to current total
+						const LLVolumeFace& face = model->getVolumeFace(j);
+						phys_tris += face.mNumIndices/3;
+					}
+				}
 			}
 		}
 	}
 		refresh();
 	}
 
+	if (use_shaders)
+	{
+		gObjectPreviewProgram.bind();
+	}
+
 	gGL.loadIdentity();
 	gPipeline.enableLightsPreview();
 
 
 	const U32 type_mask = LLVertexBuffer::MAP_VERTEX | LLVertexBuffer::MAP_NORMAL | LLVertexBuffer::MAP_TEXCOORD0;
 
-	if (use_shaders)
-	{
-		gObjectPreviewProgram.bind();
-	}
-
 	LLGLEnable normalize(GL_NORMALIZE);
 
 	if (!mBaseModel.empty() && mVertexBuffer[5].empty())
 											hull_colors.push_back(LLColor4U(rand()%128+127, rand()%128+127, rand()%128+127, 128));
 										}
 
-										glColor4ubv(hull_colors[i].mV);
+										gGL.diffuseColor4ubv(hull_colors[i].mV);
 										LLVertexBuffer::drawArrays(LLRender::TRIANGLES, physics.mMesh[i].mPositions, physics.mMesh[i].mNormals);
 
 										if (explode > 0.f)

indra/newview/llfloatertools.cpp

 	LLSelectMgr::getInstance()->setGridMode((EGridMode)combo->getCurrentIndex());
 }
 
+// static
+void LLFloaterTools::setGridMode(S32 mode)
+{
+	LLFloaterTools* tools_floater = LLFloaterReg::getTypedInstance<LLFloaterTools>("build");
+	if (!tools_floater || !tools_floater->mComboGridMode)
+	{
+		return;
+	}
+
+	tools_floater->mComboGridMode->setCurrentByIndex(mode);
+}
 
 void LLFloaterTools::onClickGridOptions()
 {

indra/newview/llfloatertools.h

 	bool selectedMediaEditable();
 	void updateLandImpacts();
 
+	static void setGridMode(S32 mode);
+
 private:
 	void refresh();
 	void refreshMedia();

indra/newview/llfloaterurlentry.cpp

 	}
 
 	// Discover the MIME type only for "http" scheme.
-	if(scheme == "http" || scheme == "https")
+	if(!media_url.empty() && 
+	   (scheme == "http" || scheme == "https"))
 	{
 		LLHTTPClient::getHeaderOnly( media_url,
 			new LLMediaTypeResponder(self->getHandle()));

indra/newview/llmanip.cpp

 	LLDrawable* drawablep = vobj->mDrawable;
 	if (drawablep && drawablep->getVOVolume())
 	{
-		
 		gPipeline.markRebuild(drawablep,LLDrawable::REBUILD_VOLUME, TRUE);
 		drawablep->setState(LLDrawable::MOVE_UNDAMPED); // force to UNDAMPED
 		drawablep->updateMove();
 			group->dirtyGeom();
 			gPipeline.markRebuild(group, TRUE);
 		}
+
+		LLViewerObject::const_child_list_t& child_list = vobj->getChildren();
+		for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(), endIter = child_list.end();
+			 iter != endIter; ++iter)
+		{
+			LLViewerObject* child = *iter;
+			rebuild(child);
+		}
 	}
 }
 
Add a comment to this file

indra/newview/llmenuoptionpathfindingrebakenavmesh.cpp

File contents unchanged.

Add a comment to this file

indra/newview/llmenuoptionpathfindingrebakenavmesh.h

File contents unchanged.

indra/newview/llmeshrepository.cpp

 {
 public:
 	LLVolumeParams mMeshParams;
-	
+	bool mProcessed;
+
 	LLMeshHeaderResponder(const LLVolumeParams& mesh_params)
 		: mMeshParams(mesh_params)
 	{
-		LLMeshRepoThread::sActiveHeaderRequests++;
+		LLMeshRepoThread::incActiveHeaderRequests();
+		mProcessed = false;
 	}
 
 	~LLMeshHeaderResponder()
 	{
-		LLMeshRepoThread::sActiveHeaderRequests--;
+		if (!mProcessed && !LLApp::isQuitting())
+		{ //something went wrong, retry
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
+			LLMeshRepository::sHTTPRetryCount++;
+			LLMeshRepoThread::HeaderRequest req(mMeshParams);
+			LLMutexLock lock(gMeshRepo.mThread->mMutex);
+			gMeshRepo.mThread->mHeaderReqQ.push(req);
+
+		}
+
+		LLMeshRepoThread::decActiveHeaderRequests();
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
 	S32 mLOD;
 	U32 mRequestedBytes;
 	U32 mOffset;
+	bool mProcessed;
 
 	LLMeshLODResponder(const LLVolumeParams& mesh_params, S32 lod, U32 offset, U32 requested_bytes)
 		: mMeshParams(mesh_params), mLOD(lod), mOffset(offset), mRequestedBytes(requested_bytes)
 	{
-		LLMeshRepoThread::sActiveLODRequests++;
+		LLMeshRepoThread::incActiveLODRequests();
+		mProcessed = false;
 	}
 
 	~LLMeshLODResponder()
 	{
-		LLMeshRepoThread::sActiveLODRequests--;
+		if (!mProcessed && !LLApp::isQuitting())
+		{
+			llwarns << "Killed without being processed, retrying." << llendl;
+			LLMeshRepository::sHTTPRetryCount++;
+			gMeshRepo.mThread->lockAndLoadMeshLOD(mMeshParams, mLOD);
+		}
+		LLMeshRepoThread::decActiveLODRequests();
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
 	LLUUID mMeshID;
 	U32 mRequestedBytes;
 	U32 mOffset;
+	bool mProcessed;
 
 	LLMeshSkinInfoResponder(const LLUUID& id, U32 offset, U32 size)
 		: mMeshID(id), mRequestedBytes(size), mOffset(offset)
 	{
+		mProcessed = false;
+	}
+
+	~LLMeshSkinInfoResponder()
+	{
+		llassert(mProcessed);
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
 	LLUUID mMeshID;
 	U32 mRequestedBytes;
 	U32 mOffset;
+	bool mProcessed;
 
 	LLMeshDecompositionResponder(const LLUUID& id, U32 offset, U32 size)
 		: mMeshID(id), mRequestedBytes(size), mOffset(offset)
 	{
+		mProcessed = false;
+	}
+
+	~LLMeshDecompositionResponder()
+	{
+		llassert(mProcessed);
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
 	LLUUID mMeshID;
 	U32 mRequestedBytes;
 	U32 mOffset;
+	bool mProcessed;
 
 	LLMeshPhysicsShapeResponder(const LLUUID& id, U32 offset, U32 size)
 		: mMeshID(id), mRequestedBytes(size), mOffset(offset)
 	{
+		mProcessed = false;
+	}
+
+	~LLMeshPhysicsShapeResponder()
+	{
+		llassert(mProcessed);
 	}
 
 	virtual void completedRaw(U32 status, const std::string& reason,
 	mPhysicsShapeRequests.insert(mesh_id);
 }
 
+void LLMeshRepoThread::lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
+{
+	if (!LLAppViewer::isQuitting())
+	{
+		loadMeshLOD(mesh_params, lod);
+	}
+}
+
+
 
 void LLMeshRepoThread::loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod)
-{ //protected by mSignal, no locking needed here
-
+{ //could be called from any thread
+	LLMutexLock lock(mMutex);
 	mesh_header_map::iterator iter = mMeshHeader.find(mesh_params.getSculptID());
 	if (iter != mMeshHeader.end())
 	{ //if we have the header, request LOD byte range
 		LODRequest req(mesh_params, lod);
 		{
-			LLMutexLock lock(mMutex);
 			mLODReqQ.push(req);
 			LLMeshRepository::sLODProcessing++;
 		}
 		}
 		else
 		{ //if no header request is pending, fetch header
-			LLMutexLock lock(mMutex);
 			mHeaderReqQ.push(req);
 			mPendingLOD[mesh_params].push_back(lod);
 		}
 	return ret;
 }
 
+//static
+void LLMeshRepoThread::incActiveLODRequests()
+{
+	LLMutexLock lock(gMeshRepo.mThread->mMutex);
+	++LLMeshRepoThread::sActiveLODRequests;
+}
+
+//static
+void LLMeshRepoThread::decActiveLODRequests()
+{
+	LLMutexLock lock(gMeshRepo.mThread->mMutex);
+	--LLMeshRepoThread::sActiveLODRequests;
+}
+
+//static
+void LLMeshRepoThread::incActiveHeaderRequests()
+{
+	LLMutexLock lock(gMeshRepo.mThread->mMutex);
+	++LLMeshRepoThread::sActiveHeaderRequests;
+}
+
+//static
+void LLMeshRepoThread::decActiveHeaderRequests()
+{
+	LLMutexLock lock(gMeshRepo.mThread->mMutex);
+	--LLMeshRepoThread::sActiveHeaderRequests;
+}
+
 //return false if failed to get header
 bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params, U32& count)
 {
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
+	
 	// thread could have already be destroyed during logout
 	if( !gMeshRepo.mThread )
 	{
 	{
 		if (status == 499 || status == 503)
 		{ //timeout or service unavailable, try again
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			gMeshRepo.mThread->loadMeshLOD(mMeshParams, mLOD);
 		}
 		else
 		{
+			llassert(status == 499 || status == 503); //intentionally trigger a breakpoint
 			llwarns << "Unhandled status " << status << llendl;
 		}
 		return;
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
+
 	// thread could have already be destroyed during logout
 	if( !gMeshRepo.mThread )
 	{
 	{
 		if (status == 499 || status == 503)
 		{ //timeout or service unavailable, try again
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			gMeshRepo.mThread->loadMeshSkinInfo(mMeshID);
 		}
 		else
 		{
+			llassert(status == 499 || status == 503); //intentionally trigger a breakpoint
 			llwarns << "Unhandled status " << status << llendl;
 		}
 		return;
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
+	
 	if( !gMeshRepo.mThread )
 	{
 		return;
 	{
 		if (status == 499 || status == 503)
 		{ //timeout or service unavailable, try again
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			gMeshRepo.mThread->loadMeshDecomposition(mMeshID);
 		}
 		else
 		{
+			llassert(status == 499 || status == 503); //intentionally trigger a breakpoint
 			llwarns << "Unhandled status " << status << llendl;
 		}
 		return;
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
+
 	// thread could have already be destroyed during logout
 	if( !gMeshRepo.mThread )
 	{
 	{
 		if (status == 499 || status == 503)
 		{ //timeout or service unavailable, try again
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			gMeshRepo.mThread->loadMeshPhysicsShape(mMeshID);
 		}
 		else
 		{
+			llassert(status == 499 || status == 503); //intentionally trigger a breakpoint
 			llwarns << "Unhandled status " << status << llendl;
 		}
 		return;
 							  const LLChannelDescriptors& channels,
 							  const LLIOPipe::buffer_ptr_t& buffer)
 {
+	mProcessed = true;
+
 	// thread could have already be destroyed during logout
 	if( !gMeshRepo.mThread )
 	{
 		// TODO*: Add maximum retry logic, exponential backoff
 		// and (somewhat more optional than the others) retries
 		// again after some set period of time
+
+		llassert(status == 503 || status == 499);
+
 		if (status == 503 || status == 499)
 		{ //retry
+			llwarns << "Timeout or service unavailable, retrying." << llendl;
 			LLMeshRepository::sHTTPRetryCount++;
 			LLMeshRepoThread::HeaderRequest req(mMeshParams);
 			LLMutexLock lock(gMeshRepo.mThread->mMutex);
 
 			return;
 		}
+		else
+		{
+			llwarns << "Unhandled status." << llendl;
+		}
 	}
 
 	S32 data_size = buffer->countAfter(channels.in(), NULL);
 
 	LLMeshRepository::sBytesReceived += llmin(data_size, 4096);
 
-	if (!gMeshRepo.mThread->headerReceived(mMeshParams, data, data_size))
+	bool success = gMeshRepo.mThread->headerReceived(mMeshParams, data, data_size);
+	
+	llassert(success);
+
+	if (!success)
 	{
 		llwarns
 			<< "Unable to parse mesh header: "

indra/newview/llmeshrepository.h

 
 	virtual void run();
 
+	void lockAndLoadMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
 	void loadMeshLOD(const LLVolumeParams& mesh_params, S32 lod);
+
 	bool fetchMeshHeader(const LLVolumeParams& mesh_params, U32& count);
 	bool fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, U32& count);
 	bool headerReceived(const LLVolumeParams& mesh_params, U8* data, S32 data_size);
 	//  (should hold onto mesh_id and try again later if header info does not exist)
 	bool fetchMeshPhysicsShape(const LLUUID& mesh_id);
 
+	static void incActiveLODRequests();
+	static void decActiveLODRequests();
+	static void incActiveHeaderRequests();
+	static void decActiveHeaderRequests();
 
 };
 
 
 	void startRequest() { ++mPendingUploads; }
 	void stopRequest() { --mPendingUploads; }
-
+		
 	bool finished() { return mFinished; }
 	virtual void run();
 	void preStart();

indra/newview/llpanelpermissions.cpp

 		}
 	}
 	
-	getChildView("button set group")->setEnabled(owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced);
+	getChildView("button set group")->setEnabled(root_selected && owners_identical && (mOwnerID == gAgent.getID()) && is_nonpermanent_enforced);
 
 	getChildView("Name:")->setEnabled(TRUE);
 	LLLineEditor* LineEditorObjectName = getChild<LLLineEditor>("Object Name");

indra/newview/llselectmgr.cpp

 
 	mGridMode = GRID_MODE_WORLD;
 	gSavedSettings.setS32("GridMode", (S32)GRID_MODE_WORLD);
-	mGridValid = FALSE;
 
 	mSelectedObjects = new LLObjectSelection();
 	mHoverObjects = new LLObjectSelection();
 	mGridMode = mode;
 	gSavedSettings.setS32("GridMode", mode);
 	updateSelectionCenter();
-	mGridValid = FALSE;
 }
 
 void LLSelectMgr::getGrid(LLVector3& origin, LLQuaternion &rotation, LLVector3 &scale)
 	origin = mGridOrigin;
 	rotation = mGridRotation;
 	scale = mGridScale;
-	mGridValid = TRUE;
 }
 
 //-----------------------------------------------------------------------------
 	return TRUE;
 }
 
-//-----------------------------------------------------------------------------
-// selectGetCreator()
-// Creator information only applies to root objects.
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
-{
-	BOOL identical = TRUE;
-	BOOL first = TRUE;
-	LLUUID first_id;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
-	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
-		{
-			return FALSE;
-		}
-
-		if (first)
-		{
-			first_id = node->mPermissions->getCreator();
-			first = FALSE;
+struct LLSelectGetFirstTest
+{
+	LLSelectGetFirstTest() : mIdentical(true), mFirst(true)	{ }
+	virtual ~LLSelectGetFirstTest() { }
+
+	// returns false to break out of the iteration.
+	bool checkMatchingNode(LLSelectNode* node)
+	{
+		if (!node || !node->mValid)
+		{
+			return false;
+		}
+
+		if (mFirst)
+		{
+			mFirstValue = getValueFromNode(node);
+			mFirst = false;
 		}
 		else
 		{
-			if ( !(first_id == node->mPermissions->getCreator() ) )
+			if ( mFirstValue != getValueFromNode(node) )
 			{
-				identical = FALSE;
+				mIdentical = false;
+				// stop testing once we know not all selected are identical.
+				return false;
+			}
+		}
+		// continue testing.
+		return true;
+	}
+
+	bool mIdentical;
+	LLUUID mFirstValue;
+
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node) = 0;
+
+private:
+	bool mFirst;
+};
+
+void LLSelectMgr::getFirst(LLSelectGetFirstTest* test)
+{
+	if (gSavedSettings.getBOOL("EditLinkedParts"))
+	{
+		for (LLObjectSelection::valid_iterator iter = getSelection()->valid_begin();
+			iter != getSelection()->valid_end(); ++iter )
+		{
+			if (!test->checkMatchingNode(*iter))
+			{
 				break;
 			}
 		}
 	}
-	if (first_id.isNull())
+	else
+	{
+		for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
+			iter != getSelection()->root_object_end(); ++iter )
+		{
+			if (!test->checkMatchingNode(*iter))
+			{
+				break;
+			}
+		}
+	}
+}
+
+//-----------------------------------------------------------------------------
+// selectGetCreator()
+// Creator information only applies to roots unless editing linked parts.
+//-----------------------------------------------------------------------------
+struct LLSelectGetFirstCreator : public LLSelectGetFirstTest
+{
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+	{
+		return node->mPermissions->getCreator();
+	}
+};
+
+BOOL LLSelectMgr::selectGetCreator(LLUUID& result_id, std::string& name)
+{
+	LLSelectGetFirstCreator test;
+	getFirst(&test);
+
+	if (test.mFirstValue.isNull())
 	{
 		name = LLTrans::getString("AvatarNameNobody");
 		return FALSE;
 	}
 	
-	result_id = first_id;
+	result_id = test.mFirstValue;
 	
-	if (identical)
-	{
-		name = LLSLURL("agent", first_id, "inspect").getSLURLString();
+	if (test.mIdentical)
+	{
+		name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
 	}
 	else
 	{
 		name = LLTrans::getString("AvatarNameMultiple");
 	}
 
-	return identical;
-}
-
+	return test.mIdentical;
+}
 
 //-----------------------------------------------------------------------------
 // selectGetOwner()
-// Owner information only applies to roots.
-//-----------------------------------------------------------------------------
+// Owner information only applies to roots unless editing linked parts.
+//-----------------------------------------------------------------------------
+struct LLSelectGetFirstOwner : public LLSelectGetFirstTest
+{
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+	{
+		// Don't use 'getOwnership' since we return a reference, not a copy.
+		// Will return LLUUID::null if unowned (which is not allowed and should never happen.)
+		return node->mPermissions->isGroupOwned() ? node->mPermissions->getGroup() : node->mPermissions->getOwner();
+	}
+};
+
 BOOL LLSelectMgr::selectGetOwner(LLUUID& result_id, std::string& name)
 {
-	BOOL identical = TRUE;
-	BOOL first = TRUE;
-	BOOL first_group_owned = FALSE;
-	LLUUID first_id;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
-	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
-		{
-			return FALSE;
-		}
-		
-		if (first)
-		{
-			node->mPermissions->getOwnership(first_id, first_group_owned);
-			first = FALSE;
+	LLSelectGetFirstOwner test;
+	getFirst(&test);
+
+	if (test.mFirstValue.isNull())
+	{
+		return FALSE;
+	}
+
+	result_id = test.mFirstValue;
+	
+	if (test.mIdentical)
+	{
+		bool group_owned = selectIsGroupOwned();
+		if (group_owned)
+		{
+			name = LLSLURL("group", test.mFirstValue, "inspect").getSLURLString();
 		}
 		else
 		{
-			LLUUID owner_id;
-			BOOL is_group_owned = FALSE;
-			if (!(node->mPermissions->getOwnership(owner_id, is_group_owned))
-				|| owner_id != first_id || is_group_owned != first_group_owned)
-			{
-				identical = FALSE;
-				break;
-			}
-		}
-	}
-	if (first_id.isNull())
+			name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
+		}
+	}
+	else
+	{
+		name = LLTrans::getString("AvatarNameMultiple");
+	}
+
+	return test.mIdentical;
+}
+
+//-----------------------------------------------------------------------------
+// selectGetLastOwner()
+// Owner information only applies to roots unless editing linked parts.
+//-----------------------------------------------------------------------------
+struct LLSelectGetFirstLastOwner : public LLSelectGetFirstTest
+{
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+	{
+		return node->mPermissions->getLastOwner();
+	}
+};
+
+BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
+{
+	LLSelectGetFirstLastOwner test;
+	getFirst(&test);
+
+	if (test.mFirstValue.isNull())
 	{
 		return FALSE;
 	}
 
-	result_id = first_id;
+	result_id = test.mFirstValue;
 	
-	if (identical)
-	{
-		BOOL public_owner = (first_id.isNull() && !first_group_owned);
-		if (first_group_owned)
-		{
-			name = LLSLURL("group", first_id, "inspect").getSLURLString();
-		}
-		else if(!public_owner)
-		{
-			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
-		}
-		else
-		{
-			name = LLTrans::getString("AvatarNameNobody");
-		}
+	if (test.mIdentical)
+	{
+		name = LLSLURL("agent", test.mFirstValue, "inspect").getSLURLString();
 	}
 	else
 	{
-		name = LLTrans::getString("AvatarNameMultiple");
-	}
-
-	return identical;
-}
-
-
-//-----------------------------------------------------------------------------
-// selectGetLastOwner()
-// Owner information only applies to roots.
-//-----------------------------------------------------------------------------
-BOOL LLSelectMgr::selectGetLastOwner(LLUUID& result_id, std::string& name)
-{
-	BOOL identical = TRUE;
-	BOOL first = TRUE;
-	LLUUID first_id;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
-	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
-		{
-			return FALSE;
-		}
-
-		if (first)
-		{
-			first_id = node->mPermissions->getLastOwner();
-			first = FALSE;
-		}
-		else
-		{
-			if ( !(first_id == node->mPermissions->getLastOwner() ) )
-			{
-				identical = FALSE;
-				break;
-			}
-		}
-	}
-	if (first_id.isNull())
-	{
-		return FALSE;
-	}
-
-	result_id = first_id;
-	
-	if (identical)
-	{
-		BOOL public_owner = (first_id.isNull());
-		if(!public_owner)
-		{
-			name = LLSLURL("agent", first_id, "inspect").getSLURLString();
-		}
-		else
-		{
-			name.assign("Public or Group");
-		}
-	}
-	else
-	{
 		name.assign( "" );
 	}
 
-	return identical;
-}
-
+	return test.mIdentical;
+}
 
 //-----------------------------------------------------------------------------
 // selectGetGroup()
-// Group information only applies to roots.
-//-----------------------------------------------------------------------------
+// Group information only applies to roots unless editing linked parts.
+//-----------------------------------------------------------------------------
+struct LLSelectGetFirstGroup : public LLSelectGetFirstTest
+{
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+	{
+		return node->mPermissions->getGroup();
+	}
+};
+
 BOOL LLSelectMgr::selectGetGroup(LLUUID& result_id)
 {
-	BOOL identical = TRUE;
-	BOOL first = TRUE;
-	LLUUID first_id;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
-	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
-		{
-			return FALSE;
-		}
-
-		if (first)
-		{
-			first_id = node->mPermissions->getGroup();
-			first = FALSE;
-		}
-		else
-		{
-			if ( !(first_id == node->mPermissions->getGroup() ) )
-			{
-				identical = FALSE;
-				break;
-			}
-		}
-	}
-
-	result_id = first_id;
-
-	return identical;
+	LLSelectGetFirstGroup test;
+	getFirst(&test);
+
+	result_id = test.mFirstValue;
+	return test.mIdentical;
 }
 
 //-----------------------------------------------------------------------------
 // selectIsGroupOwned()
-// Only operates on root nodes.  
-// Returns TRUE if all have valid data and they are all group owned.
-//-----------------------------------------------------------------------------
+// Only operates on root nodes unless editing linked parts.  
+// Returns TRUE if the first selected is group owned.
+//-----------------------------------------------------------------------------
+struct LLSelectGetFirstGroupOwner : public LLSelectGetFirstTest
+{
+protected:
+	virtual const LLUUID& getValueFromNode(LLSelectNode* node)
+	{
+		if (node->mPermissions->isGroupOwned())
+		{
+			return node->mPermissions->getGroup();
+		}
+		return LLUUID::null;
+	}
+};
+
 BOOL LLSelectMgr::selectIsGroupOwned()
 {
-	BOOL found_one = FALSE;
-	for (LLObjectSelection::root_object_iterator iter = getSelection()->root_object_begin();
-		 iter != getSelection()->root_object_end(); iter++ )
-	{
-		LLSelectNode* node = *iter;	
-		if (!node->mValid)
-		{
-			return FALSE;
-		}
-		found_one = TRUE;
-		if (!node->mPermissions->isGroupOwned())
-		{
-			return FALSE;
-		}
-	}	
-	return found_one ? TRUE : FALSE;
+	LLSelectGetFirstGroupOwner test;
+	getFirst(&test);
+
+	return test.mFirstValue.notNull() ? TRUE : FALSE;
 }
 
 //-----------------------------------------------------------------------------
 		} func(id);
 		LLSelectNode* node = LLSelectMgr::getInstance()->getSelection()->getFirstNode(&func);
 
-		if (node)
+		if (!node)
+		{
+			llwarns << "Couldn't find object " << id << " selected." << llendl;
+		}
+		else
 		{
 			if (node->mInventorySerial != inv_serial)
 			{

indra/newview/llselectmgr.h

 extern template class LLSelectMgr* LLSingleton<class LLSelectMgr>::getInstance();
 #endif
 
+// For use with getFirstTest()
+struct LLSelectGetFirstTest;
+
 class LLSelectMgr : public LLEditMenuHandler, public LLSingleton<LLSelectMgr>
 {
 public:
 	static void packGodlikeHead(void* user_data);
 	static bool confirmDelete(const LLSD& notification, const LLSD& response, LLObjectSelectionHandle handle);
 
+	// Get the first ID that matches test and whether or not all ids are identical in selected objects.
+	void getFirst(LLSelectGetFirstTest* test);
+
 public:
 	// Observer/callback support for when object selection changes or
 	// properties are received/updated
 	LLVector3				mGridOrigin;
 	LLVector3				mGridScale;
 	EGridMode				mGridMode;
-	BOOL					mGridValid;
-
 
 	BOOL					mTEMode;			// render te
 	LLVector3d				mSelectionCenterGlobal;

indra/newview/lltexturefetch.cpp

 
 	worker->lockWorkMutex();
 
+
 	//	Copy header data into image object
 	worker->mImageCodec = codec;
 	worker->mTotalPackets = packets;

indra/newview/lltexturefetch.h

 #include "llimageworker.h"
 #include "llstat.h"
 #include "llcurl.h"
+#include "llstat.h"
 #include "httprequest.h"
 #include "httpoptions.h"
 #include "httpheaders.h"

indra/newview/llviewermedia.cpp

 	/* virtual */ void completedHeader(U32 status, const std::string& reason, const LLSD& content)
 	{
 		LL_WARNS("MediaAuth") << "status = " << status << ", reason = " << reason << LL_ENDL;
-		LL_WARNS("MediaAuth") << content << LL_ENDL;
+
+		LLSD stripped_content = content;
+		stripped_content.erase("set-cookie");
+		LL_WARNS("MediaAuth") << stripped_content << LL_ENDL;
 
 		std::string cookie = content["set-cookie"].asString();
+		LL_DEBUGS("MediaAuth") << "cookie = " << cookie << LL_ENDL;
 
 		LLViewerMedia::getCookieStore()->setCookiesFromHost(cookie, mHost);
 

indra/newview/llviewermenu.cpp

 };
 
 
+//////////////////////////
+//   ANIMATION SPEED    //
+//////////////////////////
+
+// Utility function to set all AV time factors to the same global value
+static void set_all_animation_time_factors(F32	time_factor)
+{
+	LLMotionController::setCurrentTimeFactor(time_factor);
+	for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+		iter != LLCharacter::sInstances.end(); ++iter)
+	{
+		(*iter)->setAnimTimeFactor(time_factor);
+	}
+}
+
+class LLAdvancedAnimTenFaster : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		//llinfos << "LLAdvancedAnimTenFaster" << llendl;
+		F32 time_factor = LLMotionController::getCurrentTimeFactor();
+		time_factor = llmin(time_factor + 0.1f, 2.f);	// Upper limit is 200% speed
+		set_all_animation_time_factors(time_factor);
+		return true;
+	}
+};
+
+class LLAdvancedAnimTenSlower : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		//llinfos << "LLAdvancedAnimTenSlower" << llendl;
+		F32 time_factor = LLMotionController::getCurrentTimeFactor();
+		time_factor = llmax(time_factor - 0.1f, 0.1f);	// Lower limit is at 10% of normal speed
+		set_all_animation_time_factors(time_factor);
+		return true;
+	}
+};
+
+class LLAdvancedAnimResetAll : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		set_all_animation_time_factors(1.f);
+		return true;
+	}
+};
+
 
 //////////////////////////
 // RELOAD VERTEX SHADER //
 {
 	bool handleEvent(const LLSD& userdata)
 	{
-		LLNotification::Params params("ConfirmHideUI");
-		params.functor.function(boost::bind(&LLViewToggleUI::confirm, this, _1, _2));
-		LLSD substitutions;
+		if(gAgentCamera.getCameraMode() != CAMERA_MODE_MOUSELOOK)
+		{
+			LLNotification::Params params("ConfirmHideUI");
+			params.functor.function(boost::bind(&LLViewToggleUI::confirm, this, _1, _2));
+			LLSD substitutions;
 #if LL_DARWIN
-		substitutions["SHORTCUT"] = "Cmd+Shift+U";
+			substitutions["SHORTCUT"] = "Cmd+Shift+U";
 #else
-		substitutions["SHORTCUT"] = "Ctrl+Shift+U";
+			substitutions["SHORTCUT"] = "Ctrl+Shift+U";
 #endif
-		params.substitutions = substitutions;
-		if (gViewerWindow->getUIVisibility())
-		{
-			// hiding, so show notification
-			LLNotifications::instance().add(params);
-		}
-		else
-		{
-			LLNotifications::instance().forceResponse(params, 0);
-		}
-
+			params.substitutions = substitutions;
+			if (!gSavedSettings.getBOOL("HideUIControls"))
+			{
+				// hiding, so show notification
+				LLNotifications::instance().add(params);
+			}
+			else
+			{
+				LLNotifications::instance().forceResponse(params, 0);
+			}
+		}
 		return true;
 	}
 
 
 		if (option == 0) // OK
 		{
-			gViewerWindow->setUIVisibility(!gViewerWindow->getUIVisibility());
-			LLPanelStandStopFlying::getInstance()->setVisible(gViewerWindow->getUIVisibility());
+			gViewerWindow->setUIVisibility(gSavedSettings.getBOOL("HideUIControls"));
+			LLPanelStandStopFlying::getInstance()->setVisible(gSavedSettings.getBOOL("HideUIControls"));
+			gSavedSettings.setBOOL("HideUIControls",!gSavedSettings.getBOOL("HideUIControls"));
 		}