MCPcopy Create free account
hub / github.com/codereader/DarkRadiant / createSimplePatch

Function createSimplePatch

radiantcore/patch/algorithm/Prefab.cpp:200–247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200void 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
249scene::INodePtr constructCap(const IPatch& sourcePatch, CapType capType, bool front, const std::string& material)
250{

Callers

nothing calls this directly

Calls 12

ExecutionFailureClass · 0.85
checkPatchDimensionFunction · 0.85
deleteSelectionFunction · 0.85
constructPrefabFunction · 0.85
getSelectedShaderFunction · 0.85
getIntMethod · 0.80
getBooleanMethod · 0.80
_Function · 0.50
emptyMethod · 0.45
sizeMethod · 0.45
getActiveViewTypeMethod · 0.45

Tested by

no test coverage detected