summaryrefslogtreecommitdiff
path: root/thirdparty/assimp/code/FBXConverter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/assimp/code/FBXConverter.cpp')
-rw-r--r--thirdparty/assimp/code/FBXConverter.cpp35
1 files changed, 28 insertions, 7 deletions
diff --git a/thirdparty/assimp/code/FBXConverter.cpp b/thirdparty/assimp/code/FBXConverter.cpp
index 000c4ed53b..09ae06a64f 100644
--- a/thirdparty/assimp/code/FBXConverter.cpp
+++ b/thirdparty/assimp/code/FBXConverter.cpp
@@ -78,6 +78,16 @@ namespace Assimp {
FBXConverter::FBXConverter(aiScene* out, const Document& doc)
: defaultMaterialIndex()
+ , lights()
+ , cameras()
+ , textures()
+ , materials_converted()
+ , textures_converted()
+ , meshes_converted()
+ , node_anim_chain_bits()
+ , mNodeNameInstances()
+ , mNodeNames()
+ , anim_fps()
, out(out)
, doc(doc) {
// animations need to be converted first since this will
@@ -410,19 +420,24 @@ namespace Assimp {
void FBXConverter::GetUniqueName(const std::string &name, std::string &uniqueName)
{
- int i = 0;
uniqueName = name;
- while (mNodeNames.find(uniqueName) != mNodeNames.end())
+ int i = 0;
+ auto it = mNodeNameInstances.find(name); // duplicate node name instance count
+ if (it != mNodeNameInstances.end())
{
- ++i;
- std::stringstream ext;
- ext << name << std::setfill('0') << std::setw(3) << i;
- uniqueName = ext.str();
+ i = it->second;
+ while (mNodeNames.find(uniqueName) != mNodeNames.end())
+ {
+ i++;
+ std::stringstream ext;
+ ext << name << std::setfill('0') << std::setw(3) << i;
+ uniqueName = ext.str();
+ }
}
+ mNodeNameInstances[name] = i;
mNodeNames.insert(uniqueName);
}
-
const char* FBXConverter::NameTransformationComp(TransformationComp comp) {
switch (comp) {
case TransformationComp_Translation:
@@ -2041,6 +2056,12 @@ namespace Assimp {
CalculatedOpacity = 1.0f - ((Transparent.r + Transparent.g + Transparent.b) / 3.0f);
}
+ // try to get the transparency factor
+ const float TransparencyFactor = PropertyGet<float>(props, "TransparencyFactor", ok);
+ if (ok) {
+ out_mat->AddProperty(&TransparencyFactor, 1, AI_MATKEY_TRANSPARENCYFACTOR);
+ }
+
// use of TransparencyFactor is inconsistent.
// Maya always stores it as 1.0,
// so we can't use it to set AI_MATKEY_OPACITY.