Ver código fonte

Example project no longer depends on the scripting system

BearishSun 9 anos atrás
pai
commit
0ffb5e7c80

+ 1 - 0
Source/BansheeCore/Include/BsCoreApplication.h

@@ -21,6 +21,7 @@ namespace bs
 		String physics; /**< Name of physics plugin to use. */
 		String audio; /**< Name of the audio plugin to use. */
 		String input; /**< Name of the input plugin to use. */
+		bool scripting = false; /**< True to load the scripting system. */
 
 		RENDER_WINDOW_DESC primaryWindowDesc; /**< Describes the window to create during start-up. */
 

+ 1 - 0
Source/BansheeEditor/Source/BsEditorApplication.cpp

@@ -44,6 +44,7 @@ namespace bs
 		startUpDesc.audio = BS_AUDIO_MODULE;
 		startUpDesc.physics = BS_PHYSICS_MODULE;
 		startUpDesc.input = BS_INPUT_MODULE;
+		startUpDesc.scripting = true;
 
 		startUpDesc.primaryWindowDesc.videoMode = VideoMode(1920, 1080);
 		startUpDesc.primaryWindowDesc.title = "BansheeEditor";

+ 12 - 4
Source/BansheeEngine/Source/BsApplication.cpp

@@ -68,7 +68,9 @@ namespace bs
 		SceneManager::instance().setMainRenderTarget(getPrimaryWindow());
 
 		ScriptManager::startUp();
-		loadScriptSystem();
+
+		if(mStartUpDesc.scripting)
+			loadScriptSystem();
 	}
 
 	void Application::onShutDown()
@@ -78,7 +80,9 @@ namespace bs
 		SceneManager::instance().clearScene(true);
 
 		ScriptManager::shutDown();
-		unloadScriptSystem();
+
+		if (mStartUpDesc.scripting)
+			unloadScriptSystem();
 
 		CoreApplication::onShutDown();
 	}
@@ -94,6 +98,7 @@ namespace bs
 		desc.audio = BS_AUDIO_MODULE;
 		desc.physics = BS_PHYSICS_MODULE;
 		desc.input = BS_INPUT_MODULE;
+		desc.scripting = false;
 
 		desc.importers.push_back("BansheeFreeImgImporter");
 		desc.importers.push_back("BansheeFBXImporter");
@@ -141,8 +146,11 @@ namespace bs
 		// These plugins must be unloaded before any other script plugins, because
 		// they will cause finalizers to trigger and various modules those finalizers
 		// might reference must still be active
-		unloadPlugin(mSBansheeEnginePlugin);
-		unloadPlugin(mMonoPlugin);
+		if(mSBansheeEnginePlugin != nullptr)
+			unloadPlugin(mSBansheeEnginePlugin);
+
+		if(mMonoPlugin != nullptr)
+			unloadPlugin(mMonoPlugin);
 	}
 
 	void Application::startUpRenderer()

+ 8 - 7
Source/CMakeLists.txt

@@ -246,24 +246,25 @@ if(BUILD_EDITOR OR (INCLUDE_ALL_IN_WORKFLOW AND MSVC))
 endif()
 
 ## Executables
-add_subdirectory(Game)
 add_subdirectory(ExampleProject)
 
 if(BUILD_EDITOR OR (INCLUDE_ALL_IN_WORKFLOW AND MSVC))
 	add_subdirectory(BansheeEditorExec)
+	add_subdirectory(Game)
 endif()
 
 ## Managed projects
 if(MSVC)
-	include_external_msproject(MBansheeEngine ${PROJECT_SOURCE_DIR}/MBansheeEngine/MBansheeEngine.csproj)
-	add_dependencies(Game MBansheeEngine)
-	
-	set_property(TARGET MBansheeEngine PROPERTY FOLDER Script)
-
 	if(BUILD_EDITOR)
+		include_external_msproject(MBansheeEngine ${PROJECT_SOURCE_DIR}/MBansheeEngine/MBansheeEngine.csproj)
 		include_external_msproject(MBansheeEditor ${PROJECT_SOURCE_DIR}/MBansheeEditor/MBansheeEditor.csproj)
-		add_dependencies(BansheeEditorExec MBansheeEngine MBansheeEditor)
+		
+		set_property(TARGET MBansheeEngine PROPERTY FOLDER Script)
 		set_property(TARGET MBansheeEditor PROPERTY FOLDER Script)
+		
+		add_dependencies(BansheeEditorExec MBansheeEngine MBansheeEditor)
+		add_dependencies(Game MBansheeEngine)
+		
 		set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT BansheeEditorExec)
 	endif()
 else()

+ 1 - 0
Source/Game/Source/Main.cpp

@@ -72,6 +72,7 @@ void runApplication()
 	startUpDesc.audio = BS_AUDIO_MODULE;
 	startUpDesc.physics = BS_PHYSICS_MODULE;
 	startUpDesc.input = BS_INPUT_MODULE;
+	startUpDesc.scripting = true;
 
 	startUpDesc.primaryWindowDesc.videoMode = VideoMode(resolutionWidth, resolutionHeight);
 	startUpDesc.primaryWindowDesc.title = toString(gameSettings->titleBarText);