TEST progress

Adding multiple collision hulls and shapes through the shape editor now works as intended though with multiple convex hulls it does produce a few lag spikes on first load of the objects.
This commit is contained in:
marauder2k7 2024-05-15 07:32:26 +01:00
parent 78f6206cde
commit f963a78446
3 changed files with 42 additions and 23 deletions

View file

@ -1032,9 +1032,28 @@ DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char
default: objName = "ColConvex"; break; default: objName = "ColConvex"; break;
} }
for ( S32 suffix = i; suffix != 0; suffix /= 26 ) S32 suffix = i;
objName += ('A' + ( suffix % 26 ) ); while (true)
String meshName = objName + String::ToString( "%d", size ); {
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 ); mShape->addMesh( mesh->tsmesh, meshName );

View file

@ -882,7 +882,6 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow,EditorGuiGroup) {
position = "85 4"; position = "85 4";
extent = "170 18"; extent = "170 18";
profile = "ToolsGuiPopUpMenuProfile"; profile = "ToolsGuiPopUpMenuProfile";
command = "ShapeEdColWindow.editCollision();";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
tooltip = "Select the method used to auto-generate the collision geometry"; tooltip = "Select the method used to auto-generate the collision geometry";
internalName = "colType"; internalName = "colType";
@ -898,7 +897,6 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow,EditorGuiGroup) {
position = "85 24"; position = "85 24";
extent = "170 18"; extent = "170 18";
profile = "ToolsGuiPopUpMenuProfile"; profile = "ToolsGuiPopUpMenuProfile";
command = "ShapeEdColWindow.editCollision();";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
tooltip = "Select the object to fit collision geometry to"; tooltip = "Select the object to fit collision geometry to";
internalName = "colTarget"; internalName = "colTarget";
@ -914,7 +912,6 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow,EditorGuiGroup) {
position = "85 43"; position = "85 43";
extent = "170 18"; extent = "170 18";
profile = "ToolsGuiPopUpMenuProfile"; profile = "ToolsGuiPopUpMenuProfile";
command = "ShapeEdColWindow.editCollision();";
tooltipProfile = "GuiToolTipProfile"; tooltipProfile = "GuiToolTipProfile";
tooltip = "Select the object to fit collision geometry to"; tooltip = "Select the object to fit collision geometry to";
internalName = "fillMode"; internalName = "fillMode";

View file

@ -1081,13 +1081,16 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %depth, %m
{ {
%colDetailSize = -1; %colDetailSize = -1;
%colNode = "Col" @ %colDetailSize; %colNode = "Col" @ %colDetailSize;
%colData = ShapeEdColWindow.lastColSettings;
%oldTarget = getField( %colData, 1 );
// TreeView items are case sensitive, but TSShape names are not, so fixup case // TreeView items are case sensitive, but TSShape names are not, so fixup case
// if needed // if needed
%index = ShapeEditor.shape.getNodeIndex( %colNode ); %index = ShapeEditor.shape.getNodeIndex( %colNode );
if ( %index != -1 ) if ( %index != -1 )
%colNode = ShapeEditor.shape.getNodeName( %index ); %colNode = ShapeEditor.shape.getNodeName( %index );
if(%target $= "Bounds" || %oldTarget $= "Bounds" || %target $= %oldTarget)
{
// First remove the old detail and collision nodes // First remove the old detail and collision nodes
%meshList = ShapeEditor.getDetailMeshList( %colDetailSize ); %meshList = ShapeEditor.getDetailMeshList( %colDetailSize );
%meshCount = getFieldCount( %meshList ); %meshCount = getFieldCount( %meshList );
@ -1106,7 +1109,7 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %depth, %m
ShapeEditor.shape.removeNode( getField( %nodeList, %i ) ); ShapeEditor.shape.removeNode( getField( %nodeList, %i ) );
ShapeEdPropWindow.update_onNodeRemoved( %nodeList, %nodeCount ); ShapeEdPropWindow.update_onNodeRemoved( %nodeList, %nodeCount );
} }
}
// Add the new node and geometry // Add the new node and geometry
if ( %type $= "" ) if ( %type $= "" )
return; return;