mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 03:33:48 +00:00
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:
parent
25b0c5e2b1
commit
92b10df7eb
4 changed files with 64 additions and 35 deletions
|
|
@ -1111,8 +1111,8 @@ DefineTSShapeConstructorMethod(renameNode, bool, (const char* oldName, const cha
|
|||
return true;
|
||||
}}
|
||||
|
||||
DefineTSShapeConstructorMethod(addNode, bool, (const char* name, const char* parentName, TransformF txfm, bool isWorld), (TransformF::Identity, false),
|
||||
(name, parentName, txfm, isWorld), false,
|
||||
DefineTSShapeConstructorMethod(addNode, bool, (const char* name, const char* parentName, const char* target, TransformF txfm, bool isWorld), (TransformF::Identity, false),
|
||||
(name, parentName, target, txfm, isWorld), false,
|
||||
"Add a new node.\n"
|
||||
"@param name name for the new node (must not already exist)\n"
|
||||
"@param parentName name of an existing node to be the parent of the new node. "
|
||||
|
|
@ -2433,6 +2433,7 @@ void TSShapeConstructor::ChangeSet::add( TSShapeConstructor::ChangeSet::Command&
|
|||
// Detail level commands
|
||||
case CmdRenameDetailLevel: addCommand = addCmd_renameDetailLevel(cmd); break;
|
||||
case CmdRemoveDetailLevel: addCommand = addCmd_removeDetailLevel(cmd); break;
|
||||
case CmdAddCollisionDetail: addCommand = addCmd_addDetailLevel(cmd); break;
|
||||
case CmdSetDetailLevelSize: addCommand = addCmd_setDetailSize(cmd); break;
|
||||
case CmdAddImposter: addCommand = addCmd_addImposter(cmd); break;
|
||||
case CmdRemoveImposter: addCommand = addCmd_removeImposter(cmd); break;
|
||||
|
|
@ -3302,6 +3303,28 @@ bool TSShapeConstructor::ChangeSet::addCmd_renameDetailLevel(const TSShapeConstr
|
|||
return true;
|
||||
}
|
||||
|
||||
bool TSShapeConstructor::ChangeSet::addCmd_addDetailLevel(const TSShapeConstructor::ChangeSet::Command& newCmd)
|
||||
{
|
||||
const char* targ = newCmd.argv[2];
|
||||
for (S32 index = mCommands.size() - 1; index >= 0; index--)
|
||||
{
|
||||
Command& cmd = mCommands[index];
|
||||
switch (cmd.type)
|
||||
{
|
||||
case CmdAddCollisionDetail:
|
||||
if (!dStricmp(targ, cmd.argv[2]))
|
||||
{
|
||||
mCommands.erase(index);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TSShapeConstructor::ChangeSet::addCmd_removeDetailLevel(const TSShapeConstructor::ChangeSet::Command& newCmd)
|
||||
{
|
||||
// Remove any previous command that references the detail, but stop if a mesh
|
||||
|
|
@ -3480,3 +3503,32 @@ void TSShapeConstructor::onActionPerformed()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TSShapeConstructor::cleanTargetNodes(const char* detail, const char* target)
|
||||
{
|
||||
for (S32 index = mChangeSet.mCommands.size() - 1; index >= 0; index--)
|
||||
{
|
||||
ChangeSet::Command& cmd = mChangeSet.mCommands[index];
|
||||
switch (cmd.type)
|
||||
{
|
||||
case ChangeSet::eCommandType::CmdAddNode:
|
||||
// node name starts with col
|
||||
if (dStrStartsWith(cmd.argv[0], "Col"))
|
||||
{
|
||||
// node has the same detail and same target
|
||||
if (!dStricmp(detail, cmd.argv[1]) && !dStricmp(target, cmd.argv[2]))
|
||||
{
|
||||
// now remove it from shape
|
||||
mShape->removeMesh(cmd.argv[0]);
|
||||
mShape->removeNode(cmd.argv[0]);
|
||||
|
||||
// erase the command
|
||||
mChangeSet.mCommands.erase(index);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue