diff --git a/simgear/props/props.hxx b/simgear/props/props.hxx index 5103e8c0..c78d2102 100644 --- a/simgear/props/props.hxx +++ b/simgear/props/props.hxx @@ -1241,6 +1241,23 @@ public: return setValue(&val[0]); } + /** + * Set relative node to given value and afterwards make read only. + * + * @param relative_path Path to node + * @param value Value to set + * + * @return whether value could be set + */ + template + bool setValueReadOnly(const std::string& relative_path, const T& value) + { + SGPropertyNode* node = getNode(relative_path, true); + bool ret = node->setValue(value); + node->setAttributes(READ); + return ret; + } + /** * Interpolate current value to target value within given time. *