Add ScriptLibraryManager and replace raw dlLoad usage in Editor/Game/UI#20
Closed
Thomas-Chqt wants to merge 7 commits intorefactorfrom
Closed
Add ScriptLibraryManager and replace raw dlLoad usage in Editor/Game/UI#20Thomas-Chqt wants to merge 7 commits intorefactorfrom
Thomas-Chqt wants to merge 7 commits intorefactorfrom
Conversation
Introduce GE::ListScriptNamesFn, GE::ListScriptParametersFn and GE::MakeScriptInstanceFn and replace uses of ScriptLibraryManager::ListScript* / MakeScriptInstance across the codebase. ScriptLibraryManager now keeps raw C symbol pointer types (with Sym suffix) and exposes std::function wrappers. Update call sites and tests to the new API and remove now-unused includes and typedefs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
dlLoad/function-pointer handling.EditorandGameinterfaces by passing aScriptLibraryManagerinstead of raw callbacks and raw handles.unload()is called.Description
GE::ScriptLibraryManager(include/Game-Engine/ScriptLibraryManager.hppandsrc/ScriptLibraryManager.cpp) which implementsload,unload,isLoaded,listScriptNames,listScriptParameters, andmakeScriptInstanceand keeps aLibraryHandlealive viashared_ptrso instances keep the library alive.dlLoadand raw function-pointer fields inEditorwithstd::optional<GE::ScriptLibraryManager> m_scriptLibrary, and updateEditor::reloadScriptLib,startGame, and UI wiring to use the manager.EntityInspectorPanelto accept aconst GE::ScriptLibraryManager*and use it to list scripts and parameters, and display a notice when no library is loaded.Gameto accept aScriptLibraryManager*and use it insetupScene/setActiveSceneto create script instances and populate parameters.tests/Script_testCases.cppto includeScriptLibraryManagerand add aScriptLibraryManagerTestthat verifies the library remains usable for script instances afterunload()is called.Testing
tests/Script_testCases.cpp, includingScriptLibraryTestand the newScriptLibraryManagerTest, and they succeeded.Codex Task