Merge pull request #340 from Laupetin/fix/regressions-from-obj-compiling-refactor

fix: regressions from obj compiling refactor
This commit is contained in:
Jan 2025-01-11 12:22:47 +01:00 committed by GitHub
commit a759f3d82b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 13 additions and 4 deletions

View File

@ -38,7 +38,12 @@ public:
for (const auto scrString : existingAsset->m_used_script_strings)
m_zone.m_script_strings.AddOrGetScriptString(existingAsset->m_zone->m_script_strings.CValue(scrString));
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
auto* newAsset = context.AddAsset(std::move(registration));
// Make sure we remember this asset came from another zone
newAsset->m_zone = existingAsset->m_zone;
return AssetCreationResult::Success(newAsset);
}
private:

View File

@ -238,5 +238,7 @@ AssetCreationResult InfoStringLoaderAttachmentUnique::CreateAsset(const std::str
return AssetCreationResult::Failure();
}
CalculateAttachmentUniqueFields(assetName, *attachmentUniqueFull);
return AssetCreationResult::Success(context.AddAsset(std::move(registration)));
}

View File

@ -252,7 +252,8 @@ namespace
info.radiusSquared = halfSizeEigen.squaredNorm();
}
bool ApplyCommonBonesToXModel(const JsonXModelLod& jLod, XModel& xmodel, unsigned lodNumber, const XModelCommon& common)
bool ApplyCommonBonesToXModel(
const JsonXModelLod& jLod, XModel& xmodel, unsigned lodNumber, const XModelCommon& common, AssetRegistration<AssetXModel>& registration)
{
if (common.m_bones.empty())
return true;
@ -305,6 +306,7 @@ namespace
{
const auto& bone = common.m_bones[boneIndex];
xmodel.boneNames[boneIndex] = m_script_strings.AddOrGetScriptString(bone.name);
registration.AddScriptString(xmodel.boneNames[boneIndex]);
xmodel.partClassification[boneIndex] = static_cast<unsigned char>(m_part_classification_state.GetPartClassificationForBoneName(bone.name));
ApplyBasePose(xmodel.baseMat[boneIndex], bone);
@ -656,7 +658,7 @@ namespace
if (lodNumber == 0u)
{
if (!ApplyCommonBonesToXModel(jLod, xmodel, lodNumber, *common))
if (!ApplyCommonBonesToXModel(jLod, xmodel, lodNumber, *common, registration))
return false;
}
else