BearishSun 7 years ago
parent
commit
44e1123d5c
1 changed files with 24 additions and 20 deletions
  1. 24 20
      Source/EditorCore/Library/BsProjectLibrary.cpp

+ 24 - 20
Source/EditorCore/Library/BsProjectLibrary.cpp

@@ -487,6 +487,30 @@ namespace bs
 			mQueuedImports[fileEntry] = queuedImport;
 
 			fileEntry->lastUpdateTime = std::time(nullptr);
+
+			// TODO - Copy native resource directly
+			if (!newResources.empty())
+			{
+				Path internalResourcesPath = mProjectFolder;
+				internalResourcesPath.append(INTERNAL_RESOURCES_DIR);
+
+				if (!FileSystem::isDirectory(internalResourcesPath))
+					FileSystem::createDir(internalResourcesPath);
+
+				for (auto& entry : newResources)
+				{
+					String uuidStr = entry.getUUID().toString();
+
+					internalResourcesPath.setFilename(uuidStr + ".asset");
+					gResources().save(entry, internalResourcesPath, true);
+
+					const UUID& uuid = entry.getUUID();
+
+					// TODO - Not thread safe
+					mResourceManifest->registerResource(uuid, internalResourcesPath);
+				}
+			}
+
 			return true;
 		}
 
@@ -640,26 +664,6 @@ namespace bs
 
 			addDependencies(fileEntry);
 
-			if (!newResources.empty())
-			{
-				Path internalResourcesPath = mProjectFolder;
-				internalResourcesPath.append(INTERNAL_RESOURCES_DIR);
-
-				if (!FileSystem::isDirectory(internalResourcesPath))
-					FileSystem::createDir(internalResourcesPath);
-
-				for (auto& entry : newResources)
-				{
-					String uuidStr = entry.getUUID().toString();
-
-					internalResourcesPath.setFilename(uuidStr + ".asset");
-					gResources().save(entry, internalResourcesPath, true);
-
-					const UUID& uuid = entry.getUUID();
-					mResourceManifest->registerResource(uuid, internalResourcesPath);
-				}
-			}
-
 			onEntryImported(fileEntry->path);
 			reimportDependants(fileEntry->path);