BsEditorScriptLibrary.cpp 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "BsEditorScriptLibrary.h"
  2. #include "BsEditorScriptManager.h"
  3. #include "BsEditorApplication.h"
  4. #include "BsScriptObjectManager.h"
  5. #include "BsFileSystem.h"
  6. namespace BansheeEngine
  7. {
  8. void EditorScriptLibrary::initialize()
  9. {
  10. EngineScriptLibrary::initialize();
  11. EditorScriptManager::startUp();
  12. }
  13. void EditorScriptLibrary::reload()
  14. {
  15. Vector<std::pair<String, Path>> assemblies;
  16. Path engineAssemblyPath = gApplication().getEngineAssemblyPath();
  17. assemblies.push_back({ ENGINE_ASSEMBLY, engineAssemblyPath });
  18. if (gEditorApplication().isProjectLoaded())
  19. {
  20. Path gameAssemblyPath = gApplication().getGameAssemblyPath();
  21. if (FileSystem::exists(gameAssemblyPath))
  22. assemblies.push_back({ SCRIPT_GAME_ASSEMBLY, gameAssemblyPath });
  23. }
  24. String editorAssemblyPath = gEditorApplication().getEditorAssemblyPath().toString();
  25. assemblies.push_back({ EDITOR_ASSEMBLY, editorAssemblyPath });
  26. if (gEditorApplication().isProjectLoaded())
  27. {
  28. Path editorScriptAssemblyPath = gEditorApplication().getEditorScriptAssemblyPath();
  29. if (FileSystem::exists(editorScriptAssemblyPath))
  30. assemblies.push_back({ SCRIPT_EDITOR_ASSEMBLY, editorScriptAssemblyPath });
  31. }
  32. ScriptObjectManager::instance().refreshAssemblies(assemblies);
  33. }
  34. void EditorScriptLibrary::destroy()
  35. {
  36. EditorScriptManager::shutDown();
  37. EngineScriptLibrary::destroy();
  38. }
  39. }