Remove need for Has by returning an empty Ref in Get
parent
21259e0835
commit
1a5823700f
|
@ -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()); }
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
Loading…
Reference in New Issue