[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56446] trunk/blender/source/blender/ freestyle/intern: Fix for [#35116] Freestyle StringUtils:: toAscii breakes non-ascii path values.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Wed May 1 15:34:57 CEST 2013


Revision: 56446
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56446
Author:   kjym3
Date:     2013-05-01 13:34:56 +0000 (Wed, 01 May 2013)
Log Message:
-----------
Fix for [#35116] Freestyle StringUtils::toAscii breakes non-ascii path values.

Just removed all calls of StringUtils::toAscii() as well as the function definitions.

Modified Paths:
--------------
    trunk/blender/source/blender/freestyle/intern/application/AppCanvas.cpp
    trunk/blender/source/blender/freestyle/intern/application/AppConfig.cpp
    trunk/blender/source/blender/freestyle/intern/application/Controller.cpp
    trunk/blender/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp
    trunk/blender/source/blender/freestyle/intern/system/StringUtils.cpp
    trunk/blender/source/blender/freestyle/intern/system/StringUtils.h

Modified: trunk/blender/source/blender/freestyle/intern/application/AppCanvas.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/application/AppCanvas.cpp	2013-05-01 13:28:44 UTC (rev 56445)
+++ trunk/blender/source/blender/freestyle/intern/application/AppCanvas.cpp	2013-05-01 13:34:56 UTC (rev 56446)
@@ -39,7 +39,7 @@
 :Canvas()
 {
 	_pViewer = 0;
-	_MapsPath = StringUtils::toAscii(Config::Path::getInstance()->getMapsDir()).c_str();
+	_MapsPath = Config::Path::getInstance()->getMapsDir().c_str();
 }
 
 AppCanvas::AppCanvas(AppView *iViewer)

Modified: trunk/blender/source/blender/freestyle/intern/application/AppConfig.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/application/AppConfig.cpp	2013-05-01 13:28:44 UTC (rev 56445)
+++ trunk/blender/source/blender/freestyle/intern/application/AppConfig.cpp	2013-05-01 13:34:56 UTC (rev 56446)
@@ -83,15 +83,14 @@
 string Path::getEnvVar(const string& iEnvVarName)
 {
 	string value;
-	if (!getenv(StringUtils::toAscii(iEnvVarName).c_str())) {
-		cerr << "Warning: You may want to set the $" <<
-		        StringUtils::toAscii(iEnvVarName) <<
+	if (!getenv(iEnvVarName.c_str())) {
+		cerr << "Warning: You may want to set the $" << iEnvVarName <<
 		        " environment variable to use Freestyle." << endl <<
 		        "         Otherwise, the current directory will be used instead." << endl;
 		value = ".";
 	}
 	else {
-		value = getenv(StringUtils::toAscii(iEnvVarName).c_str());
+		value = getenv(iEnvVarName.c_str());
 	}
 	return value;
 }

Modified: trunk/blender/source/blender/freestyle/intern/application/Controller.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/application/Controller.cpp	2013-05-01 13:28:44 UTC (rev 56445)
+++ trunk/blender/source/blender/freestyle/intern/application/Controller.cpp	2013-05-01 13:34:56 UTC (rev 56446)
@@ -280,7 +280,7 @@
 	char cleaned[FILE_MAX];
 	BLI_strncpy(cleaned, iFileName, FILE_MAX);
 	BLI_cleanup_file(NULL, cleaned);
-	string basename = StringUtils::toAscii(string(cleaned));
+	string basename = string(cleaned);
 #endif
 
 	_ListOfModels.push_back("Blender_models");
@@ -851,7 +851,7 @@
 void Controller::InsertStyleModule(unsigned index, const char *iFileName)
 {
 	if (!BLI_testextensie(iFileName, ".py")) {
-		cerr << "Error: Cannot load \"" << StringUtils::toAscii(string(iFileName)) << "\", unknown extension" << endl;
+		cerr << "Error: Cannot load \"" << string(iFileName) << "\", unknown extension" << endl;
 		return;
 	}
 
@@ -1015,10 +1015,10 @@
 	Config::Path * cpath = Config::Path::getInstance();
 
 	// Directories
-	ViewMapIO::Options::setModelsPath(StringUtils::toAscii(cpath->getModelsPath()));
-	PythonInterpreter::Options::setPythonPath(StringUtils::toAscii(cpath->getPythonPath()));
-	TextureManager::Options::setPatternsPath(StringUtils::toAscii(cpath->getPatternsPath()));
-	TextureManager::Options::setBrushesPath(StringUtils::toAscii(cpath->getModelsPath()));
+	ViewMapIO::Options::setModelsPath(cpath->getModelsPath());
+	PythonInterpreter::Options::setPythonPath(cpath->getPythonPath());
+	TextureManager::Options::setPatternsPath(cpath->getPatternsPath());
+	TextureManager::Options::setBrushesPath(cpath->getModelsPath());
 
 	// ViewMap Format
 	ViewMapIO::Options::rmFlags(ViewMapIO::Options::FLOAT_VECTORS);

Modified: trunk/blender/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp	2013-05-01 13:28:44 UTC (rev 56445)
+++ trunk/blender/source/blender/freestyle/intern/blender_interface/BlenderTextureManager.cpp	2013-05-01 13:34:56 UTC (rev 56446)
@@ -79,13 +79,13 @@
 	switch (mediumType) {
 	case Stroke::DRY_MEDIUM:
 		//soc prepareTextureLuminance((const char*)path.toAscii(), texId);
-		prepareTextureLuminance(StringUtils::toAscii(path), texId);
+		prepareTextureLuminance(path, texId);
 		break;
 	case Stroke::HUMID_MEDIUM:
 	case Stroke::OPAQUE_MEDIUM:
 	default:
 		//soc prepareTextureAlpha((const char*)path.toAscii(), texId);
-		prepareTextureAlpha(StringUtils::toAscii(path), texId);
+		prepareTextureAlpha(path, texId);
 		break;
 	}
 	if (G.debug & G_DEBUG_FREESTYLE) {

Modified: trunk/blender/source/blender/freestyle/intern/system/StringUtils.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/system/StringUtils.cpp	2013-05-01 13:28:44 UTC (rev 56445)
+++ trunk/blender/source/blender/freestyle/intern/system/StringUtils.cpp	2013-05-01 13:34:56 UTC (rev 56446)
@@ -54,7 +54,7 @@
 
 		BLI_strncpy(cleaned, dir.c_str(), FILE_MAX);
 		BLI_cleanup_file(NULL, cleaned);
-		res = toAscii(string(cleaned));
+		res = string(cleaned);
 
 		if (!base.empty())
 			res += Config::DIR_SEP + base;
@@ -63,24 +63,6 @@
 	}
 }
 
-string toAscii(const string &str)
-{
-	stringstream out("");
-	char s;
-
-	for (unsigned int i = 0; i < str.size() ; i++) {
-		s = ((char)(str.at(i) & 0x7F));
-		out << s;
-	}
-
-	return out.str();
-}
-
-const char *toAscii(const char *str)
-{
-	return toAscii(string(str)).c_str();
-}
-
 } // end of namespace StringUtils
 
 } /* namespace Freestyle */

Modified: trunk/blender/source/blender/freestyle/intern/system/StringUtils.h
===================================================================
--- trunk/blender/source/blender/freestyle/intern/system/StringUtils.h	2013-05-01 13:28:44 UTC (rev 56445)
+++ trunk/blender/source/blender/freestyle/intern/system/StringUtils.h	2013-05-01 13:34:56 UTC (rev 56446)
@@ -53,8 +53,6 @@
 
 LIB_SYSTEM_EXPORT
 void getPathName(const string& path, const string& base, vector<string>& pathnames);
-string toAscii(const string &str);
-const char *toAscii(const char *str);
 
 // STL related
 struct ltstr




More information about the Bf-blender-cvs mailing list