Skip to content

Commit

Permalink
Fix #376: uid appdata chunks were not correctly overwritten (#377)
Browse files Browse the repository at this point in the history
* fix a bug where uid appdata chunks were not correctly overwritten

* whitespace
  • Loading branch information
Selmar authored and kcoley committed Nov 13, 2018
1 parent db17684 commit 3c0d6dc
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions 3ds Max/Max2Babylon/Tools/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -513,8 +513,11 @@ public static Guid GetGuid(this IAnimatable node)
// If the uid is already used by another node
if (guids[uid].Equals(node as IInterfaceServer) == false)
{
// Remove old uid
node.RemoveAppDataChunk(Loader.Class_ID, SClass_ID.Basenode, 0);
// Create a new uid for current node
uid = CreateGuid(node);
uid = Guid.NewGuid();
node.AddAppDataChunk(Loader.Class_ID, SClass_ID.Basenode, 0, uid.ToByteArray());
}
}
else
Expand All @@ -524,20 +527,13 @@ public static Guid GetGuid(this IAnimatable node)
}
else
{
uid = CreateGuid(node);
uid = Guid.NewGuid();
node.AddAppDataChunk(Loader.Class_ID, SClass_ID.Basenode, 0, uid.ToByteArray());
}

return uid;
}

private static Guid CreateGuid(this IAnimatable node)
{
Guid uid = Guid.NewGuid();
guids.Add(uid, node);
node.AddAppDataChunk(Loader.Class_ID, SClass_ID.Basenode, 0, uid.ToByteArray());
return uid;
}

public static string GetLocalData(this IAnimatable node)
{
var uidData = node.GetAppDataChunk(Loader.Class_ID, SClass_ID.Basenode, 1);
Expand Down

0 comments on commit 3c0d6dc

Please sign in to comment.