reskinning fixes

1) falls back to assuming the word "base" is what is to be replaced if no "oldSkin = newSkin" entry exists
2) falls back to *using* base if the entry is left entriely blank
This commit is contained in:
AzaezelX 2019-05-21 12:03:19 -05:00
parent e15f17354d
commit a8380744d8
2 changed files with 58 additions and 36 deletions

View file

@ -3694,7 +3694,9 @@ void ShapeBase::setSkinName(const char* name)
void ShapeBase::reSkin() void ShapeBase::reSkin()
{ {
if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) if (isGhost() && mShapeInstance)
{
if (mSkinNameHandle.isValidString())
{ {
mShapeInstance->resetMaterialList(); mShapeInstance->resetMaterialList();
Vector<String> skins; Vector<String> skins;
@ -3714,11 +3716,20 @@ void ShapeBase::reSkin()
oldSkin = newSkin.substr(0, split); oldSkin = newSkin.substr(0, split);
newSkin = newSkin.erase(0, split + 1); newSkin = newSkin.erase(0, split + 1);
} }
else
{
oldSkin = "";
}
mShapeInstance->reSkin(newSkin, oldSkin); mShapeInstance->reSkin(newSkin, oldSkin);
mAppliedSkinName = newSkin; mAppliedSkinName = newSkin;
} }
} }
else
{
mShapeInstance->reSkin("", mAppliedSkinName);
mAppliedSkinName = "";
}
}
} }
void ShapeBase::setCurrentWaterObject( WaterObject *obj ) void ShapeBase::setCurrentWaterObject( WaterObject *obj )

View file

@ -542,7 +542,9 @@ void TSStatic::setSkinName( const char *name )
void TSStatic::reSkin() void TSStatic::reSkin()
{ {
if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) if (isGhost() && mShapeInstance)
{
if (mSkinNameHandle.isValidString())
{ {
mShapeInstance->resetMaterialList(); mShapeInstance->resetMaterialList();
Vector<String> skins; Vector<String> skins;
@ -562,11 +564,20 @@ void TSStatic::reSkin()
oldSkin = newSkin.substr(0, split); oldSkin = newSkin.substr(0, split);
newSkin = newSkin.erase(0, split + 1); newSkin = newSkin.erase(0, split + 1);
} }
else
{
oldSkin = "";
}
mShapeInstance->reSkin(newSkin, oldSkin); mShapeInstance->reSkin(newSkin, oldSkin);
mAppliedSkinName = newSkin; mAppliedSkinName = newSkin;
} }
} }
else
{
mShapeInstance->reSkin("", mAppliedSkinName);
mAppliedSkinName = "";
}
}
} }
void TSStatic::processTick( const Move *move ) void TSStatic::processTick( const Move *move )