|
@@ -215,24 +215,30 @@ 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,
|
|
|
|
- // before we attach any child nodes
|
|
|
|
- for( aiNode* postnode : post_nodes_chain ) {
|
|
|
|
- ai_assert( postnode );
|
|
|
|
|
|
+ // check if there will be any child nodes
|
|
|
|
+ const std::vector<const Connection*>& child_conns
|
|
|
|
+ = doc.GetConnectionsByDestinationSequenced( model->ID(), "Model" );
|
|
|
|
|
|
- if ( last_parent != &parent ) {
|
|
|
|
- last_parent->mNumChildren = 1;
|
|
|
|
- last_parent->mChildren = new aiNode*[ 1 ];
|
|
|
|
- last_parent->mChildren[ 0 ] = postnode;
|
|
|
|
- }
|
|
|
|
|
|
+ // if so, link the geometric transform inverse nodes
|
|
|
|
+ // before we attach any child nodes
|
|
|
|
+ if (child_conns.size()) {
|
|
|
|
+ for( aiNode* postnode : post_nodes_chain ) {
|
|
|
|
+ ai_assert( postnode );
|
|
|
|
+
|
|
|
|
+ if ( last_parent != &parent ) {
|
|
|
|
+ last_parent->mNumChildren = 1;
|
|
|
|
+ last_parent->mChildren = new aiNode*[ 1 ];
|
|
|
|
+ last_parent->mChildren[ 0 ] = postnode;
|
|
|
|
+ }
|
|
|
|
|
|
- postnode->mParent = last_parent;
|
|
|
|
- last_parent = postnode;
|
|
|
|
|
|
+ postnode->mParent = last_parent;
|
|
|
|
+ last_parent = postnode;
|
|
|
|
|
|
- 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 ) {
|