Importing a bsl file fails


#1

This might be because I copy-pasted the initialization code (as I don’t want to use the default main loop) with slight changes. But now I can’t import shaders. I didn’t find any so files with a name that would indicate they would need to be loaded to get the bsf importer. This is the code

bs::HShader shader =
        bs::gImporter().import<bs::Shader>("Data/Shaders/CoreShaders/ScreenSpaceGUI.bsl");

and the warning:

[WARNING] There is no importer for the provided file type. (Data/Shaders/CoreShaders/ScreenSpaceGUI.bsl)
		 in bs::SpecificImporter* bs::Importer::getImporterForFile(const bs::Path&) const [/home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/Importer/BsImporter.cpp:345]

When I went looking into BsImporter.cpp I found I have two registered importers, but apparently none of them handle .bsl files:

mAssetImporters = $3 = std::vector of length 2, capacity 2 = {
  0xb0b230,
  0xadbe50
}
(gdb) p *mAssetImporters[0]
$4 = (bs::ShaderIncludeImporter) {
  <bs::SpecificImporter> = {
    _vptr.SpecificImporter = 0x7fffee16bfa8 <vtable for bs::ShaderIncludeImporter+16>, 
    mDefaultImportOptions = std::shared_ptr<const bs::ImportOptions> (empty) = {
      get() = 0x0
    }
  }, <No data fields>}
(gdb) p *mAssetImporters[1]
$5 = (bs::FGAImporter) {
  <bs::SpecificImporter> = {
    _vptr.SpecificImporter = 0x7fffee18d220 <vtable for bs::FGAImporter+16>, 
    mDefaultImportOptions = std::shared_ptr<const bs::ImportOptions> (empty) = {
      get() = 0x0
    }
  }, <No data fields>}

#2

Most importers are built as separate libraries, which can be optionally loaded by specifying them in START_UP_DESC.importers. In the default start-up process most common ones will be specified by default, but I’m guessing that process got skipped during custom initialization.

You should add the following to START_UP_DESC:

		desc.importers.push_back("bsfFreeImgImporter");
		desc.importers.push_back("bsfFBXImporter");
		desc.importers.push_back("bsfFontImporter");
		desc.importers.push_back("bsfSL");

#3

Thanks. That made the warning go away. But I have a crash that didn’t go away. I think it’s more related to me trying to circumvent the standard initialization so I’ll post this to another thread.