diff --git a/examples/html/entityProperties.html b/examples/html/entityProperties.html
index d9cad0feff..37f2d0085f 100644
--- a/examples/html/entityProperties.html
+++ b/examples/html/entityProperties.html
@@ -360,6 +360,10 @@
var elVoxelVolumeSizeZ = document.getElementById("property-voxel-volume-size-z");
var elVoxelSurfaceStyle = document.getElementById("property-voxel-surface-style");
+ var elHyperlinkHref = document.getElementById("property-hyperlink-href");
+ var elHyperlinkDescription = document.getElementById("property-hyperlink-description");
+
+
if (window.EventBridge !== undefined) {
EventBridge.scriptEventReceived.connect(function(data) {
@@ -467,6 +471,9 @@
elScriptURL.value = properties.script;
elUserData.value = properties.userData;
+ elHyperlinkHref.value = properties.href;
+ elHyperlinkDescription.value = properties.description;
+
for (var i = 0; i < allSections.length; i++) {
for (var j = 0; j < allSections[i].length; j++) {
allSections[i][j].style.display = 'none';
@@ -612,6 +619,8 @@
elLocked.addEventListener('change', createEmitCheckedPropertyUpdateFunction('locked'));
elName.addEventListener('change', createEmitTextPropertyUpdateFunction('name'));
+ elHyperlinkHref.addEventListener('change', createEmitTextPropertyUpdateFunction('href'));
+ elHyperlinkDescription.addEventListener('change', createEmitTextPropertyUpdateFunction('description'));
elVisible.addEventListener('change', createEmitCheckedPropertyUpdateFunction('visible'));
var positionChangeFunction = createEmitVec3PropertyUpdateFunction(
@@ -850,6 +859,9 @@
elVoxelVolumeSizeZ.addEventListener('change', voxelVolumeSizeChangeFunction);
elVoxelSurfaceStyle.addEventListener('change', createEmitTextPropertyUpdateFunction('voxelSurfaceStyle'));
+ var hyperlinkChangeFunction = createEmitGroupTextPropertyUpdateFunction('hyperlink','href');
+ var hyperlinkChangeFunction = createEmitGroupTextPropertyUpdateFunction('hyperlink','description');
+
elMoveSelectionToGrid.addEventListener("click", function() {
EventBridge.emitWebEvent(JSON.stringify({
@@ -937,6 +949,18 @@
+
+
+
Hyperlink
+
Href
+
+
+
+
Description
+
+
+
+
Locked
diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp
index 4a10aad95d..f64dad0ef4 100644
--- a/libraries/entities/src/EntityItem.cpp
+++ b/libraries/entities/src/EntityItem.cpp
@@ -70,7 +70,9 @@ EntityItem::EntityItem(const EntityItemID& entityItemID) :
_dirtyFlags(0),
_element(nullptr),
_physicsInfo(nullptr),
- _simulated(false)
+ _simulated(false),
+ _href(""),
+ _description("")
{
quint64 now = usecTimestampNow();
_lastSimulated = now;
@@ -117,6 +119,8 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
requestedProperties += PROP_MARKETPLACE_ID;
requestedProperties += PROP_NAME;
requestedProperties += PROP_SIMULATOR_ID;
+ requestedProperties += PROP_HREF;
+ requestedProperties += PROP_DESCRIPTION;
return requestedProperties;
}
@@ -246,6 +250,9 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
APPEND_ENTITY_PROPERTY(PROP_MARKETPLACE_ID, getMarketplaceID());
APPEND_ENTITY_PROPERTY(PROP_NAME, getName());
APPEND_ENTITY_PROPERTY(PROP_COLLISION_SOUND_URL, getCollisionSoundURL());
+ APPEND_ENTITY_PROPERTY(PROP_HREF, getHref());
+ APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, getDescription());
+
appendSubclassData(packetData, params, entityTreeElementExtraEncodeData,
requestedProperties,
@@ -573,6 +580,9 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
READ_ENTITY_PROPERTY(PROP_NAME, QString, setName);
READ_ENTITY_PROPERTY(PROP_COLLISION_SOUND_URL, QString, setCollisionSoundURL);
+ READ_ENTITY_PROPERTY(PROP_HREF, QString, setHref);
+ READ_ENTITY_PROPERTY(PROP_DESCRIPTION, QString, setDescription);
+
bytesRead += readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, propertyFlags, overwriteLocalData);
////////////////////////////////////
@@ -905,6 +915,8 @@ EntityItemProperties EntityItem::getProperties() const {
COPY_ENTITY_PROPERTY_TO_PROPERTIES(simulatorID, getSimulatorID);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(marketplaceID, getMarketplaceID);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(name, getName);
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(href, getHref);
+ COPY_ENTITY_PROPERTY_TO_PROPERTIES(description, getDescription);
properties._defaultSettings = false;
@@ -963,6 +975,8 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(userData, setUserData);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(marketplaceID, setMarketplaceID);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(name, setName);
+ SET_ENTITY_PROPERTY_FROM_PROPERTIES(href, setHref);
+ SET_ENTITY_PROPERTY_FROM_PROPERTIES(description, setDescription);
if (somethingChanged) {
uint64_t now = usecTimestampNow();
diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h
index 77a6627853..a145c4c236 100644
--- a/libraries/entities/src/EntityItem.h
+++ b/libraries/entities/src/EntityItem.h
@@ -203,7 +203,14 @@ public:
inline const glm::quat& getRotation() const { return _transform.getRotation(); }
inline void setRotation(const glm::quat& rotation) { _transform.setRotation(rotation); }
-
+
+ // Hyperlink related getters and setters
+ QString getHref() const { return _href; }
+ void setHref(QString value) { _href = value; }
+
+ QString getDescription() const { return _description; }
+ void setDescription(QString value) { _description = value; }
+
/// Dimensions in meters (0.0 - TREE_SCALE)
inline const glm::vec3& getDimensions() const { return _transform.getScale(); }
virtual void setDimensions(const glm::vec3& value);
@@ -415,6 +422,8 @@ protected:
quint64 _simulatorIDChangedTime; // when was _simulatorID last updated?
QString _marketplaceID;
QString _name;
+ QString _href; //Hyperlink href
+ QString _description; //Hyperlink description
// NOTE: Damping is applied like this: v *= pow(1 - damping, dt)
//
diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp
index 90f2b22698..cbb3b1dc31 100644
--- a/libraries/entities/src/EntityItemProperties.cpp
+++ b/libraries/entities/src/EntityItemProperties.cpp
@@ -347,6 +347,9 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
CHECK_PROPERTY_CHANGE(PROP_VOXEL_SURFACE_STYLE, voxelSurfaceStyle);
CHECK_PROPERTY_CHANGE(PROP_LINE_WIDTH, lineWidth);
CHECK_PROPERTY_CHANGE(PROP_LINE_POINTS, linePoints);
+ CHECK_PROPERTY_CHANGE(PROP_HREF, href);
+ CHECK_PROPERTY_CHANGE(PROP_DESCRIPTION, description);
+
changedProperties += _stage.getChangedProperties();
changedProperties += _atmosphere.getChangedProperties();
changedProperties += _skybox.getChangedProperties();
@@ -439,7 +442,9 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
COPY_PROPERTY_TO_QSCRIPTVALUE(voxelSurfaceStyle);
COPY_PROPERTY_TO_QSCRIPTVALUE(lineWidth);
COPY_PROPERTY_TO_QSCRIPTVALUE(linePoints);
-
+ COPY_PROPERTY_TO_QSCRIPTVALUE(href);
+ COPY_PROPERTY_TO_QSCRIPTVALUE(description);
+
// Sitting properties support
if (!skipDefaults) {
QScriptValue sittingPoints = engine->newObject();
@@ -548,6 +553,9 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
COPY_PROPERTY_FROM_QSCRIPTVALUE(voxelSurfaceStyle, uint16_t, setVoxelSurfaceStyle);
COPY_PROPERTY_FROM_QSCRIPTVALUE(lineWidth, float, setLineWidth);
COPY_PROPERTY_FROM_QSCRIPTVALUE(linePoints, qVectorVec3, setLinePoints);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(href, QString, setHref);
+ COPY_PROPERTY_FROM_QSCRIPTVALUE(description, QString, setDescription);
+
if (!honorReadOnly) {
// this is used by the json reader to set things that we don't want javascript to able to affect.
@@ -712,6 +720,8 @@ bool EntityItemProperties::encodeEntityEditPacket(PacketType command, EntityItem
APPEND_ENTITY_PROPERTY(PROP_LOCKED, properties.getLocked());
APPEND_ENTITY_PROPERTY(PROP_USER_DATA, properties.getUserData());
APPEND_ENTITY_PROPERTY(PROP_SIMULATOR_ID, properties.getSimulatorID());
+ APPEND_ENTITY_PROPERTY(PROP_HREF, properties.getHref());
+ APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, properties.getDescription());
if (properties.getType() == EntityTypes::Web) {
APPEND_ENTITY_PROPERTY(PROP_SOURCE_URL, properties.getSourceUrl());
@@ -962,6 +972,8 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_LOCKED, bool, setLocked);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_USER_DATA, QString, setUserData);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SIMULATOR_ID, QUuid, setSimulatorID);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_HREF, QString, setHref);
+ READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DESCRIPTION, QString, setDescription);
if (properties.getType() == EntityTypes::Web) {
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_SOURCE_URL, QString, setSourceUrl);
@@ -1147,6 +1159,9 @@ void EntityItemProperties::markAllChanged() {
_lineWidthChanged = true;
_linePointsChanged = true;
+ _hrefChanged = true;
+ _descriptionChanged = true;
+
}
/// The maximum bounding cube for the entity, independent of it's rotation.
diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h
index 3c8133af8f..068bc98f7e 100644
--- a/libraries/entities/src/EntityItemProperties.h
+++ b/libraries/entities/src/EntityItemProperties.h
@@ -148,6 +148,8 @@ public:
DEFINE_PROPERTY_REF(PROP_SOURCE_URL, SourceUrl, sourceUrl, QString);
DEFINE_PROPERTY(PROP_LINE_WIDTH, LineWidth, lineWidth, float);
DEFINE_PROPERTY_REF(LINE_POINTS, LinePoints, linePoints, QVector);
+ DEFINE_PROPERTY_REF(PROP_HREF, Href, href, QString);
+ DEFINE_PROPERTY_REF(PROP_DESCRIPTION, Description, description, QString);
static QString getBackgroundModeString(BackgroundMode mode);
@@ -295,6 +297,8 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
DEBUG_PROPERTY_IF_CHANGED(debug, properties, VoxelVolumeSize, voxelVolumeSize, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, VoxelData, voxelData, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, VoxelSurfaceStyle, voxelSurfaceStyle, "");
+ DEBUG_PROPERTY_IF_CHANGED(debug, properties, Href, href, "");
+ DEBUG_PROPERTY_IF_CHANGED(debug, properties, Description, description, "");
properties.getStage().debugDump();
properties.getAtmosphere().debugDump();
diff --git a/libraries/entities/src/EntityPropertyFlags.h b/libraries/entities/src/EntityPropertyFlags.h
index 8eb09fece0..f1ebdb8a1f 100644
--- a/libraries/entities/src/EntityPropertyFlags.h
+++ b/libraries/entities/src/EntityPropertyFlags.h
@@ -117,6 +117,10 @@ enum EntityPropertyList {
//for lines
PROP_LINE_WIDTH,
PROP_LINE_POINTS,
+
+ // used by hyperlinks
+ PROP_HREF,
+ PROP_DESCRIPTION,
////////////////////////////////////////////////////////////////////////////////////////////////////
// ATTENTION: add new properties ABOVE this line