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

Function setEntityKeyValue

radiantcore/selection/algorithm/Entity.cpp:35–72  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

33constexpr const char* const DEFAULT_ANGLE = "90"; // north
34
35void setEntityKeyValue(const scene::INodePtr& node, const std::string& key, const std::string& value)
36{
37 Entity* entity = Node_getEntity(node);
38
39 if (entity)
40 {
41 // Check if we have a func_static-style entity
42 std::string name = entity->getKeyValue("name");
43 std::string model = entity->getKeyValue("model");
44 bool isFuncType = (!name.empty() && name == model);
45
46 // Set the actual value
47 entity->setKeyValue(key, value);
48
49 // Check for name key changes of func_statics
50 if (isFuncType && key == "name")
51 {
52 // Adapt the model key along with the name
53 entity->setKeyValue("model", value);
54 }
55 }
56 else if (Node_isPrimitive(node))
57 {
58 // We have a primitve node selected, check its parent
59 scene::INodePtr parent(node->getParent());
60
61 if (!parent) return;
62
63 Entity* parentEnt = Node_getEntity(parent);
64
65 if (parentEnt)
66 {
67 // We have child primitive of an entity selected, the change
68 // should go right into that parent entity
69 parentEnt->setKeyValue(key, value);
70 }
71 }
72}
73
74void setEntityClassname(const std::string& classname)
75{

Callers 1

Calls 14

Node_getEntityFunction · 0.85
Node_isPrimitiveFunction · 0.85
ExecutionFailureClass · 0.85
setEntityClassnameFunction · 0.85
formatFunction · 0.50
_Function · 0.50
getKeyValueMethod · 0.45
emptyMethod · 0.45
setKeyValueMethod · 0.45
getParentMethod · 0.45
getRootMethod · 0.45
getNamespaceMethod · 0.45

Tested by

no test coverage detected