Bladeren bron

new method: TSShapeInstance::resetMaterialList(). Sets all object-instance mapto values back to initial state. reskin now does so to avoid having to track origional values independently. (so say, if you've already got skin1 plugged in to one, and nothing in to another, no need to set skin1=skin2 on the first and skin2 or base=skin2 on the second to swap both on over to skin2).
also by request, went ahead and killed case sensitivity for mapto string replacement when reskinning.

Azaezel 7 jaren geleden
bovenliggende
commit
f9bf4fca4b

+ 1 - 0
Engine/source/T3D/player.cpp

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

+ 1 - 0
Engine/source/T3D/shapeBase.cpp

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

+ 1 - 0
Engine/source/T3D/tsStatic.cpp

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

+ 8 - 2
Engine/source/ts/tsShapeInstance.cpp

@@ -307,8 +307,8 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName )
    {
       // Try changing base
       const String &pName = materialNames[i];
-	  String newName( pName );
-	  newName.replace( oldBaseName, newBaseName );
+	  String newName( String::ToLower(pName) );
+	  newName.replace( String::ToLower(oldBaseName), String::ToLower(newBaseName) );
 	  pMatList->renameMaterial( i, newName );
    }
 
@@ -316,6 +316,12 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName )
    initMaterialList();
 }
 
+void TSShapeInstance::resetMaterialList()
+{
+	TSMaterialList* oMatlist = mShape->materialList;
+	setMaterialList(oMatlist);
+}
+
 //-------------------------------------------------------------------------------------
 // Render & detail selection
 //-------------------------------------------------------------------------------------

+ 1 - 1
Engine/source/ts/tsShapeInstance.h

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