mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 20:49:41 +00:00
Fix crash in character preview for non-existing meshes (Fixes #2128)
This commit is contained in:
parent
75b0da5dce
commit
fee08f97ed
3 changed files with 22 additions and 3 deletions
|
@ -313,7 +313,15 @@ namespace MWGui
|
||||||
record.mHead = mAvailableHeads[mFaceIndex];
|
record.mHead = mAvailableHeads[mFaceIndex];
|
||||||
record.mHair = mAvailableHairs[mHairIndex];
|
record.mHair = mAvailableHairs[mHairIndex];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
mPreview->setPrototype(record);
|
mPreview->setPrototype(record);
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "Error creating preview: " << e.what() << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
mPreviewDirty = true;
|
mPreviewDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -115,8 +115,8 @@ namespace MWRender
|
||||||
|
|
||||||
void CharacterPreview::rebuild()
|
void CharacterPreview::rebuild()
|
||||||
{
|
{
|
||||||
assert(mAnimation);
|
|
||||||
delete mAnimation;
|
delete mAnimation;
|
||||||
|
mAnimation = NULL;
|
||||||
mAnimation = new NpcAnimation(mCharacter, mNode,
|
mAnimation = new NpcAnimation(mCharacter, mNode,
|
||||||
0, true, true, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));
|
0, true, true, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));
|
||||||
|
|
||||||
|
@ -187,6 +187,9 @@ namespace MWRender
|
||||||
|
|
||||||
void InventoryPreview::update()
|
void InventoryPreview::update()
|
||||||
{
|
{
|
||||||
|
if (!mAnimation)
|
||||||
|
return;
|
||||||
|
|
||||||
mAnimation->updateParts();
|
mAnimation->updateParts();
|
||||||
|
|
||||||
MWWorld::InventoryStore &inv = mCharacter.getClass().getInventoryStore(mCharacter);
|
MWWorld::InventoryStore &inv = mCharacter.getClass().getInventoryStore(mCharacter);
|
||||||
|
|
|
@ -676,7 +676,15 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
|
||||||
removeIndividualPart(type);
|
removeIndividualPart(type);
|
||||||
mPartslots[type] = group;
|
mPartslots[type] = group;
|
||||||
mPartPriorities[type] = priority;
|
mPartPriorities[type] = priority;
|
||||||
|
try
|
||||||
|
{
|
||||||
mObjectParts[type] = insertBoundedPart(mesh, group, sPartList.at(type), enchantedGlow, glowColor);
|
mObjectParts[type] = insertBoundedPart(mesh, group, sPartList.at(type), enchantedGlow, glowColor);
|
||||||
|
}
|
||||||
|
catch (std::exception& e)
|
||||||
|
{
|
||||||
|
std::cerr << "Error adding NPC part: " << e.what() << std::endl;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mSoundsDisabled)
|
if (!mSoundsDisabled)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue