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

Function createCaps

radiantcore/patch/algorithm/Prefab.cpp:299–329  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299void createCaps(const IPatch& patch, const scene::INodePtr& parent, CapType type, const std::string& shader)
300{
301 if ((type == CapType::EndCap || type == CapType::InvertedEndCap) && patch.getWidth() != 5)
302 {
303 throw cmd::ExecutionFailure(_("Cannot create end-cap, patch must have a width of 5."));
304 }
305
306 if ((type == CapType::Bevel || type == CapType::InvertedBevel) && patch.getWidth() != 3)
307 {
308 throw cmd::ExecutionFailure(_("Cannot create bevel-cap, patch must have a width of 3."));
309 }
310
311 if (type == CapType::Cylinder && patch.getWidth() != 9)
312 {
313 throw cmd::ExecutionFailure(_("Cannot create cylinder-cap, patch must have a width of 9."));
314 }
315
316 assert(parent);
317
318 // We do this once for the front and once for the back patch
319 for (auto front : { true, false })
320 {
321 auto cap = constructCap(patch, type, front, shader);
322
323 if (cap)
324 {
325 parent->addChildNode(cap);
326 Node_setSelected(cap, true);
327 }
328 }
329}
330
331}
332

Callers 1

capPatchFunction · 0.85

Calls 6

ExecutionFailureClass · 0.85
constructCapFunction · 0.85
Node_setSelectedFunction · 0.85
addChildNodeMethod · 0.80
_Function · 0.50
getWidthMethod · 0.45

Tested by

no test coverage detected