better comment for animated prefab and remove unused code in remap blendshapes

This commit is contained in:
alsed
2025-09-07 20:40:28 -03:00
parent a8768f918e
commit 52ee8b3953
2 changed files with 4 additions and 13 deletions

View File

@@ -608,8 +608,8 @@ CreateAssetResult ImportModel::Create(CreateAssetContext& context)
CreateAssetResult ImportModel::CreateModel(CreateAssetContext& context, const ModelData& modelData, const Options* options)
{
PROFILE_CPU();
IMPORT_SETUP(Model, Model::SerializedVersion);
static_assert(Model::SerializedVersion == 30, "Update code.");
IMPORT_SETUP(Model, Model::SerializedVersion);
static_assert(Model::SerializedVersion == 30, "Update code.");
// Save model header
MemoryWriteStream stream(4096);
@@ -738,7 +738,7 @@ CreateAssetResult ImportModel::CreatePrefab(CreateAssetContext& context, const M
{
if(e.IsSkinned)
{
LOG(Info,"Model {0} is Animated", e.Name);
LOG(Info,"Creating animated model prefab {0}.", e.Name);
auto* actor = New<AnimatedModel>();
actor->SetName(e.Name);
if (auto* skinnedModel = Content::LoadAsync<SkinnedModel>(e.AssetPath))

View File

@@ -2114,12 +2114,10 @@ bool ModelTool::ImportModel(const String& path, ModelData& data, Options& option
#undef REMAP_VERTEX_BUFFER
// Remap blend shapes
dstMesh->BlendShapes.Clear();
dstMesh->BlendShapes.EnsureCapacity(srcMesh->BlendShapes.Count(), false);
for (int32 blendShapeIndex = 0; blendShapeIndex < srcMesh->BlendShapes.Count(); blendShapeIndex++)
{
const auto& srcBlendShape = srcMesh->BlendShapes[blendShapeIndex];
//auto& dstBlendShape = dstMesh->BlendShapes[blendShapeIndex];
BlendShape dstBlendShape;
dstBlendShape.Name = srcBlendShape.Name;
dstBlendShape.Weight = srcBlendShape.Weight;
@@ -2132,18 +2130,11 @@ bool ModelTool::ImportModel(const String& path, ModelData& data, Options& option
dstBlendShape.Vertices.Add(v);
}
// Add only valid blend shapes
if (dstBlendShape.Vertices.HasItems())
dstMesh->BlendShapes.Add(dstBlendShape);
}
/*
// Remove empty blend shapes
for (int32 blendShapeIndex = dstMesh->BlendShapes.Count() - 1; blendShapeIndex >= 0; blendShapeIndex--)
{
if (dstMesh->BlendShapes[blendShapeIndex].Vertices.IsEmpty())
dstMesh->BlendShapes.RemoveAt(blendShapeIndex);
}
*/
// Optimize generated LOD
meshopt_optimizeVertexCache(dstMesh->Indices.Get(), dstMesh->Indices.Get(), dstMeshIndexCount, dstMeshVertexCount);
meshopt_optimizeOverdraw(dstMesh->Indices.Get(), dstMesh->Indices.Get(), dstMeshIndexCount, (const float*)dstMesh->Positions.Get(), dstMeshVertexCount, sizeof(Float3), 1.05f);