BsEditorResourceLoader.cpp 1014 B

123456789101112131415161718192021222324252627282930313233
  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. if (resEntry->meta == nullptr)
  15. {
  16. LOGWRN("Missing .meta file for resource at path: \"" + path.toString() + "\".");
  17. return HResource();
  18. }
  19. String resUUID = resEntry->meta->getUUID();
  20. if (resEntry->meta->getIncludeInBuild())
  21. {
  22. LOGWRN("Dynamically loading a resource at path: \"" + path.toString() + "\" but the resource \
  23. isn't flagged to be included in the build. It may not be available outside of the editor.");
  24. }
  25. return gResources().loadFromUUID(resUUID);
  26. }
  27. }