DEV-555: Ensure 'href' entity property supports relative paths (coordinates and named paths)

This commit is contained in:
Zach Fox 2019-09-10 11:57:02 -07:00
parent 4246d89eac
commit b39e527b5b

View file

@ -1075,16 +1075,13 @@ void EntityItem::setMass(float mass) {
void EntityItem::setHref(QString value) { void EntityItem::setHref(QString value) {
auto href = value.toLower(); auto href = value.toLower();
// Let's let the user set the value of this property to anything, then let consumers of the property
// If the string has something and doesn't start with with "hifi://" it shouldn't be set // decide what to do with it. Currently, the only in-engine consumers are `EntityTreeRenderer::mousePressEvent()`
// We allow the string to be empty, because that's the initial state of this property // and `OtherAvatar::handleChangedAvatarEntityData()` (to remove the href property from others' avatar entities).
if (!value.isEmpty() && //
!(value.toLower().startsWith("hifi://")) && // We want this property to be as flexible as possible. The value of this property _should_ only be values that can
!(value.toLower().startsWith("file://")) // be handled by `AddressManager::handleLookupString()`. That function will return `false` and not do
// TODO: serverless-domains will eventually support http and https also // anything if the value of this property isn't something that function can handle.
) {
return;
}
withWriteLock([&] { withWriteLock([&] {
_href = value; _href = value;
}); });