diff --git a/interface/src/AvatarBookmarks.cpp b/interface/src/AvatarBookmarks.cpp index 099171a427..ee639f602d 100644 --- a/interface/src/AvatarBookmarks.cpp +++ b/interface/src/AvatarBookmarks.cpp @@ -58,7 +58,7 @@ void addAvatarEntities(const QVariantList& avatarEntities) { EntityItemPropertiesFromScriptValueHonorReadOnly(scriptProperties, entityProperties); entityProperties.setParentID(myNodeID); - entityProperties.setClientOnly(true); + entityProperties.setEntityHostType(entity::HostType::AVATAR); entityProperties.setOwningAvatarID(myNodeID); entityProperties.setSimulationOwner(myNodeID, AVATAR_ENTITY_SIMULATION_PRIORITY); entityProperties.markAllChanged(); diff --git a/interface/src/avatar/MyAvatar.cpp b/interface/src/avatar/MyAvatar.cpp index 21a05576fd..97014550a8 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -887,8 +887,7 @@ void MyAvatar::simulate(float deltaTime) { moveOperator.addEntityToMoveList(entity, newCube); } // send an edit packet to update the entity-server about the queryAABox - // unless it is client-only - if (packetSender && !entity->getClientOnly()) { + if (packetSender && entity->isDomainEntity()) { EntityItemProperties properties = entity->getProperties(); properties.setQueryAACubeDirty(); properties.setLastEdited(now); @@ -899,7 +898,7 @@ void MyAvatar::simulate(float deltaTime) { entity->forEachDescendant([&](SpatiallyNestablePointer descendant) { EntityItemPointer entityDescendant = std::dynamic_pointer_cast(descendant); - if (entityDescendant && !entityDescendant->getClientOnly() && descendant->updateQueryAACube()) { + if (entityDescendant && entityDescendant->isDomainEntity() && descendant->updateQueryAACube()) { EntityItemProperties descendantProperties; descendantProperties.setQueryAACube(descendant->getQueryAACube()); descendantProperties.setLastEdited(now); diff --git a/interface/src/scripting/WalletScriptingInterface.cpp b/interface/src/scripting/WalletScriptingInterface.cpp index 93ee60ba5b..60f850adac 100644 --- a/interface/src/scripting/WalletScriptingInterface.cpp +++ b/interface/src/scripting/WalletScriptingInterface.cpp @@ -35,7 +35,7 @@ void WalletScriptingInterface::proveAvatarEntityOwnershipVerification(const QUui QSharedPointer contextOverlayInterface = DependencyManager::get(); EntityItemProperties entityProperties = DependencyManager::get()->getEntityProperties(entityID, contextOverlayInterface->getEntityPropertyFlags()); - if (entityProperties.getClientOnly()) { + if (entityProperties.getEntityHostType() == entity::HostType::AVATAR) { if (!entityID.isNull() && entityProperties.getCertificateID().length() > 0) { contextOverlayInterface->requestOwnershipVerification(entityID); } else { diff --git a/interface/src/ui/overlays/ContextOverlayInterface.cpp b/interface/src/ui/overlays/ContextOverlayInterface.cpp index e8dc022fd9..aecfdba3b8 100644 --- a/interface/src/ui/overlays/ContextOverlayInterface.cpp +++ b/interface/src/ui/overlays/ContextOverlayInterface.cpp @@ -46,7 +46,7 @@ ContextOverlayInterface::ContextOverlayInterface() { _entityPropertyFlags += PROP_DIMENSIONS; _entityPropertyFlags += PROP_REGISTRATION_POINT; _entityPropertyFlags += PROP_CERTIFICATE_ID; - _entityPropertyFlags += PROP_CLIENT_ONLY; + _entityPropertyFlags += PROP_ENTITY_HOST_TYPE; _entityPropertyFlags += PROP_OWNING_AVATAR_ID; auto entityScriptingInterface = DependencyManager::get().data(); @@ -296,7 +296,7 @@ void ContextOverlayInterface::requestOwnershipVerification(const QUuid& entityID auto nodeList = DependencyManager::get(); if (entityProperties.verifyStaticCertificateProperties()) { - if (entityProperties.getClientOnly()) { + if (entityProperties.getEntityHostType() == entity::HostType::AVATAR) { SharedNodePointer entityServer = nodeList->soloNodeOfType(NodeType::EntityServer); if (entityServer) { diff --git a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp index fceb146470..b4ea9c20f9 100644 --- a/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp +++ b/libraries/avatars-renderer/src/avatars-renderer/Avatar.cpp @@ -310,7 +310,7 @@ void Avatar::updateAvatarEntities() { PerformanceTimer perfTimer("attachments"); // AVATAR ENTITY UPDATE FLOW - // - if queueEditEntityMessage sees clientOnly flag it does _myAvatar->updateAvatarEntity() + // - if queueEditEntityMessage sees avatarEntity flag it does _myAvatar->updateAvatarEntity() // - updateAvatarEntity saves the bytes and flags the trait instance for the entity as updated // - ClientTraitsHandler::sendChangedTraitsToMixer sends the entity bytes to the mixer which relays them to other interfaces // - AvatarHashMap::processBulkAvatarTraits on other interfaces calls avatar->processTraitInstace @@ -389,7 +389,7 @@ void Avatar::updateAvatarEntities() { QScriptValue scriptProperties = variantMapToScriptValue(asMap, scriptEngine); EntityItemProperties properties; EntityItemPropertiesFromScriptValueHonorReadOnly(scriptProperties, properties); - properties.setClientOnly(true); + properties.setEntityHostType(entity::HostType::AVATAR); properties.setOwningAvatarID(getID()); // there's no entity-server to tell us we're the simulation owner, so always set the diff --git a/libraries/entities-renderer/src/RenderableEntityItem.cpp b/libraries/entities-renderer/src/RenderableEntityItem.cpp index aa335bb7d5..75d06191ea 100644 --- a/libraries/entities-renderer/src/RenderableEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableEntityItem.cpp @@ -39,7 +39,7 @@ enum class RenderItemStatusIcon { SIMULATION_OWNER = 3, HAS_ACTIONS = 4, OTHER_SIMULATION_OWNER = 5, - CLIENT_ONLY = 6, + ENTITY_HOST_TYPE = 6, NONE = 255 }; @@ -115,17 +115,20 @@ void EntityRenderer::makeStatusGetters(const EntityItemPointer& entity, Item::St }); statusGetters.push_back([entity, myNodeID] () -> render::Item::Status::Value { - if (entity->getClientOnly()) { + if (entity->isAvatarEntity()) { if (entity->getOwningAvatarID() == myNodeID) { return render::Item::Status::Value(1.0f, render::Item::Status::Value::GREEN, - (unsigned char)RenderItemStatusIcon::CLIENT_ONLY); + (unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE); } else { return render::Item::Status::Value(1.0f, render::Item::Status::Value::RED, - (unsigned char)RenderItemStatusIcon::CLIENT_ONLY); + (unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE); } + } else if (entity->isLocalEntity()) { + return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE, + (unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE); } return render::Item::Status::Value(0.0f, render::Item::Status::Value::GREEN, - (unsigned char)RenderItemStatusIcon::CLIENT_ONLY); + (unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE); }); } diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index 4aa66db227..c414a7a4ac 100644 --- a/libraries/entities/src/EntityEditPacketSender.cpp +++ b/libraries/entities/src/EntityEditPacketSender.cpp @@ -84,16 +84,19 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type, EntityTreePointer entityTree, EntityItemID entityItemID, const EntityItemProperties& properties) { - if (properties.getClientOnly()) { + if (properties.getEntityHostType() == entity::HostType::AVATAR) { if (!_myAvatar) { - qCWarning(entities) << "Suppressing entity edit message: cannot send clientOnly edit with no myAvatar"; + qCWarning(entities) << "Suppressing entity edit message: cannot send avatar entity edit with no myAvatar"; } else if (properties.getOwningAvatarID() == _myAvatar->getID()) { // this is an avatar-based entity --> update our avatar-data rather than sending to the entity-server queueEditAvatarEntityMessage(type, entityTree, entityItemID, properties); } else { - qCWarning(entities) << "Suppressing entity edit message: cannot send clientOnly edit for another avatar"; + qCWarning(entities) << "Suppressing entity edit message: cannot send avatar entity edit for another avatar"; } return; + } else if (properties.getEntityHostType() == entity::HostType::LOCAL) { + // Don't send edits for local entities + return; } if (entityTree && entityTree->isServerlessMode()) { diff --git a/libraries/entities/src/EntityItem.cpp b/libraries/entities/src/EntityItem.cpp index 36ffc68fd3..5855306994 100644 --- a/libraries/entities/src/EntityItem.cpp +++ b/libraries/entities/src/EntityItem.cpp @@ -119,7 +119,7 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param requestedProperties += PROP_PARENT_JOINT_INDEX; requestedProperties += PROP_QUERY_AA_CUBE; - requestedProperties += PROP_CLIENT_ONLY; + requestedProperties += PROP_ENTITY_HOST_TYPE; requestedProperties += PROP_OWNING_AVATAR_ID; requestedProperties += PROP_LAST_EDITED_BY; @@ -172,7 +172,7 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet EntityPropertyFlags propertyFlags(PROP_LAST_ITEM); EntityPropertyFlags requestedProperties = getEntityProperties(params); - requestedProperties -= PROP_CLIENT_ONLY; + requestedProperties -= PROP_ENTITY_HOST_TYPE; requestedProperties -= PROP_OWNING_AVATAR_ID; // If we are being called for a subsequent pass at appendEntityData() that failed to completely encode this item, @@ -1278,10 +1278,7 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire EntityItemProperties properties(propertyFlags); properties._id = getID(); properties._idSet = true; - properties._created = getCreated(); properties._lastEdited = getLastEdited(); - properties.setClientOnly(getClientOnly()); - properties.setOwningAvatarID(getOwningAvatarID()); properties._type = getType(); @@ -1337,7 +1334,7 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire COPY_ENTITY_PROPERTY_TO_PROPERTIES(localPosition, getLocalPosition); COPY_ENTITY_PROPERTY_TO_PROPERTIES(localRotation, getLocalOrientation); - COPY_ENTITY_PROPERTY_TO_PROPERTIES(clientOnly, getClientOnly); + COPY_ENTITY_PROPERTY_TO_PROPERTIES(entityHostType, getEntityHostType); COPY_ENTITY_PROPERTY_TO_PROPERTIES(owningAvatarID, getOwningAvatarID); COPY_ENTITY_PROPERTY_TO_PROPERTIES(lastEditedBy, getLastEditedBy); @@ -1479,7 +1476,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) { SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex); SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube); - SET_ENTITY_PROPERTY_FROM_PROPERTIES(clientOnly, setClientOnly); + SET_ENTITY_PROPERTY_FROM_PROPERTIES(entityHostType, setEntityHostType); SET_ENTITY_PROPERTY_FROM_PROPERTIES(owningAvatarID, setOwningAvatarID); SET_ENTITY_PROPERTY_FROM_PROPERTIES(lastEditedBy, setLastEditedBy); @@ -2496,7 +2493,7 @@ void EntityItem::dimensionsChanged() { bool EntityItem::getScalesWithParent() const { // keep this logic the same as in EntityItemProperties::getScalesWithParent - if (getClientOnly()) { + if (isAvatarEntity()) { QUuid ancestorID = findAncestorOfType(NestableType::Avatar); return !ancestorID.isNull(); } else { @@ -3277,7 +3274,7 @@ void EntityItem::prepareForSimulationOwnershipBid(EntityItemProperties& properti properties.setSimulationOwner(Physics::getSessionUUID(), priority); setPendingOwnershipPriority(priority); - properties.setClientOnly(getClientOnly()); + properties.setEntityHostType(getEntityHostType()); properties.setOwningAvatarID(getOwningAvatarID()); setLastBroadcast(now); // for debug/physics status icons -} +} \ No newline at end of file diff --git a/libraries/entities/src/EntityItem.h b/libraries/entities/src/EntityItem.h index c49017b2e0..8c78dd1cd6 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -64,6 +64,18 @@ const uint64_t MAX_INCOMING_SIMULATION_UPDATE_PERIOD = MAX_OUTGOING_SIMULATION_U class MeshProxyList; +#ifdef DOMAIN +#undef DOMAIN +#endif + +namespace entity { +enum class HostType { + DOMAIN = 0, + AVATAR, + LOCAL +}; +} + /// EntityItem class this is the base class for all entity types. It handles the basic properties and functionality available /// to all other entity types. In particular: postion, size, rotation, age, lifetime, velocity, gravity. You can not instantiate /// one directly, instead you must only construct one of it's derived classes with additional features. @@ -478,9 +490,13 @@ public: void setScriptHasFinishedPreload(bool value); bool isScriptPreloadFinished(); - bool getClientOnly() const { return _clientOnly; } - virtual void setClientOnly(bool clientOnly) { _clientOnly = clientOnly; } - // if this entity is client-only, which avatar is it associated with? + bool isDomainEntity() const { return _hostType == entity::HostType::DOMAIN; } + bool isAvatarEntity() const { return _hostType == entity::HostType::AVATAR; } + bool isLocalEntity() const { return _hostType == entity::HostType::LOCAL; } + entity::HostType getEntityHostType() const { return _hostType; } + virtual void setEntityHostType(entity::HostType hostType) { _hostType = hostType; } + + // if this entity is an avatar entity, which avatar is it associated with? QUuid getOwningAvatarID() const { return _owningAvatarID; } virtual void setOwningAvatarID(const QUuid& owningAvatarID) { _owningAvatarID = owningAvatarID; } @@ -673,7 +689,7 @@ protected: QUuid _sourceUUID; /// the server node UUID we came from - bool _clientOnly { false }; + entity::HostType _hostType { entity::HostType::DOMAIN }; bool _transitingWithAvatar{ false }; QUuid _owningAvatarID; diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 2b7135413d..b6307a83da 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -306,6 +306,29 @@ void EntityItemProperties::setMaterialMappingModeFromString(const QString& mater } } +QString EntityItemProperties::getEntityHostTypeAsString() const { + switch (_entityHostType) { + case entity::HostType::DOMAIN: + return "domain"; + case entity::HostType::AVATAR: + return "avatar"; + case entity::HostType::LOCAL: + return "local"; + default: + return ""; + } +} + +void EntityItemProperties::setEntityHostTypeFromString(const QString& entityHostType) { + if (entityHostType == "domain") { + _entityHostType = entity::HostType::DOMAIN; + } else if (entityHostType == "avatar") { + _entityHostType = entity::HostType::AVATAR; + } else if (entityHostType == "local") { + _entityHostType = entity::HostType::LOCAL; + } +} + EntityPropertyFlags EntityItemProperties::getChangedProperties() const { EntityPropertyFlags changedProperties; @@ -454,7 +477,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { CHECK_PROPERTY_CHANGE(PROP_GHOSTING_ALLOWED, ghostingAllowed); CHECK_PROPERTY_CHANGE(PROP_FILTER_URL, filterURL); - CHECK_PROPERTY_CHANGE(PROP_CLIENT_ONLY, clientOnly); + CHECK_PROPERTY_CHANGE(PROP_ENTITY_HOST_TYPE, entityHostType); CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID); CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape); @@ -490,12 +513,18 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * @property {Entities.EntityType} type - The entity type. You cannot change the type of an entity after it's created. (Though * its value may switch among "Box", "Shape", and "Sphere" depending on changes to * the shape property set for entities of these types.) Read-only. - * @property {boolean} clientOnly=false - If true then the entity is an avatar entity; otherwise it is a server - * entity. An avatar entity follows you to each domain you visit, rendering at the same world coordinates unless it's - * parented to your avatar. Value cannot be changed after the entity is created.
- * The value can also be set at entity creation by using the clientOnly parameter in + * @property {EntityHostType} entityHostType="domain" - How this entity will behave, including if and how it is sent to other people. + * The value can only be set at entity creation by using the entityHostType parameter in * {@link Entities.addEntity}. - * @property {Uuid} owningAvatarID=Uuid.NULL - The session ID of the owning avatar if clientOnly is + * @property {boolean} avatarEntity=false - If true then the entity is an avatar entity; An avatar entity follows you to each domain you visit, + * rendering at the same world coordinates unless it's parented to your avatar. Value cannot be changed after the entity is created.
+ * The value can only be set at entity creation by using the entityHostType parameter in + * {@link Entities.addEntity}. clientOnly is an alias. + * @property {boolean} localEntity=false - If true then the entity is a local entity; Local entities only render for you and are not sent over the wire. + * Value cannot be changed after the entity is created.
+ * The value can only be set at entity creation by using the entityHostType parameter in + * {@link Entities.addEntity}. + * @property {Uuid} owningAvatarID=Uuid.NULL - The session ID of the owning avatar if avatarEntity is * true, otherwise {@link Uuid|Uuid.NULL}. Read-only. * * @property {string} created - The UTC date and time that the entity was created, in ISO 8601 format as @@ -595,7 +624,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * @property {number} parentJointIndex=65535 - The joint of the entity or avatar that this entity is parented to. Use * 65535 or -1 to parent to the entity or avatar's position and orientation rather than a joint. * @property {Vec3} localPosition=0,0,0 - The position of the entity relative to its parent if the entity is parented, - * otherwise the same value as position. If the entity is parented to an avatar and is clientOnly + * otherwise the same value as position. If the entity is parented to an avatar and is an avatarEntity * so that it scales with the avatar, this value remains the original local position value while the avatar scale changes. * @property {Quat} localRotation=0,0,0,1 - The rotation of the entity relative to its parent if the entity is parented, * otherwise the same value as rotation. @@ -603,8 +632,8 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * otherwise the same value as velocity. * @property {Vec3} localAngularVelocity=0,0,0 - The angular velocity of the entity relative to its parent if the entity is * parented, otherwise the same value as position. - * @property {Vec3} localDimensions - The dimensions of the entity. If the entity is parented to an avatar and is - * clientOnly so that it scales with the avatar, this value remains the original dimensions value while the + * @property {Vec3} localDimensions - The dimensions of the entity. If the entity is parented to an avatar and is an + * avatarEntity so that it scales with the avatar, this value remains the original dimensions value while the * avatar scale changes. * * @property {Entities.BoundingBox} boundingBox - The axis-aligned bounding box that tightly encloses the entity. @@ -629,7 +658,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * @property {boolean} cloneDynamic=false - If true then clones created from this entity will have their * dynamic property set to true. * @property {boolean} cloneAvatarEntity=false - If true then clones created from this entity will be created as - * avatar entities: their clientOnly property will be set to true. + * avatar entities: their avatarEntity property will be set to true. * @property {Uuid} cloneOriginID - The ID of the entity that this entity was cloned from. * * @property {Entities.Grab} grab - The grab-related properties. @@ -740,7 +769,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const { * overlay's ID. * To apply a material to an avatar, set the material entity's parentID property to the avatar's session UUID. * To apply a material to your avatar such that it persists across domains and log-ins, create the material as an avatar entity - * by setting the clientOnly parameter in {@link Entities.addEntity} to true. + * by setting the entityHostType parameter in {@link Entities.addEntity} to "avatar". * Material entities render as non-scalable spheres if they don't have their parent set. * @typedef {object} Entities.EntityProperties-Material * @property {string} materialURL="" - URL to a {@link MaterialResource}. If you append ?name to the URL, the @@ -1532,8 +1561,8 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_DIMENSIONS, localDimensions); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLIENT_ONLY, clientOnly); // Gettable but not settable except at entity creation - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID); // Gettable but not settable + COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_ENTITY_HOST_TYPE, entityHostType, getEntityHostTypeAsString()); // Gettable but not settable except at entity creation + COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_OWNING_AVATAR_ID, owningAvatarID); // Gettable but not settable COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONEABLE, cloneable); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_LIFETIME, cloneLifetime); @@ -1572,12 +1601,14 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER_NO_SKIP(renderInfo, renderInfo); // Gettable but not settable } - // FIXME: These properties should already have been set above. if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::ClientOnly)) { - properties.setProperty("clientOnly", convertScriptValue(engine, getClientOnly())); + properties.setProperty("clientOnly", convertScriptValue(engine, getEntityHostType() == entity::HostType::AVATAR)); } - if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::OwningAvatarID)) { - properties.setProperty("owningAvatarID", convertScriptValue(engine, getOwningAvatarID())); + if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::AvatarEntity)) { + properties.setProperty("avatarEntity", convertScriptValue(engine, getEntityHostType() == entity::HostType::AVATAR)); + } + if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::LocalEntity)) { + properties.setProperty("localEntity", convertScriptValue(engine, getEntityHostType() == entity::HostType::LOCAL)); } // FIXME - I don't think these properties are supported any more @@ -1767,7 +1798,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool COPY_PROPERTY_FROM_QSCRIPTVALUE(ghostingAllowed, bool, setGhostingAllowed); COPY_PROPERTY_FROM_QSCRIPTVALUE(filterURL, QString, setFilterURL); - COPY_PROPERTY_FROM_QSCRIPTVALUE(clientOnly, bool, setClientOnly); + COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityHostType, EntityHostType); COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID); COPY_PROPERTY_FROM_QSCRIPTVALUE(dpi, uint16_t, setDPI); @@ -1933,7 +1964,7 @@ void EntityItemProperties::merge(const EntityItemProperties& other) { COPY_PROPERTY_IF_CHANGED(ghostingAllowed); COPY_PROPERTY_IF_CHANGED(filterURL); - COPY_PROPERTY_IF_CHANGED(clientOnly); + COPY_PROPERTY_IF_CHANGED(entityHostType); COPY_PROPERTY_IF_CHANGED(owningAvatarID); COPY_PROPERTY_IF_CHANGED(dpi); @@ -3223,7 +3254,7 @@ void EntityItemProperties::markAllChanged() { _ghostingAllowedChanged = true; _filterURLChanged = true; - _clientOnlyChanged = true; + _entityHostTypeChanged = true; _owningAvatarIDChanged = true; _dpiChanged = true; @@ -3725,8 +3756,8 @@ QList EntityItemProperties::listChangedProperties() { out += "queryAACube"; } - if (clientOnlyChanged()) { - out += "clientOnly"; + if (entityHostTypeChanged()) { + out += "entityHostType"; } if (owningAvatarIDChanged()) { out += "owningAvatarID"; @@ -3801,7 +3832,7 @@ bool EntityItemProperties::getScalesWithParent() const { if (success && parent) { bool avatarAncestor = (parent->getNestableType() == NestableType::Avatar || parent->hasAncestorOfType(NestableType::Avatar)); - scalesWithParent = getClientOnly() && avatarAncestor; + scalesWithParent = getEntityHostType() == entity::HostType::AVATAR && avatarAncestor; } } return scalesWithParent; @@ -3959,7 +3990,13 @@ void EntityItemProperties::convertToCloneProperties(const EntityItemID& entityID setParentJointIndex(-1); setLifetime(getCloneLifetime()); setDynamic(getCloneDynamic()); - setClientOnly(getCloneAvatarEntity()); + if (getEntityHostType() != entity::HostType::LOCAL) { + setEntityHostType(getCloneAvatarEntity() ? entity::HostType::AVATAR : entity::HostType::DOMAIN); + } else { + // Local Entities clone as local entities + setEntityHostType(entity::HostType::LOCAL); + setCollisionless(true); + } setCreated(usecTimestampNow()); setLastEdited(usecTimestampNow()); setCloneable(ENTITY_ITEM_DEFAULT_CLONEABLE); diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index 87fefb5c1b..71dc1606f4 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -280,7 +280,7 @@ public: DEFINE_PROPERTY(PROP_GHOSTING_ALLOWED, GhostingAllowed, ghostingAllowed, bool, ZoneEntityItem::DEFAULT_GHOSTING_ALLOWED); DEFINE_PROPERTY(PROP_FILTER_URL, FilterURL, filterURL, QString, ZoneEntityItem::DEFAULT_FILTER_URL); - DEFINE_PROPERTY(PROP_CLIENT_ONLY, ClientOnly, clientOnly, bool, false); + DEFINE_PROPERTY_REF_ENUM(PROP_ENTITY_HOST_TYPE, EntityHostType, entityHostType, entity::HostType, entity::HostType::DOMAIN); DEFINE_PROPERTY_REF(PROP_OWNING_AVATAR_ID, OwningAvatarID, owningAvatarID, QUuid, UNKNOWN_ENTITY_ID); DEFINE_PROPERTY_REF(PROP_DPI, DPI, dpi, uint16_t, ENTITY_ITEM_DEFAULT_DPI); @@ -590,7 +590,7 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) { DEBUG_PROPERTY_IF_CHANGED(debug, properties, GhostingAllowed, ghostingAllowed, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, FilterURL, filterURL, ""); - DEBUG_PROPERTY_IF_CHANGED(debug, properties, ClientOnly, clientOnly, ""); + DEBUG_PROPERTY_IF_CHANGED(debug, properties, EntityHostTypeAsString, entityHostType, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, OwningAvatarID, owningAvatarID, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, LastEditedBy, lastEditedBy, ""); diff --git a/libraries/entities/src/EntityPropertyFlags.cpp b/libraries/entities/src/EntityPropertyFlags.cpp index 4f3c35ce0a..4977cdc537 100644 --- a/libraries/entities/src/EntityPropertyFlags.cpp +++ b/libraries/entities/src/EntityPropertyFlags.cpp @@ -121,7 +121,7 @@ QDebug& operator<<(QDebug& dbg, const EntityPropertyFlags& f) { result = f.getHasProperty(PROP_FALLOFF_RADIUS) ? result + "falloffRadius " : result; result = f.getHasProperty(PROP_FLYING_ALLOWED) ? result + "flyingAllowed " : result; result = f.getHasProperty(PROP_GHOSTING_ALLOWED) ? result + "ghostingAllowed " : result; - result = f.getHasProperty(PROP_CLIENT_ONLY) ? result + "clientOnly " : result; + result = f.getHasProperty(PROP_ENTITY_HOST_TYPE) ? result + "entityHostType " : result; result = f.getHasProperty(PROP_OWNING_AVATAR_ID) ? result + "owningAvatarID " : result; result = f.getHasProperty(PROP_SHAPE) ? result + "shape " : result; result = f.getHasProperty(PROP_DPI) ? result + "dpi " : result; diff --git a/libraries/entities/src/EntityPropertyFlags.h b/libraries/entities/src/EntityPropertyFlags.h index e6649f74aa..49e5980ffe 100644 --- a/libraries/entities/src/EntityPropertyFlags.h +++ b/libraries/entities/src/EntityPropertyFlags.h @@ -176,7 +176,7 @@ enum EntityPropertyList { PROP_FLYING_ALLOWED, // can avatars in a zone fly? PROP_GHOSTING_ALLOWED, // can avatars in a zone turn off physics? - PROP_CLIENT_ONLY, // doesn't go over wire + PROP_ENTITY_HOST_TYPE, // doesn't go over wire PROP_OWNING_AVATAR_ID, // doesn't go over wire PROP_SHAPE, diff --git a/libraries/entities/src/EntityPsuedoPropertyFlags.h b/libraries/entities/src/EntityPsuedoPropertyFlags.h index 0b051a4c74..26c2a14015 100644 --- a/libraries/entities/src/EntityPsuedoPropertyFlags.h +++ b/libraries/entities/src/EntityPsuedoPropertyFlags.h @@ -32,6 +32,8 @@ namespace EntityPsuedoPropertyFlag { RenderInfo, ClientOnly, OwningAvatarID, + AvatarEntity, + LocalEntity, NumFlags }; diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 5487ae33b0..4a634899c4 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -470,7 +470,7 @@ void synchronizeEditedGrabProperties(EntityItemProperties& properties, const QSt } -QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, bool clientOnly) { +QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, const QString& entityHostTypeString) { PROFILE_RANGE(script_entities, __FUNCTION__); _activityTracking.addedEntityCount++; @@ -479,9 +479,13 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties const auto sessionID = nodeList->getSessionUUID(); EntityItemProperties propertiesWithSimID = properties; - if (clientOnly) { - propertiesWithSimID.setClientOnly(clientOnly); + propertiesWithSimID.setEntityHostTypeFromString(entityHostTypeString); + if (propertiesWithSimID.getEntityHostType() == entity::HostType::AVATAR) { propertiesWithSimID.setOwningAvatarID(sessionID); + } else if (propertiesWithSimID.getEntityHostType() == entity::HostType::LOCAL) { + // For now, local entities are always collisionless + // TODO: create a separate, local physics simulation that just handles local entities (and MyAvatar?) + propertiesWithSimID.setCollisionless(true); } propertiesWithSimID.setLastEditedBy(sessionID); @@ -570,8 +574,11 @@ QUuid EntityScriptingInterface::cloneEntity(QUuid entityIDToClone) { bool cloneAvatarEntity = properties.getCloneAvatarEntity(); properties.convertToCloneProperties(entityIDToClone); - if (cloneAvatarEntity) { - return addEntity(properties, true); + if (properties.getEntityHostType() == entity::HostType::LOCAL) { + // Local entities are only cloned locally + return addEntity(properties, "local"); + } else if (cloneAvatarEntity) { + return addEntity(properties, "avatar"); } else { // setLastEdited timestamp to 0 to ensure this entity gets updated with the properties // from the server-created entity, don't change this unless you know what you are doing @@ -683,6 +690,10 @@ QScriptValue EntityScriptingInterface::getMultipleEntityPropertiesInternal(QScri psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::ClientOnly); } else if (extendedPropertyString == "owningAvatarID") { psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::OwningAvatarID); + } else if (extendedPropertyString == "avatarEntity") { + psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::AvatarEntity); + } else if (extendedPropertyString == "localEntity") { + psuedoPropertyFlags.set(EntityPsuedoPropertyFlag::LocalEntity); } }; @@ -786,7 +797,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& return; } - if (entity->getClientOnly() && entity->getOwningAvatarID() != sessionID) { + if (entity->isAvatarEntity() && entity->getOwningAvatarID() != sessionID) { // don't edit other avatar's avatarEntities properties = EntityItemProperties(); return; @@ -829,7 +840,11 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& } // set these to make EntityItemProperties::getScalesWithParent() work correctly - properties.setClientOnly(entity->getClientOnly()); + entity::HostType entityHostType = entity->getEntityHostType(); + properties.setEntityHostType(entityHostType); + if (entityHostType == entity::HostType::LOCAL) { + properties.setCollisionless(true); + } properties.setOwningAvatarID(entity->getOwningAvatarID()); properties.setActionData(entity->getDynamicData()); @@ -956,7 +971,7 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { auto nodeList = DependencyManager::get(); const QUuid myNodeID = nodeList->getSessionUUID(); - if (entity->getClientOnly() && entity->getOwningAvatarID() != myNodeID) { + if (entity->isAvatarEntity() && entity->getOwningAvatarID() != myNodeID) { // don't delete other avatar's avatarEntities shouldSendDeleteToServer = false; return; @@ -966,11 +981,11 @@ void EntityScriptingInterface::deleteEntity(QUuid id) { shouldSendDeleteToServer = false; } else { // only delete local entities, server entities will round trip through the server filters - if (entity->getClientOnly() || _entityTree->isServerlessMode()) { + if (entity->isAvatarEntity() || _entityTree->isServerlessMode()) { shouldSendDeleteToServer = false; _entityTree->deleteEntity(entityID); - if (entity->getClientOnly() && getEntityPacketSender()->getMyAvatar()) { + if (entity->isAvatarEntity() && getEntityPacketSender()->getMyAvatar()) { getEntityPacketSender()->getMyAvatar()->clearAvatarEntity(entityID, false); } } @@ -1637,14 +1652,14 @@ bool EntityScriptingInterface::actionWorker(const QUuid& entityID, return; } - if (entity->getClientOnly() && entity->getOwningAvatarID() != myNodeID) { + if (entity->isAvatarEntity() && entity->getOwningAvatarID() != myNodeID) { return; } doTransmit = actor(simulation, entity); _entityTree->entityChanged(entity); if (doTransmit) { - properties.setClientOnly(entity->getClientOnly()); + properties.setEntityHostType(entity->getEntityHostType()); properties.setOwningAvatarID(entity->getOwningAvatarID()); } }); diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index df7b0df9a1..ff1149fb06 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -233,13 +233,29 @@ public slots: */ Q_INVOKABLE bool canReplaceContent(); + /**jsdoc + *

How an entity is sent over the wire.

+ * + * + * + * + * + * + * + * + * + *
ValueDescription
domainDomain entities are sent over the entity server to everyone else
avatarAvatar entities are sent over the avatar entity and are associated with one avatar
localLocal entities are not sent over the wire and will only render for you, locally
+ * @typedef {string} EntityHostType + */ + /**jsdoc * Add a new entity with specified properties. * @function Entities.addEntity * @param {Entities.EntityProperties} properties - The properties of the entity to create. - * @param {boolean} [clientOnly=false] - If true, or if clientOnly is set true in - * the properties, the entity is created as an avatar entity; otherwise it is created on the server. An avatar entity + * @param {EntityHostType} [entityHostType="domain"] - If "avatar" the entity is created as an avatar entity. An avatar entity * follows you to each domain you visit, rendering at the same world coordinates unless it's parented to your avatar. + * If "local", the entity is created as a local entity, which will only render for you and isn't sent over the wire. + * Otherwise it is created as a normal entity and sent over the entity server. * @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid|Uuid.NULL}. * @example Create a box entity in front of your avatar. * var entityID = Entities.addEntity({ @@ -250,7 +266,19 @@ public slots: * }); * print("Entity created: " + entityID); */ - Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties, bool clientOnly = false); + Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties, const QString& entityHostTypeString); + + /**jsdoc + * Add a new entity with specified properties. + * @function Entities.addEntity + * @param {Entities.EntityProperties} properties - The properties of the entity to create. + * @param {boolean} [avatarEntity=false] - Whether to create an avatar entity or a domain entity + * @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid|Uuid.NULL}. + */ + Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties, bool avatarEntity = false) { + QString entityHostType = avatarEntity ? "avatar" : "domain"; + return addEntity(properties, entityHostType); + } /// temporary method until addEntity can be used from QJSEngine /// Deliberately not adding jsdoc, only used internally. @@ -896,8 +924,7 @@ public slots: Q_INVOKABLE bool appendPoint(QUuid entityID, const glm::vec3& point); /**jsdoc - * Dumps debug information about all entities in Interface's local in-memory tree of entities it knows about — domain - * and client-only — to the program log. + * Dumps debug information about all entities in Interface's local in-memory tree of entities it knows about to the program log. * @function Entities.dumpTree */ Q_INVOKABLE void dumpTree() const; @@ -1870,7 +1897,7 @@ signals: /**jsdoc * Triggered when an entity is added to Interface's local in-memory tree of entities it knows about. This may occur when * entities are loaded upon visiting a domain, when the user rotates their view so that more entities become visible, and - * when a domain or client-only entity is added (e.g., by {@Entities.addEntity|addEntity}). + * when any type of entity is added (e.g., by {@Entities.addEntity|addEntity}). * @function Entities.addingEntity * @param {Uuid} entityID - The ID of the entity added. * @returns {Signal} diff --git a/libraries/entities/src/EntityTree.cpp b/libraries/entities/src/EntityTree.cpp index fee8d72fe7..b23be66ade 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -542,7 +542,7 @@ EntityItemPointer EntityTree::addEntity(const EntityItemID& entityID, const Enti return nullptr; } - if (!properties.getClientOnly() && getIsClient() && + if (properties.getEntityHostType() == entity::HostType::DOMAIN && getIsClient() && !nodeList->getThisNodeCanRez() && !nodeList->getThisNodeCanRezTmp() && !nodeList->getThisNodeCanRezCertified() && !nodeList->getThisNodeCanRezTmpCertified() && !_serverlessDomain && !isClone) { return nullptr; @@ -2669,7 +2669,15 @@ bool EntityTree::readFromMap(QVariantMap& map) { entityItemID = EntityItemID(QUuid::createUuid()); } - if (properties.getClientOnly()) { + // Convert old clientOnly bool to new entityHostType enum + // (must happen before setOwningAvatarID below) + if (contentVersion < (int)EntityVersion::EntityHostTypes) { + if (entityMap.contains("clientOnly")) { + properties.setEntityHostType(entityMap["clientOnly"].toBool() ? entity::HostType::AVATAR : entity::HostType::DOMAIN); + } + } + + if (properties.getEntityHostType() == entity::HostType::AVATAR) { auto nodeList = DependencyManager::get(); const QUuid myNodeID = nodeList->getSessionUUID(); properties.setOwningAvatarID(myNodeID); diff --git a/libraries/networking/src/udt/PacketHeaders.cpp b/libraries/networking/src/udt/PacketHeaders.cpp index cab3ba3211..fad38d565b 100644 --- a/libraries/networking/src/udt/PacketHeaders.cpp +++ b/libraries/networking/src/udt/PacketHeaders.cpp @@ -33,7 +33,7 @@ PacketVersion versionForPacketType(PacketType packetType) { case PacketType::EntityEdit: case PacketType::EntityData: case PacketType::EntityPhysics: - return static_cast(EntityVersion::MaterialRepeat); + return static_cast(EntityVersion::EntityHostTypes); case PacketType::EntityQuery: return static_cast(EntityQueryPacketVersion::ConicalFrustums); case PacketType::AvatarIdentity: diff --git a/libraries/networking/src/udt/PacketHeaders.h b/libraries/networking/src/udt/PacketHeaders.h index 4c61bdfec9..b46eb3e9e4 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -245,7 +245,8 @@ enum class EntityVersion : PacketVersion { GrabProperties, ScriptGlmVectors, FixedLightSerialization, - MaterialRepeat + MaterialRepeat, + EntityHostTypes }; enum class EntityScriptCallMethodVersion : PacketVersion { diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index c920665279..4b635ef0be 100644 --- a/libraries/physics/src/EntityMotionState.cpp +++ b/libraries/physics/src/EntityMotionState.cpp @@ -80,8 +80,8 @@ EntityMotionState::EntityMotionState(btCollisionShape* shape, EntityItemPointer // rather than pass the legit shape pointer to the ObjectMotionState ctor above. setShape(shape); - if (_entity->getClientOnly() && _entity->getOwningAvatarID() != Physics::getSessionUUID()) { - // client-only entities are always thus, so we cache this fact in _ownershipState + if (_entity->isAvatarEntity() && _entity->getOwningAvatarID() != Physics::getSessionUUID()) { + // avatar entities entities are always thus, so we cache this fact in _ownershipState _ownershipState = EntityMotionState::OwnershipState::Unownable; } @@ -430,7 +430,7 @@ bool EntityMotionState::shouldSendUpdate(uint32_t simulationStep) { assert(entityTreeIsLocked()); // this case is prevented by setting _ownershipState to UNOWNABLE in EntityMotionState::ctor - assert(!(_entity->getClientOnly() && _entity->getOwningAvatarID() != Physics::getSessionUUID())); + assert(!(_entity->isAvatarEntity() && _entity->getOwningAvatarID() != Physics::getSessionUUID())); if (_entity->getTransitingWithAvatar()) { return false; @@ -595,7 +595,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ EntityTreeElementPointer element = _entity->getElement(); EntityTreePointer tree = element ? element->getTree() : nullptr; - properties.setClientOnly(_entity->getClientOnly()); + properties.setEntityHostType(_entity->getEntityHostType()); properties.setOwningAvatarID(_entity->getOwningAvatarID()); entityPacketSender->queueEditEntityMessage(PacketType::EntityPhysics, tree, id, properties); @@ -610,7 +610,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_ EntityItemProperties newQueryCubeProperties; newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube()); newQueryCubeProperties.setLastEdited(properties.getLastEdited()); - newQueryCubeProperties.setClientOnly(entityDescendant->getClientOnly()); + newQueryCubeProperties.setEntityHostType(entityDescendant->getEntityHostType()); newQueryCubeProperties.setOwningAvatarID(entityDescendant->getOwningAvatarID()); entityPacketSender->queueEditEntityMessage(PacketType::EntityPhysics, tree, diff --git a/libraries/physics/src/PhysicalEntitySimulation.cpp b/libraries/physics/src/PhysicalEntitySimulation.cpp index ab8bfb8290..8e5248f6a9 100644 --- a/libraries/physics/src/PhysicalEntitySimulation.cpp +++ b/libraries/physics/src/PhysicalEntitySimulation.cpp @@ -79,7 +79,7 @@ void PhysicalEntitySimulation::removeEntityInternal(EntityItemPointer entity) { _deadEntities.insert(entity); } } - if (entity->getClientOnly()) { + if (entity->isAvatarEntity()) { _deadAvatarEntities.insert(entity); } } @@ -339,7 +339,7 @@ void PhysicalEntitySimulation::handleDeactivatedMotionStates(const VectorOfMotio EntityItemPointer entity = entityState->getEntity(); _entitiesToSort.insert(entity); if (!serverlessMode) { - if (entity->getClientOnly()) { + if (entity->isAvatarEntity()) { switch (entityState->getOwnershipState()) { case EntityMotionState::OwnershipState::PendingBid: _bids.removeFirst(entityState); diff --git a/scripts/system/attachedEntitiesManager.js b/scripts/system/attachedEntitiesManager.js index c0144e772f..061e27f595 100644 --- a/scripts/system/attachedEntitiesManager.js +++ b/scripts/system/attachedEntitiesManager.js @@ -186,7 +186,7 @@ function AttachedEntitiesManager() { delete wearProps.actionData; delete wearProps.sittingPoints; delete wearProps.boundingBox; - delete wearProps.clientOnly; + delete wearProps.avatarEntity; delete wearProps.owningAvatarID; delete wearProps.localPosition; delete wearProps.localRotation; diff --git a/scripts/system/avatarapp.js b/scripts/system/avatarapp.js index 396e1e3824..81a6447aae 100644 --- a/scripts/system/avatarapp.js +++ b/scripts/system/avatarapp.js @@ -328,8 +328,8 @@ function isGrabbable(entityID) { return false; } - var properties = Entities.getEntityProperties(entityID, ['clientOnly', 'grab.grabbable']); - if (properties.clientOnly) { + var properties = Entities.getEntityProperties(entityID, ['avatarEntity', 'grab.grabbable']); + if (properties.avatarEntity) { return properties.grab.grabbable; } @@ -337,8 +337,8 @@ function isGrabbable(entityID) { } function setGrabbable(entityID, grabbable) { - var properties = Entities.getEntityProperties(entityID, ['clientOnly']); - if (properties.clientOnly) { + var properties = Entities.getEntityProperties(entityID, ['avatarEntity']); + if (properties.avatarEntity) { Entities.editEntity(entityID, { grab: { grabbable: grabbable }}); } } diff --git a/scripts/system/libraries/WebTablet.js b/scripts/system/libraries/WebTablet.js index 8e5b41deda..f29edd8ff9 100644 --- a/scripts/system/libraries/WebTablet.js +++ b/scripts/system/libraries/WebTablet.js @@ -97,9 +97,8 @@ cleanUpOldMaterialEntities = function() { * @param width [number] width in meters of the tablet model * @param dpi [number] dpi of web surface used to show the content. * @param hand [number] -1 indicates no hand, Controller.Standard.RightHand or Controller.Standard.LeftHand - * @param clientOnly [bool] true indicates tablet model is only visible to client. */ -WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) { +WebTablet = function (url, width, dpi, hand, location, visible) { var _this = this; diff --git a/scripts/system/libraries/entitySelectionTool.js b/scripts/system/libraries/entitySelectionTool.js index e10678a611..1f0bc9404c 100644 --- a/scripts/system/libraries/entitySelectionTool.js +++ b/scripts/system/libraries/entitySelectionTool.js @@ -264,7 +264,7 @@ SelectionManager = (function() { if (properties === undefined) { properties = Entities.getEntityProperties(originalEntityID); } - if (!properties.locked && (!properties.clientOnly || properties.owningAvatarID === MyAvatar.sessionUUID)) { + if (!properties.locked && (!properties.avatarEntity || properties.owningAvatarID === MyAvatar.sessionUUID)) { if (nonDynamicEntityIsBeingGrabbedByAvatar(properties)) { properties.parentID = null; properties.parentJointIndex = null; diff --git a/scripts/system/marketplaces/marketplace.js b/scripts/system/marketplaces/marketplace.js index d90695c767..d3e5c96739 100644 --- a/scripts/system/marketplaces/marketplace.js +++ b/scripts/system/marketplaces/marketplace.js @@ -30,7 +30,7 @@ var TOOLBAR_MARGIN_Y = 0; var marketplaceVisible = false; var marketplaceWebTablet; -// We persist clientOnly data in the .ini file, and reconsistitute it on restart. +// We persist avatarEntity data in the .ini file, and reconsistitute it on restart. // To keep things consistent, we pickle the tablet data in Settings, and kill any existing such on restart and domain change. var persistenceKey = "io.highfidelity.lastDomainTablet"; diff --git a/scripts/system/nameTag.js b/scripts/system/nameTag.js index 69e5dac1bf..147da25779 100644 --- a/scripts/system/nameTag.js +++ b/scripts/system/nameTag.js @@ -12,7 +12,7 @@ // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -const CLIENTONLY = false; +const AVATARENTITY = false; const ENTITY_CHECK_INTERVAL = 5000; // ms = 5 seconds const STARTUP_DELAY = 2000; // ms = 2 second const OLD_AGE = 3500; // we recreate the entity if older than this time in seconds @@ -43,7 +43,7 @@ function addNameTag() { dimensions: dimensionsFromName(), position: nameTagPosition } - nameTagEntityID = Entities.addEntity(nameTagProperties, CLIENTONLY); + nameTagEntityID = Entities.addEntity(nameTagProperties, AVATARENTITY); } function updateNameTag() { diff --git a/scripts/system/tablet-ui/tabletUI.js b/scripts/system/tablet-ui/tabletUI.js index 9a22014895..f9e9165f2e 100644 --- a/scripts/system/tablet-ui/tabletUI.js +++ b/scripts/system/tablet-ui/tabletUI.js @@ -108,7 +108,7 @@ tabletScalePercentage = getTabletScalePercentageFromSettings(); UIWebTablet = new WebTablet("hifi/tablet/TabletRoot.qml", DEFAULT_WIDTH * (tabletScalePercentage / 100), - null, activeHand, true, null, false); + null, activeHand, null, false); UIWebTablet.register(); HMD.tabletID = UIWebTablet.tabletEntityID; HMD.homeButtonID = UIWebTablet.homeButtonID;