try, try again

This commit is contained in:
Seth Alves 2016-03-11 16:21:20 -08:00
parent 5f05d576cc
commit 01659cf93b
4 changed files with 5 additions and 43 deletions

View file

@ -74,26 +74,7 @@ void RenderableModelEntityItem::loader() {
void RenderableModelEntityItem::setDimensions(const glm::vec3& value) { void RenderableModelEntityItem::setDimensions(const glm::vec3& value) {
_dimensionsInitialized = true; _dimensionsInitialized = true;
bool success;
AACube queryAACube = getQueryAACube(success);
ModelEntityItem::setDimensions(value); ModelEntityItem::setDimensions(value);
AACube maxAACube = getMaximumAACube(success);
if (!success) {
return;
}
if (!success || !queryAACube.contains(maxAACube)) {
EntityItemProperties properties;
properties.setQueryAACube(maxAACube);
qCDebug(entitiesrenderer) << "Auto-setting queryAACube:" << (!getName().isEmpty() ? getName() : getModelURL());
QMetaObject::invokeMethod(DependencyManager::get<EntityScriptingInterface>().data(), "editEntity",
Qt::QueuedConnection,
Q_ARG(QUuid, getEntityItemID()),
Q_ARG(EntityItemProperties, properties));
}
} }
bool RenderableModelEntityItem::setProperties(const EntityItemProperties& properties) { bool RenderableModelEntityItem::setProperties(const EntityItemProperties& properties) {

View file

@ -1202,27 +1202,6 @@ const Transform EntityItem::getTransformToCenter(bool& success) const {
return result; return result;
} }
// void EntityItem::checkAndAdjustQueryAACube() {
// bool maxAACubeSuccess;
// AACube maxAACube = getMaximumAACube(maxAACubeSuccess);
// if (maxAACubeSuccess) {
// if (!_queryAACubeSet || !_queryAACube.contains(maxAACube)) {
// // allow server to patch up broken queryAACubes
// EntityTreePointer tree = getTree();
// if (tree) {
// EntityItemProperties properties;
// properties.setQueryAACube(maxAACube);
// tree->updateEntity(getID(), properties);
// }
// }
// }
// }
void EntityItem::setParentID(const QUuid& parentID) {
SpatiallyNestable::setParentID(parentID);
}
void EntityItem::setDimensions(const glm::vec3& value) { void EntityItem::setDimensions(const glm::vec3& value) {
if (value.x <= 0.0f || value.y <= 0.0f || value.z <= 0.0f) { if (value.x <= 0.0f || value.y <= 0.0f || value.z <= 0.0f) {
return; return;
@ -1334,6 +1313,7 @@ AACube EntityItem::getQueryAACube(bool& success) const {
return result; return result;
} }
// 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
// ... has a corner to corner distance of glm::length(maxDimension,maxDimension,maxDimension) // ... has a corner to corner distance of glm::length(maxDimension,maxDimension,maxDimension)

View file

@ -179,8 +179,6 @@ public:
QString getDescription() const { return _description; } QString getDescription() const { return _description; }
void setDescription(QString value) { _description = value; } void setDescription(QString value) { _description = value; }
virtual void setParentID(const QUuid& parentID);
/// Dimensions in meters (0.0 - TREE_SCALE) /// Dimensions in meters (0.0 - TREE_SCALE)
inline const glm::vec3 getDimensions() const { return getScale(); } inline const glm::vec3 getDimensions() const { return getScale(); }
virtual void setDimensions(const glm::vec3& value); virtual void setDimensions(const glm::vec3& value);
@ -242,6 +240,7 @@ public:
using SpatiallyNestable::getQueryAACube; using SpatiallyNestable::getQueryAACube;
virtual AACube getQueryAACube(bool& success) const override; virtual AACube getQueryAACube(bool& success) const override;
const QString& getScript() const { return _script; } const QString& getScript() const { return _script; }
void setScript(const QString& value) { _script = value; } void setScript(const QString& value) { _script = value; }

View file

@ -55,6 +55,7 @@ void SpatiallyNestable::setParentID(const QUuid& parentID) {
_parentKnowsMe = false; _parentKnowsMe = false;
} }
}); });
checkAndAdjustQueryAACube();
} }
Transform SpatiallyNestable::getParentTransform(bool& success, int depth) const { Transform SpatiallyNestable::getParentTransform(bool& success, int depth) const {
@ -139,6 +140,7 @@ void SpatiallyNestable::forgetChild(SpatiallyNestablePointer newChild) const {
void SpatiallyNestable::setParentJointIndex(quint16 parentJointIndex) { void SpatiallyNestable::setParentJointIndex(quint16 parentJointIndex) {
_parentJointIndex = parentJointIndex; _parentJointIndex = parentJointIndex;
checkAndAdjustQueryAACube();
} }
glm::vec3 SpatiallyNestable::worldToLocal(const glm::vec3& position, glm::vec3 SpatiallyNestable::worldToLocal(const glm::vec3& position,
@ -776,7 +778,7 @@ void SpatiallyNestable::setQueryAACube(const AACube& queryAACube) {
return; return;
} }
_queryAACube = queryAACube; _queryAACube = queryAACube;
if (_queryAACube.getScale() > 0.0f) { if (queryAACube.getScale() > 0.0f) {
_queryAACubeSet = true; _queryAACubeSet = true;
} }
} }