usage of dynamic_cast instead of static_cast
parent
7db668e66f
commit
9415380b4c
|
@ -28,7 +28,7 @@ namespace Assimp {
|
||||||
|
|
||||||
#define IMPL_STRUCT_READ(ty) \
|
#define IMPL_STRUCT_READ(ty) \
|
||||||
bool read##ty(ElemBase *v, const size_t cnt, const FileDatabase &db) { \
|
bool read##ty(ElemBase *v, const size_t cnt, const FileDatabase &db) { \
|
||||||
return read<ty>(db.dna[#ty], static_cast<ty *>(v), cnt, db); \
|
return read<ty>(db.dna[#ty], dynamic_cast<ty *>(v), cnt, db); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IMPL_STRUCT_CREATE(ty) \
|
#define IMPL_STRUCT_CREATE(ty) \
|
||||||
|
@ -37,7 +37,8 @@ namespace Assimp {
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IMPL_STRUCT_DESTROY(ty) \
|
#define IMPL_STRUCT_DESTROY(ty) \
|
||||||
void destroy##ty(ElemBase *p) { \
|
void destroy##ty(ElemBase *pE) { \
|
||||||
|
ty *p = dynamic_cast<ty *>(pE); \
|
||||||
delete[]p; \
|
delete[]p; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +173,8 @@ namespace Assimp {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const void * getCustomDataLayerData(const CustomData &customdata, const CustomDataType cdtype, const std::string &name) {
|
const ElemBase * getCustomDataLayerData(const CustomData &customdata, const CustomDataType cdtype, const std::string &name)
|
||||||
|
{
|
||||||
const std::shared_ptr<CustomDataLayer> pLayer = getCustomDataLayer(customdata, cdtype, name);
|
const std::shared_ptr<CustomDataLayer> pLayer = getCustomDataLayer(customdata, cdtype, name);
|
||||||
if (pLayer && pLayer->data) {
|
if (pLayer && pLayer->data) {
|
||||||
return pLayer->data.get();
|
return pLayer->data.get();
|
||||||
|
|
|
@ -82,8 +82,8 @@ namespace Assimp {
|
||||||
* @param[in] customdata CustomData to search for wanted layer
|
* @param[in] customdata CustomData to search for wanted layer
|
||||||
* @param[in] cdtype to search for
|
* @param[in] cdtype to search for
|
||||||
* @param[in] name to search for
|
* @param[in] name to search for
|
||||||
* @return CustomDataLayer * or nullptr if not found
|
* @return * to struct data or nullptr if not found
|
||||||
*/
|
*/
|
||||||
const void * getCustomDataLayerData(const CustomData &customdata, CustomDataType cdtype, const std::string &name);
|
const ElemBase * getCustomDataLayerData(const CustomData &customdata, CustomDataType cdtype, const std::string &name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1039,9 +1039,9 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
|
||||||
for (uint32_t t = 0; t < maxTex; ++t) {
|
for (uint32_t t = 0; t < maxTex; ++t) {
|
||||||
if (pMat->mtex[t] && pMat->mtex[t]->uvname[0]) {
|
if (pMat->mtex[t] && pMat->mtex[t]->uvname[0]) {
|
||||||
// get the CustomData layer for given uvname and correct type
|
// get the CustomData layer for given uvname and correct type
|
||||||
const MLoopUV *pLoop = static_cast<const MLoopUV*>(getCustomDataLayerData(mesh->ldata, CD_MLOOPUV, pMat->mtex[t]->uvname));
|
const ElemBase *pLoop = getCustomDataLayerData(mesh->ldata, CD_MLOOPUV, pMat->mtex[t]->uvname);
|
||||||
if (pLoop) {
|
if (pLoop) {
|
||||||
texuv.insert(std::make_pair(t, pLoop));
|
texuv.insert(std::make_pair(t, dynamic_cast<const MLoopUV *>(pLoop)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue