diff --git a/Engine/source/ts/tsMeshFit.cpp b/Engine/source/ts/tsMeshFit.cpp index ab4c57b10..bd7fbee0f 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -1032,9 +1032,28 @@ DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char default: objName = "ColConvex"; break; } - for ( S32 suffix = i; suffix != 0; suffix /= 26 ) - objName += ('A' + ( suffix % 26 ) ); - String meshName = objName + String::ToString( "%d", size ); + S32 suffix = i; + while (true) + { + String tempName = objName; + if (suffix == 0) + suffix = 1; + + for (S32 s = suffix; s != 0; s /= 26) { + tempName += ('A' + (s % 26)); + } + + if (mShape->findName(tempName) == -1) + break; + + suffix++; + } + + for (S32 s = suffix; s != 0; s /= 26) { + objName += ('A' + (s % 26)); + } + + String meshName = objName + String::ToString("%d", size); mShape->addMesh( mesh->tsmesh, meshName ); diff --git a/Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui b/Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui index 7a52de1fa..74c61fe37 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui +++ b/Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui @@ -882,7 +882,6 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow,EditorGuiGroup) { position = "85 4"; extent = "170 18"; profile = "ToolsGuiPopUpMenuProfile"; - command = "ShapeEdColWindow.editCollision();"; tooltipProfile = "GuiToolTipProfile"; tooltip = "Select the method used to auto-generate the collision geometry"; internalName = "colType"; @@ -898,7 +897,6 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow,EditorGuiGroup) { position = "85 24"; extent = "170 18"; profile = "ToolsGuiPopUpMenuProfile"; - command = "ShapeEdColWindow.editCollision();"; tooltipProfile = "GuiToolTipProfile"; tooltip = "Select the object to fit collision geometry to"; internalName = "colTarget"; @@ -914,7 +912,6 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow,EditorGuiGroup) { position = "85 43"; extent = "170 18"; profile = "ToolsGuiPopUpMenuProfile"; - command = "ShapeEdColWindow.editCollision();"; tooltipProfile = "GuiToolTipProfile"; tooltip = "Select the object to fit collision geometry to"; internalName = "fillMode"; diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.tscript b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.tscript index f3c27f8a3..c93beb996 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.tscript +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.tscript @@ -1081,32 +1081,35 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %depth, %m { %colDetailSize = -1; %colNode = "Col" @ %colDetailSize; - + %colData = ShapeEdColWindow.lastColSettings; + %oldTarget = getField( %colData, 1 ); // TreeView items are case sensitive, but TSShape names are not, so fixup case // if needed %index = ShapeEditor.shape.getNodeIndex( %colNode ); if ( %index != -1 ) %colNode = ShapeEditor.shape.getNodeName( %index ); - // First remove the old detail and collision nodes - %meshList = ShapeEditor.getDetailMeshList( %colDetailSize ); - %meshCount = getFieldCount( %meshList ); - if ( %meshCount > 0 ) + if(%target $= "Bounds" || %oldTarget $= "Bounds" || %target $= %oldTarget) { - ShapeEditor.shape.removeDetailLevel( %colDetailSize ); - for ( %i = 0; %i < %meshCount; %i++ ) - ShapeEdPropWindow.update_onMeshRemoved( getField( %meshList, %i ) ); - } + // First remove the old detail and collision nodes + %meshList = ShapeEditor.getDetailMeshList( %colDetailSize ); + %meshCount = getFieldCount( %meshList ); + if ( %meshCount > 0 ) + { + ShapeEditor.shape.removeDetailLevel( %colDetailSize ); + for ( %i = 0; %i < %meshCount; %i++ ) + ShapeEdPropWindow.update_onMeshRemoved( getField( %meshList, %i ) ); + } - %nodeList = ShapeEditor.getNodeNames( %colNode, "" ); - %nodeCount = getFieldCount( %nodeList ); - if ( %nodeCount > 0 ) - { - for ( %i = 0; %i < %nodeCount; %i++ ) - ShapeEditor.shape.removeNode( getField( %nodeList, %i ) ); - ShapeEdPropWindow.update_onNodeRemoved( %nodeList, %nodeCount ); + %nodeList = ShapeEditor.getNodeNames( %colNode, "" ); + %nodeCount = getFieldCount( %nodeList ); + if ( %nodeCount > 0 ) + { + for ( %i = 0; %i < %nodeCount; %i++ ) + ShapeEditor.shape.removeNode( getField( %nodeList, %i ) ); + ShapeEdPropWindow.update_onNodeRemoved( %nodeList, %nodeCount ); + } } - // Add the new node and geometry if ( %type $= "" ) return;