You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Revert "assimp: Sync with upstream 0201fc5"
This reverts commit78b22393a8. It caused a regression in FBX import leading to crashes. Fixes #36908. (cherry picked from commitda1f80c1f2)
This commit is contained in:
37
thirdparty/assimp/code/FBX/FBXConverter.cpp
vendored
37
thirdparty/assimp/code/FBX/FBXConverter.cpp
vendored
@@ -2,7 +2,7 @@
|
||||
Open Asset Import Library (assimp)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2020, assimp team
|
||||
Copyright (c) 2006-2019, assimp team
|
||||
|
||||
|
||||
All rights reserved.
|
||||
@@ -60,8 +60,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <assimp/scene.h>
|
||||
|
||||
#include <assimp/CreateAnimMesh.h>
|
||||
#include <assimp/commonMetaData.h>
|
||||
#include <assimp/StringUtils.h>
|
||||
|
||||
#include <tuple>
|
||||
#include <memory>
|
||||
@@ -1564,7 +1562,7 @@ namespace Assimp {
|
||||
|
||||
bone_map.clear();
|
||||
}
|
||||
catch (std::exception&) {
|
||||
catch (std::exception&e) {
|
||||
std::for_each(bones.begin(), bones.end(), Util::delete_fun<aiBone>());
|
||||
throw;
|
||||
}
|
||||
@@ -1599,11 +1597,12 @@ namespace Assimp {
|
||||
aiBone *bone = nullptr;
|
||||
|
||||
if (bone_map.count(deformer_name)) {
|
||||
ASSIMP_LOG_DEBUG_F("retrieved bone from lookup ", bone_name.C_Str(), ". Deformer:", deformer_name);
|
||||
bone = bone_map[deformer_name];
|
||||
} else {
|
||||
ASSIMP_LOG_DEBUG_F("created new bone ", bone_name.C_Str(), ". Deformer: ", deformer_name);
|
||||
bone = new aiBone();
|
||||
std::cout << "retrieved bone from lookup " << bone_name.C_Str() << ". Deformer: " << deformer_name
|
||||
<< std::endl;
|
||||
bone = bone_map[deformer_name];
|
||||
} else {
|
||||
std::cout << "created new bone " << bone_name.C_Str() << ". Deformer: " << deformer_name << std::endl;
|
||||
bone = new aiBone();
|
||||
bone->mName = bone_name;
|
||||
|
||||
// store local transform link for post processing
|
||||
@@ -1649,7 +1648,7 @@ namespace Assimp {
|
||||
bone_map.insert(std::pair<const std::string, aiBone *>(deformer_name, bone));
|
||||
}
|
||||
|
||||
ASSIMP_LOG_DEBUG_F("bone research: Indicies size: ", out_indices.size());
|
||||
std::cout << "bone research: Indicies size: " << out_indices.size() << std::endl;
|
||||
|
||||
// lookup must be populated in case something goes wrong
|
||||
// this also allocates bones to mesh instance outside
|
||||
@@ -2088,14 +2087,7 @@ namespace Assimp {
|
||||
TrySetTextureProperties(out_mat, textures, "Maya|TEX_emissive_map|file", aiTextureType_EMISSION_COLOR, mesh);
|
||||
TrySetTextureProperties(out_mat, textures, "Maya|TEX_metallic_map|file", aiTextureType_METALNESS, mesh);
|
||||
TrySetTextureProperties(out_mat, textures, "Maya|TEX_roughness_map|file", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
|
||||
TrySetTextureProperties(out_mat, textures, "Maya|TEX_ao_map|file", aiTextureType_AMBIENT_OCCLUSION, mesh);
|
||||
|
||||
// 3DSMax PBR
|
||||
TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|base_color_map", aiTextureType_BASE_COLOR, mesh);
|
||||
TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|bump_map", aiTextureType_NORMAL_CAMERA, mesh);
|
||||
TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|emission_map", aiTextureType_EMISSION_COLOR, mesh);
|
||||
TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|metalness_map", aiTextureType_METALNESS, mesh);
|
||||
TrySetTextureProperties(out_mat, textures, "3dsMax|Parameters|roughness_map", aiTextureType_DIFFUSE_ROUGHNESS, mesh);
|
||||
TrySetTextureProperties(out_mat, textures, "Maya|TEX_ao_map|file", aiTextureType_AMBIENT_OCCLUSION, mesh);
|
||||
}
|
||||
|
||||
void FBXConverter::SetTextureProperties(aiMaterial* out_mat, const LayeredTextureMap& layeredTextures, const MeshGeometry* const mesh)
|
||||
@@ -3612,9 +3604,7 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
|
||||
return;
|
||||
}
|
||||
|
||||
const bool hasGenerator = !doc.Creator().empty();
|
||||
|
||||
out->mMetaData = aiMetadata::Alloc(16 + (hasGenerator ? 1 : 0));
|
||||
out->mMetaData = aiMetadata::Alloc(15);
|
||||
out->mMetaData->Set(0, "UpAxis", doc.GlobalSettings().UpAxis());
|
||||
out->mMetaData->Set(1, "UpAxisSign", doc.GlobalSettings().UpAxisSign());
|
||||
out->mMetaData->Set(2, "FrontAxis", doc.GlobalSettings().FrontAxis());
|
||||
@@ -3630,11 +3620,6 @@ void FBXConverter::SetShadingPropertiesRaw(aiMaterial* out_mat, const PropertyTa
|
||||
out->mMetaData->Set(12, "TimeSpanStart", doc.GlobalSettings().TimeSpanStart());
|
||||
out->mMetaData->Set(13, "TimeSpanStop", doc.GlobalSettings().TimeSpanStop());
|
||||
out->mMetaData->Set(14, "CustomFrameRate", doc.GlobalSettings().CustomFrameRate());
|
||||
out->mMetaData->Set(15, AI_METADATA_SOURCE_FORMAT_VERSION, aiString(to_string(doc.FBXVersion())));
|
||||
if (hasGenerator)
|
||||
{
|
||||
out->mMetaData->Set(16, AI_METADATA_SOURCE_GENERATOR, aiString(doc.Creator()));
|
||||
}
|
||||
}
|
||||
|
||||
void FBXConverter::TransferDataToScene()
|
||||
|
||||
Reference in New Issue
Block a user