FBX Export: handle newly-added geometric transform inverse nodes.

This also tidies up the imported node structure a little,
by not adding the inverse nodes if there are no child nodes.
pull/1804/head
Tommy 2018-02-24 08:42:03 +01:00
parent 5e4b2b898f
commit b91976eead
2 changed files with 23 additions and 14 deletions

View File

@ -215,8 +215,13 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
// attach geometry // attach geometry
ConvertModel( *model, *nodes_chain.back(), new_abs_transform ); ConvertModel( *model, *nodes_chain.back(), new_abs_transform );
// now link the geometric transform inverse nodes, // check if there will be any child nodes
const std::vector<const Connection*>& child_conns
= doc.GetConnectionsByDestinationSequenced( model->ID(), "Model" );
// if so, link the geometric transform inverse nodes
// before we attach any child nodes // before we attach any child nodes
if (child_conns.size()) {
for( aiNode* postnode : post_nodes_chain ) { for( aiNode* postnode : post_nodes_chain ) {
ai_assert( postnode ); ai_assert( postnode );
@ -231,8 +236,9 @@ void Converter::ConvertNodes( uint64_t id, aiNode& parent, const aiMatrix4x4& pa
new_abs_transform *= postnode->mTransformation; new_abs_transform *= postnode->mTransformation;
} }
}
// attach sub-nodes // attach sub-nodes (if any)
ConvertNodes( model->ID(), *last_parent, new_abs_transform ); ConvertNodes( model->ID(), *last_parent, new_abs_transform );
if ( doc.Settings().readLights ) { if ( doc.Settings().readLights ) {

View File

@ -1775,7 +1775,10 @@ const std::map<std::string,std::pair<std::string,char>> transform_types = {
{"ScalingPivotInverse", {"ScalingPivotInverse", 'i'}}, {"ScalingPivotInverse", {"ScalingPivotInverse", 'i'}},
{"GeometricScaling", {"GeometricScaling", 's'}}, {"GeometricScaling", {"GeometricScaling", 's'}},
{"GeometricRotation", {"GeometricRotation", 'r'}}, {"GeometricRotation", {"GeometricRotation", 'r'}},
{"GeometricTranslation", {"GeometricTranslation", 't'}} {"GeometricTranslation", {"GeometricTranslation", 't'}},
{"GeometricTranslationInverse", {"GeometricTranslationInverse", 'i'}},
{"GeometricRotationInverse", {"GeometricRotationInverse", 'i'}},
{"GeometricScalingInverse", {"GeometricScalingInverse", 'i'}}
}; };
// write a single model node to the stream // write a single model node to the stream