From 2132379b05e5eeae9621f7684e1cab698255e670 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Thu, 16 May 2024 21:21:34 +0100 Subject: [PATCH] backwards compat Changed: addCollisionDetail now has its fill mode at the end for easier backwards compat --- Engine/source/ts/tsMeshFit.cpp | 6 ++--- Engine/source/ts/tsShapeConstruct.h | 2 +- .../scripts/shapeEditor.ed.tscript | 19 +++++++------- .../scripts/shapeEditorActions.ed.tscript | 26 +++++++++---------- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/Engine/source/ts/tsMeshFit.cpp b/Engine/source/ts/tsMeshFit.cpp index 13a08ee04..944a72cc2 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -936,8 +936,8 @@ DefineTSShapeConstructorMethod( addPrimitive, bool, ( const char* meshName, cons return true; }} -DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char* type, const char* target, const char* fillMode, S32 depth, F32 minPercentage, S32 maxHulls, S32 maxVerts, F32 boxMaxError, F32 sphereMaxError, F32 capsuleMaxError ), ( "bounds", "flood fill", 4, 10, 30, 32, 0, 0, 0), - ( size, type, target, fillMode, depth, minPercentage, maxHulls, maxVerts, boxMaxError, sphereMaxError, capsuleMaxError ), false, +DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char* type, const char* target, S32 depth, F32 minPercentage, S32 maxHulls, S32 maxVerts, F32 boxMaxError, F32 sphereMaxError, F32 capsuleMaxError, const char* fillMode), ( "bounds", 4, 10, 30, 32, 0, 0, 0, "flood fill"), + ( size, type, target, depth, minPercentage, maxHulls, maxVerts, boxMaxError, sphereMaxError, capsuleMaxError, fillMode), false, "Autofit a mesh primitive or set of convex hulls to the shape geometry. Hulls " "may optionally be converted to boxes, spheres and/or capsules based on their " "volume.\n" @@ -946,7 +946,6 @@ DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char "26-dop, convex hulls. See the Shape Editor documentation for more details " "about these types.\n" "@param target geometry to fit collision mesh(es) to; either \"bounds\" (for the whole shape), or the name of an object in the shape\n" - "@param fillMode method for filling the voxels in the volume (hulls only)\n" "@param depth maximum split recursion depth (hulls only)\n" "@param minPercentage volume % error threshold (hulls only)\n" "@param maxHulls allowed to be generated (hulls only)\n" @@ -954,6 +953,7 @@ DefineTSShapeConstructorMethod( addCollisionDetail, bool, ( S32 size, const char "@param boxMaxError max % volume difference for a hull to be converted to a box (hulls only)\n" "@param sphereMaxError max % volume difference for a hull to be converted to a sphere (hulls only)\n" "@param capsuleMaxError max % volume difference for a hull to be converted to a capsule (hulls only)\n" + "@param fillMode method for filling the voxels in the volume (hulls only)\n" "@return true if successful, false otherwise\n\n" "@tsexample\n" "%this.addCollisionDetail( -1, \"box\", \"bounds\" );\n" diff --git a/Engine/source/ts/tsShapeConstruct.h b/Engine/source/ts/tsShapeConstruct.h index d9b9e1e01..df04078de 100644 --- a/Engine/source/ts/tsShapeConstruct.h +++ b/Engine/source/ts/tsShapeConstruct.h @@ -317,7 +317,7 @@ public: const char* getImposterSettings(S32 index); S32 addImposter(S32 size, S32 equatorSteps, S32 polarSteps, S32 dl, S32 dim, bool includePoles, F32 polarAngle); bool removeImposter(); - bool addCollisionDetail(S32 size, const char* type, const char* target, const char* fillMode = "flood fill", S32 depth = 4, F32 minPercentage = 10.0f, S32 maxHull = 30, S32 maxVerts = 32, F32 boxMaxError = 0, F32 sphereMaxError = 0, F32 capsuleMaxError = 0); + bool addCollisionDetail(S32 size, const char* type, const char* target, S32 depth = 4, F32 minPercentage = 10.0f, S32 maxHull = 30, S32 maxVerts = 32, F32 boxMaxError = 0, F32 sphereMaxError = 0, F32 capsuleMaxError = 0, const char* fillMode = "flood fill"); ///@} /// @name Sequences diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript index bf3bee27b..a7114117f 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript @@ -2969,26 +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, 3 ) ); + %this-->hullDepth.setValue( getField( %colData, 2 ) ); %this-->hullDepthText.setText( mFloor( %this-->hullDepth.getValue() ) ); - %this-->hullMergeThreshold.setValue( getField( %colData, 4 ) ); + %this-->hullMergeThreshold.setValue( getField( %colData, 3 ) ); %this-->hullMergeText.setText( mFloor( %this-->hullMergeThreshold.getValue() ) ); - %this-->hullConcaveThreshold.setValue( getField( %colData, 5 ) ); + %this-->hullConcaveThreshold.setValue( getField( %colData, 4 ) ); %this-->hullConcaveText.setText( mFloor( %this-->hullConcaveThreshold.getValue() ) ); - %this-->hullMaxVerts.setValue( getField( %colData, 6 ) ); + %this-->hullMaxVerts.setValue( getField( %colData, 5 ) ); %this-->hullMaxVertsText.setText( mFloor( %this-->hullMaxVerts.getValue() ) ); - %this-->hullMaxBoxError.setValue( getField( %colData, 7 ) ); + %this-->hullMaxBoxError.setValue( getField( %colData, 6 ) ); %this-->hullMaxBoxErrorText.setText( mFloor( %this-->hullMaxBoxError.getValue() ) ); - %this-->hullMaxSphereError.setValue( getField( %colData, 8 ) ); + %this-->hullMaxSphereError.setValue( getField( %colData, 7 ) ); %this-->hullMaxSphereErrorText.setText( mFloor( %this-->hullMaxSphereError.getValue() ) ); - %this-->hullMaxCapsuleError.setValue( getField( %colData, 9 ) ); + %this-->hullMaxCapsuleError.setValue( getField( %colData, 8 ) ); %this-->hullMaxCapsuleErrorText.setText( mFloor( %this-->hullMaxCapsuleError.getValue() ) ); + %fillModeID = %this-->fillMode.findText( getField( %colData, 9 ) ); + %this-->fillMode.setSelected( %fillModeID, false ); } else { diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.tscript b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.tscript index 94a06ad95..09168cbca 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.tscript +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditorActions.ed.tscript @@ -1055,18 +1055,17 @@ function ShapeEditor::doEditCollision( %this, %type, %target, %fillMode, %depth, %action.oldType = getField( %colData, 0 ); %action.oldTarget = getField( %colData, 1 ); - %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.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, 9); %action.newType = %type; %action.newTarget = %target; - %action.newFillMode = %fillMode; %action.newDepth = %depth; %action.newMerge = %merge; %action.newConcavity = %concavity; @@ -1074,6 +1073,7 @@ function ShapeEditor::doEditCollision( %this, %type, %target, %fillMode, %depth, %action.newBoxMax = %boxMax; %action.newSphereMax = %sphereMax; %action.newCapsuleMax = %capsuleMax; + %action.newFillMode = %fillMode; %this.doAction( %action ); } @@ -1095,9 +1095,9 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %fillMode, if ( %type $= "" ) return; - if ( !ShapeEditor.shape.addCollisionDetail( %colDetailSize, %type, %target, %fillMode, + if ( !ShapeEditor.shape.addCollisionDetail( %colDetailSize, %type, %target, %depth, %merge, %concavity, %maxVerts, - %boxMax, %sphereMax, %capsuleMax ) ) + %boxMax, %sphereMax, %capsuleMax, %fillMode) ) return false; // Update UI @@ -1107,8 +1107,8 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %fillMode, for ( %i = 0; %i < %count; %i++ ) ShapeEdPropWindow.update_onMeshAdded( getField( %meshList, %i ) ); - ShapeEdColWindow.lastColSettings = %type TAB %target TAB %fillMode TAB %depth TAB %merge TAB - %concavity TAB %maxVerts TAB %boxMax TAB %sphereMax TAB %capsuleMax; + ShapeEdColWindow.lastColSettings = %type TAB %target TAB %depth TAB %merge TAB + %concavity TAB %maxVerts TAB %boxMax TAB %sphereMax TAB %capsuleMax TAB %fillMode ; ShapeEdColWindow.update_onCollisionChanged(); return true;