From 4884cf21727607a4abea319e7c71ae69217736d6 Mon Sep 17 00:00:00 2001 From: Matias Date: Wed, 3 Apr 2019 12:35:09 +0200 Subject: [PATCH] issue_2393: Added TransparencyFactor material key --- code/FBXConverter.cpp | 6 ++++++ include/assimp/material.h | 1 + 2 files changed, 7 insertions(+) diff --git a/code/FBXConverter.cpp b/code/FBXConverter.cpp index a61ae4006..71989b9f5 100644 --- a/code/FBXConverter.cpp +++ b/code/FBXConverter.cpp @@ -2041,6 +2041,12 @@ namespace Assimp { CalculatedOpacity = 1.0f - ((Transparent.r + Transparent.g + Transparent.b) / 3.0f); } + // try to get the transparency factor + const float TransparencyFactor = PropertyGet(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. diff --git a/include/assimp/material.h b/include/assimp/material.h index b882bbc72..4b5a1293d 100644 --- a/include/assimp/material.h +++ b/include/assimp/material.h @@ -900,6 +900,7 @@ extern "C" { #define AI_MATKEY_ENABLE_WIREFRAME "$mat.wireframe",0,0 #define AI_MATKEY_BLEND_FUNC "$mat.blend",0,0 #define AI_MATKEY_OPACITY "$mat.opacity",0,0 +#define AI_MATKEY_TRANSPARENCYFACTOR "$mat.transparencyfactor",0,0 #define AI_MATKEY_BUMPSCALING "$mat.bumpscaling",0,0 #define AI_MATKEY_SHININESS "$mat.shininess",0,0 #define AI_MATKEY_REFLECTIVITY "$mat.reflectivity",0,0