Fix for bug where, when removing a motion that is used by more than one motion set.

Signed-off-by: T.J. McGrath-Daly <tj.mcgrath.daly@huawei.com>
This commit is contained in:
T.J. McGrath-Daly
2021-10-26 09:38:46 +08:00
parent edefb57cfd
commit dfa6f77075
@@ -1138,6 +1138,12 @@ namespace EMStudio
for (size_t motionSetId = 0; motionSetId < numMotionSets; motionSetId++)
{
EMotionFX::MotionSet* motionSet2 = EMotionFX::GetMotionManager().GetMotionSet(motionSetId);
if (motionSet2->GetIsOwnedByRuntime())
{
continue;
}
if (motionSet2->FindMotionEntryById(motionEntry->GetId()))
{
numMotionSetContainsMotion++;
@@ -1148,12 +1154,6 @@ namespace EMStudio
}
}
// If motion exists in multiple motion sets, then it should not be removed from motions window.
if (removeMotion && numMotionSetContainsMotion > 1)
{
continue;
}
// check the reference counter if only one reference registered
// two is needed because the remove motion command has to be called to have the undo/redo possible
// without it the motion list is also not updated because the remove motion callback is not called
@@ -1170,6 +1170,12 @@ namespace EMStudio
}
motionIdsToRemoveString += motionEntry->GetId();
// If motion exists in multiple motion sets, then it should not be removed from motions window.
if (removeMotion && numMotionSetContainsMotion > 1)
{
continue;
}
// Check if the motion is not valid, that means the motion is not loaded.
if (removeMotion && motionEntry->GetMotion())
{