Beispiel #1
0
NodeSmartReference Model_load(ModelLoader* loader, const char* path, const char* name, const char* type)
{
  if(loader != 0)
  {
    return ModelResource_load(loader, name);
  }
  else
  {
    const char* moduleName = findModuleName(&GlobalFiletypes(), MapFormat::Name(), type);
    if(string_not_empty(moduleName))
    {
      const MapFormat* format = ReferenceAPI_getMapModules().findModule(moduleName);
      if(format != 0)
      {
        return MapResource_load(*format, path, name);
      }
      else
      {
        globalErrorStream() << "ERROR: Map type incorrectly registered: \"" << moduleName << "\"\n";
        return g_nullModel;
      }
    }
    else
    {
      if(string_not_empty(type))
      {
        globalErrorStream() << "Model type not supported: \"" << name << "\"\n";
      }
      return g_nullModel;
    }
  }
}
Beispiel #2
0
NodeSmartReference Model_load (ModelLoader* loader, const std::string& path, const std::string& name, const std::string& type)
{
    if (loader != 0) {
        return ModelResource_load(loader, name);
    } else {
        // Get a loader module name for this type, if possible. If none is
        // found, try again with the "map" type, since we might be loading a
        // map with a different extension
        std::string moduleName = findModuleName(&GlobalFiletypes(), MapFormat::Name(), type);

        // Empty, try again with "map" type
        if (moduleName.empty()) {
            moduleName = findModuleName(&GlobalFiletypes(), MapFormat::Name(), "map");
        }

        const MapFormat* format = ReferenceAPI_getMapModules().findModule(moduleName);
        if (format != 0) {
            return MapResource_load(*format, path, name);
        } else {
            globalErrorStream() << "ERROR: Map type incorrectly registered: " << moduleName << "\n";
            return g_nullModel;
        }
    }
}