Merge pull request #2108 from Azaezel/reskinRedux

allows for arbitrary reskinning
This commit is contained in:
Areloch 2018-04-30 23:37:36 -05:00 committed by GitHub
commit 1f2847bc11
5 changed files with 13 additions and 7 deletions

View file

@ -1953,6 +1953,7 @@ void Player::reSkin()
{
if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
{
mShapeInstance->resetMaterialList();
Vector<String> skins;
String(mSkinNameHandle.getString()).split( ";", skins );

View file

@ -3689,6 +3689,7 @@ void ShapeBase::reSkin()
{
if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
{
mShapeInstance->resetMaterialList();
Vector<String> skins;
String(mSkinNameHandle.getString()).split( ";", skins );

View file

@ -537,6 +537,7 @@ void TSStatic::reSkin()
{
if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
{
mShapeInstance->resetMaterialList();
Vector<String> skins;
String(mSkinNameHandle.getString()).split( ";", skins );

View file

@ -307,18 +307,21 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName )
{
// Try changing base
const String &pName = materialNames[i];
if ( pName.compare( oldBaseName, oldBaseNameLength, String::NoCase ) == 0 )
{
String newName( pName );
newName.replace( 0, oldBaseNameLength, newBaseName );
pMatList->renameMaterial( i, newName );
}
String newName( String::ToLower(pName) );
newName.replace( String::ToLower(oldBaseName), String::ToLower(newBaseName) );
pMatList->renameMaterial( i, newName );
}
// Initialize the material instances
initMaterialList();
}
void TSShapeInstance::resetMaterialList()
{
TSMaterialList* oMatlist = mShape->materialList;
setMaterialList(oMatlist);
}
//-------------------------------------------------------------------------------------
// Render & detail selection
//-------------------------------------------------------------------------------------

View file

@ -377,7 +377,7 @@ protected:
}
void reSkin( String newBaseName, String oldBaseName = String::EmptyString );
void resetMaterialList();
enum
{
MaskNodeRotation = 0x01,