Add SGPropertyNode::setValueReadOnly.
Helper to set value of relative node and mark read only. Use eg. for exposing configuration and build values to the property tree.
This commit is contained in:
@@ -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<typename T>
|
||||
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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user