Remove need for Has by returning an empty Ref in Get

pull/1423/head
Daniel Hritzkiv 2017-09-05 14:40:27 -04:00
parent 21259e0835
commit 1a5823700f
No known key found for this signature in database
GPG Key ID: D1D19875679D5CBF
3 changed files with 3 additions and 15 deletions

View File

@ -958,8 +958,6 @@ namespace glTF2
Ref<T> Get(unsigned int i);
Ref<T> Get(const char* id);
bool Has(const char* id);
Ref<T> Create(const char* id);
Ref<T> Create(const std::string& id)
{ return Create(id.c_str()); }

View File

@ -244,17 +244,7 @@ Ref<T> LazyDict<T>::Get(const char* id)
return Ref<T>(mObjs, it->second);
}
return Create(id);
}
template<class T>
bool LazyDict<T>::Has(const char* id)
{
id = T::TranslateId(mAsset, id);
typename IdDict::iterator it = mObjsById.find(id);
return it != mObjsById.end();
return Ref<T>();
}
template<class T>

View File

@ -248,8 +248,8 @@ void glTF2Exporter::GetTexSampler(const aiMaterial* mat, Ref<Texture> texture, a
id = aId.C_Str();
}
if (mAsset->samplers.Has(id.c_str())) {
texture->sampler = mAsset->samplers.Get(id.c_str());
if (Ref<Sampler> ref = mAsset->samplers.Get(id.c_str())) {
texture->sampler = ref;
} else {
id = mAsset->FindUniqueID(id, "sampler");