From 079d1dcbd694bd498d59a226b1ca550123467891 Mon Sep 17 00:00:00 2001 From: SamGondelman Date: Mon, 12 Nov 2018 18:00:28 -0800 Subject: [PATCH] convert clientOnly to entityHost and add local entities --- interface/src/AvatarBookmarks.cpp | 2 +- interface/src/avatar/MyAvatar.cpp | 5 +- .../scripting/WalletScriptingInterface.cpp | 2 +- .../ui/overlays/ContextOverlayInterface.cpp | 4 +- .../src/avatars-renderer/Avatar.cpp | 4 +- .../src/RenderableEntityItem.cpp | 13 +-- .../entities/src/EntityEditPacketSender.cpp | 9 ++- libraries/entities/src/EntityItem.cpp | 17 ++-- libraries/entities/src/EntityItem.h | 18 ++++- .../entities/src/EntityItemProperties.cpp | 79 +++++++++++++------ libraries/entities/src/EntityItemProperties.h | 4 +- .../entities/src/EntityPropertyFlags.cpp | 2 +- libraries/entities/src/EntityPropertyFlags.h | 2 +- .../entities/src/EntityPsuedoPropertyFlags.h | 2 + .../entities/src/EntityScriptingInterface.cpp | 31 +++++--- .../entities/src/EntityScriptingInterface.h | 39 +++++++-- libraries/entities/src/EntityTree.cpp | 12 ++- .../networking/src/udt/PacketHeaders.cpp | 2 +- libraries/networking/src/udt/PacketHeaders.h | 3 +- libraries/physics/src/EntityMotionState.cpp | 10 +-- .../physics/src/PhysicalEntitySimulation.cpp | 4 +- scripts/system/attachedEntitiesManager.js | 2 +- scripts/system/avatarapp.js | 8 +- scripts/system/libraries/WebTablet.js | 3 +- .../system/libraries/entitySelectionTool.js | 2 +- scripts/system/marketplaces/marketplace.js | 2 +- scripts/system/nameTag.js | 4 +- scripts/system/tablet-ui/tabletUI.js | 2 +- 28 files changed, 187 insertions(+), 100 deletions(-) diff --git a/interface/src/AvatarBookmarks.cpp b/interface/src/AvatarBookmarks.cpp index ce21c68c3d..df7620013c 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.setEntityHost(EntityHost::AVATAR_ENTITY); 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 876e64c592..ff6c7e4710 100755 --- a/interface/src/avatar/MyAvatar.cpp +++ b/interface/src/avatar/MyAvatar.cpp @@ -911,8 +911,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); @@ -923,7 +922,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..6ad81f0e2b 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.getEntityHost() == EntityHost::AVATAR_ENTITY) { 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 11c268dd48..f6c213163d 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; _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.getEntityHost() == EntityHost::AVATAR_ENTITY) { 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 f694148b30..fcac61a0bd 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.setEntityHost(EntityHost::AVATAR_ENTITY); 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..9b9d0bb7a9 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 = 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); } else { return render::Item::Status::Value(1.0f, render::Item::Status::Value::RED, - (unsigned char)RenderItemStatusIcon::CLIENT_ONLY); + (unsigned char)RenderItemStatusIcon::ENTITY_HOST); } + } else if (entity->isLocalEntity()) { + return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE, + (unsigned char)RenderItemStatusIcon::ENTITY_HOST); } return render::Item::Status::Value(0.0f, render::Item::Status::Value::GREEN, - (unsigned char)RenderItemStatusIcon::CLIENT_ONLY); + (unsigned char)RenderItemStatusIcon::ENTITY_HOST); }); } diff --git a/libraries/entities/src/EntityEditPacketSender.cpp b/libraries/entities/src/EntityEditPacketSender.cpp index 4aa66db227..0169bb6d9c 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.getEntityHost() == EntityHost::AVATAR_ENTITY) { 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.getEntityHost() == EntityHost::LOCAL_ENTITY) { + // 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..8ffde04b23 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; 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; 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(entityHost, getEntityHost); 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(entityHost, setEntityHost); 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.setEntityHost(getEntityHost()); 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..e119595eb6 100644 --- a/libraries/entities/src/EntityItem.h +++ b/libraries/entities/src/EntityItem.h @@ -64,6 +64,12 @@ const uint64_t MAX_INCOMING_SIMULATION_UPDATE_PERIOD = MAX_OUTGOING_SIMULATION_U class MeshProxyList; +enum class EntityHost { + DOMAIN_ENTITY = 0, + AVATAR_ENTITY, + LOCAL_ENTITY +}; + /// 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 +484,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 _entityHost == EntityHost::DOMAIN_ENTITY; } + bool isAvatarEntity() const { return _entityHost == EntityHost::AVATAR_ENTITY; } + bool isLocalEntity() const { return _entityHost == EntityHost::LOCAL_ENTITY; } + EntityHost getEntityHost() const { return _entityHost; } + virtual void setEntityHost(EntityHost entityHost) { _entityHost = entityHost; } + + // 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 +683,7 @@ protected: QUuid _sourceUUID; /// the server node UUID we came from - bool _clientOnly { false }; + EntityHost _entityHost { EntityHost::DOMAIN_ENTITY }; bool _transitingWithAvatar{ false }; QUuid _owningAvatarID; diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index c243f772e2..ff8da64f60 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::getEntityHostAsString() const { + switch (_entityHost) { + case EntityHost::DOMAIN_ENTITY: + return "domain"; + case EntityHost::AVATAR_ENTITY: + return "avatar"; + case EntityHost::LOCAL_ENTITY: + return "local"; + default: + return ""; + } +} + +void EntityItemProperties::setEntityHostFromString(const QString& entityHost) { + if (entityHost == "domain") { + _entityHost = EntityHost::DOMAIN_ENTITY; + } else if (entityHost == "avatar") { + _entityHost = EntityHost::AVATAR_ENTITY; + } else if (entityHost == "local") { + _entityHost = EntityHost::LOCAL_ENTITY; + } +} + EntityPropertyFlags EntityItemProperties::getChangedProperties() const { EntityPropertyFlags changedProperties; @@ -453,7 +476,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, entityHost); CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID); CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape); @@ -489,12 +512,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 {EntityHost} entityHost="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 entityHost 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 entityHost 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 entityHost 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 @@ -594,7 +623,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. @@ -602,8 +631,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. @@ -628,7 +657,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. @@ -739,7 +768,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 entityHost 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 @@ -1527,8 +1556,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, entityHost, getEntityHostAsString()); // 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); @@ -1567,12 +1596,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, getEntityHost() == EntityHost::AVATAR_ENTITY)); } - if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::OwningAvatarID)) { - properties.setProperty("owningAvatarID", convertScriptValue(engine, getOwningAvatarID())); + if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::AvatarEntity)) { + properties.setProperty("avatarEntity", convertScriptValue(engine, getEntityHost() == EntityHost::AVATAR_ENTITY)); + } + if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::LocalEntity)) { + properties.setProperty("localEntity", convertScriptValue(engine, getEntityHost() == EntityHost::LOCAL_ENTITY)); } // FIXME - I don't think these properties are supported any more @@ -1761,7 +1792,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(entityHost, EntityHost); COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID); COPY_PROPERTY_FROM_QSCRIPTVALUE(dpi, uint16_t, setDPI); @@ -1927,7 +1958,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(entityHost); COPY_PROPERTY_IF_CHANGED(owningAvatarID); COPY_PROPERTY_IF_CHANGED(dpi); @@ -3213,7 +3244,7 @@ void EntityItemProperties::markAllChanged() { _ghostingAllowedChanged = true; _filterURLChanged = true; - _clientOnlyChanged = true; + _entityHostChanged = true; _owningAvatarIDChanged = true; _dpiChanged = true; @@ -3712,8 +3743,8 @@ QList EntityItemProperties::listChangedProperties() { out += "queryAACube"; } - if (clientOnlyChanged()) { - out += "clientOnly"; + if (entityHostChanged()) { + out += "entityHost"; } if (owningAvatarIDChanged()) { out += "owningAvatarID"; @@ -3788,7 +3819,7 @@ bool EntityItemProperties::getScalesWithParent() const { if (success && parent) { bool avatarAncestor = (parent->getNestableType() == NestableType::Avatar || parent->hasAncestorOfType(NestableType::Avatar)); - scalesWithParent = getClientOnly() && avatarAncestor; + scalesWithParent = getEntityHost() == EntityHost::AVATAR_ENTITY && avatarAncestor; } } return scalesWithParent; @@ -3946,7 +3977,7 @@ void EntityItemProperties::convertToCloneProperties(const EntityItemID& entityID setParentJointIndex(-1); setLifetime(getCloneLifetime()); setDynamic(getCloneDynamic()); - setClientOnly(getCloneAvatarEntity()); + setEntityHost(getCloneAvatarEntity() ? EntityHost::AVATAR_ENTITY : EntityHost::DOMAIN_ENTITY); setCreated(usecTimestampNow()); setLastEdited(usecTimestampNow()); setCloneable(ENTITY_ITEM_DEFAULT_CLONEABLE); diff --git a/libraries/entities/src/EntityItemProperties.h b/libraries/entities/src/EntityItemProperties.h index c91ccda5aa..9e666bca1b 100644 --- a/libraries/entities/src/EntityItemProperties.h +++ b/libraries/entities/src/EntityItemProperties.h @@ -279,7 +279,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, EntityHost, entityHost, EntityHost, EntityHost::DOMAIN_ENTITY); 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); @@ -589,7 +589,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, EntityHostAsString, entityHost, ""); 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 c077b153b8..ff95e40fde 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) ? result + "entityHost " : 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 d2f687fbd3..7f1d48acdf 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, // 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 3491688588..969e69f048 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& entityHostString) { PROFILE_RANGE(script_entities, __FUNCTION__); _activityTracking.addedEntityCount++; @@ -479,8 +479,8 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties const auto sessionID = nodeList->getSessionUUID(); EntityItemProperties propertiesWithSimID = properties; - if (clientOnly) { - propertiesWithSimID.setClientOnly(clientOnly); + propertiesWithSimID.setEntityHostFromString(entityHostString); + if (propertiesWithSimID.getEntityHost() == EntityHost::AVATAR_ENTITY) { propertiesWithSimID.setOwningAvatarID(sessionID); } @@ -568,8 +568,11 @@ QUuid EntityScriptingInterface::cloneEntity(QUuid entityIDToClone) { bool cloneAvatarEntity = properties.getCloneAvatarEntity(); properties.convertToCloneProperties(entityIDToClone); - if (cloneAvatarEntity) { - return addEntity(properties, true); + if (properties.getEntityHost() == EntityHost::LOCAL_ENTITY) { + // 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 @@ -681,6 +684,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); } }; @@ -784,7 +791,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; @@ -827,7 +834,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties& } // set these to make EntityItemProperties::getScalesWithParent() work correctly - properties.setClientOnly(entity->getClientOnly()); + properties.setEntityHost(entity->getEntityHost()); properties.setOwningAvatarID(entity->getOwningAvatarID()); // make sure the properties has a type, so that the encode can know which properties to include @@ -952,7 +959,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 // If you actually own the entity but the onwership property is not set because of a domain switch // The lines below makes sure the entity is deleted once its properties are set. @@ -967,11 +974,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); } } @@ -1638,14 +1645,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.setEntityHost(entity->getEntityHost()); properties.setOwningAvatarID(entity->getOwningAvatarID()); } }); diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index df7b0df9a1..78d71ac76b 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} EntityHost + */ + /**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 {EntityHost} [entityHost="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& entityHostString); + + /**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 entityHost = avatarEntity ? "avatar" : "domain"; + return addEntity(properties, entityHost); + } /// 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 16d7e74703..1abdd15314 100644 --- a/libraries/entities/src/EntityTree.cpp +++ b/libraries/entities/src/EntityTree.cpp @@ -541,7 +541,7 @@ EntityItemPointer EntityTree::addEntity(const EntityItemID& entityID, const Enti return nullptr; } - if (!properties.getClientOnly() && getIsClient() && + if (properties.getEntityHost() == EntityHost::DOMAIN_ENTITY && getIsClient() && !nodeList->getThisNodeCanRez() && !nodeList->getThisNodeCanRezTmp() && !nodeList->getThisNodeCanRezCertified() && !nodeList->getThisNodeCanRezTmpCertified() && !_serverlessDomain && !isClone) { return nullptr; @@ -2668,7 +2668,15 @@ bool EntityTree::readFromMap(QVariantMap& map) { entityItemID = EntityItemID(QUuid::createUuid()); } - if (properties.getClientOnly()) { + // Convert old clientOnly bool to new entityHost enum + // (must happen before setOwningAvatarID below) + if (contentVersion < (int)EntityVersion::EntityHosts) { + if (entityMap.contains("clientOnly")) { + properties.setEntityHost(entityMap["clientOnly"].toBool() ? EntityHost::AVATAR_ENTITY : EntityHost::DOMAIN_ENTITY); + } + } + + if (properties.getEntityHost() == EntityHost::AVATAR_ENTITY) { 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 9eed463d2d..62ff742793 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::FixedLightSerialization); + return static_cast(EntityVersion::EntityHosts); 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 37a4b32940..284760ea38 100644 --- a/libraries/networking/src/udt/PacketHeaders.h +++ b/libraries/networking/src/udt/PacketHeaders.h @@ -245,7 +245,8 @@ enum class EntityVersion : PacketVersion { BloomEffect, GrabProperties, ScriptGlmVectors, - FixedLightSerialization + FixedLightSerialization, + EntityHosts }; enum class EntityScriptCallMethodVersion : PacketVersion { diff --git a/libraries/physics/src/EntityMotionState.cpp b/libraries/physics/src/EntityMotionState.cpp index c920665279..aaae31abb1 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.setEntityHost(_entity->getEntityHost()); 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.setEntityHost(entityDescendant->getEntityHost()); 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 a55ed74a86..16a5760358 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 168c81db1f..d1dbd31019 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;