Commit 3b9c2eda authored by Maki's avatar Maki 🌺
Browse files

Removed custom tags

parent d6632cb8
......@@ -91,7 +91,6 @@ EntityPropertyFlags EntityItem::getEntityProperties(EncodeBitstreamParams& param
requestedProperties += PROP_PRIVATE_USER_DATA;
requestedProperties += PROP_HREF;
requestedProperties += PROP_DESCRIPTION;
requestedProperties += PROP_CUSTOM_TAGS;
requestedProperties += PROP_POSITION;
requestedProperties += PROP_DIMENSIONS;
requestedProperties += PROP_ROTATION;
......@@ -294,7 +293,6 @@ OctreeElement::AppendState EntityItem::appendEntityData(
APPEND_ENTITY_PROPERTY(PROP_PRIVATE_USER_DATA, privateUserData);
APPEND_ENTITY_PROPERTY(PROP_HREF, getHref());
APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, getDescription());
APPEND_ENTITY_PROPERTY(PROP_CUSTOM_TAGS, getCustomTags());
APPEND_ENTITY_PROPERTY(PROP_POSITION, getLocalPosition());
APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, getScaledDimensions());
APPEND_ENTITY_PROPERTY(PROP_ROTATION, getLocalOrientation());
......@@ -833,7 +831,6 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
READ_ENTITY_PROPERTY(PROP_PRIVATE_USER_DATA, QString, setPrivateUserData);
READ_ENTITY_PROPERTY(PROP_HREF, QString, setHref);
READ_ENTITY_PROPERTY(PROP_DESCRIPTION, QString, setDescription);
READ_ENTITY_PROPERTY(PROP_CUSTOM_TAGS, QString, setCustomTags);
{ // When we own the simulation we don't accept updates to the entity's transform/velocities
// we also want to ignore any duplicate packets that have the same "recently updated" values
// as a packet we've already recieved. This is because we want multiple edits of the same
......@@ -1110,33 +1107,6 @@ void EntityItem::setHref(QString value) {
withWriteLock([&] { _href = value; });
}
// TIVOLI tagging
void EntityItem::setCustomTags(QString value) { // TIVOLI tagging
value = value.toLower();
if (_customTags.length() == 0) value = "," + value; // should always start with a comma
withWriteLock([&] { _customTags = value; });
}
// TIVOLI tagging
void EntityItem::addTag(QString value) { // TIVOLI tagging
value = value.toLower();
QString result;
withReadLock([&] {
result = _customTags;
});
//value.remove(QRegExp(QString::fromUtf8("[-`~!@#$%^&*()_—+=|:;<>«»,.?/{}\'\"\\\[\\\]\\\\]")));
if (result.indexOf(","+value+",") > -1) return; // Check if the tag already exists, if so, do nothing
result += value + ","; //
withWriteLock([&] { _customTags = result; });
qDebug() << " NEW TAGS LIST IS " << result;
}
QString EntityItem::getCustomTags() const { // TIVOLI tagging
QString result;
withReadLock([&] { result = _customTags; });
return result;
}
void EntityItem::setCollisionSoundURL(const QString& value) {
bool modified = false;
withWriteLock([&] {
......@@ -1391,7 +1361,6 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire
COPY_ENTITY_PROPERTY_TO_PROPERTIES(privateUserData, getPrivateUserData);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(href, getHref);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(description, getDescription);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(customTags, getCustomTags);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(entityPriority, getEntityPriority);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(position, getLocalPosition);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(dimensions, getScaledDimensions);
......@@ -1540,7 +1509,6 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(privateUserData, setPrivateUserData);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(href, setHref);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(description, setDescription);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(customTags, setCustomTags);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(position, setPosition);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(dimensions, setScaledDimensions);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(rotation, setRotation);
......
......@@ -200,11 +200,6 @@ public:
QString getDescription() const;
void setDescription(const QString& value);
// TIVOLI tagging getters and setters
QString getCustomTags() const; // TIVOLI tagging
void setCustomTags(QString value); // TIVOLI tagging
void addTag(QString value); // TIVOLI tagging
/// Dimensions in meters (0.0 - TREE_SCALE)
virtual glm::vec3 getScaledDimensions() const;
virtual void setScaledDimensions(const glm::vec3& value);
......@@ -681,7 +676,6 @@ protected:
QString _name { ENTITY_ITEM_DEFAULT_NAME };
QString _href; //Hyperlink href
QString _description; //Hyperlink description
QString _customTags; // TIVOLI tagging
// Certifiable Properties
QString _itemName { ENTITY_ITEM_DEFAULT_ITEM_NAME };
......
......@@ -490,7 +490,6 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
CHECK_PROPERTY_CHANGE(PROP_PRIVATE_USER_DATA, privateUserData);
CHECK_PROPERTY_CHANGE(PROP_HREF, href);
CHECK_PROPERTY_CHANGE(PROP_DESCRIPTION, description);
CHECK_PROPERTY_CHANGE(PROP_CUSTOM_TAGS, customTags);
CHECK_PROPERTY_CHANGE(PROP_POSITION, position);
CHECK_PROPERTY_CHANGE(PROP_DIMENSIONS, dimensions);
CHECK_PROPERTY_CHANGE(PROP_ROTATION, rotation);
......@@ -1666,7 +1665,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_PRIVATE_USER_DATA, privateUserData);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_HREF, href);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DESCRIPTION, description);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_CUSTOM_TAGS, customTags);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_POSITION, position);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_DIMENSIONS, dimensions);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_ROTATION, rotation);
......@@ -2089,7 +2087,6 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
COPY_PROPERTY_FROM_QSCRIPTVALUE(privateUserData, QString, setPrivateUserData);
COPY_PROPERTY_FROM_QSCRIPTVALUE(href, QString, setHref);
COPY_PROPERTY_FROM_QSCRIPTVALUE(description, QString, setDescription);
COPY_PROPERTY_FROM_QSCRIPTVALUE(customTags, QString, setCustomTags); // TIVOLI tagging
COPY_PROPERTY_FROM_QSCRIPTVALUE_ENUM(entityPriority, EntityPriority);
COPY_PROPERTY_FROM_QSCRIPTVALUE(position, vec3, setPosition);
COPY_PROPERTY_FROM_QSCRIPTVALUE(dimensions, vec3, setDimensions);
......@@ -2394,7 +2391,6 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
COPY_PROPERTY_IF_CHANGED(privateUserData);
COPY_PROPERTY_IF_CHANGED(href);
COPY_PROPERTY_IF_CHANGED(description);
COPY_PROPERTY_IF_CHANGED(customTags);
COPY_PROPERTY_IF_CHANGED(entityPriority);
COPY_PROPERTY_IF_CHANGED(position);
COPY_PROPERTY_IF_CHANGED(dimensions);
......@@ -2691,7 +2687,6 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr
ADD_PROPERTY_TO_MAP(PROP_PRIVATE_USER_DATA, PrivateUserData, privateUserData, QString);
ADD_PROPERTY_TO_MAP(PROP_HREF, Href, href, QString);
ADD_PROPERTY_TO_MAP(PROP_DESCRIPTION, Description, description, QString);
ADD_PROPERTY_TO_MAP(PROP_CUSTOM_TAGS, CustomTags, customTags, QString);
ADD_PROPERTY_TO_MAP(PROP_POSITION, Position, position, vec3);
ADD_PROPERTY_TO_MAP_WITH_RANGE(PROP_DIMENSIONS, Dimensions, dimensions, vec3, ENTITY_ITEM_MIN_DIMENSION, FLT_MAX);
ADD_PROPERTY_TO_MAP(PROP_ROTATION, Rotation, rotation, quat);
......@@ -3193,7 +3188,6 @@ OctreeElement::AppendState EntityItemProperties::encodeEntityEditPacket(PacketTy
APPEND_ENTITY_PROPERTY(PROP_PRIVATE_USER_DATA, properties.getPrivateUserData());
APPEND_ENTITY_PROPERTY(PROP_HREF, properties.getHref());
APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, properties.getDescription());
APPEND_ENTITY_PROPERTY(PROP_CUSTOM_TAGS, properties.getCustomTags());
APPEND_ENTITY_PROPERTY(PROP_POSITION, properties.getPosition());
APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, properties.getDimensions());
APPEND_ENTITY_PROPERTY(PROP_ROTATION, properties.getRotation());
......@@ -3698,7 +3692,6 @@ bool EntityItemProperties::decodeEntityEditPacket(const unsigned char* data, int
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_PRIVATE_USER_DATA, QString, setPrivateUserData);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_HREF, QString, setHref);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DESCRIPTION, QString, setDescription);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_CUSTOM_TAGS, QString, setCustomTags);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_POSITION, vec3, setPosition);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_DIMENSIONS, vec3, setDimensions);
READ_ENTITY_PROPERTY_TO_PROPERTIES(PROP_ROTATION, quat, setRotation);
......@@ -4124,7 +4117,6 @@ void EntityItemProperties::markAllChanged() {
_privateUserDataChanged = true;
_hrefChanged = true;
_descriptionChanged = true;
_customTagsChanged = true;
_entityPriorityChanged = true;
_positionChanged = true;
_dimensionsChanged = true;
......@@ -4508,9 +4500,6 @@ QList<QString> EntityItemProperties::listChangedProperties() {
if (descriptionChanged()) {
out += "description";
}
if (customTagsChanged()) {
out += "customTags";
}
if (entityPriorityChanged()) {
out += "entityPriority";
}
......
......@@ -183,7 +183,6 @@ public:
DEFINE_PROPERTY_REF(PROP_PRIVATE_USER_DATA, PrivateUserData, privateUserData, QString, ENTITY_ITEM_DEFAULT_PRIVATE_USER_DATA);
DEFINE_PROPERTY_REF(PROP_HREF, Href, href, QString, "");
DEFINE_PROPERTY_REF(PROP_DESCRIPTION, Description, description, QString, "");
DEFINE_PROPERTY_REF(PROP_CUSTOM_TAGS, CustomTags, customTags, QString, ""); // TIVOLI TAGGING
//DEFINE_PROPERTY_REF_ENUM(PROP_ENTITY_PRIORITY, EntityPriority, entityPriority, EntityPriority, EntityPriority::AUTOMATIC);
DEFINE_PROPERTY_REF_WITH_SETTER(PROP_POSITION, Position, position, glm::vec3, ENTITY_ITEM_ZERO_VEC3);
DEFINE_PROPERTY_REF(PROP_DIMENSIONS, Dimensions, dimensions, glm::vec3, ENTITY_ITEM_DEFAULT_DIMENSIONS);
......@@ -696,7 +695,6 @@ inline QDebug operator<<(QDebug debug, const EntityItemProperties& properties) {
DEBUG_PROPERTY_IF_CHANGED(debug, properties, VoxelSurfaceStyle, voxelSurfaceStyle, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Href, href, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, Description, description, "");
DEBUG_PROPERTY_IF_CHANGED(debug, properties, CustomTags, customTags, "");// TIVOLI tagging
// DEBUG_PROPERTY_IF_CHANGED(debug, properties, EntityPriority, entityPriority, "");// TIVOLI tagging
if (properties.actionDataChanged()) {
......
......@@ -114,7 +114,6 @@ const bool ENTITY_ITEM_DEFAULT_CLONE_AVATAR_ENTITY = false;
const QUuid ENTITY_ITEM_DEFAULT_CLONE_ORIGIN_ID = QUuid();
const bool ENTITY_ITEM_DEFAULT_CLONE_GRABBABLE = false;
const QString ENTITY_ITEM_DEFAULT_CUSTOM_TAGS = QString(""); // TIVOLI tagging system
const uint8_t ENTITY_ITEM_DEFAULT_ENTITY_PRIORITY = 1; // 1 = normal ("automatic") priority
#endif // hifi_EntityItemPropertiesDefaults_h
......@@ -46,7 +46,6 @@ enum EntityPropertyList
PROP_ENTITY_PRIORITY,
PROP_PRIMITIVE_MODE,
PROP_IGNORE_PICK_INTERSECTION,
PROP_CUSTOM_TAGS,// TIVOLI tagging
// Grab
......
......@@ -1207,21 +1207,6 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesByName(const QString entity
return result;
}
// TIVOLI tagging
QVector<QUuid> EntityScriptingInterface::findEntitiesWithTag(const QString tagName,
const glm::vec3& center,
float radius) const {
QVector<QUuid> result;
if (_entityTree) {
_entityTree->withReadLock([&] {
unsigned int searchFilter = PickFilter::getBitMask(PickFilter::FlagBit::DOMAIN_ENTITIES) |
PickFilter::getBitMask(PickFilter::FlagBit::AVATAR_ENTITIES);
_entityTree->evalEntitiesInSphereWithTag(center, radius, tagName, PickFilter(searchFilter), result);
});
}
return result;
}
RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersection(const PickRay& ray,
bool precisionPicking,
const QScriptValue& entityIdsToInclude,
......
......@@ -776,23 +776,6 @@ public slots:
Q_INVOKABLE QVector<QUuid> findEntitiesByName(const QString entityName, const glm::vec3& center, float radius,
bool caseSensitiveSearch = false) const;
// TIVOLI tagging
/**jsdoc
* Finds all domain and avatar entities marked with a custom tag that intersect a sphere.
* @function Entities.findEntitiesWithTag
* @param {string} tagName - The tag of the entity to search for. Tags are forced to lower-case.
* @param {Vec3} center - The point about which to search.
* @param {number} radius - The radius within which to search.
* @returns {Uuid[]} An array of entity IDs that have the specified tag and intersect the search sphere. The array is
* empty if no entities could be found.
* @example <caption>Report the number of entities with the tag, "SCENERY".</caption>
* var entityIDs = Entities.findEntitiesWithTag("SCENERY", MyAvatar.position, 10, false);
* print("Number of entities with the tag SCENERY: " + entityIDs.length);
*/
Q_INVOKABLE QVector<QUuid> findEntitiesWithTag(const QString tagName,
const glm::vec3& center,
float radius) const;
/**jsdoc
* Finds the first avatar or domain entity intersected by a {@link PickRay}. <code>Light</code> and <code>Zone</code>
* entities are not intersected unless they've been configured as pickable using
......
......@@ -1126,36 +1126,6 @@ bool evalInSphereWithNameOperation(const OctreeElementPointer& element, void* ex
return false;
}
class FindEntitiesInSphereWithTagArgs {
public:
// Inputs
glm::vec3 position;
float targetRadius;
QString tagName;
PickFilter searchFilter;
// Outputs
QVector<QUuid> entities;
};
bool evalInSphereWithTagOperation(const OctreeElementPointer& element, void* extraData) {
FindEntitiesInSphereWithTagArgs* args = static_cast<FindEntitiesInSphereWithTagArgs*>(extraData);
glm::vec3 penetration;
bool sphereIntersection = element->getAACube().findSpherePenetration(args->position, args->targetRadius, penetration);
// If this element contains the point, then search it...
if (sphereIntersection) {
EntityTreeElementPointer entityTreeElement = std::static_pointer_cast<EntityTreeElement>(element);
entityTreeElement->evalEntitiesInSphereWithTag(args->position, args->targetRadius, args->tagName,
args->searchFilter, args->entities);
return true; // keep searching in case children have closer entities
}
// if this element doesn't contain the point, then none of it's children can contain the point, so stop searching
return false;
}
// NOTE: assumes caller has handled locking
void EntityTree::evalEntitiesInSphereWithName(const glm::vec3& center, float radius, const QString& name, bool caseSensitive, PickFilter searchFilter, QVector<QUuid>& foundEntities) {
FindEntitiesInSphereWithNameArgs args = { center, radius, name, caseSensitive, searchFilter, QVector<QUuid>() };
......@@ -1163,19 +1133,6 @@ void EntityTree::evalEntitiesInSphereWithName(const glm::vec3& center, float rad
foundEntities.swap(args.entities);
}
// NOTE: assumes caller has handled locking
void EntityTree::evalEntitiesInSphereWithTag(const glm::vec3& center,
float radius,
const QString& tagName,
PickFilter searchFilter,
QVector<QUuid>& foundEntities) {
FindEntitiesInSphereWithTagArgs args = { center, radius, tagName, searchFilter, QVector<QUuid>() };
recurseTreeWithOperation(evalInSphereWithTagOperation, &args);
foundEntities.swap(args.entities);
}
class FindEntitiesInCubeArgs {
public:
// Inputs
......@@ -1186,9 +1143,6 @@ public:
QVector<QUuid> entities;
};
bool findInCubeOperation(const OctreeElementPointer& element, void* extraData) {
FindEntitiesInCubeArgs* args = static_cast<FindEntitiesInCubeArgs*>(extraData);
if (element->getAACube().touches(args->cube)) {
......
......@@ -644,75 +644,6 @@ void EntityTreeElement::evalEntitiesInSphereWithName(const glm::vec3& position,
});
}
// void evalEntitiesInSphereWithTag(const glm::vec3& position, float radius, const QString& tagName, PickFilter searchFilter, QVector<QUuid>& foundEntities) const;
void EntityTreeElement::evalEntitiesInSphereWithTag(const glm::vec3& position,
float radius,
const QString& tagName,
PickFilter searchFilter,
QVector<QUuid>& foundEntities) const {
forEachEntity([&](EntityItemPointer entity) {
if (!checkFilterSettings(entity, searchFilter)) {
return;
}
QString entityTags = entity->getCustomTags();
/* QStringList parts = tagName.split('_', Qt::SkipEmptyParts);
for (int i = 1; i < tagName.size(); ++i)
tagName[i].replace(0, 1, tagName[i][0].toUpper());
tagName = parts.join("");*/
if (entityTags.indexOf(tagName.toUtf8().toBase64()) >= 0) {
bool success;
AABox entityBox = entity->getAABox(success);
// if the sphere doesn't intersect with our world frame AABox, we don't need to consider the more complex case
glm::vec3 penetration;
if (success && entityBox.findSpherePenetration(position, radius, penetration)) {
glm::vec3 dimensions = entity->getRaycastDimensions();
// FIXME - consider allowing the entity to determine penetration so that
// entities could presumably do actual hull testing if they wanted to
// FIXME - handle entity->getShapeType() == SHAPE_TYPE_SPHERE case better in particular
// can we handle the ellipsoid case better? We only currently handle perfect spheres
// with centered registration points
if (entity->getShapeType() == SHAPE_TYPE_SPHERE &&
(dimensions.x == dimensions.y && dimensions.y == dimensions.z)) {
// NOTE: entity->getRadius() doesn't return the true radius, it returns the radius of the
// maximum bounding sphere, which is actually larger than our actual radius
float entityTrueRadius = dimensions.x / 2.0f;
bool success;
if (findSphereSpherePenetration(position, radius, entity->getCenterPosition(success), entityTrueRadius,
penetration)) {
if (success) {
foundEntities.push_back(entity->getID());
}
}
} else {
// determine the worldToEntityMatrix that doesn't include scale because
// we're going to use the registration aware aa box in the entity frame
glm::mat4 rotation = glm::mat4_cast(entity->getWorldOrientation());
glm::mat4 translation = glm::translate(entity->getWorldPosition());
glm::mat4 entityToWorldMatrix = translation * rotation;
glm::mat4 worldToEntityMatrix = glm::inverse(entityToWorldMatrix);
glm::vec3 registrationPoint = entity->getRegistrationPoint();
glm::vec3 corner = -(dimensions * registrationPoint);
AABox entityFrameBox(corner, dimensions);
glm::vec3 entityFrameSearchPosition = glm::vec3(worldToEntityMatrix * glm::vec4(position, 1.0f));
if (entityFrameBox.findSpherePenetration(entityFrameSearchPosition, radius, penetration)) {
foundEntities.push_back(entity->getID());
}
}
}
}
});
}
void EntityTreeElement::evalEntitiesInCube(const AACube& cube, PickFilter searchFilter, QVector<QUuid>& foundEntities) const {
forEachEntity([&](EntityItemPointer entity) {
if (!checkFilterSettings(entity, searchFilter)) {
......
......@@ -278,7 +278,6 @@ enum class EntityVersion : PacketVersion {
TextEntityFonts,
ScriptServerKinematicMotion,
ZoneCullingMode, // caitlyn
CustomTags, // caitlyn
EntityPriority, // caitlyn
ModelBlendshapes, // hifiexperiments
CloneGrabbable, // maki
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment