This commit is contained in:
SamGondelman 2018-11-26 01:15:07 -05:00
parent 8dbb2d806b
commit e282d51883
18 changed files with 92 additions and 86 deletions

View file

@ -58,7 +58,7 @@ void addAvatarEntities(const QVariantList& avatarEntities) {
EntityItemPropertiesFromScriptValueHonorReadOnly(scriptProperties, entityProperties); EntityItemPropertiesFromScriptValueHonorReadOnly(scriptProperties, entityProperties);
entityProperties.setParentID(myNodeID); entityProperties.setParentID(myNodeID);
entityProperties.setEntityHost(EntityHost::AVATAR_ENTITY); entityProperties.setEntityHostType(entity::HostType::AVATAR);
entityProperties.setOwningAvatarID(myNodeID); entityProperties.setOwningAvatarID(myNodeID);
entityProperties.setSimulationOwner(myNodeID, AVATAR_ENTITY_SIMULATION_PRIORITY); entityProperties.setSimulationOwner(myNodeID, AVATAR_ENTITY_SIMULATION_PRIORITY);
entityProperties.markAllChanged(); entityProperties.markAllChanged();

View file

@ -35,7 +35,7 @@ void WalletScriptingInterface::proveAvatarEntityOwnershipVerification(const QUui
QSharedPointer<ContextOverlayInterface> contextOverlayInterface = DependencyManager::get<ContextOverlayInterface>(); QSharedPointer<ContextOverlayInterface> contextOverlayInterface = DependencyManager::get<ContextOverlayInterface>();
EntityItemProperties entityProperties = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(entityID, EntityItemProperties entityProperties = DependencyManager::get<EntityScriptingInterface>()->getEntityProperties(entityID,
contextOverlayInterface->getEntityPropertyFlags()); contextOverlayInterface->getEntityPropertyFlags());
if (entityProperties.getEntityHost() == EntityHost::AVATAR_ENTITY) { if (entityProperties.getEntityHostType() == entity::HostType::AVATAR) {
if (!entityID.isNull() && entityProperties.getCertificateID().length() > 0) { if (!entityID.isNull() && entityProperties.getCertificateID().length() > 0) {
contextOverlayInterface->requestOwnershipVerification(entityID); contextOverlayInterface->requestOwnershipVerification(entityID);
} else { } else {

View file

@ -46,7 +46,7 @@ ContextOverlayInterface::ContextOverlayInterface() {
_entityPropertyFlags += PROP_DIMENSIONS; _entityPropertyFlags += PROP_DIMENSIONS;
_entityPropertyFlags += PROP_REGISTRATION_POINT; _entityPropertyFlags += PROP_REGISTRATION_POINT;
_entityPropertyFlags += PROP_CERTIFICATE_ID; _entityPropertyFlags += PROP_CERTIFICATE_ID;
_entityPropertyFlags += PROP_ENTITY_HOST; _entityPropertyFlags += PROP_ENTITY_HOST_TYPE;
_entityPropertyFlags += PROP_OWNING_AVATAR_ID; _entityPropertyFlags += PROP_OWNING_AVATAR_ID;
auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>().data(); auto entityScriptingInterface = DependencyManager::get<EntityScriptingInterface>().data();
@ -296,7 +296,7 @@ void ContextOverlayInterface::requestOwnershipVerification(const QUuid& entityID
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
if (entityProperties.verifyStaticCertificateProperties()) { if (entityProperties.verifyStaticCertificateProperties()) {
if (entityProperties.getEntityHost() == EntityHost::AVATAR_ENTITY) { if (entityProperties.getEntityHostType() == entity::HostType::AVATAR) {
SharedNodePointer entityServer = nodeList->soloNodeOfType(NodeType::EntityServer); SharedNodePointer entityServer = nodeList->soloNodeOfType(NodeType::EntityServer);
if (entityServer) { if (entityServer) {

View file

@ -389,7 +389,7 @@ void Avatar::updateAvatarEntities() {
QScriptValue scriptProperties = variantMapToScriptValue(asMap, scriptEngine); QScriptValue scriptProperties = variantMapToScriptValue(asMap, scriptEngine);
EntityItemProperties properties; EntityItemProperties properties;
EntityItemPropertiesFromScriptValueHonorReadOnly(scriptProperties, properties); EntityItemPropertiesFromScriptValueHonorReadOnly(scriptProperties, properties);
properties.setEntityHost(EntityHost::AVATAR_ENTITY); properties.setEntityHostType(entity::HostType::AVATAR);
properties.setOwningAvatarID(getID()); properties.setOwningAvatarID(getID());
// there's no entity-server to tell us we're the simulation owner, so always set the // there's no entity-server to tell us we're the simulation owner, so always set the

View file

@ -39,7 +39,7 @@ enum class RenderItemStatusIcon {
SIMULATION_OWNER = 3, SIMULATION_OWNER = 3,
HAS_ACTIONS = 4, HAS_ACTIONS = 4,
OTHER_SIMULATION_OWNER = 5, OTHER_SIMULATION_OWNER = 5,
ENTITY_HOST = 6, ENTITY_HOST_TYPE = 6,
NONE = 255 NONE = 255
}; };
@ -118,17 +118,17 @@ void EntityRenderer::makeStatusGetters(const EntityItemPointer& entity, Item::St
if (entity->isAvatarEntity()) { if (entity->isAvatarEntity()) {
if (entity->getOwningAvatarID() == myNodeID) { if (entity->getOwningAvatarID() == myNodeID) {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::GREEN, return render::Item::Status::Value(1.0f, render::Item::Status::Value::GREEN,
(unsigned char)RenderItemStatusIcon::ENTITY_HOST); (unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE);
} else { } else {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::RED, return render::Item::Status::Value(1.0f, render::Item::Status::Value::RED,
(unsigned char)RenderItemStatusIcon::ENTITY_HOST); (unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE);
} }
} else if (entity->isLocalEntity()) { } else if (entity->isLocalEntity()) {
return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE, return render::Item::Status::Value(1.0f, render::Item::Status::Value::BLUE,
(unsigned char)RenderItemStatusIcon::ENTITY_HOST); (unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE);
} }
return render::Item::Status::Value(0.0f, render::Item::Status::Value::GREEN, return render::Item::Status::Value(0.0f, render::Item::Status::Value::GREEN,
(unsigned char)RenderItemStatusIcon::ENTITY_HOST); (unsigned char)RenderItemStatusIcon::ENTITY_HOST_TYPE);
}); });
} }

View file

@ -84,7 +84,7 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type,
EntityTreePointer entityTree, EntityTreePointer entityTree,
EntityItemID entityItemID, EntityItemID entityItemID,
const EntityItemProperties& properties) { const EntityItemProperties& properties) {
if (properties.getEntityHost() == EntityHost::AVATAR_ENTITY) { if (properties.getEntityHostType() == entity::HostType::AVATAR) {
if (!_myAvatar) { if (!_myAvatar) {
qCWarning(entities) << "Suppressing entity edit message: cannot send avatar entity edit with no myAvatar"; qCWarning(entities) << "Suppressing entity edit message: cannot send avatar entity edit with no myAvatar";
} else if (properties.getOwningAvatarID() == _myAvatar->getID()) { } else if (properties.getOwningAvatarID() == _myAvatar->getID()) {
@ -94,7 +94,7 @@ void EntityEditPacketSender::queueEditEntityMessage(PacketType type,
qCWarning(entities) << "Suppressing entity edit message: cannot send avatar entity edit for another avatar"; qCWarning(entities) << "Suppressing entity edit message: cannot send avatar entity edit for another avatar";
} }
return; return;
} else if (properties.getEntityHost() == EntityHost::LOCAL_ENTITY) { } else if (properties.getEntityHostType() == entity::HostType::LOCAL) {
// Don't send edits for local entities // Don't send edits for local entities
return; return;
} }

View file

@ -119,7 +119,7 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
requestedProperties += PROP_PARENT_JOINT_INDEX; requestedProperties += PROP_PARENT_JOINT_INDEX;
requestedProperties += PROP_QUERY_AA_CUBE; requestedProperties += PROP_QUERY_AA_CUBE;
requestedProperties += PROP_ENTITY_HOST; requestedProperties += PROP_ENTITY_HOST_TYPE;
requestedProperties += PROP_OWNING_AVATAR_ID; requestedProperties += PROP_OWNING_AVATAR_ID;
requestedProperties += PROP_LAST_EDITED_BY; requestedProperties += PROP_LAST_EDITED_BY;
@ -172,7 +172,7 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
EntityPropertyFlags propertyFlags(PROP_LAST_ITEM); EntityPropertyFlags propertyFlags(PROP_LAST_ITEM);
EntityPropertyFlags requestedProperties = getEntityProperties(params); EntityPropertyFlags requestedProperties = getEntityProperties(params);
requestedProperties -= PROP_ENTITY_HOST; requestedProperties -= PROP_ENTITY_HOST_TYPE;
requestedProperties -= PROP_OWNING_AVATAR_ID; requestedProperties -= PROP_OWNING_AVATAR_ID;
// If we are being called for a subsequent pass at appendEntityData() that failed to completely encode this item, // If we are being called for a subsequent pass at appendEntityData() that failed to completely encode this item,
@ -1334,7 +1334,7 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire
COPY_ENTITY_PROPERTY_TO_PROPERTIES(localPosition, getLocalPosition); COPY_ENTITY_PROPERTY_TO_PROPERTIES(localPosition, getLocalPosition);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(localRotation, getLocalOrientation); COPY_ENTITY_PROPERTY_TO_PROPERTIES(localRotation, getLocalOrientation);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(entityHost, getEntityHost); COPY_ENTITY_PROPERTY_TO_PROPERTIES(entityHostType, getEntityHostType);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(owningAvatarID, getOwningAvatarID); COPY_ENTITY_PROPERTY_TO_PROPERTIES(owningAvatarID, getOwningAvatarID);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(lastEditedBy, getLastEditedBy); COPY_ENTITY_PROPERTY_TO_PROPERTIES(lastEditedBy, getLastEditedBy);
@ -1476,7 +1476,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex); SET_ENTITY_PROPERTY_FROM_PROPERTIES(parentJointIndex, setParentJointIndex);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube); SET_ENTITY_PROPERTY_FROM_PROPERTIES(queryAACube, setQueryAACube);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(entityHost, setEntityHost); SET_ENTITY_PROPERTY_FROM_PROPERTIES(entityHostType, setEntityHostType);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(owningAvatarID, setOwningAvatarID); SET_ENTITY_PROPERTY_FROM_PROPERTIES(owningAvatarID, setOwningAvatarID);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lastEditedBy, setLastEditedBy); SET_ENTITY_PROPERTY_FROM_PROPERTIES(lastEditedBy, setLastEditedBy);
@ -3274,7 +3274,7 @@ void EntityItem::prepareForSimulationOwnershipBid(EntityItemProperties& properti
properties.setSimulationOwner(Physics::getSessionUUID(), priority); properties.setSimulationOwner(Physics::getSessionUUID(), priority);
setPendingOwnershipPriority(priority); setPendingOwnershipPriority(priority);
properties.setEntityHost(getEntityHost()); properties.setEntityHostType(getEntityHostType());
properties.setOwningAvatarID(getOwningAvatarID()); properties.setOwningAvatarID(getOwningAvatarID());
setLastBroadcast(now); // for debug/physics status icons setLastBroadcast(now); // for debug/physics status icons
} }

View file

@ -64,11 +64,17 @@ const uint64_t MAX_INCOMING_SIMULATION_UPDATE_PERIOD = MAX_OUTGOING_SIMULATION_U
class MeshProxyList; class MeshProxyList;
enum class EntityHost { #ifdef DOMAIN
DOMAIN_ENTITY = 0, #undef DOMAIN
AVATAR_ENTITY, #endif
LOCAL_ENTITY
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 /// 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 /// to all other entity types. In particular: postion, size, rotation, age, lifetime, velocity, gravity. You can not instantiate
@ -484,11 +490,11 @@ public:
void setScriptHasFinishedPreload(bool value); void setScriptHasFinishedPreload(bool value);
bool isScriptPreloadFinished(); bool isScriptPreloadFinished();
bool isDomainEntity() const { return _entityHost == EntityHost::DOMAIN_ENTITY; } bool isDomainEntity() const { return _hostType == entity::HostType::DOMAIN; }
bool isAvatarEntity() const { return _entityHost == EntityHost::AVATAR_ENTITY; } bool isAvatarEntity() const { return _hostType == entity::HostType::AVATAR; }
bool isLocalEntity() const { return _entityHost == EntityHost::LOCAL_ENTITY; } bool isLocalEntity() const { return _hostType == entity::HostType::LOCAL; }
EntityHost getEntityHost() const { return _entityHost; } entity::HostType getEntityHostType() const { return _hostType; }
virtual void setEntityHost(EntityHost entityHost) { _entityHost = entityHost; } virtual void setEntityHostType(entity::HostType hostType) { _hostType = hostType; }
// if this entity is an avatar entity, which avatar is it associated with? // if this entity is an avatar entity, which avatar is it associated with?
QUuid getOwningAvatarID() const { return _owningAvatarID; } QUuid getOwningAvatarID() const { return _owningAvatarID; }
@ -683,7 +689,7 @@ protected:
QUuid _sourceUUID; /// the server node UUID we came from QUuid _sourceUUID; /// the server node UUID we came from
EntityHost _entityHost { EntityHost::DOMAIN_ENTITY }; entity::HostType _hostType { entity::HostType::DOMAIN };
bool _transitingWithAvatar{ false }; bool _transitingWithAvatar{ false };
QUuid _owningAvatarID; QUuid _owningAvatarID;

View file

@ -306,26 +306,26 @@ void EntityItemProperties::setMaterialMappingModeFromString(const QString& mater
} }
} }
QString EntityItemProperties::getEntityHostAsString() const { QString EntityItemProperties::getEntityHostTypeAsString() const {
switch (_entityHost) { switch (_entityHostType) {
case EntityHost::DOMAIN_ENTITY: case entity::HostType::DOMAIN:
return "domain"; return "domain";
case EntityHost::AVATAR_ENTITY: case entity::HostType::AVATAR:
return "avatar"; return "avatar";
case EntityHost::LOCAL_ENTITY: case entity::HostType::LOCAL:
return "local"; return "local";
default: default:
return ""; return "";
} }
} }
void EntityItemProperties::setEntityHostFromString(const QString& entityHost) { void EntityItemProperties::setEntityHostTypeFromString(const QString& entityHostType) {
if (entityHost == "domain") { if (entityHostType == "domain") {
_entityHost = EntityHost::DOMAIN_ENTITY; _entityHostType = entity::HostType::DOMAIN;
} else if (entityHost == "avatar") { } else if (entityHostType == "avatar") {
_entityHost = EntityHost::AVATAR_ENTITY; _entityHostType = entity::HostType::AVATAR;
} else if (entityHost == "local") { } else if (entityHostType == "local") {
_entityHost = EntityHost::LOCAL_ENTITY; _entityHostType = entity::HostType::LOCAL;
} }
} }
@ -476,7 +476,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
CHECK_PROPERTY_CHANGE(PROP_GHOSTING_ALLOWED, ghostingAllowed); CHECK_PROPERTY_CHANGE(PROP_GHOSTING_ALLOWED, ghostingAllowed);
CHECK_PROPERTY_CHANGE(PROP_FILTER_URL, filterURL); CHECK_PROPERTY_CHANGE(PROP_FILTER_URL, filterURL);
CHECK_PROPERTY_CHANGE(PROP_ENTITY_HOST, entityHost); CHECK_PROPERTY_CHANGE(PROP_ENTITY_HOST_TYPE, entityHostType);
CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID); CHECK_PROPERTY_CHANGE(PROP_OWNING_AVATAR_ID, owningAvatarID);
CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape); CHECK_PROPERTY_CHANGE(PROP_SHAPE, shape);
@ -512,16 +512,16 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* @property {Entities.EntityType} type - The entity type. You cannot change the type of an entity after it's created. (Though * @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 <code>"Box"</code>, <code>"Shape"</code>, and <code>"Sphere"</code> depending on changes to * its value may switch among <code>"Box"</code>, <code>"Shape"</code>, and <code>"Sphere"</code> depending on changes to
* the <code>shape</code> property set for entities of these types.) <em>Read-only.</em> * the <code>shape</code> property set for entities of these types.) <em>Read-only.</em>
* @property {EntityHost} entityHost="domain" - How this entity will behave, including if and how it is sent to other people. * @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 <code>entityHost</code> parameter in * The value can only be set at entity creation by using the <code>entityHostType</code> parameter in
* {@link Entities.addEntity}. * {@link Entities.addEntity}.
* @property {boolean} avatarEntity=false - If <code>true</code> then the entity is an avatar entity; An avatar entity follows you to each domain you visit, * @property {boolean} avatarEntity=false - If <code>true</code> 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. <em>Value cannot be changed after the entity is created.</em><br /> * rendering at the same world coordinates unless it's parented to your avatar. <em>Value cannot be changed after the entity is created.</em><br />
* The value can only be set at entity creation by using the <code>entityHost</code> parameter in * The value can only be set at entity creation by using the <code>entityHostType</code> parameter in
* {@link Entities.addEntity}. <code>clientOnly</code> is an alias. * {@link Entities.addEntity}. <code>clientOnly</code> is an alias.
* @property {boolean} localEntity=false - If <code>true</code> then the entity is a local entity; Local entities only render for you and are not sent over the wire. * @property {boolean} localEntity=false - If <code>true</code> then the entity is a local entity; Local entities only render for you and are not sent over the wire.
* <em>Value cannot be changed after the entity is created.</em><br /> * <em>Value cannot be changed after the entity is created.</em><br />
* The value can only be set at entity creation by using the <code>entityHost</code> parameter in * The value can only be set at entity creation by using the <code>entityHostType</code> parameter in
* {@link Entities.addEntity}. * {@link Entities.addEntity}.
* @property {Uuid} owningAvatarID=Uuid.NULL - The session ID of the owning avatar if <code>avatarEntity</code> is * @property {Uuid} owningAvatarID=Uuid.NULL - The session ID of the owning avatar if <code>avatarEntity</code> is
* <code>true</code>, otherwise {@link Uuid|Uuid.NULL}. <em>Read-only.</em> * <code>true</code>, otherwise {@link Uuid|Uuid.NULL}. <em>Read-only.</em>
@ -768,7 +768,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* overlay's ID. * overlay's ID.
* To apply a material to an avatar, set the material entity's <code>parentID</code> property to the avatar's session UUID. * To apply a material to an avatar, set the material entity's <code>parentID</code> 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 * 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 <code>entityHost</code> parameter in {@link Entities.addEntity} to <code>"avatar"</code>. * by setting the <code>entityHostType</code> parameter in {@link Entities.addEntity} to <code>"avatar"</code>.
* Material entities render as non-scalable spheres if they don't have their parent set. * Material entities render as non-scalable spheres if they don't have their parent set.
* @typedef {object} Entities.EntityProperties-Material * @typedef {object} Entities.EntityProperties-Material
* @property {string} materialURL="" - URL to a {@link MaterialResource}. If you append <code>?name</code> to the URL, the * @property {string} materialURL="" - URL to a {@link MaterialResource}. If you append <code>?name</code> to the URL, the
@ -1556,8 +1556,8 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ANGULAR_VELOCITY, localAngularVelocity);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_DIMENSIONS, localDimensions); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_DIMENSIONS, localDimensions);
COPY_PROPERTY_TO_QSCRIPTVALUE_GETTER(PROP_ENTITY_HOST, entityHost, getEntityHostAsString()); // Gettable but not settable except at entity creation 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_OWNING_AVATAR_ID, owningAvatarID); // Gettable but not settable
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONEABLE, cloneable); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONEABLE, cloneable);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_LIFETIME, cloneLifetime); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CLONE_LIFETIME, cloneLifetime);
@ -1597,13 +1597,13 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
} }
if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::ClientOnly)) { if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::ClientOnly)) {
properties.setProperty("clientOnly", convertScriptValue(engine, getEntityHost() == EntityHost::AVATAR_ENTITY)); properties.setProperty("clientOnly", convertScriptValue(engine, getEntityHostType() == entity::HostType::AVATAR));
} }
if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::AvatarEntity)) { if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::AvatarEntity)) {
properties.setProperty("avatarEntity", convertScriptValue(engine, getEntityHost() == EntityHost::AVATAR_ENTITY)); properties.setProperty("avatarEntity", convertScriptValue(engine, getEntityHostType() == entity::HostType::AVATAR));
} }
if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::LocalEntity)) { if (!psuedoPropertyFlagsActive || psueudoPropertyFlags.test(EntityPsuedoPropertyFlag::LocalEntity)) {
properties.setProperty("localEntity", convertScriptValue(engine, getEntityHost() == EntityHost::LOCAL_ENTITY)); properties.setProperty("localEntity", convertScriptValue(engine, getEntityHostType() == entity::HostType::LOCAL));
} }
// FIXME - I don't think these properties are supported any more // FIXME - I don't think these properties are supported any more
@ -1792,7 +1792,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
COPY_PROPERTY_FROM_QSCRIPTVALUE(ghostingAllowed, bool, setGhostingAllowed); COPY_PROPERTY_FROM_QSCRIPTVALUE(ghostingAllowed, bool, setGhostingAllowed);
COPY_PROPERTY_FROM_QSCRIPTVALUE(filterURL, QString, setFilterURL); COPY_PROPERTY_FROM_QSCRIPTVALUE(filterURL, QString, setFilterURL);
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityHost, EntityHost); COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityHostType, EntityHostType);
COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID); COPY_PROPERTY_FROM_QSCRIPTVALUE(owningAvatarID, QUuid, setOwningAvatarID);
COPY_PROPERTY_FROM_QSCRIPTVALUE(dpi, uint16_t, setDPI); COPY_PROPERTY_FROM_QSCRIPTVALUE(dpi, uint16_t, setDPI);
@ -1958,7 +1958,7 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
COPY_PROPERTY_IF_CHANGED(ghostingAllowed); COPY_PROPERTY_IF_CHANGED(ghostingAllowed);
COPY_PROPERTY_IF_CHANGED(filterURL); COPY_PROPERTY_IF_CHANGED(filterURL);
COPY_PROPERTY_IF_CHANGED(entityHost); COPY_PROPERTY_IF_CHANGED(entityHostType);
COPY_PROPERTY_IF_CHANGED(owningAvatarID); COPY_PROPERTY_IF_CHANGED(owningAvatarID);
COPY_PROPERTY_IF_CHANGED(dpi); COPY_PROPERTY_IF_CHANGED(dpi);
@ -3244,7 +3244,7 @@ void EntityItemProperties::markAllChanged() {
_ghostingAllowedChanged = true; _ghostingAllowedChanged = true;
_filterURLChanged = true; _filterURLChanged = true;
_entityHostChanged = true; _entityHostTypeChanged = true;
_owningAvatarIDChanged = true; _owningAvatarIDChanged = true;
_dpiChanged = true; _dpiChanged = true;
@ -3743,8 +3743,8 @@ QList<QString> EntityItemProperties::listChangedProperties() {
out += "queryAACube"; out += "queryAACube";
} }
if (entityHostChanged()) { if (entityHostTypeChanged()) {
out += "entityHost"; out += "entityHostType";
} }
if (owningAvatarIDChanged()) { if (owningAvatarIDChanged()) {
out += "owningAvatarID"; out += "owningAvatarID";
@ -3819,7 +3819,7 @@ bool EntityItemProperties::getScalesWithParent() const {
if (success && parent) { if (success && parent) {
bool avatarAncestor = (parent->getNestableType() == NestableType::Avatar || bool avatarAncestor = (parent->getNestableType() == NestableType::Avatar ||
parent->hasAncestorOfType(NestableType::Avatar)); parent->hasAncestorOfType(NestableType::Avatar));
scalesWithParent = getEntityHost() == EntityHost::AVATAR_ENTITY && avatarAncestor; scalesWithParent = getEntityHostType() == entity::HostType::AVATAR && avatarAncestor;
} }
} }
return scalesWithParent; return scalesWithParent;
@ -3977,11 +3977,11 @@ void EntityItemProperties::convertToCloneProperties(const EntityItemID& entityID
setParentJointIndex(-1); setParentJointIndex(-1);
setLifetime(getCloneLifetime()); setLifetime(getCloneLifetime());
setDynamic(getCloneDynamic()); setDynamic(getCloneDynamic());
if (getEntityHost() != EntityHost::LOCAL_ENTITY) { if (getEntityHostType() != entity::HostType::LOCAL) {
setEntityHost(getCloneAvatarEntity() ? EntityHost::AVATAR_ENTITY : EntityHost::DOMAIN_ENTITY); setEntityHostType(getCloneAvatarEntity() ? entity::HostType::AVATAR : entity::HostType::DOMAIN);
} else { } else {
// Local Entities clone as local entities // Local Entities clone as local entities
setEntityHost(EntityHost::LOCAL_ENTITY); setEntityHostType(entity::HostType::LOCAL);
setCollisionless(true); setCollisionless(true);
} }
setCreated(usecTimestampNow()); setCreated(usecTimestampNow());

View file

@ -279,7 +279,7 @@ public:
DEFINE_PROPERTY(PROP_GHOSTING_ALLOWED, GhostingAllowed, ghostingAllowed, bool, ZoneEntityItem::DEFAULT_GHOSTING_ALLOWED); 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_FILTER_URL, FilterURL, filterURL, QString, ZoneEntityItem::DEFAULT_FILTER_URL);
DEFINE_PROPERTY_REF_ENUM(PROP_ENTITY_HOST, EntityHost, entityHost, EntityHost, EntityHost::DOMAIN_ENTITY); 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_OWNING_AVATAR_ID, OwningAvatarID, owningAvatarID, QUuid, UNKNOWN_ENTITY_ID);
DEFINE_PROPERTY_REF(PROP_DPI, DPI, dpi, uint16_t, ENTITY_ITEM_DEFAULT_DPI); 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, GhostingAllowed, ghostingAllowed, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, FilterURL, filterURL, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, FilterURL, filterURL, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, EntityHostAsString, entityHost, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, EntityHostTypeAsString, entityHostType, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, OwningAvatarID, owningAvatarID, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, OwningAvatarID, owningAvatarID, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, LastEditedBy, lastEditedBy, ""); DEBUG_PROPERTY_IF_CHANGED(debug, properties, LastEditedBy, lastEditedBy, "");

View file

@ -121,7 +121,7 @@ QDebug& operator<<(QDebug& dbg, const EntityPropertyFlags& f) {
result = f.getHasProperty(PROP_FALLOFF_RADIUS) ? result + "falloffRadius " : result; result = f.getHasProperty(PROP_FALLOFF_RADIUS) ? result + "falloffRadius " : result;
result = f.getHasProperty(PROP_FLYING_ALLOWED) ? result + "flyingAllowed " : result; result = f.getHasProperty(PROP_FLYING_ALLOWED) ? result + "flyingAllowed " : result;
result = f.getHasProperty(PROP_GHOSTING_ALLOWED) ? result + "ghostingAllowed " : result; result = f.getHasProperty(PROP_GHOSTING_ALLOWED) ? result + "ghostingAllowed " : result;
result = f.getHasProperty(PROP_ENTITY_HOST) ? result + "entityHost " : 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_OWNING_AVATAR_ID) ? result + "owningAvatarID " : result;
result = f.getHasProperty(PROP_SHAPE) ? result + "shape " : result; result = f.getHasProperty(PROP_SHAPE) ? result + "shape " : result;
result = f.getHasProperty(PROP_DPI) ? result + "dpi " : result; result = f.getHasProperty(PROP_DPI) ? result + "dpi " : result;

View file

@ -176,7 +176,7 @@ enum EntityPropertyList {
PROP_FLYING_ALLOWED, // can avatars in a zone fly? PROP_FLYING_ALLOWED, // can avatars in a zone fly?
PROP_GHOSTING_ALLOWED, // can avatars in a zone turn off physics? PROP_GHOSTING_ALLOWED, // can avatars in a zone turn off physics?
PROP_ENTITY_HOST, // doesn't go over wire PROP_ENTITY_HOST_TYPE, // doesn't go over wire
PROP_OWNING_AVATAR_ID, // doesn't go over wire PROP_OWNING_AVATAR_ID, // doesn't go over wire
PROP_SHAPE, PROP_SHAPE,

View file

@ -470,7 +470,7 @@ void synchronizeEditedGrabProperties(EntityItemProperties& properties, const QSt
} }
QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, const QString& entityHostString) { QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties, const QString& entityHostTypeString) {
PROFILE_RANGE(script_entities, __FUNCTION__); PROFILE_RANGE(script_entities, __FUNCTION__);
_activityTracking.addedEntityCount++; _activityTracking.addedEntityCount++;
@ -479,10 +479,10 @@ QUuid EntityScriptingInterface::addEntity(const EntityItemProperties& properties
const auto sessionID = nodeList->getSessionUUID(); const auto sessionID = nodeList->getSessionUUID();
EntityItemProperties propertiesWithSimID = properties; EntityItemProperties propertiesWithSimID = properties;
propertiesWithSimID.setEntityHostFromString(entityHostString); propertiesWithSimID.setEntityHostTypeFromString(entityHostTypeString);
if (propertiesWithSimID.getEntityHost() == EntityHost::AVATAR_ENTITY) { if (propertiesWithSimID.getEntityHostType() == entity::HostType::AVATAR) {
propertiesWithSimID.setOwningAvatarID(sessionID); propertiesWithSimID.setOwningAvatarID(sessionID);
} else if (propertiesWithSimID.getEntityHost() == EntityHost::LOCAL_ENTITY) { } else if (propertiesWithSimID.getEntityHostType() == entity::HostType::LOCAL) {
// For now, local entities are always collisionless // For now, local entities are always collisionless
// TODO: create a separate, local physics simulation that just handles local entities (and MyAvatar?) // TODO: create a separate, local physics simulation that just handles local entities (and MyAvatar?)
propertiesWithSimID.setCollisionless(true); propertiesWithSimID.setCollisionless(true);
@ -572,7 +572,7 @@ QUuid EntityScriptingInterface::cloneEntity(QUuid entityIDToClone) {
bool cloneAvatarEntity = properties.getCloneAvatarEntity(); bool cloneAvatarEntity = properties.getCloneAvatarEntity();
properties.convertToCloneProperties(entityIDToClone); properties.convertToCloneProperties(entityIDToClone);
if (properties.getEntityHost() == EntityHost::LOCAL_ENTITY) { if (properties.getEntityHostType() == entity::HostType::LOCAL) {
// Local entities are only cloned locally // Local entities are only cloned locally
return addEntity(properties, "local"); return addEntity(properties, "local");
} else if (cloneAvatarEntity) { } else if (cloneAvatarEntity) {
@ -838,9 +838,9 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
} }
// set these to make EntityItemProperties::getScalesWithParent() work correctly // set these to make EntityItemProperties::getScalesWithParent() work correctly
EntityHost entityHost = entity->getEntityHost(); entity::HostType entityHostType = entity->getEntityHostType();
properties.setEntityHost(entityHost); properties.setEntityHostType(entityHostType);
if (entityHost == EntityHost::LOCAL_ENTITY) { if (entityHostType == entity::HostType::LOCAL) {
properties.setCollisionless(true); properties.setCollisionless(true);
} }
properties.setOwningAvatarID(entity->getOwningAvatarID()); properties.setOwningAvatarID(entity->getOwningAvatarID());
@ -1660,7 +1660,7 @@ bool EntityScriptingInterface::actionWorker(const QUuid& entityID,
doTransmit = actor(simulation, entity); doTransmit = actor(simulation, entity);
_entityTree->entityChanged(entity); _entityTree->entityChanged(entity);
if (doTransmit) { if (doTransmit) {
properties.setEntityHost(entity->getEntityHost()); properties.setEntityHostType(entity->getEntityHostType());
properties.setOwningAvatarID(entity->getOwningAvatarID()); properties.setOwningAvatarID(entity->getOwningAvatarID());
} }
}); });

View file

@ -245,14 +245,14 @@ public slots:
* <tr><td><code>local</code></td><td>Local entities are not sent over the wire and will only render for you, locally</td></tr> * <tr><td><code>local</code></td><td>Local entities are not sent over the wire and will only render for you, locally</td></tr>
* </tbody> * </tbody>
* </table> * </table>
* @typedef {string} EntityHost * @typedef {string} EntityHostType
*/ */
/**jsdoc /**jsdoc
* Add a new entity with specified properties. * Add a new entity with specified properties.
* @function Entities.addEntity * @function Entities.addEntity
* @param {Entities.EntityProperties} properties - The properties of the entity to create. * @param {Entities.EntityProperties} properties - The properties of the entity to create.
* @param {EntityHost} [entityHost="domain"] - If <code>"avatar"</code> the entity is created as an avatar entity. An avatar entity * @param {EntityHostType} [entityHostType="domain"] - If <code>"avatar"</code> 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. * follows you to each domain you visit, rendering at the same world coordinates unless it's parented to your avatar.
* If <code>"local"</code>, the entity is created as a local entity, which will only render for you and isn't sent over the wire. * If <code>"local"</code>, 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. * Otherwise it is created as a normal entity and sent over the entity server.
@ -266,7 +266,7 @@ public slots:
* }); * });
* print("Entity created: " + entityID); * print("Entity created: " + entityID);
*/ */
Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties, const QString& entityHostString); Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties, const QString& entityHostTypeString);
/**jsdoc /**jsdoc
* Add a new entity with specified properties. * Add a new entity with specified properties.
@ -276,8 +276,8 @@ public slots:
* @returns {Uuid} The ID of the entity if successfully created, otherwise {@link Uuid|Uuid.NULL}. * @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) { Q_INVOKABLE QUuid addEntity(const EntityItemProperties& properties, bool avatarEntity = false) {
QString entityHost = avatarEntity ? "avatar" : "domain"; QString entityHostType = avatarEntity ? "avatar" : "domain";
return addEntity(properties, entityHost); return addEntity(properties, entityHostType);
} }
/// temporary method until addEntity can be used from QJSEngine /// temporary method until addEntity can be used from QJSEngine

View file

@ -541,7 +541,7 @@ EntityItemPointer EntityTree::addEntity(const EntityItemID& entityID, const Enti
return nullptr; return nullptr;
} }
if (properties.getEntityHost() == EntityHost::DOMAIN_ENTITY && getIsClient() && if (properties.getEntityHostType() == entity::HostType::DOMAIN && getIsClient() &&
!nodeList->getThisNodeCanRez() && !nodeList->getThisNodeCanRezTmp() && !nodeList->getThisNodeCanRez() && !nodeList->getThisNodeCanRezTmp() &&
!nodeList->getThisNodeCanRezCertified() && !nodeList->getThisNodeCanRezTmpCertified() && !_serverlessDomain && !isClone) { !nodeList->getThisNodeCanRezCertified() && !nodeList->getThisNodeCanRezTmpCertified() && !_serverlessDomain && !isClone) {
return nullptr; return nullptr;
@ -2668,15 +2668,15 @@ bool EntityTree::readFromMap(QVariantMap& map) {
entityItemID = EntityItemID(QUuid::createUuid()); entityItemID = EntityItemID(QUuid::createUuid());
} }
// Convert old clientOnly bool to new entityHost enum // Convert old clientOnly bool to new entityHostType enum
// (must happen before setOwningAvatarID below) // (must happen before setOwningAvatarID below)
if (contentVersion < (int)EntityVersion::EntityHosts) { if (contentVersion < (int)EntityVersion::EntityHostTypes) {
if (entityMap.contains("clientOnly")) { if (entityMap.contains("clientOnly")) {
properties.setEntityHost(entityMap["clientOnly"].toBool() ? EntityHost::AVATAR_ENTITY : EntityHost::DOMAIN_ENTITY); properties.setEntityHostType(entityMap["clientOnly"].toBool() ? entity::HostType::AVATAR : entity::HostType::DOMAIN);
} }
} }
if (properties.getEntityHost() == EntityHost::AVATAR_ENTITY) { if (properties.getEntityHostType() == entity::HostType::AVATAR) {
auto nodeList = DependencyManager::get<NodeList>(); auto nodeList = DependencyManager::get<NodeList>();
const QUuid myNodeID = nodeList->getSessionUUID(); const QUuid myNodeID = nodeList->getSessionUUID();
properties.setOwningAvatarID(myNodeID); properties.setOwningAvatarID(myNodeID);

View file

@ -33,7 +33,7 @@ PacketVersion versionForPacketType(PacketType packetType) {
case PacketType::EntityEdit: case PacketType::EntityEdit:
case PacketType::EntityData: case PacketType::EntityData:
case PacketType::EntityPhysics: case PacketType::EntityPhysics:
return static_cast<PacketVersion>(EntityVersion::EntityHosts); return static_cast<PacketVersion>(EntityVersion::EntityHostTypes);
case PacketType::EntityQuery: case PacketType::EntityQuery:
return static_cast<PacketVersion>(EntityQueryPacketVersion::ConicalFrustums); return static_cast<PacketVersion>(EntityQueryPacketVersion::ConicalFrustums);
case PacketType::AvatarIdentity: case PacketType::AvatarIdentity:

View file

@ -246,7 +246,7 @@ enum class EntityVersion : PacketVersion {
GrabProperties, GrabProperties,
ScriptGlmVectors, ScriptGlmVectors,
FixedLightSerialization, FixedLightSerialization,
EntityHosts EntityHostTypes
}; };
enum class EntityScriptCallMethodVersion : PacketVersion { enum class EntityScriptCallMethodVersion : PacketVersion {

View file

@ -595,7 +595,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
EntityTreeElementPointer element = _entity->getElement(); EntityTreeElementPointer element = _entity->getElement();
EntityTreePointer tree = element ? element->getTree() : nullptr; EntityTreePointer tree = element ? element->getTree() : nullptr;
properties.setEntityHost(_entity->getEntityHost()); properties.setEntityHostType(_entity->getEntityHostType());
properties.setOwningAvatarID(_entity->getOwningAvatarID()); properties.setOwningAvatarID(_entity->getOwningAvatarID());
entityPacketSender->queueEditEntityMessage(PacketType::EntityPhysics, tree, id, properties); entityPacketSender->queueEditEntityMessage(PacketType::EntityPhysics, tree, id, properties);
@ -610,7 +610,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
EntityItemProperties newQueryCubeProperties; EntityItemProperties newQueryCubeProperties;
newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube()); newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube());
newQueryCubeProperties.setLastEdited(properties.getLastEdited()); newQueryCubeProperties.setLastEdited(properties.getLastEdited());
newQueryCubeProperties.setEntityHost(entityDescendant->getEntityHost()); newQueryCubeProperties.setEntityHostType(entityDescendant->getEntityHostType());
newQueryCubeProperties.setOwningAvatarID(entityDescendant->getOwningAvatarID()); newQueryCubeProperties.setOwningAvatarID(entityDescendant->getOwningAvatarID());
entityPacketSender->queueEditEntityMessage(PacketType::EntityPhysics, tree, entityPacketSender->queueEditEntityMessage(PacketType::EntityPhysics, tree,