瀏覽代碼

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 年之前
父節點
當前提交
f9bf4fca4b

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

@@ -1953,6 +1953,7 @@ void Player::reSkin()
 {
 {
    if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
    if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
    {
    {
+	  mShapeInstance->resetMaterialList();
       Vector<String> skins;
       Vector<String> skins;
       String(mSkinNameHandle.getString()).split( ";", 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() )
    if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
    {
    {
+	  mShapeInstance->resetMaterialList();
       Vector<String> skins;
       Vector<String> skins;
       String(mSkinNameHandle.getString()).split( ";", 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() )
    if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() )
    {
    {
+	  mShapeInstance->resetMaterialList();
       Vector<String> skins;
       Vector<String> skins;
       String(mSkinNameHandle.getString()).split( ";", 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
       // Try changing base
       const String &pName = materialNames[i];
       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 );
 	  pMatList->renameMaterial( i, newName );
    }
    }
 
 
@@ -316,6 +316,12 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName )
    initMaterialList();
    initMaterialList();
 }
 }
 
 
+void TSShapeInstance::resetMaterialList()
+{
+	TSMaterialList* oMatlist = mShape->materialList;
+	setMaterialList(oMatlist);
+}
+
 //-------------------------------------------------------------------------------------
 //-------------------------------------------------------------------------------------
 // Render & detail selection
 // Render & detail selection
 //-------------------------------------------------------------------------------------
 //-------------------------------------------------------------------------------------

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

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