cleanup nodes

ADDED: functionality to clean nodes out of the script that are related to a specific target
ADDED: functionality to clean multiple addCollisionDetails from the script
ADDED: ColConvex get added as nodes now and dont just get skipped (for future reference ColMeshes are checked for colConvex are not but this will be needed in future)

Removed: erroneous deletion of nodes and meshes from shapeEditorActions tscript file.
This commit is contained in:
marauder2k7 2024-05-16 07:04:54 +01:00
parent 25b0c5e2b1
commit 92b10df7eb
4 changed files with 64 additions and 35 deletions

View file

@ -1091,36 +1091,15 @@ function ActionEditCollision::updateCollision( %this, %type, %target, %fillMode,
if ( %index != -1 )
%colNode = ShapeEditor.shape.getNodeName( %index );
if(%target $= %oldTarget)
{
// 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 );
}
}
// Add the new node and geometry
if ( %type $= "" )
return;
if ( !ShapeEditor.shape.addCollisionDetail( %colDetailSize, %type, %target, %fillMode,
%depth, %merge, %concavity, %maxVerts,
%boxMax, %sphereMax, %capsuleMax ) )
return false;
// Update UI
%meshList = ShapeEditor.getDetailMeshList( %colDetailSize );
ShapeEdPropWindow.update_onNodeAdded( %colNode, ShapeEditor.shape.getNodeCount() ); // will also add child nodes