Fix 3DS instances loading, fixes #151

This commit is contained in:
Martin Büchler
2014-01-30 02:39:04 +01:00
parent 3cc4ece11e
commit 9f10553601
3 changed files with 66 additions and 31 deletions

View File

@@ -659,14 +659,22 @@ void Discreet3DSImporter::ParseHierarchyChunk(uint16_t parent)
// Now find out whether we have this node already (target animation channels
// are stored with a separate object ID)
D3DS::Node* pcNode = FindNode(mRootNode,name);
if (pcNode)
int instanceNumber = 1;
if ( pcNode)
{
// Make this node the current node
mCurrentNode = pcNode;
break;
// if the source is not a CHUNK_TRACKINFO block it wont be an object instance
if (parent != Discreet3DS::CHUNK_TRACKINFO)
{
mCurrentNode = pcNode;
break;
}
pcNode->mInstanceCount++;
instanceNumber = pcNode->mInstanceCount;
}
pcNode = new D3DS::Node();
pcNode->mName = name;
pcNode->mInstanceNumber = instanceNumber;
// There are two unknown values which we can safely ignore
stream->IncPtr(4);