Bladeren bron

Build: Updated 'bsf' version with new scene loading approach

BearishSun 6 jaren geleden
bovenliggende
commit
f7a01db5b0

+ 1 - 4
Source/EditorCore/UndoRedo/BsCmdBreakPrefab.cpp

@@ -7,14 +7,11 @@ namespace bs
 {
 	CmdBreakPrefab::CmdBreakPrefab(const String& description, const HSceneObject& sceneObject)
 		:EditorCommand(description), mSceneObject(sceneObject)
-	{
-
-	}
+	{ }
 
 	CmdBreakPrefab::~CmdBreakPrefab()
 	{
 		mSceneObject = nullptr;
-
 	}
 	
 	void CmdBreakPrefab::execute(const HSceneObject& sceneObject, const String& description)

+ 1 - 1
Source/EditorCore/UndoRedo/BsCmdBreakPrefab.h

@@ -13,7 +13,7 @@ namespace bs
 	 */
 
 	/** A command used for undo/redo purposes. It breaks a prefab link of a scene object and allows you to restore link. */
-	class BS_ED_EXPORT CmdBreakPrefab : public EditorCommand
+	class BS_ED_EXPORT CmdBreakPrefab final : public EditorCommand
 	{
 	public:
 		~CmdBreakPrefab();

+ 2 - 9
Source/EditorCore/UndoRedo/BsCmdCloneSO.cpp

@@ -7,14 +7,7 @@ namespace bs
 {
 	CmdCloneSO::CmdCloneSO(const String& description, const Vector<HSceneObject>& originals)
 		:EditorCommand(description), mOriginals(originals)
-	{
-
-	}
-
-	CmdCloneSO::~CmdCloneSO()
-	{
-
-	}
+	{ }
 
 	HSceneObject CmdCloneSO::execute(const HSceneObject& sceneObject, const String& description)
 	{
@@ -25,7 +18,7 @@ namespace bs
 		UndoRedo::instance().registerCommand(commandPtr);
 		commandPtr->commit();
 
-		if (commandPtr->mClones.size() > 0)
+		if (!commandPtr->mClones.empty())
 			return commandPtr->mClones[0];
 
 		return HSceneObject();

+ 1 - 3
Source/EditorCore/UndoRedo/BsCmdCloneSO.h

@@ -13,11 +13,9 @@ namespace bs
 	 */
 
 	/** A command used for undo/redo purposes. Clones scene object(s) and removes them as an undo operation. */
-	class BS_ED_EXPORT CmdCloneSO : public EditorCommand
+	class BS_ED_EXPORT CmdCloneSO final : public EditorCommand
 	{
 	public:
-		~CmdCloneSO();
-
 		/**
 		 * Creates a new scene object by cloning an existing object. Automatically registers the command with undo/redo 
 		 * system.

+ 2 - 8
Source/EditorCore/UndoRedo/BsCmdCreateSO.cpp

@@ -7,14 +7,7 @@ namespace bs
 {
 	CmdCreateSO::CmdCreateSO(const String& description, const String& name, UINT32 flags)
 		:EditorCommand(description), mName(name), mFlags(flags)
-	{
-
-	}
-
-	CmdCreateSO::~CmdCreateSO()
-	{
-
-	}
+	{ }
 
 	HSceneObject CmdCreateSO::execute(const String& name, UINT32 flags, const String& description)
 	{
@@ -40,6 +33,7 @@ namespace bs
 
 		if (!mSceneObject.isDestroyed())
 			mSceneObject->destroy(true);
+
 		mSceneObject = nullptr;
 	}
 }

+ 1 - 3
Source/EditorCore/UndoRedo/BsCmdCreateSO.h

@@ -13,11 +13,9 @@ namespace bs
 	 */
 
 	/** A command used for undo/redo purposes. Creates a scene object and removes it as an undo operation. */
-	class BS_ED_EXPORT CmdCreateSO : public EditorCommand
+	class BS_ED_EXPORT CmdCreateSO final : public EditorCommand
 	{
 	public:
-		~CmdCreateSO();
-
 		/**
 		 * Creates a new scene object. Automatically registers the command with undo/redo system.
 		 *

+ 1 - 1
Source/EditorCore/UndoRedo/BsCmdDeleteSO.h

@@ -14,7 +14,7 @@ namespace bs
 	 */
 
 	/** A command used for undo/redo purposes. Deletes a scene object and restores it as an undo operation. */
-	class BS_ED_EXPORT CmdDeleteSO : public EditorCommand
+	class BS_ED_EXPORT CmdDeleteSO final : public EditorCommand
 	{
 	public:
 		~CmdDeleteSO();

+ 1 - 8
Source/EditorCore/UndoRedo/BsCmdInstantiateSO.cpp

@@ -8,14 +8,7 @@ namespace bs
 {
 	CmdInstantiateSO::CmdInstantiateSO(const String& description, const HPrefab& prefab)
 		:EditorCommand(description), mPrefab(prefab)
-	{
-
-	}
-
-	CmdInstantiateSO::~CmdInstantiateSO()
-	{
-
-	}
+	{ }
 
 	HSceneObject CmdInstantiateSO::execute(const HPrefab& prefab, const String& description)
 	{

+ 1 - 3
Source/EditorCore/UndoRedo/BsCmdInstantiateSO.h

@@ -16,11 +16,9 @@ namespace bs
 	 * A command used for undo/redo purposes. Instantiates scene object(s) from a prefab and removes them as an undo
 	 * operation.
 	 */
-	class BS_ED_EXPORT CmdInstantiateSO : public EditorCommand
+	class BS_ED_EXPORT CmdInstantiateSO final : public EditorCommand
 	{
 	public:
-		~CmdInstantiateSO();
-
 		/**
 		 * Instantiates the specified prefab. Automatically registers the command with undo/redo system.
 		 *

+ 1 - 1
Source/EditorCore/UndoRedo/BsCmdRecordSO.h

@@ -17,7 +17,7 @@ namespace bs
 	 * A command used for undo/redo purposes. It records a state of the entire scene object at a specific point and allows
 	 * you to restore it to its original values as needed.
 	 */
-	class BS_ED_EXPORT CmdRecordSO : public EditorCommand
+	class BS_ED_EXPORT CmdRecordSO final : public EditorCommand
 	{
 	public:
 		~CmdRecordSO();

+ 1 - 1
Source/EditorCore/UndoRedo/BsCmdReparentSO.h

@@ -16,7 +16,7 @@ namespace bs
 	 * A command used for undo/redo purposes. It records a scene object parent change operations. It allows you to apply
 	 * the parent change or revert the object to its original parent as needed.
 	 */
-	class BS_ED_EXPORT CmdReparentSO : public EditorCommand
+	class BS_ED_EXPORT CmdReparentSO final : public EditorCommand
 	{
 	public:
 		/**

+ 1 - 7
Source/Game/Main.cpp

@@ -154,13 +154,7 @@ void runApplication()
 		HPrefab mainScene = static_resource_cast<Prefab>(gResources().loadFromUUID(gameSettings->mainSceneUUID, 
 			false, ResourceLoadFlag::LoadDependencies));
 		if (mainScene.isLoaded(false))
-		{
-			HSceneObject root = mainScene->instantiate();
-			HSceneObject oldRoot = gSceneManager().getMainScene()->getRoot();
-
-			gSceneManager().setRootNode(root);
-			oldRoot->destroy();
-		}
+			gSceneManager().loadScene(mainScene);
 	}
 
 	Application::instance().runMainLoop();