| 198 | } |
| 199 | |
| 200 | void createSimplePatch(const cmd::ArgumentList& args) |
| 201 | { |
| 202 | std::size_t width = 0; |
| 203 | std::size_t height = 0; |
| 204 | bool removeSelectedBrush = false; |
| 205 | |
| 206 | if (args.empty() || args.size() > 3) |
| 207 | { |
| 208 | throw cmd::ExecutionFailure(_("Invalid number of arguments")); |
| 209 | } |
| 210 | if (args.size() == 1) |
| 211 | { |
| 212 | // Try to convert the arguments to actual integers and do the range checks |
| 213 | width = height = checkPatchDimension(args[0].getInt()); |
| 214 | } |
| 215 | else if (args.size() == 2) |
| 216 | { |
| 217 | width = checkPatchDimension(args[0].getInt()); |
| 218 | height = checkPatchDimension(args[1].getInt()); |
| 219 | } |
| 220 | else if (args.size() == 3) |
| 221 | { |
| 222 | width = checkPatchDimension(args[0].getInt()); |
| 223 | height = checkPatchDimension(args[1].getInt()); |
| 224 | removeSelectedBrush = args[2].getBoolean(); |
| 225 | } |
| 226 | |
| 227 | // Only fire the dialog if no or invalid command arguments are given |
| 228 | if (width != 0 && height != 0) |
| 229 | { |
| 230 | UndoableCommand undo("patchCreatePlane"); |
| 231 | |
| 232 | // Retrieve the boundaries before any delete operation |
| 233 | AABB bounds = getDefaultBoundsFromSelection(); |
| 234 | |
| 235 | if (removeSelectedBrush) |
| 236 | { |
| 237 | // Delete the selection, the should be only one brush selected |
| 238 | selection::algorithm::deleteSelection(); |
| 239 | } |
| 240 | |
| 241 | // Call the PatchConstruct routine (GtkRadiant legacy) |
| 242 | constructPrefab(bounds, |
| 243 | getSelectedShader(), |
| 244 | ePlane, GlobalOrthoViewManager().getActiveViewType(), |
| 245 | width, height); |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | scene::INodePtr constructCap(const IPatch& sourcePatch, CapType capType, bool front, const std::string& material) |
| 250 | { |
nothing calls this directly
no test coverage detected