Merge pull request #147 from aws-lumberyard-dev/genewalt_emfx_ReleaseUnusedRawAssetDataAfterInit
Release unused raw asset data in EMotionFX asset
This commit is contained in:
@@ -68,6 +68,8 @@ namespace EMotionFX
|
||||
&actorSettings,
|
||||
"");
|
||||
|
||||
assetData->ReleaseEMotionFXData();
|
||||
|
||||
if (!assetData->m_emfxActor)
|
||||
{
|
||||
AZ_Error("EMotionFX", false, "Failed to initialize actor asset %s", asset.ToString<AZStd::string>().c_str());
|
||||
@@ -77,7 +79,6 @@ namespace EMotionFX
|
||||
assetData->m_emfxActor->SetIsOwnedByRuntime(true);
|
||||
|
||||
// Note: Render actor depends on the mesh asset, so we need to manually create it after mesh asset has been loaded.
|
||||
|
||||
return static_cast<bool>(assetData->m_emfxActor);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +90,7 @@ namespace EMotionFX
|
||||
}
|
||||
}
|
||||
|
||||
assetData->ReleaseEMotionFXData();
|
||||
AZ_Error("EMotionFX", assetData->m_emfxAnimGraph, "Failed to initialize anim graph asset %s", asset.GetHint().c_str());
|
||||
return static_cast<bool>(assetData->m_emfxAnimGraph);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,12 @@ namespace EMotionFX
|
||||
: AZ::Data::AssetData(id)
|
||||
{}
|
||||
|
||||
void ReleaseEMotionFXData()
|
||||
{
|
||||
m_emfxNativeData.clear();
|
||||
m_emfxNativeData.shrink_to_fit();
|
||||
}
|
||||
|
||||
AZStd::vector<AZ::u8> m_emfxNativeData;
|
||||
};
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace EMotionFX
|
||||
assetData->m_emfxMotion->SetIsOwnedByRuntime(true);
|
||||
}
|
||||
|
||||
assetData->ReleaseEMotionFXData();
|
||||
AZ_Error("EMotionFX", assetData->m_emfxMotion, "Failed to initialize motion asset %s", asset.GetHint().c_str());
|
||||
return (assetData->m_emfxMotion);
|
||||
}
|
||||
|
||||
@@ -232,6 +232,7 @@ namespace EMotionFX
|
||||
// Set motion set's motion load callback, so if EMotion FX queries back for a motion,
|
||||
// we can pull the one managed through an AZ::Asset.
|
||||
assetData->m_emfxMotionSet->SetCallback(aznew CustomMotionSetCallback(asset));
|
||||
assetData->ReleaseEMotionFXData();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user