From: Daniel Hritzkiv Date: Tue, 5 Sep 2017 18:40:27 +0000 (-0400) Subject: Remove need for Has by returning an empty Ref in Get X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a5823700f17caa6c6cdedfd34ce5bbd3ba85556;p=platform%2Fupstream%2Fassimp.git Remove need for Has by returning an empty Ref in Get --- diff --git a/code/glTF2Asset.h b/code/glTF2Asset.h index aabd462..9a70ff4 100644 --- a/code/glTF2Asset.h +++ b/code/glTF2Asset.h @@ -958,8 +958,6 @@ namespace glTF2 Ref Get(unsigned int i); Ref Get(const char* id); - bool Has(const char* id); - Ref Create(const char* id); Ref Create(const std::string& id) { return Create(id.c_str()); } diff --git a/code/glTF2Asset.inl b/code/glTF2Asset.inl index 88dbfcf..1c75d00 100644 --- a/code/glTF2Asset.inl +++ b/code/glTF2Asset.inl @@ -244,17 +244,7 @@ Ref LazyDict::Get(const char* id) return Ref(mObjs, it->second); } - return Create(id); -} - -template -bool LazyDict::Has(const char* id) -{ - id = T::TranslateId(mAsset, id); - - typename IdDict::iterator it = mObjsById.find(id); - - return it != mObjsById.end(); + return Ref(); } template diff --git a/code/glTF2Exporter.cpp b/code/glTF2Exporter.cpp index fec7236..073309b 100644 --- a/code/glTF2Exporter.cpp +++ b/code/glTF2Exporter.cpp @@ -248,8 +248,8 @@ void glTF2Exporter::GetTexSampler(const aiMaterial* mat, Ref texture, a id = aId.C_Str(); } - if (mAsset->samplers.Has(id.c_str())) { - texture->sampler = mAsset->samplers.Get(id.c_str()); + if (Ref ref = mAsset->samplers.Get(id.c_str())) { + texture->sampler = ref; } else { id = mAsset->FindUniqueID(id, "sampler");