Преглед изворни кода

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 пре 10 година
родитељ
комит
58676d0066

+ 3 - 0
BansheeCore/Include/BsCoreApplication.h

@@ -69,6 +69,9 @@ namespace BansheeEngine
 			 */
 			 */
 			BS_THREAD_ID_TYPE getSimThreadId() { return mSimThreadId; }
 			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.
 			 * Loads a plugin.
 			 *
 			 *

+ 6 - 2
BansheeCore/Source/BsPrefab.cpp

@@ -5,6 +5,7 @@
 #include "BsResources.h"
 #include "BsResources.h"
 #include "BsSceneObject.h"
 #include "BsSceneObject.h"
 #include "BsPrefabUtility.h"
 #include "BsPrefabUtility.h"
+#include "BsCoreApplication.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -136,8 +137,11 @@ namespace BansheeEngine
 			return HSceneObject();
 			return HSceneObject();
 
 
 #if BS_EDITOR_BUILD
 #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
 #endif
 
 
 		HSceneObject clone = _clone();
 		HSceneObject clone = _clone();

+ 1 - 1
BansheeCore/Source/BsPrefabUtility.cpp

@@ -95,7 +95,7 @@ namespace BansheeEngine
 			HSceneObject current = *iter;
 			HSceneObject current = *iter;
 			HPrefab prefabLink = static_resource_cast<Prefab>(gResources().loadFromUUID(current->mPrefabLinkUUID, false, false));
 			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
 				// Save IDs, destroy original, create new, restore IDs
 				SceneObjectProxy soProxy;
 				SceneObjectProxy soProxy;

+ 7 - 3
BansheeCore/Source/BsSceneObject.cpp

@@ -10,6 +10,7 @@
 #include "BsGameObjectManager.h"
 #include "BsGameObjectManager.h"
 #include "BsPrefabUtility.h"
 #include "BsPrefabUtility.h"
 #include "BsMatrix3.h"
 #include "BsMatrix3.h"
+#include "BsCoreApplication.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -491,9 +492,12 @@ namespace BansheeEngine
 		_setParent(parent, keepWorldTransform);
 		_setParent(parent, keepWorldTransform);
 
 
 #if BS_EDITOR_BUILD
 #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
 #endif
 	}
 	}
 
 

+ 0 - 1
BansheeEditor/Source/BsProjectLibrary.cpp

@@ -729,7 +729,6 @@ namespace BansheeEngine
 						const String& UUID = resEntry->meta->getUUID();
 						const String& UUID = resEntry->meta->getUUID();
 
 
 						mUUIDToPath[UUID] = newFullPath;
 						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. */
 		/**	Returns the absolute path to the folder where script assemblies are located in. */
 		virtual Path getScriptAssemblyFolder() const;
 		virtual Path getScriptAssemblyFolder() const;
 
 
-		/**	Returns true if the application is running in an editor, false if standalone. */
-		virtual bool isEditor() const { return false; }
-
 	protected:
 	protected:
 		/** @copydoc Module::onStartUp */
 		/** @copydoc Module::onStartUp */
 		virtual void onStartUp() override;
 		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));
 		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 root = mainScene->instantiate();
 			HSceneObject oldRoot = gSceneManager().getRootNode();
 			HSceneObject oldRoot = gSceneManager().getRootNode();

+ 2 - 1
SBansheeEditor/Source/BsScriptBuildManager.cpp

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