MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / addCmd_setMeshSize

Method addCmd_setMeshSize

Engine/source/ts/tsShapeConstruct.cpp:2967–3006  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2965// MESH COMMANDS
2966
2967bool TSShapeConstructor::ChangeSet::addCmd_setMeshSize(const TSShapeConstructor::ChangeSet::Command& newCmd)
2968{
2969 // Replace size argument for previous addMesh or setMeshSize, but stop if the
2970 // new name is already in use (can occur if 2 nodes switch names). eg.
2971 // A->C
2972 // B->A
2973 // C->B (cannot replace the previous A->C with A->B as 'B' is in use)
2974
2975 for (S32 index = mCommands.size() - 1; index >= 0; index--)
2976 {
2977 Command& cmd = mCommands[index];
2978 switch (cmd.type)
2979 {
2980 case CmdAddMesh:
2981 if (namesEqual(cmd.argv[0], newCmd.argv[0]))
2982 {
2983 cmd.argv[0] = newCmd.argv[1]; // Replace initial size argument
2984 return false;
2985 }
2986 break;
2987
2988 case CmdSetMeshSize:
2989 if (cmd.argv[1] == newCmd.argv[0])
2990 {
2991 cmd.argv[1] = newCmd.argv[1]; // Collapse successive size sets
2992 if (cmd.argv[0] == cmd.argv[1])
2993 mCommands.erase(index); // Ignore empty resizes
2994 return false;
2995 }
2996 else if (cmd.argv[0] == newCmd.argv[1])
2997 return true; // Size is in use, cannot go back further
2998 break;
2999
3000 default:
3001 break;
3002 }
3003 }
3004
3005 return true;
3006}
3007
3008bool TSShapeConstructor::ChangeSet::addCmd_setMeshType(const TSShapeConstructor::ChangeSet::Command& newCmd)
3009{

Callers

nothing calls this directly

Calls 3

namesEqualFunction · 0.85
sizeMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected