Explorar o código

Fixed issue where color picking doesn't work properly
Fixed issue where rename in project library didn't work when triggered from context menu
Fix so the editor doesn't crash when there's a non-ASCII character in its path

BearishSun %!s(int64=9) %!d(string=hai) anos
pai
achega
19ebd1e824

+ 4 - 4
Scripts/build_editor_win_x64.py

@@ -4,19 +4,19 @@
 # installed and the path is valid.
 
 # Usage: "build_editor_win_x64 $Configuration"
-# Where: $Configuration - e.g. DebugRelease, Release
+# Where: $Configuration - e.g. OptimizedDebug, Release
 
 import os
 
 msbuildPath = "C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\amd64"
-configuration = 'DebugRelease' #sys.argv[1]
-solutionPath = "..\\BansheeEngine.sln"
+configuration = 'OptimizedDebug' #sys.argv[1]
+solutionPath = "..\\Build\\VS2015\\BansheeEngine.sln"
 
 if not os.path.exists(msbuildPath):
     print("MSBuild path is not valid. Used path {0}: ".format(msbuildPath))
     exit;
 
 os.environ["PATH"] += os.pathsep + msbuildPath
-os.system("msbuild {0} /p:Configuration=DebugRelease;Platform=x64".format(solutionPath))
+os.system("msbuild {0} /p:Configuration=OptimizedDebug;Platform=x64".format(solutionPath))
 os.system("msbuild {0} /p:Configuration=Release;Platform=x64".format(solutionPath))
 os.system("package_editor.py " + configuration)

+ 2 - 2
Scripts/package_editor.py

@@ -5,7 +5,7 @@
 # been built before executing this script.
 
 # Usage: "package_editor $Configuration"
-# Where: $Configuration - e.g. Debug, DebugRelease
+# Where: $Configuration - e.g. Debug, OptimizedDebug
 
 # TODO: Don't package Settings.asset, Game binaries, Example binaries
 
@@ -13,7 +13,7 @@ import os
 import sys
 import shutil
 
-configuration = 'DebugRelease' #sys.argv[1]
+configuration = 'OptimizedDebug' #sys.argv[1]
 dataFoldersToIgnore = ['Examples', 'Raw']
 
 dataFolder = 'Data'

+ 1 - 1
Source/BansheeCore/Source/BsIconUtility.cpp

@@ -201,7 +201,7 @@ namespace BansheeEngine
 		//    - icon/cursor/etc data
 
 		std::fstream stream;
-		stream.open(path.toString().c_str(), std::ios::in | std::ios::out | std::ios::binary);
+		stream.open(path.toWString().c_str(), std::ios::in | std::ios::out | std::ios::binary);
 
 		// First check magic number to ensure file is even an executable
 		UINT16 magicNum;

+ 2 - 2
Source/BansheeMono/Include/BsMonoAssembly.h

@@ -63,7 +63,7 @@ namespace BansheeEngine
 	private:
 		friend class MonoManager;
 
-		MonoAssembly(const String& path, const String& name);
+		MonoAssembly(const WString& path, const String& name);
 
 		/**
 	     * Attempts to find a managed class with the specified namespace and name in this assembly. Registers a new class
@@ -96,7 +96,7 @@ namespace BansheeEngine
 		bool isGenericClass(const String& name) const;
 
 		String mName;
-		String mPath;
+		WString mPath;
 		MonoImage* mMonoImage;
 		::MonoAssembly* mMonoAssembly;
 		bool mIsLoaded;

+ 1 - 1
Source/BansheeMono/Include/BsMonoManager.h

@@ -31,7 +31,7 @@ namespace BansheeEngine
 		 * @param[in]	path	Absolute path to the assembly .dll.
 		 * @param[in]	name	Unique name for the assembly.
 		 */
-		MonoAssembly& loadAssembly(const String& path, const String& name);
+		MonoAssembly& loadAssembly(const WString& path, const String& name);
 
 		/**	Searches all loaded assemblies for the specified class. */
 		MonoClass* findClass(const String& ns, const String& typeName);

+ 10 - 8
Source/BansheeMono/Source/BsMonoAssembly.cpp

@@ -39,7 +39,7 @@ namespace BansheeEngine
 
 	}
 
-	MonoAssembly::MonoAssembly(const String& path, const String& name)
+	MonoAssembly::MonoAssembly(const WString& path, const String& name)
 		: mName(name), mPath(path), mMonoImage(nullptr), mMonoAssembly(nullptr), mIsLoaded(false), mIsDependency(false)
 		, mHaveCachedClassList(false)
 	{
@@ -60,7 +60,7 @@ namespace BansheeEngine
 		SPtr<DataStream> assemblyStream = FileSystem::openFile(mPath, true);
 		if (assemblyStream == nullptr)
 		{
-			LOGERR("Cannot load assembly at path \"" + mPath + "\" because the file doesn't exist");
+			LOGERR("Cannot load assembly at path \"" + toString(mPath) + "\" because the file doesn't exist");
 			return;
 		}
 
@@ -68,18 +68,20 @@ namespace BansheeEngine
 		char* assemblyData = (char*)bs_stack_alloc(assemblySize);
 		assemblyStream->read(assemblyData, assemblySize);
 
-		MonoImageOpenStatus status;
-		MonoImage* image = mono_image_open_from_data_with_name(assemblyData, assemblySize, true, &status, false, mPath.c_str());
+		String imageName = Path(mPath).getFilename();
+
+		MonoImageOpenStatus status = MONO_IMAGE_OK;
+		MonoImage* image = mono_image_open_from_data_with_name(assemblyData, assemblySize, true, &status, false, imageName.c_str());
 		bs_stack_free(assemblyData);
 
 		if (status != MONO_IMAGE_OK || image == nullptr)
 		{
-			LOGERR("Failed loading image data for assembly \"" + mPath + "\"");
+			LOGERR("Failed loading image data for assembly \"" + toString(mPath) + "\"");
 			return;
 		}
 
 		// Load MDB file
-		Path mdbPath = mPath + ".mdb";
+		Path mdbPath = mPath + L".mdb";
 		if (FileSystem::exists(mdbPath))
 		{
 			SPtr<DataStream> mdbStream = FileSystem::openFile(mdbPath, true);
@@ -95,10 +97,10 @@ namespace BansheeEngine
 			}
 		}
 
-		mMonoAssembly = mono_assembly_load_from_full(image, mPath.c_str(), &status, false);
+		mMonoAssembly = mono_assembly_load_from_full(image, imageName.c_str(), &status, false);
 		if (status != MONO_IMAGE_OK || mMonoAssembly == nullptr)
 		{
-			LOGERR("Failed loading assembly \"" + mPath + "\"");
+			LOGERR("Failed loading assembly \"" + toString(mPath) + "\"");
 			return;
 		}
 		

+ 5 - 3
Source/BansheeMono/Source/BsMonoManager.cpp

@@ -74,13 +74,15 @@ namespace BansheeEngine
 		}
 	}
 
-	MonoAssembly& MonoManager::loadAssembly(const String& path, const String& name)
+	MonoAssembly& MonoManager::loadAssembly(const WString& path, const String& name)
 	{
 		MonoAssembly* assembly = nullptr;
 
 		if (mScriptDomain == nullptr)
 		{
-			mScriptDomain = mono_domain_create_appdomain(const_cast<char *>(path.c_str()), nullptr);
+			String appDomainName = toString(path);
+
+			mScriptDomain = mono_domain_create_appdomain(const_cast<char *>(appDomainName.c_str()), nullptr);
 			mono_domain_set(mScriptDomain, false);
 
 			if (mScriptDomain == nullptr)
@@ -137,7 +139,7 @@ namespace BansheeEngine
 			auto iterFind = mAssemblies.find("corlib");
 			if (iterFind == mAssemblies.end())
 			{
-				corlib = new (bs_alloc<MonoAssembly>()) MonoAssembly("corlib", "corlib");
+				corlib = new (bs_alloc<MonoAssembly>()) MonoAssembly(L"corlib", "corlib");
 				mAssemblies["corlib"] = corlib;
 			}
 			else

+ 2 - 2
Source/BansheeUtility/Source/BsFileSerializer.cpp

@@ -22,7 +22,7 @@ namespace BansheeEngine
 		if (!FileSystem::exists(parentDir))
 			FileSystem::createDir(parentDir);
 
-		mOutputStream.open(fileLocation.toString().c_str(), std::ios::out | std::ios::binary);
+		mOutputStream.open(fileLocation.toWString().c_str(), std::ios::out | std::ios::binary);
 		if (mOutputStream.fail())
 		{
 			LOGWRN("Failed to save file: \"" + fileLocation.toString() + "\". Error: " + strerror(errno) + ".");
@@ -63,7 +63,7 @@ namespace BansheeEngine
 
 	FileDecoder::FileDecoder(const Path& fileLocation)
 	{
-		mInputStream.open(fileLocation.toString().c_str(), std::ios::in | std::ios::ate | std::ios::binary);
+		mInputStream.open(fileLocation.toWString().c_str(), std::ios::in | std::ios::ate | std::ios::binary);
 
 		if (mInputStream.fail())
 		{

+ 15 - 5
Source/MBansheeEditor/Windows/Library/LibraryWindow.cs

@@ -167,17 +167,18 @@ namespace BansheeEditor
             searchBarLayout = contentLayout.AddLayoutX();
             searchField = new GUITextField();
             searchField.OnChanged += OnSearchChanged;
+            searchField.OnFocusGained += StopRename;
 
             GUIContent clearIcon = new GUIContent(EditorBuiltin.GetLibraryWindowIcon(LibraryWindowIcon.Clear), 
                 new LocEdString("Clear"));
             GUIButton clearSearchBtn = new GUIButton(clearIcon);
-            clearSearchBtn.OnClick += ClearSearch;
+            clearSearchBtn.OnClick += OnClearClicked;
             clearSearchBtn.SetWidth(40);
 
             GUIContent optionsIcon = new GUIContent(EditorBuiltin.GetLibraryWindowIcon(LibraryWindowIcon.Options), 
                 new LocEdString("Options"));
             optionsButton = new GUIButton(optionsIcon);
-            optionsButton.OnClick += OpenOptionsWindow;
+            optionsButton.OnClick += OnOptionsClicked;
             optionsButton.SetWidth(40);
             searchBarLayout.AddElement(searchField);
             searchBarLayout.AddElement(clearSearchBtn);
@@ -335,7 +336,7 @@ namespace BansheeEditor
             }
             else
             {
-                if (isRenameInProgress)
+                if (isRenameInProgress && !HasFocus)
                     StopRename();
             }
 
@@ -1186,8 +1187,10 @@ namespace BansheeEditor
         /// <summary>
         /// Clears the search bar and refreshes the content area to display contents of the current directory.
         /// </summary>
-        private void ClearSearch()
+        private void OnClearClicked()
         {
+            StopRename();
+
             searchField.Value = "";
             searchQuery = "";
             Refresh();
@@ -1230,8 +1233,10 @@ namespace BansheeEditor
         /// <summary>
         /// Opens the drop down options window that allows you to customize library window look and feel.
         /// </summary>
-        private void OpenOptionsWindow()
+        private void OnOptionsClicked()
         {
+            StopRename();
+
             Vector2I openPosition;
             Rect2I buttonBounds = GUILayoutUtility.CalculateBounds(optionsButton, GUI);
 
@@ -1523,6 +1528,7 @@ namespace BansheeEditor
         /// <param name="path">Project library path to the folder to enter.</param>
         private void OnFolderButtonClicked(string path)
         {
+            StopRename();
             EnterDirectory(path);
         }
 
@@ -1540,6 +1546,8 @@ namespace BansheeEditor
         /// </summary>
         private void OnHomeClicked()
         {
+            StopRename();
+
             CurrentFolder = ProjectLibrary.Root.Path;
             Refresh();
         }
@@ -1550,6 +1558,8 @@ namespace BansheeEditor
         /// </summary>
         private void OnUpClicked()
         {
+            StopRename();
+
             string currentDir = CurrentFolder;
             currentDir = currentDir.Trim(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
 

+ 2 - 1
Source/MBansheeEditor/Windows/Scene/SceneWindow.cs

@@ -813,7 +813,8 @@ namespace BansheeEditor
             width = MathEx.Max(20, width);
             height = MathEx.Max(20, height);
 
-            renderTexture = new RenderTexture2D(PixelFormat.R8G8B8A8, width, height);
+            // Note: Depth buffer is required because ScenePicking uses it
+            renderTexture = new RenderTexture2D(PixelFormat.R8G8B8A8, width, height, 1, false, true);
             renderTexture.Priority = 1;
 
 		    if (camera == null)

+ 4 - 4
Source/SBansheeEditor/Source/BsEditorScriptLibrary.cpp

@@ -57,21 +57,21 @@ namespace BansheeEngine
 		}
 		else // Otherwise just additively load them
 		{
-			MonoManager::instance().loadAssembly(engineAssemblyPath.toString(), ENGINE_ASSEMBLY);
+			MonoManager::instance().loadAssembly(engineAssemblyPath.toWString(), ENGINE_ASSEMBLY);
 			ScriptAssemblyManager::instance().loadAssemblyInfo(ENGINE_ASSEMBLY);
 
 			if (FileSystem::exists(gameAssemblyPath))
 			{
-				MonoManager::instance().loadAssembly(gameAssemblyPath.toString(), SCRIPT_GAME_ASSEMBLY);
+				MonoManager::instance().loadAssembly(gameAssemblyPath.toWString(), SCRIPT_GAME_ASSEMBLY);
 				ScriptAssemblyManager::instance().loadAssemblyInfo(SCRIPT_GAME_ASSEMBLY);
 			}
 
-			MonoManager::instance().loadAssembly(editorAssemblyPath.toString(), EDITOR_ASSEMBLY);
+			MonoManager::instance().loadAssembly(editorAssemblyPath.toWString(), EDITOR_ASSEMBLY);
 			ScriptAssemblyManager::instance().loadAssemblyInfo(EDITOR_ASSEMBLY);
 
 			if (FileSystem::exists(editorScriptAssemblyPath))
 			{
-				MonoManager::instance().loadAssembly(editorScriptAssemblyPath.toString(), SCRIPT_EDITOR_ASSEMBLY);
+				MonoManager::instance().loadAssembly(editorScriptAssemblyPath.toWString(), SCRIPT_EDITOR_ASSEMBLY);
 				ScriptAssemblyManager::instance().loadAssemblyInfo(SCRIPT_EDITOR_ASSEMBLY);
 			}
 

+ 1 - 1
Source/SBansheeEditor/Source/BsEditorScriptManager.cpp

@@ -125,7 +125,7 @@ namespace BansheeEngine
 
 	void EditorScriptManager::loadMonoTypes()
 	{
-		const String editorAssemblyPath = gEditorApplication().getEditorAssemblyPath().toString();
+		WString editorAssemblyPath = gEditorApplication().getEditorAssemblyPath().toWString();
 		mEditorAssembly = &MonoManager::instance().loadAssembly(editorAssemblyPath, EDITOR_ASSEMBLY);
 
 		mProgramEdClass = mEditorAssembly->getClass("BansheeEditor", "Program");

+ 4 - 4
Source/SBansheeEngine/Source/BsEngineScriptLibrary.cpp

@@ -31,7 +31,7 @@ namespace BansheeEngine
 		const String ASSEMBLY_ENTRY_POINT = "Program::Start";
 
 		MonoManager::startUp();
-		MonoAssembly& bansheeEngineAssembly = MonoManager::instance().loadAssembly(engineAssemblyPath.toString(), ENGINE_ASSEMBLY);
+		MonoAssembly& bansheeEngineAssembly = MonoManager::instance().loadAssembly(engineAssemblyPath.toWString(), ENGINE_ASSEMBLY);
 
 		PlayInEditorManager::startUp();
 		ScriptDebug::startUp();
@@ -51,7 +51,7 @@ namespace BansheeEngine
 		Path gameAssemblyPath = gApplication().getGameAssemblyPath();
 		if (FileSystem::exists(gameAssemblyPath))
 		{
-			MonoManager::instance().loadAssembly(gameAssemblyPath.toString(), SCRIPT_GAME_ASSEMBLY);
+			MonoManager::instance().loadAssembly(gameAssemblyPath.toWString(), SCRIPT_GAME_ASSEMBLY);
 			ScriptAssemblyManager::instance().loadAssemblyInfo(SCRIPT_GAME_ASSEMBLY);
 		}
 
@@ -76,12 +76,12 @@ namespace BansheeEngine
 		}
 		else // Otherwise just additively load them
 		{
-			MonoManager::instance().loadAssembly(engineAssemblyPath.toString(), ENGINE_ASSEMBLY);
+			MonoManager::instance().loadAssembly(engineAssemblyPath.toWString(), ENGINE_ASSEMBLY);
 			ScriptAssemblyManager::instance().loadAssemblyInfo(ENGINE_ASSEMBLY);
 
 			if (FileSystem::exists(gameAssemblyPath))
 			{
-				MonoManager::instance().loadAssembly(gameAssemblyPath.toString(), SCRIPT_GAME_ASSEMBLY);
+				MonoManager::instance().loadAssembly(gameAssemblyPath.toWString(), SCRIPT_GAME_ASSEMBLY);
 				ScriptAssemblyManager::instance().loadAssemblyInfo(SCRIPT_GAME_ASSEMBLY);
 			}
 

+ 1 - 1
Source/SBansheeEngine/Source/BsScriptObjectManager.cpp

@@ -57,7 +57,7 @@ namespace BansheeEngine
 
 		for (auto& assemblyPair : assemblies)
 		{
-			MonoManager::instance().loadAssembly(assemblyPair.second.toString(), assemblyPair.first);
+			MonoManager::instance().loadAssembly(assemblyPair.second.toWString(), assemblyPair.first);
 			ScriptAssemblyManager::instance().loadAssemblyInfo(assemblyPair.first);
 		}