mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
Merge pull request #52 from Azaezel/Alpha40ReskinRevamp
reskinning fixes
This commit is contained in:
commit
882a0d5380
2 changed files with 58 additions and 36 deletions
|
|
@ -3694,31 +3694,42 @@ 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;
|
||||||
String(mSkinNameHandle.getString()).split( ";", skins );
|
String(mSkinNameHandle.getString()).split(";", skins);
|
||||||
|
|
||||||
for (S32 i = 0; i < skins.size(); i++)
|
for (S32 i = 0; i < skins.size(); i++)
|
||||||
{
|
{
|
||||||
String oldSkin( mAppliedSkinName.c_str() );
|
String oldSkin(mAppliedSkinName.c_str());
|
||||||
String newSkin( skins[i] );
|
String newSkin(skins[i]);
|
||||||
|
|
||||||
// Check if the skin handle contains an explicit "old" base string. This
|
// Check if the skin handle contains an explicit "old" base string. This
|
||||||
// allows all models to support skinning, even if they don't follow the
|
// allows all models to support skinning, even if they don't follow the
|
||||||
// "base_xxx" material naming convention.
|
// "base_xxx" material naming convention.
|
||||||
S32 split = newSkin.find( '=' ); // "old=new" format skin?
|
S32 split = newSkin.find('='); // "old=new" format skin?
|
||||||
if ( split != String::NPos )
|
if (split != String::NPos)
|
||||||
{
|
{
|
||||||
oldSkin = newSkin.substr( 0, split );
|
oldSkin = newSkin.substr(0, split);
|
||||||
newSkin = newSkin.erase( 0, split+1 );
|
newSkin = newSkin.erase(0, split + 1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
mShapeInstance->reSkin( newSkin, oldSkin );
|
{
|
||||||
|
oldSkin = "";
|
||||||
|
}
|
||||||
|
mShapeInstance->reSkin(newSkin, oldSkin);
|
||||||
mAppliedSkinName = newSkin;
|
mAppliedSkinName = newSkin;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mShapeInstance->reSkin("", mAppliedSkinName);
|
||||||
|
mAppliedSkinName = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShapeBase::setCurrentWaterObject( WaterObject *obj )
|
void ShapeBase::setCurrentWaterObject( WaterObject *obj )
|
||||||
|
|
|
||||||
|
|
@ -542,31 +542,42 @@ 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;
|
||||||
String(mSkinNameHandle.getString()).split( ";", skins );
|
String(mSkinNameHandle.getString()).split(";", skins);
|
||||||
|
|
||||||
for (S32 i = 0; i < skins.size(); i++)
|
for (S32 i = 0; i < skins.size(); i++)
|
||||||
{
|
{
|
||||||
String oldSkin( mAppliedSkinName.c_str() );
|
String oldSkin(mAppliedSkinName.c_str());
|
||||||
String newSkin( skins[i] );
|
String newSkin(skins[i]);
|
||||||
|
|
||||||
// Check if the skin handle contains an explicit "old" base string. This
|
// Check if the skin handle contains an explicit "old" base string. This
|
||||||
// allows all models to support skinning, even if they don't follow the
|
// allows all models to support skinning, even if they don't follow the
|
||||||
// "base_xxx" material naming convention.
|
// "base_xxx" material naming convention.
|
||||||
S32 split = newSkin.find( '=' ); // "old=new" format skin?
|
S32 split = newSkin.find('='); // "old=new" format skin?
|
||||||
if ( split != String::NPos )
|
if (split != String::NPos)
|
||||||
{
|
{
|
||||||
oldSkin = newSkin.substr( 0, split );
|
oldSkin = newSkin.substr(0, split);
|
||||||
newSkin = newSkin.erase( 0, split+1 );
|
newSkin = newSkin.erase(0, split + 1);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
mShapeInstance->reSkin( newSkin, oldSkin );
|
{
|
||||||
|
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 )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue