Explorar el Código

Renaming a file in Project library no longer records the incorrect path in the resource manifest
Don't update prefabs on instantiation if running outside of editor
Building in release mode properly packages resources

BearishSun hace 10 años
padre
commit
58676d0066

+ 3 - 0
BansheeCore/Include/BsCoreApplication.h

@@ -69,6 +69,9 @@ namespace BansheeEngine
 			 */
 			BS_THREAD_ID_TYPE getSimThreadId() { return mSimThreadId; }
 
+			/**	Returns true if the application is running in an editor, false if standalone. */
+			virtual bool isEditor() const { return false; }
+
 			/**
 			 * Loads a plugin.
 			 *

+ 6 - 2
BansheeCore/Source/BsPrefab.cpp

@@ -5,6 +5,7 @@
 #include "BsResources.h"
 #include "BsSceneObject.h"
 #include "BsPrefabUtility.h"
+#include "BsCoreApplication.h"
 
 namespace BansheeEngine
 {
@@ -136,8 +137,11 @@ namespace BansheeEngine
 			return HSceneObject();
 
 #if BS_EDITOR_BUILD
-		// Update any child prefab instances in case their prefabs changed
-		_updateChildInstances();
+		if (gCoreApplication().isEditor())
+		{
+			// Update any child prefab instances in case their prefabs changed
+			_updateChildInstances();
+		}
 #endif
 
 		HSceneObject clone = _clone();

+ 1 - 1
BansheeCore/Source/BsPrefabUtility.cpp

@@ -95,7 +95,7 @@ namespace BansheeEngine
 			HSceneObject current = *iter;
 			HPrefab prefabLink = static_resource_cast<Prefab>(gResources().loadFromUUID(current->mPrefabLinkUUID, false, false));
 
-			if (prefabLink != nullptr && prefabLink->getHash() != current->mPrefabHash)
+			if (prefabLink.isLoaded(false) && prefabLink->getHash() != current->mPrefabHash)
 			{
 				// Save IDs, destroy original, create new, restore IDs
 				SceneObjectProxy soProxy;

+ 7 - 3
BansheeCore/Source/BsSceneObject.cpp

@@ -10,6 +10,7 @@
 #include "BsGameObjectManager.h"
 #include "BsPrefabUtility.h"
 #include "BsMatrix3.h"
+#include "BsCoreApplication.h"
 
 namespace BansheeEngine
 {
@@ -491,9 +492,12 @@ namespace BansheeEngine
 		_setParent(parent, keepWorldTransform);
 
 #if BS_EDITOR_BUILD
-		String newPrefab = getPrefabLink();
-		if (originalPrefab != newPrefab)
-			PrefabUtility::clearPrefabIds(mThisHandle);
+		if (gCoreApplication().isEditor())
+		{
+			String newPrefab = getPrefabLink();
+			if (originalPrefab != newPrefab)
+				PrefabUtility::clearPrefabIds(mThisHandle);
+		}
 #endif
 	}
 

+ 0 - 1
BansheeEditor/Source/BsProjectLibrary.cpp

@@ -729,7 +729,6 @@ namespace BansheeEngine
 						const String& UUID = resEntry->meta->getUUID();
 
 						mUUIDToPath[UUID] = newFullPath;
-						mResourceManifest->registerResource(UUID, newFullPath);
 					}
 				}
 

+ 0 - 3
BansheeEngine/Include/BsApplication.h

@@ -49,9 +49,6 @@ namespace BansheeEngine
 		/**	Returns the absolute path to the folder where script assemblies are located in. */
 		virtual Path getScriptAssemblyFolder() const;
 
-		/**	Returns true if the application is running in an editor, false if standalone. */
-		virtual bool isEditor() const { return false; }
-
 	protected:
 		/** @copydoc Module::onStartUp */
 		virtual void onStartUp() override;

+ 1 - 1
Game/Source/Main.cpp

@@ -126,7 +126,7 @@ void runApplication()
 
 	{
 		HPrefab mainScene = static_resource_cast<Prefab>(gResources().loadFromUUID(gameSettings->mainSceneUUID, false, true, false));
-		if (mainScene != nullptr)
+		if (mainScene.isLoaded(false))
 		{
 			HSceneObject root = mainScene->instantiate();
 			HSceneObject oldRoot = gSceneManager().getRootNode();

+ 2 - 1
SBansheeEditor/Source/BsScriptBuildManager.cpp

@@ -293,7 +293,8 @@ namespace BansheeEngine
 		for (auto& entry : usedResources)
 		{
 			String uuid;
-			BS_ASSERT(gResources().getUUIDFromFilePath(entry, uuid));
+			bool foundUUID = gResources().getUUIDFromFilePath(entry, uuid);
+			BS_ASSERT(foundUUID);
 
 			Path sourcePath = gProjectLibrary().uuidToPath(uuid);
 			if (sourcePath.isEmpty()) // Resource not part of library, meaning its built-in and we don't need to copy those here