| 33 | constexpr const char* const DEFAULT_ANGLE = "90"; // north |
| 34 | |
| 35 | void 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 | |
| 74 | void setEntityClassname(const std::string& classname) |
| 75 | { |
no test coverage detected