Просмотр исходного кода

When importing resources show progress bar for at least one frame
Fixed drag and drop bounds for Library window

BearishSun 10 лет назад
Родитель
Сommit
d043e23240
3 измененных файлов с 32 добавлено и 23 удалено
  1. 1 1
      BansheeEditorExec/BsEditorExec.cpp
  2. 3 3
      MBansheeEditor/Library/LibraryWindow.cs
  3. 28 19
      MBansheeEditor/ProjectLibrary.cs

+ 1 - 1
BansheeEditorExec/BsEditorExec.cpp

@@ -72,7 +72,7 @@ int CALLBACK WinMain(
 
 
 	__try
 	__try
 	{
 	{
-		EditorApplication::startUp(RenderAPIPlugin::OpenGL);
+		EditorApplication::startUp(RenderAPIPlugin::DX11);
 		EditorApplication::instance().runMainLoop();
 		EditorApplication::instance().runMainLoop();
 		EditorApplication::shutDown();
 		EditorApplication::shutDown();
 	}
 	}

+ 3 - 3
MBansheeEditor/Library/LibraryWindow.cs

@@ -197,7 +197,7 @@ namespace BansheeEditor
             Reset();
             Reset();
 
 
             dropTarget = new LibraryDropTarget(this);
             dropTarget = new LibraryDropTarget(this);
-            dropTarget.Bounds = contentScrollArea.Bounds;
+            dropTarget.Bounds = GetScrollAreaBounds();
             dropTarget.OnStart += OnDragStart;
             dropTarget.OnStart += OnDragStart;
             dropTarget.OnDrag += OnDragMove;
             dropTarget.OnDrag += OnDragMove;
             dropTarget.OnLeave += OnDragLeave;
             dropTarget.OnLeave += OnDragLeave;
@@ -364,7 +364,7 @@ namespace BansheeEditor
 
 
             Refresh();
             Refresh();
 
 
-            dropTarget.Bounds = contentScrollArea.Bounds;
+            dropTarget.Bounds = GetScrollAreaBounds();
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -1147,7 +1147,7 @@ namespace BansheeEditor
             Rect2I folderListBounds = folderListLayout.Bounds;
             Rect2I folderListBounds = folderListLayout.Bounds;
             Rect2I searchBarBounds = searchBarLayout.Bounds;
             Rect2I searchBarBounds = searchBarLayout.Bounds;
 
 
-            bounds.y += folderListBounds.height + searchBarBounds.height;
+            bounds.y = folderListBounds.height + searchBarBounds.height;
             bounds.height -= folderListBounds.height + searchBarBounds.height;
             bounds.height -= folderListBounds.height + searchBarBounds.height;
 
 
             return bounds;
             return bounds;

+ 28 - 19
MBansheeEditor/ProjectLibrary.cs

@@ -37,6 +37,7 @@ namespace BansheeEditor
         private static HashSet<string> queuedForImport = new HashSet<string>();
         private static HashSet<string> queuedForImport = new HashSet<string>();
         private static int numImportedFiles;
         private static int numImportedFiles;
         private static int totalFilesToImport;
         private static int totalFilesToImport;
+        private static bool importInProgress;
 
 
         private const float TIME_SLICE_SECONDS = 0.030f;
         private const float TIME_SLICE_SECONDS = 0.030f;
 
 
@@ -253,28 +254,29 @@ namespace BansheeEditor
         {
         {
             if (queuedForImport.Count > 0)
             if (queuedForImport.Count > 0)
             {
             {
-                UInt64 start = Time.Precise;
-                List<string> toRemove = new List<string>();
-                string lastEntry = "";
-
-                foreach (var entry in queuedForImport)
+                // Skip first frame to get the progress bar a chance to show up
+                if (importInProgress)
                 {
                 {
-                    lastEntry = entry;
+                    UInt64 start = Time.Precise;
+                    List<string> toRemove = new List<string>();
 
 
-                    Internal_Refresh(entry, true);
-                    toRemove.Add(entry);
-                    numImportedFiles++;
+                    foreach (var entry in queuedForImport)
+                    {
+                        Internal_Refresh(entry, true);
+                        toRemove.Add(entry);
+                        numImportedFiles++;
 
 
-                    UInt64 end = Time.Precise;
-                    UInt64 elapsed = end - start;
+                        UInt64 end = Time.Precise;
+                        UInt64 elapsed = end - start;
 
 
-                    float elapsedSeconds = elapsed * Time.MicroToSecond;
-                    if (elapsedSeconds > TIME_SLICE_SECONDS)
-                        break;
-                }
+                        float elapsedSeconds = elapsed * Time.MicroToSecond;
+                        if (elapsedSeconds > TIME_SLICE_SECONDS)
+                            break;
+                    }
 
 
-                foreach (var entry in toRemove)
-                    queuedForImport.Remove(entry);
+                    foreach (var entry in toRemove)
+                        queuedForImport.Remove(entry);
+                }
 
 
                 if (queuedForImport.Count == 0)
                 if (queuedForImport.Count == 0)
                 {
                 {
@@ -285,7 +287,10 @@ namespace BansheeEditor
                 }
                 }
                 else
                 else
                 {
                 {
-                    string displayName = lastEntry;
+                    IEnumerator<string> enumerator = queuedForImport.GetEnumerator();
+                    enumerator.MoveNext();
+
+                    string displayName = enumerator.Current;
                     displayName = displayName.Replace("\\", "\\\\");
                     displayName = displayName.Replace("\\", "\\\\");
 
 
                     if (displayName.Length > 60)
                     if (displayName.Length > 60)
@@ -295,9 +300,13 @@ namespace BansheeEditor
                     }
                     }
 
 
                     float pct = numImportedFiles / (float)totalFilesToImport;
                     float pct = numImportedFiles / (float)totalFilesToImport;
-                    ProgressBar.Show("Importing (" + numImportedFiles + "/" + totalFilesToImport + ")", displayName, pct);
+                    ProgressBar.Show("Importing (" + numImportedFiles + "/" + totalFilesToImport + ")", displayName, 0.5f);
                 }
                 }
+
+                importInProgress = true;
             }
             }
+            else
+                importInProgress = false;
         }
         }
 
 
         /// <summary>
         /// <summary>