Forráskód Böngészése

Fix an issue where project was saved after unload
Fix an issue where project load methods were called twice in a row

BearishSun 10 éve
szülő
commit
f514a09514

+ 4 - 0
BansheeEditor/Source/BsEditorApplication.cpp

@@ -310,6 +310,10 @@ namespace BansheeEngine
 		ProjectLibrary::instance().unloadLibrary();
 		Resources::instance().unloadAllUnused();
 		gCoreSceneManager().clearScene();
+
+		mProjectPath = Path::BLANK;
+		mProjectName = StringUtil::WBLANK;
+		mIsProjectLoaded = false;
 	}
 
 	void EditorApplication::loadProject(const Path& projectPath)

+ 3 - 3
MBansheeEditor/EditorApplication.cs

@@ -103,7 +103,10 @@ namespace BansheeEditor
             inputConfig.RegisterButton(SceneWindow.RotateToolBinding, ButtonCode.E);
             inputConfig.RegisterButton(SceneWindow.ScaleToolBinding, ButtonCode.R);
             inputConfig.RegisterButton(SceneWindow.DuplicateBinding, ButtonCode.D, ButtonModifier.Ctrl);
+        }
 
+        private static void OnEditorLoad()
+        {
             if (EditorSettings.AutoLoadLastProject)
             {
                 string projectPath = EditorSettings.LastOpenProject;
@@ -237,10 +240,7 @@ namespace BansheeEditor
             }
 
             if (IsProjectLoaded)
-            {
-                SaveProject();
                 UnloadProject();
-            }
 
             Internal_LoadProject(path); // Triggers OnProjectLoaded when done
         }

+ 0 - 2
MBansheeEditor/LibraryWindow.cs

@@ -185,8 +185,6 @@ namespace BansheeEditor
 
         private void DoOnDragStart(Vector2I windowPos)
         {
-            Debug.Log("DRAG STARTED + " + windowPos + " - " + GUI.Bounds);
-
             ElementEntry underCursorElem = FindElementAt(windowPos);
             if (underCursorElem == null)
             {

+ 14 - 0
MBansheeEditor/Program.cs

@@ -31,6 +31,20 @@ namespace BansheeEditor
             //dbgStyle.textColor = newColor;
         }
 
+        static void OnEditorLoad()
+        {
+            if (EditorSettings.AutoLoadLastProject)
+            {
+                string projectPath = EditorSettings.LastOpenProject;
+                if (EditorApplication.IsValidProject(projectPath))
+                    EditorApplication.LoadProject(projectPath);
+                else
+                    ProjectWindow.Open();
+            }
+            else
+                ProjectWindow.Open();
+        }
+
         static void OnEditorUpdate()
         {
             app.OnEditorUpdate();

+ 5 - 1
SBansheeEditor/Source/BsEditorScriptManager.cpp

@@ -48,7 +48,11 @@ namespace BansheeEngine
 		mOnDomainLoadConn = ScriptObjectManager::instance().onRefreshDomainLoaded.connect(std::bind(&EditorScriptManager::loadMonoTypes, this));
 		mOnAssemblyRefreshDoneConn = ScriptObjectManager::instance().onRefreshComplete.connect(std::bind(&EditorScriptManager::onAssemblyRefreshDone, this));
 		triggerOnInitialize();
-		
+
+		// Trigger OnEditorLoad
+		const String EDITOR_ON_LOAD = "Program::OnEditorLoad";
+		mEditorAssembly->invoke(EDITOR_ON_LOAD);
+
 		// Initial update
 		mLastUpdateTime = gTime().getTime();
 		mUpdateMethod->invoke(nullptr, nullptr);

+ 5 - 3
TODO.txt

@@ -52,9 +52,11 @@ Code quality improvements:
 ----------------------------------------------------------------------
 Polish
 
-Move data folder within current repo
- - Store default layout asset in Data/Editor folder
- - Store data generated by editor runtime at Data/Runtime
+Open a project window and closing it, then attempting shutdown causes a crash when destroying a ScriptGUILayout
+ - Likely due to clearScene() deleting all GUIWidgets and their related elements before managed elements were destroyed
+
+Newly created project has invalid layout
+ - Potentially original project's layout is also corrupted
 
 Ribek use:
  - When mousing over GUIMenu elements cursor changes if underlying GUI element changes