Append a setting "AI_CONFIG_EXPORT_FBX_TRANSPARENCY_FACTOR_REFER_TO_OPACITY". (#5450)
Co-authored-by: Kim Kulling <kimkulling@users.noreply.github.com>pull/5480/head
parent
01231d0e60
commit
f95050e7aa
|
@ -1089,6 +1089,8 @@ void FBXExporter::WriteObjects ()
|
||||||
bool bJoinIdenticalVertices = mProperties->GetPropertyBool("bJoinIdenticalVertices", true);
|
bool bJoinIdenticalVertices = mProperties->GetPropertyBool("bJoinIdenticalVertices", true);
|
||||||
std::vector<std::vector<int32_t>> vVertexIndice;//save vertex_indices as it is needed later
|
std::vector<std::vector<int32_t>> vVertexIndice;//save vertex_indices as it is needed later
|
||||||
|
|
||||||
|
const auto bTransparencyFactorReferencedToOpacity = mProperties->GetPropertyBool(AI_CONFIG_EXPORT_FBX_TRANSPARENCY_FACTOR_REFER_TO_OPACITY, false);
|
||||||
|
|
||||||
// geometry (aiMesh)
|
// geometry (aiMesh)
|
||||||
mesh_uids.clear();
|
mesh_uids.clear();
|
||||||
indent = 1;
|
indent = 1;
|
||||||
|
@ -1445,6 +1447,8 @@ void FBXExporter::WriteObjects ()
|
||||||
// "TransparentColor" / "TransparencyFactor"...
|
// "TransparentColor" / "TransparencyFactor"...
|
||||||
// thanks FBX, for your insightful interpretation of consistency
|
// thanks FBX, for your insightful interpretation of consistency
|
||||||
p.AddP70colorA("TransparentColor", c.r, c.g, c.b);
|
p.AddP70colorA("TransparentColor", c.r, c.g, c.b);
|
||||||
|
|
||||||
|
if (!bTransparencyFactorReferencedToOpacity) {
|
||||||
// TransparencyFactor defaults to 0.0, so set it to 1.0.
|
// TransparencyFactor defaults to 0.0, so set it to 1.0.
|
||||||
// note: Maya always sets this to 1.0,
|
// note: Maya always sets this to 1.0,
|
||||||
// so we can't use it sensibly as "Opacity".
|
// so we can't use it sensibly as "Opacity".
|
||||||
|
@ -1453,6 +1457,12 @@ void FBXExporter::WriteObjects ()
|
||||||
// probably for a similar reason.
|
// probably for a similar reason.
|
||||||
p.AddP70numberA("TransparencyFactor", 1.0);
|
p.AddP70numberA("TransparencyFactor", 1.0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (bTransparencyFactorReferencedToOpacity) {
|
||||||
|
if (m->Get(AI_MATKEY_OPACITY, f) == aiReturn_SUCCESS) {
|
||||||
|
p.AddP70numberA("TransparencyFactor", 1.0 - f);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (m->Get(AI_MATKEY_COLOR_REFLECTIVE, c) == aiReturn_SUCCESS) {
|
if (m->Get(AI_MATKEY_COLOR_REFLECTIVE, c) == aiReturn_SUCCESS) {
|
||||||
p.AddP70colorA("ReflectionColor", c.r, c.g, c.b);
|
p.AddP70colorA("ReflectionColor", c.r, c.g, c.b);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1113,6 +1113,16 @@ enum aiComponent
|
||||||
#define AI_CONFIG_EXPORT_GLTF_UNLIMITED_SKINNING_BONES_PER_VERTEX \
|
#define AI_CONFIG_EXPORT_GLTF_UNLIMITED_SKINNING_BONES_PER_VERTEX \
|
||||||
"USE_UNLIMITED_BONES_PER VERTEX"
|
"USE_UNLIMITED_BONES_PER VERTEX"
|
||||||
|
|
||||||
|
/** @brief Specifies whether to write the value referenced to opacity in TransparencyFactor of each material.
|
||||||
|
*
|
||||||
|
* When this flag is not defined, the TransparencyFactor value of each meterial is 1.0.
|
||||||
|
* By enabling this flag, the value is 1.0 - opacity;
|
||||||
|
|
||||||
|
* Property type: Bool. Default value: false.
|
||||||
|
*/
|
||||||
|
#define AI_CONFIG_EXPORT_FBX_TRANSPARENCY_FACTOR_REFER_TO_OPACITY \
|
||||||
|
"EXPORT_FBX_TRANSPARENCY_FACTOR_REFER_TO_OPACITY"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Specifies the blob name, assimp uses for exporting.
|
* @brief Specifies the blob name, assimp uses for exporting.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue