repair gltf_viewer drag&drop

Drag and dropping a gltf folder was broken:
- the handle didn't find the gltf file on drag&drop
- the ResourceLoader cached the asset path
- don't exit(1) when drag&dropping an invalid file
This commit is contained in:
Mathias Agopian
2023-11-01 15:02:43 -07:00
committed by Mathias Agopian
parent 46e6664c3d
commit 7d694ee85e
3 changed files with 86 additions and 32 deletions

View File

@@ -74,15 +74,15 @@ enum class CacheResult {
};
struct ResourceLoader::Impl {
Impl(const ResourceConfiguration& config) :
explicit Impl(const ResourceConfiguration& config) :
mEngine(config.engine),
mNormalizeSkinningWeights(config.normalizeSkinningWeights),
mGltfPath(config.gltfPath ? config.gltfPath : ""),
mUriDataCache(std::make_shared<UriDataCache>()) {}
Engine* const mEngine;
const bool mNormalizeSkinningWeights;
const std::string mGltfPath;
bool mNormalizeSkinningWeights;
std::string mGltfPath;
// User-provided resource data with URI string keys, populated with addResourceData().
// This is used on platforms without traditional file systems, such as Android, iOS, and WebGL.
@@ -320,6 +320,11 @@ ResourceLoader::~ResourceLoader() {
delete pImpl;
}
void ResourceLoader::setConfiguration(const ResourceConfiguration& config) {
pImpl->mNormalizeSkinningWeights = config.normalizeSkinningWeights;
pImpl->mGltfPath = config.gltfPath;
}
void ResourceLoader::addResourceData(const char* uri, BufferDescriptor&& buffer) {
pImpl->addResourceData(uri, std::move(buffer));
}