BsEditorResourceLoader.cpp 865 B

123456789101112131415161718192021222324252627
  1. #include "BsEditorResourceLoader.h"
  2. #include "BsProjectLibrary.h"
  3. #include "BsResources.h"
  4. #include "BsProjectResourceMeta.h"
  5. #include "BsDebug.h"
  6. namespace BansheeEngine
  7. {
  8. HResource EditorResourceLoader::load(const Path& path) const
  9. {
  10. ProjectLibrary::LibraryEntry* entry = gProjectLibrary().findEntry(path);
  11. if (entry == nullptr || entry->type == ProjectLibrary::LibraryEntryType::Directory)
  12. return HResource();
  13. ProjectLibrary::ResourceEntry* resEntry = static_cast<ProjectLibrary::ResourceEntry*>(entry);
  14. String resUUID = resEntry->meta->getUUID();
  15. if (resEntry->meta->getIncludeInBuild())
  16. {
  17. LOGWRN("Dynamically loading a resource at path: \"" + path.toString() + "\" but the resource \
  18. isn't flagged to be included in the build. It may not be available outside of the editor.");
  19. }
  20. return gResources().loadFromUUID(resUUID);
  21. }
  22. }