-
Notifications
You must be signed in to change notification settings - Fork 403
Plugin hotreload
See also LiveCode plugin.
Plugins in form od dynamic libraries can be hot-reloaded from Studio.
Steps to enable hotreload using Visual Studio:
-
create a separate solution for the plugin. Example of a genie file for such plugin:
function copyPDA(config) configuration { config } prebuildcommands { [[if EXIST "$(SolutionDir)bin\]]..config..[[\Hunter.pda" ( move /Y "$(SolutionDir)bin\]]..config..[[\Hunter.pda" "$(SolutionDir)bin\]]..config..[[\Hunter.pdb" )]], } postbuildcommands { [[move /Y "$(SolutionDir)bin\]]..config..[[\Hunter.pdb" "$(SolutionDir)bin\]]..config..[[\Hunter.pda"]], } configuration {} end dofile("../lumixengine/projects/plugin.lua") bootstrapPlugin("Hunter") files { "src/**.cpp", "src/**.h", "genie.lua" } links { "renderer", "editor" } includedirs { "src", } defines { "BUILDING_GAME" } useLua() includedirs { "../LumixEngine/external/lua/include", "../LumixEngine/external/bgfx/include" } defaultConfigurations("tmp/vs2017/bin/") copyPDA("Debug") copyPDA("RelWithDebInfo")
-
Compile Lumix Studio and the plugin
-
Run Lumix Studio and pass the path to the plugin's library to studio as argument
studio.exe -plugin=c:\path\to\library.dll
-
Make a change in the plugin and recompile it
-
Lumix Studio automatically reloads the plugin
Note: Recompilation of the plugin sometimes fails because Visual Studio's debugger locks some files. If this happens detach the debugger first before recompiling the plugin.
When reloading a plugin, IScene::beforeReload
is called on scene of the reloaded plugin and then the scene is removed and destroyed. After that the plugin's library is unloaded and the new one is loaded. New scene is created with the new plugin and IScene::afterReload
is called.