[SCM] A client for connecting to 3D metaverses such as Linden Labs Secondlife(tm) and OpenSim grids branch, master, updated. upstream/1.20.12-55-g5b64f45

Robin Cornelius robin.cornelius at gmail.com
Fri Jul 18 07:06:37 UTC 2008


The following commit has been merged in the master branch:
commit c4ba6342b3404185bfa82be80d876a4798a14d21
Author: Robin Cornelius <robin.cornelius at gmail.com>
Date:   Wed Jul 16 22:59:51 2008 +0200

    Add in VWR-4981 patch, save user windlight settings in user RW area

diff --git a/debian/changelog b/debian/changelog
index f08a570..edfedfb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ omvviewer (1.20.13-1) experimental; urgency=low
     + Fix some patches for file path changes    
       - Modify VWR-5082_set_bulk_inv_permissions.dpatch
       - Modify trademark_compliance.dpatch
+    + Add VWR-4981_save_windlight_settings_in_user_rw_area.dpatch 
 
  -- Robin Cornelius <robin.cornelius at gmail.com>  Sat, 12 Jul 2008 22:15:56 +0200
 
diff --git a/debian/patches/VWR-4981_save_windlight_settings_in_user_rw_area.dpatch b/debian/patches/VWR-4981_save_windlight_settings_in_user_rw_area.dpatch
new file mode 100644
index 0000000..5e8637e
--- /dev/null
+++ b/debian/patches/VWR-4981_save_windlight_settings_in_user_rw_area.dpatch
@@ -0,0 +1,448 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## VWR 4681.dpatch by  <robin.cornelius at gmail.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Save the user modifications in a RW user location
+
+ at DPATCH@
+
+diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
+index 1eb0654..cc8ce60 100644
+--- a/indra/newview/llstartup.cpp
++++ b/indra/newview/llstartup.cpp
+@@ -809,6 +809,17 @@ BOOL idle_startup()
+ 		LLFile::mkdir(gDirUtilp->getChatLogsDir().c_str());
+ 		LLFile::mkdir(gDirUtilp->getPerAccountChatLogsDir().c_str());
+ 
++		//good as place as any to create user windlight directories
++		std::string user_windlight_skies_path_name(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/skies", ""));
++		LLFile::mkdir(user_windlight_skies_path_name.c_str());
++
++		std::string user_windlight_water_path_name(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/water", ""));
++		LLFile::mkdir(user_windlight_water_path_name.c_str());
++
++		std::string user_windlight_days_path_name(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/days", ""));
++		LLFile::mkdir(user_windlight_days_path_name.c_str());
++
++
+ 		if (show_connect_box)
+ 		{
+ 			if ( LLPanelLogin::isGridComboDirty() )
+diff --git a/indra/newview/llwaterparammanager.cpp b/indra/newview/llwaterparammanager.cpp
+index fb09fd8..a11b575 100644
+--- a/indra/newview/llwaterparammanager.cpp
++++ b/indra/newview/llwaterparammanager.cpp
+@@ -86,48 +86,59 @@ LLWaterParamManager::~LLWaterParamManager()
+ 
+ void LLWaterParamManager::loadAllPresets(const LLString& file_name)
+ {
+-	LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", ""));
+-	LL_INFOS2("AppInit", "Shaders") << "Loading water settings from " << path_name << LL_ENDL;
+ 
+-	//mParamList.clear();
+-	
++	LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", ""));
++	LL_INFOS2("AppInit", "Shaders") << "Loading Default water settings from " << path_name << LL_ENDL;
++			
+ 	bool found = true;			
+ 	while(found) 
+ 	{
+ 		std::string name;
+ 		found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false);
+-
+-		LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
+-		
+-		// if we have one
+-		if(found) 
++		if(found)
+ 		{
++
++			name=name.erase(name.length()-4);
++
+ 			// bugfix for SL-46920: preventing filenames that break stuff.
+ 			char * curl_str = curl_unescape(name.c_str(), name.size());
+ 			std::string unescaped_name(curl_str);
+ 			curl_free(curl_str);
+ 			curl_str = NULL;
+ 
+-			// not much error checking here since we're getting rid of this
+-			std::string water_name = unescaped_name.substr(0, unescaped_name.size() - 4);
+-		
+-			LLString cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", name));
+-			LL_DEBUGS2("AppInit", "Shaders") << "Loading water from " << cur_path << LL_ENDL;
++			LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
++			loadPreset(unescaped_name,FALSE);
++		}
++	}
++
++	// And repeat for user presets, note the user presets will modify any system presets already loaded
++
++	LLString path_name2(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/water", ""));
++	LL_INFOS2("AppInit", "Shaders") << "Loading User water settings from " << path_name2 << LL_ENDL;
+ 			
+-			std::ifstream water_xml(cur_path.c_str());
+-			if (water_xml)
+-			{
+-				LLSD water_data(LLSD::emptyMap());
+-				LLPointer<LLSDParser> parser = new LLSDXMLParser();
+-				parser->parse(water_xml, water_data, LLSDSerialize::SIZE_UNLIMITED);
++	found = true;			
++	while(found) 
++	{
++		std::string name;
++		found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name, false);
++		if(found)
++		{
++			name=name.erase(name.length()-4);
+ 
+-				addParamSet(water_name, water_data);
+-			}
++			// bugfix for SL-46920: preventing filenames that break stuff.
++			char * curl_str = curl_unescape(name.c_str(), name.size());
++			std::string unescaped_name(curl_str);
++			curl_free(curl_str);
++			curl_str = NULL;
++
++			LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
++			loadPreset(unescaped_name,FALSE);
+ 		}
+ 	}
++
+ }
+ 
+-void LLWaterParamManager::loadPreset(const LLString & name)
++void LLWaterParamManager::loadPreset(const LLString & name,bool propagate)
+ {
+ 	// bugfix for SL-46920: preventing filenames that break stuff.
+ 	char * curl_str = curl_escape(name.c_str(), name.size());
+@@ -139,8 +150,17 @@ void LLWaterParamManager::loadPreset(const LLString & name)
+ 
+ 	std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", escaped_filename));
+ 	llinfos << "Loading water settings from " << pathName << llendl;
+-
+-	std::ifstream presetsXML(pathName.c_str());
++	
++	std::ifstream presetsXML;
++	presetsXML.open(pathName.c_str());
++	
++	// That failed, try loading from the users area instead.
++	if(!presetsXML)
++	{
++		pathName=gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/water", escaped_filename);
++		llinfos << "Loading User water setting from " << pathName << llendl;
++		presetsXML.open(pathName.c_str());
++	}
+ 
+ 	if (presetsXML)
+ 	{
+@@ -166,10 +186,12 @@ void LLWaterParamManager::loadPreset(const LLString & name)
+ 		return;
+ 	}
+ 
+-	getParamSet(name, mCurParams);
+-
+-	propagateParameters();
+-}
++	if(propagate)
++	{
++		getParamSet(name, mCurParams);
++		propagateParameters();
++	}
++}	
+ 
+ void LLWaterParamManager::savePreset(const LLString & name)
+ {
+@@ -183,7 +205,7 @@ void LLWaterParamManager::savePreset(const LLString & name)
+ 
+ 	// make an empty llsd
+ 	LLSD paramsData(LLSD::emptyMap());
+-	std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", escaped_filename));
++	std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/water", escaped_filename));
+ 
+ 	// fill it with LLSD windlight params
+ 	paramsData = mParamList[name].getAll();
+@@ -386,7 +408,7 @@ bool LLWaterParamManager::removeParamSet(const std::string& name, bool delete_fr
+ 
+ 	if(delete_from_disk)
+ 	{
+-		LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/water", ""));
++		LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/water", ""));
+ 		
+ 		// use full curl escaped name
+ 		char * curl_str = curl_escape(name.c_str(), name.size());
+diff --git a/indra/newview/llwaterparammanager.h b/indra/newview/llwaterparammanager.h
+index 6c9ce3e..62f23d9 100644
+--- a/indra/newview/llwaterparammanager.h
++++ b/indra/newview/llwaterparammanager.h
+@@ -228,7 +228,7 @@ public:
+ 	void loadAllPresets(const LLString & fileName);
+ 
+ 	/// load an individual preset into the sky
+-	void loadPreset(const LLString & name);
++	void loadPreset(const LLString & name,bool propagate=TRUE);
+ 
+ 	/// save the parameter presets to file
+ 	void savePreset(const LLString & name);
+diff --git a/indra/newview/llwldaycycle.cpp b/indra/newview/llwldaycycle.cpp
+index 4626160..cc0222e 100644
+--- a/indra/newview/llwldaycycle.cpp
++++ b/indra/newview/llwldaycycle.cpp
+@@ -50,15 +50,32 @@ LLWLDayCycle::~LLWLDayCycle()
+ 
+ void LLWLDayCycle::loadDayCycle(const LLString & fileName)
+ {
++
++	// Currently the day cycle only loads in Default.xml and has no provision to
++	// allow different filenames to be provided, so first see if we have a user customised
++	// Default.xml and if that fails open the system default one. reverse logic to water 
++	// and skies
++
+ 	// clear the first few things
+ 	mTimeMap.clear();
+ 
+ 	// now load the file
+-	LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, 
++	LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, 
+ 		"windlight/days", fileName));
+-	llinfos << "Loading DayCycle settings from " << pathName << llendl;
++	llinfos << "Loading User DayCycle settings from " << pathName << llendl;
+ 	
+-	llifstream day_cycle_xml(pathName.c_str());
++	llifstream day_cycle_xml;
++	day_cycle_xml.open(pathName.c_str());
++	
++	if(!day_cycle_xml)
++	{
++			LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, 
++		"windlight/days", fileName));
++		llinfos << "Loading Default DayCycle settings from " << pathName << llendl;
++		day_cycle_xml.open(pathName.c_str());
++	}
++
++
+ 	if (day_cycle_xml.is_open())
+ 	{
+ 		// load and parse it
+@@ -100,7 +117,7 @@ void LLWLDayCycle::saveDayCycle(const LLString & fileName)
+ {
+ 	LLSD day_data(LLSD::emptyArray());
+ 
+-	LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/days", fileName));
++	LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/days", fileName));
+ 	//llinfos << "Saving WindLight settings to " << pathName << llendl;
+ 
+ 	for(std::map<F32, std::string>::const_iterator mIt = mTimeMap.begin();
+diff --git a/indra/newview/llwlparammanager.cpp b/indra/newview/llwlparammanager.cpp
+index 9f23b37..0b63ecb 100644
+--- a/indra/newview/llwlparammanager.cpp
++++ b/indra/newview/llwlparammanager.cpp
+@@ -106,83 +106,65 @@ LLWLParamManager::~LLWLParamManager()
+ 
+ void LLWLParamManager::loadPresets(const LLString& file_name)
+ {
+-	// if fileName exists, use legacy loading form the big file, otherwise, search the sky 
+-	// directory, and add the list
+-	if(file_name != "") 
++	LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""));
++	LL_INFOS2("AppInit", "Shaders") << "Loading Default WindLight settings from " << path_name << LL_ENDL;
++			
++	bool found = true;			
++	while(found) 
+ 	{
+-		LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", file_name));
+-		LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL;
+-
+-		llifstream presetsXML(path_name.c_str());
+-	
+-		if (presetsXML)
++		std::string name;
++		found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false);
++		if(found)
+ 		{
+-			LLSD paramsData(LLSD::emptyMap());
+ 
+-			LLPointer<LLSDParser> parser = new LLSDXMLParser();
++			name=name.erase(name.length()-4);
+ 
+-			parser->parse(presetsXML, paramsData, LLSDSerialize::SIZE_UNLIMITED);
++			// bugfix for SL-46920: preventing filenames that break stuff.
++			char * curl_str = curl_unescape(name.c_str(), name.size());
++			std::string unescaped_name(curl_str);
++			curl_free(curl_str);
++			curl_str = NULL;
+ 
+-			LLSD::map_const_iterator endParams = paramsData.endMap();
+-			for(LLSD::map_const_iterator curParams = paramsData.beginMap();
+-				curParams != endParams;
+-				++curParams)
+-			{
+-				addParamSet(curParams->first, curParams->second);
+-			}
++			LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
++			loadPreset(unescaped_name,FALSE);
+ 		}
+ 	}
+-	
+-	// otherwise, search the sky directory and find things there
+-	else
++
++	// And repeat for user presets, note the user presets will modify any system presets already loaded
++
++	LLString path_name2(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/skies", ""));
++	LL_INFOS2("AppInit", "Shaders") << "Loading User WindLight settings from " << path_name2 << LL_ENDL;
++			
++	found = true;			
++	while(found) 
+ 	{
+-		LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""));
+-		LL_INFOS2("AppInit", "Shaders") << "Loading WindLight settings from " << path_name << LL_ENDL;
+-	
+-		//mParamList.clear();
+-		
+-		bool found = true;			
+-		while(found) 
++		std::string name;
++		found = gDirUtilp->getNextFileInDir(path_name2, "*.xml", name, false);
++		if(found)
+ 		{
+-			std::string name;
+-			found = gDirUtilp->getNextFileInDir(path_name, "*.xml", name, false);
++			name=name.erase(name.length()-4);
++
++			// bugfix for SL-46920: preventing filenames that break stuff.
++			char * curl_str = curl_unescape(name.c_str(), name.size());
++			std::string unescaped_name(curl_str);
++			curl_free(curl_str);
++			curl_str = NULL;
+ 
+ 			LL_DEBUGS2("AppInit", "Shaders") << "name: " << name << LL_ENDL;
+-			
+-			// if we have one
+-			if(found) 
+-			{
+-				// bugfix for SL-46920: preventing filenames that break stuff.
+-				char * curl_str = curl_unescape(name.c_str(), name.size());
+-				std::string unescaped_name(curl_str);
+-				curl_free(curl_str);
+-				curl_str = NULL;
+-
+-				// not much error checking here since we're getting rid of this
+-				std::string sky_name = unescaped_name.substr(0, unescaped_name.size() - 4);
+-			
+-				LLString cur_path(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", name));
+-				LL_DEBUGS2("AppInit", "Shaders") << "Loading sky from " << cur_path << LL_ENDL;
+-				
+-				std::ifstream sky_xml(cur_path.c_str());
+-				if (sky_xml)
+-				{
+-					LLSD sky_data(LLSD::emptyMap());
+-					LLPointer<LLSDParser> parser = new LLSDXMLParser();
+-					parser->parse(sky_xml, sky_data, LLSDSerialize::SIZE_UNLIMITED);
+-
+-					addParamSet(sky_name, sky_data);
+-				}
+-			}
++			loadPreset(unescaped_name,FALSE);
+ 		}
+ 	}
++
+ }
+ 
+ void LLWLParamManager::savePresets(const LLString & fileName)
+ {
++	//Nobody currently calls me, but if they did, then its reasonable to write the data out to the user's folder
++	//and not over the RO system wide version.
++
+ 	LLSD paramsData(LLSD::emptyMap());
+ 	
+-	LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight", fileName));
++	LLString pathName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight", fileName));
+ 
+ 	for(std::map<std::string, LLWLParamSet>::iterator mIt = mParamList.begin();
+ 		mIt != mParamList.end();
+@@ -200,8 +182,9 @@ void LLWLParamManager::savePresets(const LLString & fileName)
+ 	presetsXML.close();
+ }
+ 
+-void LLWLParamManager::loadPreset(const LLString & name)
++void LLWLParamManager::loadPreset(const LLString & name,bool propagate)
+ {
++	
+ 	// bugfix for SL-46920: preventing filenames that break stuff.
+ 	char * curl_str = curl_escape(name.c_str(), name.size());
+ 	std::string escaped_filename(curl_str);
+@@ -213,7 +196,16 @@ void LLWLParamManager::loadPreset(const LLString & name)
+ 	std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename));
+ 	llinfos << "Loading WindLight sky setting from " << pathName << llendl;
+ 
+-	std::ifstream presetsXML(pathName.c_str());
++	std::ifstream presetsXML;
++	presetsXML.open(pathName.c_str());
++
++	// That failed, try loading from the users area instead.
++	if(!presetsXML)
++	{
++		pathName=gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/skies", escaped_filename);
++		llinfos << "Loading User WindLight sky setting from " << pathName << llendl;
++		presetsXML.open(pathName.c_str());
++	}
+ 
+ 	if (presetsXML)
+ 	{
+@@ -239,10 +231,13 @@ void LLWLParamManager::loadPreset(const LLString & name)
+ 		return;
+ 	}
+ 
+-	getParamSet(name, mCurParams);
+-
+-	propagateParameters();
+-}
++	
++	if(propagate)
++	{
++		getParamSet(name, mCurParams);
++		propagateParameters();
++	}
++}	
+ 
+ void LLWLParamManager::savePreset(const LLString & name)
+ {
+@@ -256,7 +251,7 @@ void LLWLParamManager::savePreset(const LLString & name)
+ 
+ 	// make an empty llsd
+ 	LLSD paramsData(LLSD::emptyMap());
+-	std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", escaped_filename));
++	std::string pathName(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/skies", escaped_filename));
+ 
+ 	// fill it with LLSD windlight params
+ 	paramsData = mParamList[name].getAll();
+@@ -531,7 +526,7 @@ bool LLWLParamManager::removeParamSet(const std::string& name, bool delete_from_
+ 	
+ 	if(delete_from_disk)
+ 	{
+-		LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, "windlight/skies", ""));
++		LLString path_name(gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "windlight/skies", ""));
+ 		
+ 		// use full curl escaped name
+ 		char * curl_str = curl_escape(name.c_str(), name.size());
+diff --git a/indra/newview/llwlparammanager.h b/indra/newview/llwlparammanager.h
+index 72b888d..aaac355 100644
+--- a/indra/newview/llwlparammanager.h
++++ b/indra/newview/llwlparammanager.h
+@@ -135,7 +135,7 @@ public:
+ 	void savePresets(const LLString & fileName);
+ 
+ 	/// load an individual preset into the sky
+-	void loadPreset(const LLString & name);
++	void loadPreset(const LLString & name,bool propogate=TRUE);
+ 
+ 	/// save the parameter presets to file
+ 	void savePreset(const LLString & name);
+@@ -195,7 +195,6 @@ public:
+ 	// singleton pattern implementation
+ 	static LLWLParamManager * instance();
+ 
+-
+ public:
+ 
+ 	// helper variables

-- 
A client for connecting to 3D metaverses such as Linden Labs Secondlife(tm) and OpenSim grids



More information about the Pkg-games-commits mailing list