Browse Source

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

BearishSun 10 năm trước cách đây
mục cha
commit
d043e23240

+ 1 - 1
BansheeEditorExec/BsEditorExec.cpp

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

+ 3 - 3
MBansheeEditor/Library/LibraryWindow.cs

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

+ 28 - 19
MBansheeEditor/ProjectLibrary.cs

@@ -37,6 +37,7 @@ namespace BansheeEditor
         private static HashSet<string> queuedForImport = new HashSet<string>();
         private static int numImportedFiles;
         private static int totalFilesToImport;
+        private static bool importInProgress;
 
         private const float TIME_SLICE_SECONDS = 0.030f;
 
@@ -253,28 +254,29 @@ namespace BansheeEditor
         {
             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)
                 {
@@ -285,7 +287,10 @@ namespace BansheeEditor
                 }
                 else
                 {
-                    string displayName = lastEntry;
+                    IEnumerator<string> enumerator = queuedForImport.GetEnumerator();
+                    enumerator.MoveNext();
+
+                    string displayName = enumerator.Current;
                     displayName = displayName.Replace("\\", "\\\\");
 
                     if (displayName.Length > 60)
@@ -295,9 +300,13 @@ namespace BansheeEditor
                     }
 
                     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>