| 3068 | } |
| 3069 | |
| 3070 | bool TSShapeConstructor::ChangeSet::addCmd_removeMesh(const TSShapeConstructor::ChangeSet::Command& newCmd) |
| 3071 | { |
| 3072 | // Remove any previous command that references the mesh, but stop if the mesh |
| 3073 | // is used as a source for addMesh |
| 3074 | |
| 3075 | String meshName(newCmd.argv[0]); |
| 3076 | for (S32 index = mCommands.size() - 1; index >= 0; index--) |
| 3077 | { |
| 3078 | Command& cmd = mCommands[index]; |
| 3079 | switch (cmd.type) |
| 3080 | { |
| 3081 | case CmdAddMesh: |
| 3082 | if (namesEqual(cmd.argv[0], meshName)) |
| 3083 | { |
| 3084 | mCommands.erase(index); // Remove the added mesh |
| 3085 | return false; |
| 3086 | } |
| 3087 | else if (namesEqual(cmd.argv[2], meshName)) |
| 3088 | { |
| 3089 | // Removed mesh is used as source for another mesh => can't go back |
| 3090 | // any further |
| 3091 | return true; |
| 3092 | } |
| 3093 | break; |
| 3094 | |
| 3095 | case CmdAddPrimitive: |
| 3096 | if (namesEqual(cmd.argv[0], meshName)) |
| 3097 | { |
| 3098 | mCommands.erase(index); // Remove the added primitive |
| 3099 | return false; |
| 3100 | } |
| 3101 | break; |
| 3102 | |
| 3103 | case CmdSetMeshSize: |
| 3104 | case CmdSetMeshType: |
| 3105 | case CmdSetMeshMaterial: |
| 3106 | if (namesEqual(cmd.argv[0], meshName)) |
| 3107 | mCommands.erase(index); // Remove any commands that reference the removed mesh |
| 3108 | break; |
| 3109 | |
| 3110 | default: |
| 3111 | break; |
| 3112 | } |
| 3113 | } |
| 3114 | |
| 3115 | return true; |
| 3116 | } |
| 3117 | |
| 3118 | //----------------------------------------------------------------------------- |
| 3119 | // OBJECT COMMANDS |
nothing calls this directly
no test coverage detected