finish fill mode setting

now fill mode actually takes effect and changes the fill mode type used to generate the convex hull
This commit is contained in:
marauder2k7 2024-05-16 04:32:14 +01:00
parent 48848f9706
commit 25b0c5e2b1
4 changed files with 46 additions and 33 deletions

View file

@ -2936,14 +2936,17 @@ function ShapeEdColWindow::onWake( %this )
%this-->colType.add( "26-DOP" );
%this-->colType.add( "Convex Hulls" );
%this-->fillMode.clear();
%this-->fillMode.add("Flood fill");
%this-->fillMode.add("Surface only");
%this-->fillMode.add("Raycast Fill");
%this-->fillMode.setSelected( %this-->fillMode.findText( "Flood fill" ), false );
}
function ShapeEdColWindow::update_onShapeSelectionChanged( %this )
{
%this.lastColSettings = "" TAB "Bounds";
%this.lastColSettings = "" TAB "Bounds" TAB "Flood fill";
// Initialise collision mesh target list
%this-->colTarget.clear();
@ -2953,8 +2956,6 @@ function ShapeEdColWindow::update_onShapeSelectionChanged( %this )
%this-->colTarget.add( ShapeEditor.shape.getObjectName( %i ) );
%this-->colTarget.setSelected( %this-->colTarget.findText( "Bounds" ), false );
%this-->fillMode.setSelected( %this-->fillMode.findText( "Flood fill" ), false );
}
function ShapeEdColWindow::update_onCollisionChanged( %this )
@ -2968,22 +2969,25 @@ function ShapeEdColWindow::update_onCollisionChanged( %this )
%targetId = %this-->colTarget.findText( getField( %colData, 1 ) );
%this-->colTarget.setSelected( %targetId, false );
%fillModeID = %this-->fillMode.findText( getField( %colData, 2 ) );
%this-->fillMode.setSelected( %fillModeID, false );
if ( %this-->colType.getText() $= "Convex Hulls" )
{
%this-->hullInactive.setVisible( false );
%this-->hullDepth.setValue( getField( %colData, 2 ) );
%this-->hullDepth.setValue( getField( %colData, 3 ) );
%this-->hullDepthText.setText( mFloor( %this-->hullDepth.getValue() ) );
%this-->hullMergeThreshold.setValue( getField( %colData, 3 ) );
%this-->hullMergeThreshold.setValue( getField( %colData, 4 ) );
%this-->hullMergeText.setText( mFloor( %this-->hullMergeThreshold.getValue() ) );
%this-->hullConcaveThreshold.setValue( getField( %colData, 4 ) );
%this-->hullConcaveThreshold.setValue( getField( %colData, 5 ) );
%this-->hullConcaveText.setText( mFloor( %this-->hullConcaveThreshold.getValue() ) );
%this-->hullMaxVerts.setValue( getField( %colData, 5 ) );
%this-->hullMaxVerts.setValue( getField( %colData, 6 ) );
%this-->hullMaxVertsText.setText( mFloor( %this-->hullMaxVerts.getValue() ) );
%this-->hullMaxBoxError.setValue( getField( %colData, 6 ) );
%this-->hullMaxBoxError.setValue( getField( %colData, 7 ) );
%this-->hullMaxBoxErrorText.setText( mFloor( %this-->hullMaxBoxError.getValue() ) );
%this-->hullMaxSphereError.setValue( getField( %colData, 7 ) );
%this-->hullMaxSphereError.setValue( getField( %colData, 8 ) );
%this-->hullMaxSphereErrorText.setText( mFloor( %this-->hullMaxSphereError.getValue() ) );
%this-->hullMaxCapsuleError.setValue( getField( %colData, 8 ) );
%this-->hullMaxCapsuleError.setValue( getField( %colData, 9 ) );
%this-->hullMaxCapsuleErrorText.setText( mFloor( %this-->hullMaxCapsuleError.getValue() ) );
}
else
@ -3013,6 +3017,7 @@ function ShapeEdColWindow::editCollisionOK( %this )
{
%type = %this-->colType.getText();
%target = %this-->colTarget.getText();
%fillMode = %this-->fillMode.getText();
%depth = %this-->hullDepth.getValue();
%merge = %this-->hullMergeThreshold.getValue();
%concavity = %this-->hullConcaveThreshold.getValue();
@ -3021,7 +3026,7 @@ function ShapeEdColWindow::editCollisionOK( %this )
%maxSphere = %this-->hullMaxSphereError.getValue();
%maxCapsule = %this-->hullMaxCapsuleError.getValue();
ShapeEditor.doEditCollision( %type, %target, %depth, %merge, %concavity, %maxVerts,
ShapeEditor.doEditCollision( %type, %target, %fillMode, %depth, %merge, %concavity, %maxVerts,
%maxBox, %maxSphere, %maxCapsule );
}

View file

@ -1046,7 +1046,7 @@ function ActionAddMeshFromFile::undo( %this )
//------------------------------------------------------------------------------
// Add/edit collision geometry
function ShapeEditor::doEditCollision( %this, %type, %target, %depth, %merge, %concavity,
function ShapeEditor::doEditCollision( %this, %type, %target, %fillMode, %depth, %merge, %concavity,
%maxVerts, %boxMax, %sphereMax, %capsuleMax )
{
%colData = ShapeEdColWindow.lastColSettings;
@ -1055,16 +1055,18 @@ function ShapeEditor::doEditCollision( %this, %type, %target, %depth, %merge, %c
%action.oldType = getField( %colData, 0 );
%action.oldTarget = getField( %colData, 1 );
%action.oldDepth = getField( %colData, 2 );
%action.oldMerge = getField( %colData, 3 );
%action.oldConcavity = getField( %colData, 4 );
%action.oldMaxVerts = getField( %colData, 5 );
%action.oldBoxMax = getField( %colData, 6 );
%action.oldSphereMax = getField( %colData, 7 );
%action.oldCapsuleMax = getField( %colData, 8 );
%action.oldFillMode = getField(%colData, 2);
%action.oldDepth = getField( %colData, 3 );
%action.oldMerge = getField( %colData, 4 );
%action.oldConcavity = getField( %colData, 5 );
%action.oldMaxVerts = getField( %colData, 6 );
%action.oldBoxMax = getField( %colData, 7 );
%action.oldSphereMax = getField( %colData, 8 );
%action.oldCapsuleMax = getField( %colData, 9 );
%action.newType = %type;
%action.newTarget = %target;
%action.newFillMode = %fillMode;
%action.newDepth = %depth;
%action.newMerge = %merge;
%action.newConcavity = %concavity;
@ -1076,7 +1078,7 @@ function ShapeEditor::doEditCollision( %this, %type, %target, %depth, %merge, %c
%this.doAction( %action );
}
function ActionEditCollision::updateCollision( %this, %type, %target, %depth, %merge, %concavity,
function ActionEditCollision::updateCollision( %this, %type, %target, %fillMode, %depth, %merge, %concavity,
%maxVerts, %boxMax, %sphereMax, %capsuleMax )
{
%colDetailSize = -1;
@ -1089,7 +1091,7 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %depth, %m
if ( %index != -1 )
%colNode = ShapeEditor.shape.getNodeName( %index );
if(%target $= "Bounds" || %oldTarget $= "Bounds" || %target $= %oldTarget)
if(%target $= %oldTarget)
{
// First remove the old detail and collision nodes
%meshList = ShapeEditor.getDetailMeshList( %colDetailSize );
@ -1114,7 +1116,7 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %depth, %m
if ( %type $= "" )
return;
if ( !ShapeEditor.shape.addCollisionDetail( %colDetailSize, %type, %target,
if ( !ShapeEditor.shape.addCollisionDetail( %colDetailSize, %type, %target, %fillMode,
%depth, %merge, %concavity, %maxVerts,
%boxMax, %sphereMax, %capsuleMax ) )
return false;
@ -1126,7 +1128,7 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %depth, %m
for ( %i = 0; %i < %count; %i++ )
ShapeEdPropWindow.update_onMeshAdded( getField( %meshList, %i ) );
ShapeEdColWindow.lastColSettings = %type TAB %target TAB %depth TAB %merge TAB
ShapeEdColWindow.lastColSettings = %type TAB %target TAB %fillMode TAB %depth TAB %merge TAB
%concavity TAB %maxVerts TAB %boxMax TAB %sphereMax TAB %capsuleMax;
ShapeEdColWindow.update_onCollisionChanged();
@ -1136,7 +1138,7 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %depth, %m
function ActionEditCollision::doit( %this )
{
ShapeEdWaitGui.show( "Generating collision geometry..." );
%success = %this.updateCollision( %this.newType, %this.newTarget, %this.newDepth, %this.newMerge,
%success = %this.updateCollision( %this.newType, %this.newTarget, %this.newFillMode, %this.newDepth, %this.newMerge,
%this.newConcavity, %this.newMaxVerts, %this.newBoxMax,
%this.newSphereMax, %this.newCapsuleMax );
ShapeEdWaitGui.hide();
@ -1149,7 +1151,7 @@ function ActionEditCollision::undo( %this )
Parent::undo( %this );
ShapeEdWaitGui.show( "Generating collision geometry..." );
%this.updateCollision( %this.oldType, %this.oldTarget, %this.oldDepth, %this.oldMerge,
%this.updateCollision( %this.oldType, %this.oldTarget, %this.oldFillMode, %this.oldDepth, %this.oldMerge,
%this.oldConcavity, %this.oldMaxVerts, %this.oldBoxMax,
%this.oldSphereMax, %this.oldCapsuleMax );
ShapeEdWaitGui.hide();