Merge pull request #11659 from zfox23/mergeRC57IntoMaster_20171023

2017-10-23: Merge RC57 into Master
This commit is contained in:
Brad Hefta-Gaub 2017-10-24 21:19:01 -07:00 committed by GitHub
commit 18a74cea91
16 changed files with 217 additions and 198 deletions

View file

@ -39,7 +39,8 @@ Rectangle {
property bool itemIsJson: true; property bool itemIsJson: true;
property bool shouldBuyWithControlledFailure: false; property bool shouldBuyWithControlledFailure: false;
property bool debugCheckoutSuccess: false; property bool debugCheckoutSuccess: false;
property bool canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified; property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified();
property bool isWearable;
// Style // Style
color: hifi.colors.white; color: hifi.colors.white;
Hifi.QmlCommerce { Hifi.QmlCommerce {
@ -80,6 +81,7 @@ Rectangle {
root.activeView = "checkoutFailure"; root.activeView = "checkoutFailure";
} else { } else {
root.itemHref = result.data.download_url; root.itemHref = result.data.download_url;
root.isWearable = result.data.categories.indexOf("Wearables") > -1;
root.activeView = "checkoutSuccess"; root.activeView = "checkoutSuccess";
} }
} }
@ -592,7 +594,7 @@ Rectangle {
height: 50; height: 50;
anchors.left: parent.left; anchors.left: parent.left;
anchors.right: parent.right; anchors.right: parent.right;
text: "Rez It" text: root.isWearable ? "Wear It" : "Rez It"
onClicked: { onClicked: {
if (urlHandler.canHandleUrl(root.itemHref)) { if (urlHandler.canHandleUrl(root.itemHref)) {
urlHandler.handleUrl(root.itemHref); urlHandler.handleUrl(root.itemHref);
@ -603,7 +605,7 @@ Rectangle {
} }
RalewaySemiBold { RalewaySemiBold {
id: noPermissionText; id: noPermissionText;
visible: !root.canRezCertifiedItems; visible: !root.canRezCertifiedItems && !root.isWearable;
text: '<font color="' + hifi.colors.redAccent + '"><a href="#">You do not have Certified Rez permissions in this domain.</a></font>' text: '<font color="' + hifi.colors.redAccent + '"><a href="#">You do not have Certified Rez permissions in this domain.</a></font>'
// Text size // Text size
size: 16; size: 16;

View file

@ -39,6 +39,7 @@ Item {
property int itemEdition; property int itemEdition;
property int numberSold; property int numberSold;
property int limitedRun; property int limitedRun;
property bool isWearable;
property string originalStatusText; property string originalStatusText;
property string originalStatusColor; property string originalStatusColor;
@ -342,7 +343,7 @@ Item {
anchors.bottom: parent.bottom; anchors.bottom: parent.bottom;
anchors.right: parent.right; anchors.right: parent.right;
width: height; width: height;
enabled: root.canRezCertifiedItems && root.purchaseStatus !== "invalidated"; enabled: (root.canRezCertifiedItems || root.isWearable) && root.purchaseStatus !== "invalidated";
onClicked: { onClicked: {
if (urlHandler.canHandleUrl(root.itemHref)) { if (urlHandler.canHandleUrl(root.itemHref)) {
@ -415,7 +416,7 @@ Item {
size: 16; size: 16;
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: "Rez It" text: root.isWearable ? "Wear It" : "Rez It"
} }
} }
} }

View file

@ -32,7 +32,7 @@ Rectangle {
property bool securityImageResultReceived: false; property bool securityImageResultReceived: false;
property bool purchasesReceived: false; property bool purchasesReceived: false;
property bool punctuationMode: false; property bool punctuationMode: false;
property bool canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified; property bool canRezCertifiedItems: Entities.canRezCertified() || Entities.canRezTmpCertified();
property bool pendingInventoryReply: true; property bool pendingInventoryReply: true;
property bool isShowingMyItems: false; property bool isShowingMyItems: false;
property bool isDebuggingFirstUseTutorial: false; property bool isDebuggingFirstUseTutorial: false;
@ -434,6 +434,7 @@ Rectangle {
numberSold: model.number_sold; numberSold: model.number_sold;
limitedRun: model.limited_run; limitedRun: model.limited_run;
displayedItemCount: model.displayedItemCount; displayedItemCount: model.displayedItemCount;
isWearable: model.categories.indexOf("Wearables") > -1;
anchors.topMargin: 12; anchors.topMargin: 12;
anchors.bottomMargin: 12; anchors.bottomMargin: 12;
@ -582,9 +583,11 @@ Rectangle {
Timer { Timer {
id: inventoryTimer; id: inventoryTimer;
interval: 90000; interval: 4000; // Change this back to 90000 after demo
//interval: 90000;
onTriggered: { onTriggered: {
if (root.activeView === "purchasesMain" && !root.pendingInventoryReply) { if (root.activeView === "purchasesMain" && !root.pendingInventoryReply) {
console.log("Refreshing Purchases...");
root.pendingInventoryReply = true; root.pendingInventoryReply = true;
commerce.inventory(); commerce.inventory();
} }
@ -660,6 +663,8 @@ Rectangle {
currentPurchasesModelStatus !== previousPurchasesModelStatus) { currentPurchasesModelStatus !== previousPurchasesModelStatus) {
purchasesModel.setProperty(i, "statusChanged", true); purchasesModel.setProperty(i, "statusChanged", true);
} else {
purchasesModel.setProperty(i, "statusChanged", false);
} }
} }
} }

View file

@ -43,6 +43,7 @@ Item {
calculatePendingAndInvalidated(); calculatePendingAndInvalidated();
} }
refreshTimer.start();
} }
} }
@ -117,6 +118,8 @@ Item {
historyReceived = false; historyReceived = false;
commerce.balance(); commerce.balance();
commerce.history(); commerce.history();
} else {
refreshTimer.stop();
} }
} }
} }
@ -138,6 +141,17 @@ Item {
} }
} }
Timer {
id: refreshTimer;
interval: 4000; // Remove this after demo?
onTriggered: {
console.log("Refreshing Wallet Home...");
historyReceived = false;
commerce.balance();
commerce.history();
}
}
// Recent Activity // Recent Activity
Rectangle { Rectangle {
id: recentActivityContainer; id: recentActivityContainer;

View file

@ -587,14 +587,16 @@ void MyAvatar::simulate(float deltaTime) {
MovingEntitiesOperator moveOperator; MovingEntitiesOperator moveOperator;
forEachDescendant([&](SpatiallyNestablePointer object) { forEachDescendant([&](SpatiallyNestablePointer object) {
// if the queryBox has changed, tell the entity-server // if the queryBox has changed, tell the entity-server
if (object->getNestableType() == NestableType::Entity && object->checkAndMaybeUpdateQueryAACube()) { if (object->getNestableType() == NestableType::Entity && object->updateQueryAACube()) {
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object); EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
bool success; bool success;
AACube newCube = entity->getQueryAACube(success); AACube newCube = entity->getQueryAACube(success);
if (success) { if (success) {
moveOperator.addEntityToMoveList(entity, newCube); moveOperator.addEntityToMoveList(entity, newCube);
} }
if (packetSender) { // send an edit packet to update the entity-server about the queryAABox. If it's an
// avatar-entity, don't.
if (packetSender && !entity->getClientOnly()) {
EntityItemProperties properties = entity->getProperties(); EntityItemProperties properties = entity->getProperties();
properties.setQueryAACubeDirty(); properties.setQueryAACubeDirty();
properties.setLastEdited(now); properties.setLastEdited(now);

View file

@ -140,8 +140,8 @@ bool ContextOverlayInterface::createOrDestroyContextOverlay(const EntityItemID&
if (event.getID() == LEFT_HAND_HW_ID) { if (event.getID() == LEFT_HAND_HW_ID) {
offsetAngle *= -1.0f; offsetAngle *= -1.0f;
} }
contextOverlayPosition = (glm::quat(glm::radians(glm::vec3(0.0f, offsetAngle, 0.0f)))) * contextOverlayPosition = cameraPosition +
((cameraPosition + direction * (distance - CONTEXT_OVERLAY_OFFSET_DISTANCE))); (glm::quat(glm::radians(glm::vec3(0.0f, offsetAngle, 0.0f)))) * (direction * (distance - CONTEXT_OVERLAY_OFFSET_DISTANCE));
contextOverlayDimensions = glm::vec2(CONTEXT_OVERLAY_SIZE, CONTEXT_OVERLAY_SIZE) * glm::distance(contextOverlayPosition, cameraPosition); contextOverlayDimensions = glm::vec2(CONTEXT_OVERLAY_SIZE, CONTEXT_OVERLAY_SIZE) * glm::distance(contextOverlayPosition, cameraPosition);
} }

View file

@ -69,8 +69,8 @@ ParticleEffectEntityRenderer::ParticleEffectEntityRenderer(const EntityItemPoint
} }
bool ParticleEffectEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const { bool ParticleEffectEntityRenderer::needsRenderUpdateFromTypedEntity(const TypedEntityPointer& entity) const {
entity->checkAndMaybeUpdateQueryAACube(); entity->updateQueryAACube();
if (_emitting != entity->getIsEmitting()) { if (_emitting != entity->getIsEmitting()) {
return true; return true;
} }

View file

@ -43,7 +43,7 @@ int EntityItem::_maxActionsDataSize = 800;
quint64 EntityItem::_rememberDeletedActionTime = 20 * USECS_PER_SECOND; quint64 EntityItem::_rememberDeletedActionTime = 20 * USECS_PER_SECOND;
EntityItem::EntityItem(const EntityItemID& entityItemID) : EntityItem::EntityItem(const EntityItemID& entityItemID) :
SpatiallyNestable(NestableType::Entity, entityItemID) SpatiallyNestable(NestableType::Entity, entityItemID)
{ {
setLocalVelocity(ENTITY_ITEM_DEFAULT_VELOCITY); setLocalVelocity(ENTITY_ITEM_DEFAULT_VELOCITY);
setLocalAngularVelocity(ENTITY_ITEM_DEFAULT_ANGULAR_VELOCITY); setLocalAngularVelocity(ENTITY_ITEM_DEFAULT_ANGULAR_VELOCITY);
@ -707,9 +707,17 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
weOwnSimulation = _simulationOwner.matchesValidID(myNodeID); weOwnSimulation = _simulationOwner.matchesValidID(myNodeID);
} }
} }
auto lastEdited = lastEditedFromBufferAdjusted;
bool otherOverwrites = overwriteLocalData && !weOwnSimulation;
auto shouldUpdate = [lastEdited, otherOverwrites, filterRejection](quint64 updatedTimestamp, bool valueChanged) {
bool simulationChanged = lastEdited > updatedTimestamp;
return otherOverwrites && simulationChanged && (valueChanged || filterRejection);
};
{ // When we own the simulation we don't accept updates to the entity's transform/velocities { // 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 // 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 // as a packet we've already recieved. This is because we want multiple edits of the same
// information to be idempotent, but if we applied new physics properties we'd resimulation // information to be idempotent, but if we applied new physics properties we'd resimulation
// with small differences in results. // with small differences in results.
@ -717,17 +725,11 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
// made these lambdas that can access other details about the previous updates to suppress // made these lambdas that can access other details about the previous updates to suppress
// any duplicates. // any duplicates.
// Note: duplicate packets are expected and not wrong. They may be sent for any number of // Note: duplicate packets are expected and not wrong. They may be sent for any number of
// reasons and the contract is that the client handles them in an idempotent manner. // reasons and the contract is that the client handles them in an idempotent manner.
auto lastEdited = lastEditedFromBufferAdjusted;
bool otherOverwrites = overwriteLocalData && !weOwnSimulation;
auto shouldUpdate = [lastEdited, otherOverwrites, filterRejection](quint64 updatedTimestamp, bool valueChanged) {
bool simulationChanged = lastEdited > updatedTimestamp;
return otherOverwrites && simulationChanged && (valueChanged || filterRejection);
};
auto customUpdatePositionFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){ auto customUpdatePositionFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){
if (shouldUpdate(_lastUpdatedPositionTimestamp, value != _lastUpdatedPositionValue)) { if (shouldUpdate(_lastUpdatedPositionTimestamp, value != _lastUpdatedPositionValue)) {
updatePositionFromNetwork(value); updatePosition(value);
_lastUpdatedPositionTimestamp = lastEdited; _lastUpdatedPositionTimestamp = lastEdited;
_lastUpdatedPositionValue = value; _lastUpdatedPositionValue = value;
} }
@ -735,7 +737,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
auto customUpdateRotationFromNetwork = [this, shouldUpdate, lastEdited](glm::quat value){ auto customUpdateRotationFromNetwork = [this, shouldUpdate, lastEdited](glm::quat value){
if (shouldUpdate(_lastUpdatedRotationTimestamp, value != _lastUpdatedRotationValue)) { if (shouldUpdate(_lastUpdatedRotationTimestamp, value != _lastUpdatedRotationValue)) {
updateRotationFromNetwork(value); updateRotation(value);
_lastUpdatedRotationTimestamp = lastEdited; _lastUpdatedRotationTimestamp = lastEdited;
_lastUpdatedRotationValue = value; _lastUpdatedRotationValue = value;
} }
@ -743,7 +745,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
auto customUpdateVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){ auto customUpdateVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){
if (shouldUpdate(_lastUpdatedVelocityTimestamp, value != _lastUpdatedVelocityValue)) { if (shouldUpdate(_lastUpdatedVelocityTimestamp, value != _lastUpdatedVelocityValue)) {
updateVelocityFromNetwork(value); updateVelocity(value);
_lastUpdatedVelocityTimestamp = lastEdited; _lastUpdatedVelocityTimestamp = lastEdited;
_lastUpdatedVelocityValue = value; _lastUpdatedVelocityValue = value;
} }
@ -751,7 +753,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
auto customUpdateAngularVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){ auto customUpdateAngularVelocityFromNetwork = [this, shouldUpdate, lastEdited](glm::vec3 value){
if (shouldUpdate(_lastUpdatedAngularVelocityTimestamp, value != _lastUpdatedAngularVelocityValue)) { if (shouldUpdate(_lastUpdatedAngularVelocityTimestamp, value != _lastUpdatedAngularVelocityValue)) {
updateAngularVelocityFromNetwork(value); updateAngularVelocity(value);
_lastUpdatedAngularVelocityTimestamp = lastEdited; _lastUpdatedAngularVelocityTimestamp = lastEdited;
_lastUpdatedAngularVelocityValue = value; _lastUpdatedAngularVelocityValue = value;
} }
@ -770,8 +772,6 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
READ_ENTITY_PROPERTY(PROP_VELOCITY, glm::vec3, customUpdateVelocityFromNetwork); READ_ENTITY_PROPERTY(PROP_VELOCITY, glm::vec3, customUpdateVelocityFromNetwork);
READ_ENTITY_PROPERTY(PROP_ANGULAR_VELOCITY, glm::vec3, customUpdateAngularVelocityFromNetwork); READ_ENTITY_PROPERTY(PROP_ANGULAR_VELOCITY, glm::vec3, customUpdateAngularVelocityFromNetwork);
READ_ENTITY_PROPERTY(PROP_ACCELERATION, glm::vec3, customSetAcceleration); READ_ENTITY_PROPERTY(PROP_ACCELERATION, glm::vec3, customSetAcceleration);
} }
READ_ENTITY_PROPERTY(PROP_DIMENSIONS, glm::vec3, updateDimensions); READ_ENTITY_PROPERTY(PROP_DIMENSIONS, glm::vec3, updateDimensions);
@ -832,7 +832,18 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
overwriteLocalData = oldOverwrite; overwriteLocalData = oldOverwrite;
} }
READ_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, AACube, setQueryAACube);
{
auto customUpdateQueryAACubeFromNetwork = [this, shouldUpdate, lastEdited](AACube value){
if (shouldUpdate(_lastUpdatedQueryAACubeTimestamp, value != _lastUpdatedQueryAACubeValue)) {
setQueryAACube(value);
_lastUpdatedQueryAACubeTimestamp = lastEdited;
_lastUpdatedQueryAACubeValue = value;
}
};
READ_ENTITY_PROPERTY(PROP_QUERY_AA_CUBE, AACube, customUpdateQueryAACubeFromNetwork);
}
READ_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy); READ_ENTITY_PROPERTY(PROP_LAST_EDITED_BY, QUuid, setLastEditedBy);
bytesRead += readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, bytesRead += readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
@ -1363,8 +1374,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(lastEditedBy, setLastEditedBy); SET_ENTITY_PROPERTY_FROM_PROPERTIES(lastEditedBy, setLastEditedBy);
AACube saveQueryAACube = _queryAACube; if (updateQueryAACube()) {
if (checkAndMaybeUpdateQueryAACube() && saveQueryAACube != _queryAACube) {
somethingChanged = true; somethingChanged = true;
} }
@ -1528,6 +1538,9 @@ AACube EntityItem::getQueryAACube(bool& success) const {
return result; return result;
} }
bool EntityItem::shouldPuffQueryAACube() const {
return hasActions() || isChildOfMyAvatar() || isMovingRelativeToParent();
}
// NOTE: This should only be used in cases of old bitstreams which only contain radius data // NOTE: This should only be used in cases of old bitstreams which only contain radius data
// 0,0,0 --> maxDimension,maxDimension,maxDimension // 0,0,0 --> maxDimension,maxDimension,maxDimension
@ -1641,7 +1654,7 @@ bool EntityItem::verifyStaticCertificateProperties() {
const auto hash = getStaticCertificateHash(); const auto hash = getStaticCertificateHash();
const auto text = reinterpret_cast<const unsigned char*>(hash.constData()); const auto text = reinterpret_cast<const unsigned char*>(hash.constData());
const unsigned int textLength = hash.length(); const unsigned int textLength = hash.length();
// After DEBUG_CERT ends, we will get/cache this once from the marketplace when needed, and it likely won't be RSA. // After DEBUG_CERT ends, we will get/cache this once from the marketplace when needed, and it likely won't be RSA.
const char publicKey[] = "-----BEGIN PUBLIC KEY-----\n\ const char publicKey[] = "-----BEGIN PUBLIC KEY-----\n\
MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALCoBiDAZOClO26tC5pd7JikBL61WIgp\n\ MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBALCoBiDAZOClO26tC5pd7JikBL61WIgp\n\
@ -1732,16 +1745,10 @@ void EntityItem::updateParentID(const QUuid& value) {
if (tree) { if (tree) {
tree->addToNeedsParentFixupList(getThisPointer()); tree->addToNeedsParentFixupList(getThisPointer());
} }
updateQueryAACube();
} }
} }
void EntityItem::updatePositionFromNetwork(const glm::vec3& value) {
if (shouldSuppressLocationEdits()) {
return;
}
updatePosition(value);
}
void EntityItem::updateDimensions(const glm::vec3& value) { void EntityItem::updateDimensions(const glm::vec3& value) {
if (getDimensions() != value) { if (getDimensions() != value) {
setDimensions(value); setDimensions(value);
@ -1764,13 +1771,6 @@ void EntityItem::updateRotation(const glm::quat& rotation) {
} }
} }
void EntityItem::updateRotationFromNetwork(const glm::quat& rotation) {
if (shouldSuppressLocationEdits()) {
return;
}
updateRotation(rotation);
}
void EntityItem::updateMass(float mass) { void EntityItem::updateMass(float mass) {
// Setting the mass actually changes the _density (at fixed volume), however // Setting the mass actually changes the _density (at fixed volume), however
// we must protect the density range to help maintain stability of physics simulation // we must protect the density range to help maintain stability of physics simulation
@ -1821,13 +1821,6 @@ void EntityItem::updateVelocity(const glm::vec3& value) {
} }
} }
void EntityItem::updateVelocityFromNetwork(const glm::vec3& value) {
if (shouldSuppressLocationEdits()) {
return;
}
updateVelocity(value);
}
void EntityItem::updateDamping(float value) { void EntityItem::updateDamping(float value) {
auto clampedDamping = glm::clamp(value, 0.0f, 1.0f); auto clampedDamping = glm::clamp(value, 0.0f, 1.0f);
if (_damping != clampedDamping) { if (_damping != clampedDamping) {
@ -1879,13 +1872,6 @@ void EntityItem::updateAngularVelocity(const glm::vec3& value) {
} }
} }
void EntityItem::updateAngularVelocityFromNetwork(const glm::vec3& value) {
if (shouldSuppressLocationEdits()) {
return;
}
updateAngularVelocity(value);
}
void EntityItem::updateAngularDamping(float value) { void EntityItem::updateAngularDamping(float value) {
auto clampedDamping = glm::clamp(value, 0.0f, 1.0f); auto clampedDamping = glm::clamp(value, 0.0f, 1.0f);
if (_angularDamping != clampedDamping) { if (_angularDamping != clampedDamping) {
@ -1998,9 +1984,7 @@ void EntityItem::computeCollisionGroupAndFinalMask(int16_t& group, int16_t& mask
// if this entity is a descendant of MyAvatar, don't collide with MyAvatar. This avoids the // if this entity is a descendant of MyAvatar, don't collide with MyAvatar. This avoids the
// "bootstrapping" problem where you can shoot yourself across the room by grabbing something // "bootstrapping" problem where you can shoot yourself across the room by grabbing something
// and holding it against your own avatar. // and holding it against your own avatar.
QUuid ancestorID = findAncestorOfType(NestableType::Avatar); if (isChildOfMyAvatar()) {
if (!ancestorID.isNull() &&
(ancestorID == Physics::getSessionUUID() || ancestorID == AVATAR_SELF_ID)) {
iAmHoldingThis = true; iAmHoldingThis = true;
} }
// also, don't bootstrap our own avatar with a hold action // also, don't bootstrap our own avatar with a hold action
@ -2107,6 +2091,7 @@ bool EntityItem::addAction(EntitySimulationPointer simulation, EntityDynamicPoin
removeActionInternal(action->getID()); removeActionInternal(action->getID());
} }
}); });
updateQueryAACube();
return result; return result;
} }
@ -2165,6 +2150,8 @@ bool EntityItem::removeAction(EntitySimulationPointer simulation, const QUuid& a
checkWaitingToRemove(simulation); checkWaitingToRemove(simulation);
success = removeActionInternal(actionID); success = removeActionInternal(actionID);
}); });
updateQueryAACube();
return success; return success;
} }
@ -2407,6 +2394,7 @@ QVariantMap EntityItem::getActionArguments(const QUuid& actionID) const {
} }
bool EntityItem::shouldSuppressLocationEdits() const { bool EntityItem::shouldSuppressLocationEdits() const {
// if any of the actions indicate they'd like suppression, suppress
QHash<QUuid, EntityDynamicPointer>::const_iterator i = _objectActions.begin(); QHash<QUuid, EntityDynamicPointer>::const_iterator i = _objectActions.begin();
while (i != _objectActions.end()) { while (i != _objectActions.end()) {
if (i.value()->shouldSuppressLocationEdits()) { if (i.value()->shouldSuppressLocationEdits()) {
@ -2415,6 +2403,11 @@ bool EntityItem::shouldSuppressLocationEdits() const {
i++; i++;
} }
// if any of the ancestors are MyAvatar, suppress
if (isChildOfMyAvatar()) {
return true;
}
return false; return false;
} }
@ -2477,16 +2470,16 @@ void EntityItem::globalizeProperties(EntityItemProperties& properties, const QSt
bool EntityItem::matchesJSONFilters(const QJsonObject& jsonFilters) const { bool EntityItem::matchesJSONFilters(const QJsonObject& jsonFilters) const {
// The intention for the query JSON filter and this method is to be flexible to handle a variety of filters for // The intention for the query JSON filter and this method is to be flexible to handle a variety of filters for
// ALL entity properties. Some work will need to be done to the property system so that it can be more flexible // ALL entity properties. Some work will need to be done to the property system so that it can be more flexible
// (to grab the value and default value of a property given the string representation of that property, for example) // (to grab the value and default value of a property given the string representation of that property, for example)
// currently the only property filter we handle is '+' for serverScripts // currently the only property filter we handle is '+' for serverScripts
// which means that we only handle a filtered query asking for entities where the serverScripts property is non-default // which means that we only handle a filtered query asking for entities where the serverScripts property is non-default
static const QString SERVER_SCRIPTS_PROPERTY = "serverScripts"; static const QString SERVER_SCRIPTS_PROPERTY = "serverScripts";
foreach(const auto& property, jsonFilters.keys()) { foreach(const auto& property, jsonFilters.keys()) {
if (property == SERVER_SCRIPTS_PROPERTY && jsonFilters[property] == EntityQueryFilterSymbol::NonDefault) { if (property == SERVER_SCRIPTS_PROPERTY && jsonFilters[property] == EntityQueryFilterSymbol::NonDefault) {
// check if this entity has a non-default value for serverScripts // check if this entity has a non-default value for serverScripts
@ -2497,7 +2490,7 @@ bool EntityItem::matchesJSONFilters(const QJsonObject& jsonFilters) const {
} }
} }
} }
// the json filter syntax did not match what we expected, return a match // the json filter syntax did not match what we expected, return a match
return true; return true;
} }
@ -2510,7 +2503,7 @@ quint64 EntityItem::getLastSimulated() const {
return result; return result;
} }
void EntityItem::setLastSimulated(quint64 now) { void EntityItem::setLastSimulated(quint64 now) {
withWriteLock([&] { withWriteLock([&] {
_lastSimulated = now; _lastSimulated = now;
}); });
@ -2531,7 +2524,7 @@ void EntityItem::setLastEdited(quint64 lastEdited) {
}); });
} }
quint64 EntityItem::getLastBroadcast() const { quint64 EntityItem::getLastBroadcast() const {
quint64 result; quint64 result;
withReadLock([&] { withReadLock([&] {
result = _lastBroadcast; result = _lastBroadcast;
@ -2539,19 +2532,19 @@ quint64 EntityItem::getLastBroadcast() const {
return result; return result;
} }
void EntityItem::setLastBroadcast(quint64 lastBroadcast) { void EntityItem::setLastBroadcast(quint64 lastBroadcast) {
withWriteLock([&] { withWriteLock([&] {
_lastBroadcast = lastBroadcast; _lastBroadcast = lastBroadcast;
}); });
} }
void EntityItem::markAsChangedOnServer() { void EntityItem::markAsChangedOnServer() {
withWriteLock([&] { withWriteLock([&] {
_changedOnServer = usecTimestampNow(); _changedOnServer = usecTimestampNow();
}); });
} }
quint64 EntityItem::getLastChangedOnServer() const { quint64 EntityItem::getLastChangedOnServer() const {
quint64 result; quint64 result;
withReadLock([&] { withReadLock([&] {
result = _changedOnServer; result = _changedOnServer;
@ -2559,13 +2552,13 @@ quint64 EntityItem::getLastChangedOnServer() const {
return result; return result;
} }
void EntityItem::update(const quint64& now) { void EntityItem::update(const quint64& now) {
withWriteLock([&] { withWriteLock([&] {
_lastUpdated = now; _lastUpdated = now;
}); });
} }
quint64 EntityItem::getLastUpdated() const { quint64 EntityItem::getLastUpdated() const {
quint64 result; quint64 result;
withReadLock([&] { withReadLock([&] {
result = _lastUpdated; result = _lastUpdated;
@ -2573,10 +2566,10 @@ quint64 EntityItem::getLastUpdated() const {
return result; return result;
} }
void EntityItem::requiresRecalcBoxes() { void EntityItem::requiresRecalcBoxes() {
withWriteLock([&] { withWriteLock([&] {
_recalcAABox = true; _recalcAABox = true;
_recalcMinAACube = true; _recalcMinAACube = true;
_recalcMaxAACube = true; _recalcMaxAACube = true;
}); });
} }
@ -2589,7 +2582,7 @@ QString EntityItem::getHref() const {
return result; return result;
} }
QString EntityItem::getDescription() const { QString EntityItem::getDescription() const {
QString result; QString result;
withReadLock([&] { withReadLock([&] {
result = _description; result = _description;
@ -2611,54 +2604,54 @@ float EntityItem::getLocalRenderAlpha() const {
return result; return result;
} }
void EntityItem::setLocalRenderAlpha(float localRenderAlpha) { void EntityItem::setLocalRenderAlpha(float localRenderAlpha) {
withWriteLock([&] { withWriteLock([&] {
_localRenderAlpha = localRenderAlpha; _localRenderAlpha = localRenderAlpha;
}); });
} }
glm::vec3 EntityItem::getGravity() const { glm::vec3 EntityItem::getGravity() const {
glm::vec3 result; glm::vec3 result;
withReadLock([&] { withReadLock([&] {
result = _gravity; result = _gravity;
}); });
return result; return result;
} }
void EntityItem::setGravity(const glm::vec3& value) { void EntityItem::setGravity(const glm::vec3& value) {
withWriteLock([&] { withWriteLock([&] {
_gravity = value; _gravity = value;
}); });
} }
glm::vec3 EntityItem::getAcceleration() const { glm::vec3 EntityItem::getAcceleration() const {
glm::vec3 result; glm::vec3 result;
withReadLock([&] { withReadLock([&] {
result = _acceleration; result = _acceleration;
}); });
return result; return result;
} }
void EntityItem::setAcceleration(const glm::vec3& value) { void EntityItem::setAcceleration(const glm::vec3& value) {
withWriteLock([&] { withWriteLock([&] {
_acceleration = value; _acceleration = value;
}); });
} }
float EntityItem::getDamping() const { float EntityItem::getDamping() const {
float result; float result;
withReadLock([&] { withReadLock([&] {
result = _damping; result = _damping;
}); });
return result; return result;
} }
void EntityItem::setDamping(float value) { void EntityItem::setDamping(float value) {
withWriteLock([&] { withWriteLock([&] {
_damping = value; _damping = value;
}); });
} }
float EntityItem::getRestitution() const { float EntityItem::getRestitution() const {
float result; float result;
withReadLock([&] { withReadLock([&] {
result = _restitution; result = _restitution;
@ -2666,7 +2659,7 @@ float EntityItem::getRestitution() const {
return result; return result;
} }
float EntityItem::getFriction() const { float EntityItem::getFriction() const {
float result; float result;
withReadLock([&] { withReadLock([&] {
result = _friction; result = _friction;
@ -2675,35 +2668,35 @@ float EntityItem::getFriction() const {
} }
// lifetime related properties. // lifetime related properties.
float EntityItem::getLifetime() const { float EntityItem::getLifetime() const {
float result; float result;
withReadLock([&] { withReadLock([&] {
result = _lifetime; result = _lifetime;
}); });
return result; return result;
} }
void EntityItem::setLifetime(float value) { void EntityItem::setLifetime(float value) {
withWriteLock([&] { withWriteLock([&] {
_lifetime = value; _lifetime = value;
}); });
} }
quint64 EntityItem::getCreated() const { quint64 EntityItem::getCreated() const {
quint64 result; quint64 result;
withReadLock([&] { withReadLock([&] {
result = _created; result = _created;
}); });
return result; return result;
} }
void EntityItem::setCreated(quint64 value) { void EntityItem::setCreated(quint64 value) {
withWriteLock([&] { withWriteLock([&] {
_created = value; _created = value;
}); });
} }
QString EntityItem::getScript() const { QString EntityItem::getScript() const {
QString result; QString result;
withReadLock([&] { withReadLock([&] {
result = _script; result = _script;
@ -2711,13 +2704,13 @@ QString EntityItem::getScript() const {
return result; return result;
} }
void EntityItem::setScript(const QString& value) { void EntityItem::setScript(const QString& value) {
withWriteLock([&] { withWriteLock([&] {
_script = value; _script = value;
}); });
} }
quint64 EntityItem::getScriptTimestamp() const { quint64 EntityItem::getScriptTimestamp() const {
quint64 result; quint64 result;
withReadLock([&] { withReadLock([&] {
result = _scriptTimestamp; result = _scriptTimestamp;
@ -2725,13 +2718,13 @@ quint64 EntityItem::getScriptTimestamp() const {
return result; return result;
} }
void EntityItem::setScriptTimestamp(const quint64 value) { void EntityItem::setScriptTimestamp(const quint64 value) {
withWriteLock([&] { withWriteLock([&] {
_scriptTimestamp = value; _scriptTimestamp = value;
}); });
} }
QString EntityItem::getServerScripts() const { QString EntityItem::getServerScripts() const {
QString result; QString result;
withReadLock([&] { withReadLock([&] {
result = _serverScripts; result = _serverScripts;
@ -2741,12 +2734,12 @@ QString EntityItem::getServerScripts() const {
void EntityItem::setServerScripts(const QString& serverScripts) { void EntityItem::setServerScripts(const QString& serverScripts) {
withWriteLock([&] { withWriteLock([&] {
_serverScripts = serverScripts; _serverScripts = serverScripts;
_serverScriptsChangedTimestamp = usecTimestampNow(); _serverScriptsChangedTimestamp = usecTimestampNow();
}); });
} }
QString EntityItem::getCollisionSoundURL() const { QString EntityItem::getCollisionSoundURL() const {
QString result; QString result;
withReadLock([&] { withReadLock([&] {
result = _collisionSoundURL; result = _collisionSoundURL;
@ -2754,22 +2747,22 @@ QString EntityItem::getCollisionSoundURL() const {
return result; return result;
} }
glm::vec3 EntityItem::getRegistrationPoint() const { glm::vec3 EntityItem::getRegistrationPoint() const {
glm::vec3 result; glm::vec3 result;
withReadLock([&] { withReadLock([&] {
result = _registrationPoint; result = _registrationPoint;
}); });
return result; return result;
} }
void EntityItem::setRegistrationPoint(const glm::vec3& value) { void EntityItem::setRegistrationPoint(const glm::vec3& value) {
withWriteLock([&] { withWriteLock([&] {
_registrationPoint = glm::clamp(value, 0.0f, 1.0f); _registrationPoint = glm::clamp(value, 0.0f, 1.0f);
}); });
dimensionsChanged(); // Registration Point affects the bounding box dimensionsChanged(); // Registration Point affects the bounding box
} }
float EntityItem::getAngularDamping() const { float EntityItem::getAngularDamping() const {
float result; float result;
withReadLock([&] { withReadLock([&] {
result = _angularDamping; result = _angularDamping;
@ -2777,13 +2770,13 @@ float EntityItem::getAngularDamping() const {
return result; return result;
} }
void EntityItem::setAngularDamping(float value) { void EntityItem::setAngularDamping(float value) {
withWriteLock([&] { withWriteLock([&] {
_angularDamping = value; _angularDamping = value;
}); });
} }
QString EntityItem::getName() const { QString EntityItem::getName() const {
QString result; QString result;
withReadLock([&] { withReadLock([&] {
result = _name; result = _name;
@ -2791,13 +2784,13 @@ QString EntityItem::getName() const {
return result; return result;
} }
void EntityItem::setName(const QString& value) { void EntityItem::setName(const QString& value) {
withWriteLock([&] { withWriteLock([&] {
_name = value; _name = value;
}); });
} }
QString EntityItem::getDebugName() { QString EntityItem::getDebugName() {
QString result = getName(); QString result = getName();
if (result.isEmpty()) { if (result.isEmpty()) {
result = getID().toString(); result = getID().toString();
@ -2805,7 +2798,7 @@ QString EntityItem::getDebugName() {
return result; return result;
} }
bool EntityItem::getVisible() const { bool EntityItem::getVisible() const {
bool result; bool result;
withReadLock([&] { withReadLock([&] {
result = _visible; result = _visible;
@ -2813,13 +2806,18 @@ bool EntityItem::getVisible() const {
return result; return result;
} }
void EntityItem::setVisible(bool value) { void EntityItem::setVisible(bool value) {
withWriteLock([&] { withWriteLock([&] {
_visible = value; _visible = value;
}); });
} }
bool EntityItem::getCollisionless() const { bool EntityItem::isChildOfMyAvatar() const {
QUuid ancestorID = findAncestorOfType(NestableType::Avatar);
return !ancestorID.isNull() && (ancestorID == Physics::getSessionUUID() || ancestorID == AVATAR_SELF_ID);
}
bool EntityItem::getCollisionless() const {
bool result; bool result;
withReadLock([&] { withReadLock([&] {
result = _collisionless; result = _collisionless;
@ -2827,13 +2825,13 @@ bool EntityItem::getCollisionless() const {
return result; return result;
} }
void EntityItem::setCollisionless(bool value) { void EntityItem::setCollisionless(bool value) {
withWriteLock([&] { withWriteLock([&] {
_collisionless = value; _collisionless = value;
}); });
} }
uint8_t EntityItem::getCollisionMask() const { uint8_t EntityItem::getCollisionMask() const {
uint8_t result; uint8_t result;
withReadLock([&] { withReadLock([&] {
result = _collisionMask; result = _collisionMask;
@ -2841,13 +2839,13 @@ uint8_t EntityItem::getCollisionMask() const {
return result; return result;
} }
void EntityItem::setCollisionMask(uint8_t value) { void EntityItem::setCollisionMask(uint8_t value) {
withWriteLock([&] { withWriteLock([&] {
_collisionMask = value; _collisionMask = value;
}); });
} }
bool EntityItem::getDynamic() const { bool EntityItem::getDynamic() const {
if (SHAPE_TYPE_STATIC_MESH == getShapeType()) { if (SHAPE_TYPE_STATIC_MESH == getShapeType()) {
return false; return false;
} }
@ -2858,13 +2856,13 @@ bool EntityItem::getDynamic() const {
return result; return result;
} }
void EntityItem::setDynamic(bool value) { void EntityItem::setDynamic(bool value) {
withWriteLock([&] { withWriteLock([&] {
_dynamic = value; _dynamic = value;
}); });
} }
bool EntityItem::getLocked() const { bool EntityItem::getLocked() const {
bool result; bool result;
withReadLock([&] { withReadLock([&] {
result = _locked; result = _locked;
@ -2872,7 +2870,7 @@ bool EntityItem::getLocked() const {
return result; return result;
} }
void EntityItem::setLocked(bool value) { void EntityItem::setLocked(bool value) {
withWriteLock([&] { withWriteLock([&] {
_locked = value; _locked = value;
}); });
@ -2895,7 +2893,7 @@ void EntityItem::updateLocked(bool value) {
} }
} }
QString EntityItem::getUserData() const { QString EntityItem::getUserData() const {
QString result; QString result;
withReadLock([&] { withReadLock([&] {
result = _userData; result = _userData;
@ -2903,7 +2901,7 @@ QString EntityItem::getUserData() const {
return result; return result;
} }
void EntityItem::setUserData(const QString& value) { void EntityItem::setUserData(const QString& value) {
withWriteLock([&] { withWriteLock([&] {
_userData = value; _userData = value;
}); });
@ -2937,7 +2935,7 @@ DEFINE_PROPERTY_ACCESSOR(quint32, EditionNumber, editionNumber)
DEFINE_PROPERTY_ACCESSOR(quint32, EntityInstanceNumber, entityInstanceNumber) DEFINE_PROPERTY_ACCESSOR(quint32, EntityInstanceNumber, entityInstanceNumber)
DEFINE_PROPERTY_ACCESSOR(QString, CertificateID, certificateID) DEFINE_PROPERTY_ACCESSOR(QString, CertificateID, certificateID)
uint32_t EntityItem::getDirtyFlags() const { uint32_t EntityItem::getDirtyFlags() const {
uint32_t result; uint32_t result;
withReadLock([&] { withReadLock([&] {
result = _dirtyFlags; result = _dirtyFlags;
@ -2952,7 +2950,7 @@ void EntityItem::markDirtyFlags(uint32_t mask) {
}); });
} }
void EntityItem::clearDirtyFlags(uint32_t mask) { void EntityItem::clearDirtyFlags(uint32_t mask) {
withWriteLock([&] { withWriteLock([&] {
_dirtyFlags &= ~mask; _dirtyFlags &= ~mask;
}); });

View file

@ -240,6 +240,7 @@ public:
using SpatiallyNestable::getQueryAACube; using SpatiallyNestable::getQueryAACube;
virtual AACube getQueryAACube(bool& success) const override; virtual AACube getQueryAACube(bool& success) const override;
virtual bool shouldPuffQueryAACube() const override;
QString getScript() const; QString getScript() const;
void setScript(const QString& value); void setScript(const QString& value);
@ -273,6 +274,8 @@ public:
inline bool isVisible() const { return getVisible(); } inline bool isVisible() const { return getVisible(); }
inline bool isInvisible() const { return !getVisible(); } inline bool isInvisible() const { return !getVisible(); }
bool isChildOfMyAvatar() const;
bool getCollisionless() const; bool getCollisionless() const;
void setCollisionless(bool value); void setCollisionless(bool value);
@ -354,20 +357,16 @@ public:
virtual void updateRegistrationPoint(const glm::vec3& value); virtual void updateRegistrationPoint(const glm::vec3& value);
void updatePosition(const glm::vec3& value); void updatePosition(const glm::vec3& value);
void updateParentID(const QUuid& value); void updateParentID(const QUuid& value);
void updatePositionFromNetwork(const glm::vec3& value);
void updateDimensions(const glm::vec3& value); void updateDimensions(const glm::vec3& value);
void updateRotation(const glm::quat& rotation); void updateRotation(const glm::quat& rotation);
void updateRotationFromNetwork(const glm::quat& rotation);
void updateDensity(float value); void updateDensity(float value);
void updateMass(float value); void updateMass(float value);
void updateVelocity(const glm::vec3& value); void updateVelocity(const glm::vec3& value);
void updateVelocityFromNetwork(const glm::vec3& value);
void updateDamping(float value); void updateDamping(float value);
void updateRestitution(float value); void updateRestitution(float value);
void updateFriction(float value); void updateFriction(float value);
void updateGravity(const glm::vec3& value); void updateGravity(const glm::vec3& value);
void updateAngularVelocity(const glm::vec3& value); void updateAngularVelocity(const glm::vec3& value);
void updateAngularVelocityFromNetwork(const glm::vec3& value);
void updateAngularDamping(float value); void updateAngularDamping(float value);
void updateCollisionless(bool value); void updateCollisionless(bool value);
void updateCollisionMask(uint8_t value); void updateCollisionMask(uint8_t value);
@ -629,12 +628,14 @@ protected:
glm::vec3 _lastUpdatedVelocityValue; glm::vec3 _lastUpdatedVelocityValue;
glm::vec3 _lastUpdatedAngularVelocityValue; glm::vec3 _lastUpdatedAngularVelocityValue;
glm::vec3 _lastUpdatedAccelerationValue; glm::vec3 _lastUpdatedAccelerationValue;
AACube _lastUpdatedQueryAACubeValue;
quint64 _lastUpdatedPositionTimestamp { 0 }; quint64 _lastUpdatedPositionTimestamp { 0 };
quint64 _lastUpdatedRotationTimestamp { 0 }; quint64 _lastUpdatedRotationTimestamp { 0 };
quint64 _lastUpdatedVelocityTimestamp { 0 }; quint64 _lastUpdatedVelocityTimestamp { 0 };
quint64 _lastUpdatedAngularVelocityTimestamp { 0 }; quint64 _lastUpdatedAngularVelocityTimestamp { 0 };
quint64 _lastUpdatedAccelerationTimestamp { 0 }; quint64 _lastUpdatedAccelerationTimestamp { 0 };
quint64 _lastUpdatedQueryAACubeTimestamp { 0 };
}; };

View file

@ -461,7 +461,7 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, const EntityItemProperties&
// if they've changed. // if they've changed.
entity->forEachDescendant([&](SpatiallyNestablePointer descendant) { entity->forEachDescendant([&](SpatiallyNestablePointer descendant) {
if (descendant->getNestableType() == NestableType::Entity) { if (descendant->getNestableType() == NestableType::Entity) {
if (descendant->checkAndMaybeUpdateQueryAACube()) { if (descendant->updateQueryAACube()) {
EntityItemPointer entityDescendant = std::static_pointer_cast<EntityItem>(descendant); EntityItemPointer entityDescendant = std::static_pointer_cast<EntityItem>(descendant);
EntityItemProperties newQueryCubeProperties; EntityItemProperties newQueryCubeProperties;
newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube()); newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube());
@ -1843,4 +1843,4 @@ QString EntityScriptingInterface::computeCertificateID(const QUuid& entityID) {
} }
return result; return result;
} }
#endif #endif

View file

@ -1029,7 +1029,8 @@ void EntityTree::fixupTerseEditLogging(EntityItemProperties& properties, QList<Q
changedProperties[index] = QString("queryAACube:") + changedProperties[index] = QString("queryAACube:") +
QString::number((int)center.x) + "," + QString::number((int)center.x) + "," +
QString::number((int)center.y) + "," + QString::number((int)center.y) + "," +
QString::number((int)center.z); QString::number((int)center.z) + "/" +
QString::number(properties.getQueryAACube().getDimensions().x);
} }
if (properties.positionChanged()) { if (properties.positionChanged()) {
int index = changedProperties.indexOf("position"); int index = changedProperties.indexOf("position");
@ -1807,7 +1808,7 @@ QVector<EntityItemID> EntityTree::sendEntities(EntityEditPacketSender* packetSen
addToNeedsParentFixupList(entity); addToNeedsParentFixupList(entity);
} }
entity->forceQueryAACubeUpdate(); entity->forceQueryAACubeUpdate();
entity->checkAndMaybeUpdateQueryAACube(); entity->updateQueryAACube();
moveOperator.addEntityToMoveList(entity, entity->getQueryAACube()); moveOperator.addEntityToMoveList(entity, entity->getQueryAACube());
i++; i++;
} else { } else {

View file

@ -136,7 +136,7 @@ void SimpleEntitySimulation::sortEntitiesThatMoved() {
SetOfEntities::iterator itemItr = _entitiesToSort.begin(); SetOfEntities::iterator itemItr = _entitiesToSort.begin();
while (itemItr != _entitiesToSort.end()) { while (itemItr != _entitiesToSort.end()) {
EntityItemPointer entity = *itemItr; EntityItemPointer entity = *itemItr;
entity->checkAndMaybeUpdateQueryAACube(); entity->updateQueryAACube();
++itemItr; ++itemItr;
} }
EntitySimulation::sortEntitiesThatMoved(); EntitySimulation::sortEntitiesThatMoved();

View file

@ -491,6 +491,10 @@ bool EntityMotionState::shouldSendUpdate(uint32_t simulationStep) {
return true; return true;
} }
if (_entity->shouldSuppressLocationEdits()) {
return false;
}
if (!isLocallyOwned()) { if (!isLocallyOwned()) {
// we don't own the simulation // we don't own the simulation
@ -577,7 +581,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
} }
if (properties.transformChanged()) { if (properties.transformChanged()) {
if (_entity->checkAndMaybeUpdateQueryAACube()) { if (_entity->updateQueryAACube()) {
// due to parenting, the server may not know where something is in world-space, so include the bounding cube. // due to parenting, the server may not know where something is in world-space, so include the bounding cube.
properties.setQueryAACube(_entity->getQueryAACube()); properties.setQueryAACube(_entity->getQueryAACube());
} }
@ -644,7 +648,7 @@ void EntityMotionState::sendUpdate(OctreeEditPacketSender* packetSender, uint32_
_entity->forEachDescendant([&](SpatiallyNestablePointer descendant) { _entity->forEachDescendant([&](SpatiallyNestablePointer descendant) {
if (descendant->getNestableType() == NestableType::Entity) { if (descendant->getNestableType() == NestableType::Entity) {
EntityItemPointer entityDescendant = std::static_pointer_cast<EntityItem>(descendant); EntityItemPointer entityDescendant = std::static_pointer_cast<EntityItem>(descendant);
if (descendant->checkAndMaybeUpdateQueryAACube()) { if (descendant->updateQueryAACube()) {
EntityItemProperties newQueryCubeProperties; EntityItemProperties newQueryCubeProperties;
newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube()); newQueryCubeProperties.setQueryAACube(descendant->getQueryAACube());
newQueryCubeProperties.setLastEdited(properties.getLastEdited()); newQueryCubeProperties.setLastEdited(properties.getLastEdited());

View file

@ -963,35 +963,41 @@ AACube SpatiallyNestable::getMaximumAACube(bool& success) const {
const float PARENTED_EXPANSION_FACTOR = 3.0f; const float PARENTED_EXPANSION_FACTOR = 3.0f;
bool SpatiallyNestable::checkAndMaybeUpdateQueryAACube() { bool SpatiallyNestable::updateQueryAACube() {
bool success = false; if (!queryAACubeNeedsUpdate()) {
AACube maxAACube = getMaximumAACube(success); return false;
if (success) {
// maybe update _queryAACube
if (!_queryAACubeSet || (_parentID.isNull() && _children.size() == 0) || !_queryAACube.contains(maxAACube)) {
if (_parentJointIndex != INVALID_JOINT_INDEX || _children.size() > 0 ) {
// make an expanded AACube centered on the object
float scale = PARENTED_EXPANSION_FACTOR * maxAACube.getScale();
_queryAACube = AACube(maxAACube.calcCenter() - glm::vec3(0.5f * scale), scale);
} else {
_queryAACube = maxAACube;
}
forEachDescendant([&](const SpatiallyNestablePointer& descendant) {
bool childSuccess;
AACube descendantAACube = descendant->getQueryAACube(childSuccess);
if (childSuccess) {
if (_queryAACube.contains(descendantAACube)) {
return ;
}
_queryAACube += descendantAACube.getMinimumPoint();
_queryAACube += descendantAACube.getMaximumPoint();
}
});
_queryAACubeSet = true;
}
} }
return success;
bool success;
AACube maxAACube = getMaximumAACube(success);
if (!success) {
return false;
}
if (shouldPuffQueryAACube()) {
// make an expanded AACube centered on the object
float scale = PARENTED_EXPANSION_FACTOR * maxAACube.getScale();
_queryAACube = AACube(maxAACube.calcCenter() - glm::vec3(0.5f * scale), scale);
_queryAACubeIsPuffed = true;
} else {
_queryAACube = maxAACube;
_queryAACubeIsPuffed = false;
}
forEachDescendant([&](const SpatiallyNestablePointer& descendant) {
bool childSuccess;
AACube descendantAACube = descendant->getQueryAACube(childSuccess);
if (childSuccess) {
if (_queryAACube.contains(descendantAACube)) {
return; // from lambda
}
_queryAACube += descendantAACube.getMinimumPoint();
_queryAACube += descendantAACube.getMaximumPoint();
}
});
_queryAACubeSet = true;
return true;
} }
void SpatiallyNestable::setQueryAACube(const AACube& queryAACube) { void SpatiallyNestable::setQueryAACube(const AACube& queryAACube) {
@ -1008,6 +1014,16 @@ bool SpatiallyNestable::queryAACubeNeedsUpdate() const {
return true; return true;
} }
bool success;
AACube maxAACube = getMaximumAACube(success);
if (success && !_queryAACube.contains(maxAACube)) {
return true;
}
if (shouldPuffQueryAACube() != _queryAACubeIsPuffed) {
return true;
}
// make sure children are still in their boxes, also. // make sure children are still in their boxes, also.
bool childNeedsUpdate = false; bool childNeedsUpdate = false;
forEachDescendantTest([&](const SpatiallyNestablePointer& descendant) { forEachDescendantTest([&](const SpatiallyNestablePointer& descendant) {
@ -1021,31 +1037,6 @@ bool SpatiallyNestable::queryAACubeNeedsUpdate() const {
return childNeedsUpdate; return childNeedsUpdate;
} }
void SpatiallyNestable::updateQueryAACube() {
bool success;
AACube maxAACube = getMaximumAACube(success);
if (_parentJointIndex != INVALID_JOINT_INDEX || _children.size() > 0 ) {
// make an expanded AACube centered on the object
float scale = PARENTED_EXPANSION_FACTOR * maxAACube.getScale();
_queryAACube = AACube(maxAACube.calcCenter() - glm::vec3(0.5f * scale), scale);
} else {
_queryAACube = maxAACube;
}
forEachDescendant([&](const SpatiallyNestablePointer& descendant) {
bool success;
AACube descendantAACube = descendant->getQueryAACube(success);
if (success) {
if (_queryAACube.contains(descendantAACube)) {
return;
}
_queryAACube += descendantAACube.getMinimumPoint();
_queryAACube += descendantAACube.getMaximumPoint();
}
});
_queryAACubeSet = true;
}
AACube SpatiallyNestable::getQueryAACube(bool& success) const { AACube SpatiallyNestable::getQueryAACube(bool& success) const {
if (_queryAACubeSet) { if (_queryAACubeSet) {
success = true; success = true;

View file

@ -106,11 +106,11 @@ public:
virtual glm::vec3 getParentAngularVelocity(bool& success) const; virtual glm::vec3 getParentAngularVelocity(bool& success) const;
virtual AACube getMaximumAACube(bool& success) const; virtual AACube getMaximumAACube(bool& success) const;
bool checkAndMaybeUpdateQueryAACube();
void updateQueryAACube();
virtual void setQueryAACube(const AACube& queryAACube); virtual void setQueryAACube(const AACube& queryAACube);
virtual bool queryAACubeNeedsUpdate() const; virtual bool queryAACubeNeedsUpdate() const;
virtual bool shouldPuffQueryAACube() const { return false; }
bool updateQueryAACube();
void forceQueryAACubeUpdate() { _queryAACubeSet = false; } void forceQueryAACubeUpdate() { _queryAACubeSet = false; }
virtual AACube getQueryAACube(bool& success) const; virtual AACube getQueryAACube(bool& success) const;
virtual AACube getQueryAACube() const; virtual AACube getQueryAACube() const;
@ -234,6 +234,7 @@ private:
glm::vec3 _angularVelocity; glm::vec3 _angularVelocity;
mutable bool _parentKnowsMe { false }; mutable bool _parentKnowsMe { false };
bool _isDead { false }; bool _isDead { false };
bool _queryAACubeIsPuffed { false };
}; };

View file

@ -74,8 +74,8 @@
itemName: 'Test Flaregun', itemName: 'Test Flaregun',
itemPrice: (debugError ? 10 : 17), itemPrice: (debugError ? 10 : 17),
itemHref: 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json', itemHref: 'http://mpassets.highfidelity.com/0d90d21c-ce7a-4990-ad18-e9d2cf991027-v1/flaregun.json',
}, categories: ["Wearables", "Miscellaneous"]
canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified }
}); });
} }
} }
@ -115,7 +115,6 @@
if (url === MARKETPLACE_PURCHASES_QML_PATH) { if (url === MARKETPLACE_PURCHASES_QML_PATH) {
tablet.sendToQml({ tablet.sendToQml({
method: 'updatePurchases', method: 'updatePurchases',
canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified,
referrerURL: referrerURL, referrerURL: referrerURL,
filterText: filterText filterText: filterText
}); });
@ -136,9 +135,10 @@
function setCertificateInfo(currentEntityWithContextOverlay, itemCertificateId) { function setCertificateInfo(currentEntityWithContextOverlay, itemCertificateId) {
wireEventBridge(true); wireEventBridge(true);
var certificateId = itemCertificateId || (Entities.getEntityProperties(currentEntityWithContextOverlay, ['certificateID']).certificateID + "\n");
tablet.sendToQml({ tablet.sendToQml({
method: 'inspectionCertificate_setCertificateId', method: 'inspectionCertificate_setCertificateId',
certificateId: itemCertificateId || Entities.getEntityProperties(currentEntityWithContextOverlay, ['certificateID']).certificateID certificateId: certificateId
}); });
} }
@ -203,8 +203,7 @@
tablet.pushOntoStack(MARKETPLACE_CHECKOUT_QML_PATH); tablet.pushOntoStack(MARKETPLACE_CHECKOUT_QML_PATH);
tablet.sendToQml({ tablet.sendToQml({
method: 'updateCheckoutQML', method: 'updateCheckoutQML',
params: parsedJsonMessage, params: parsedJsonMessage
canRezCertifiedItems: Entities.canRezCertified || Entities.canRezTmpCertified
}); });
} else if (parsedJsonMessage.type === "REQUEST_SETTING") { } else if (parsedJsonMessage.type === "REQUEST_SETTING") {
sendCommerceSettings(); sendCommerceSettings();