Merge pull request #14977 from SamGondelman/rot

Case 21354: Add "modelScale" property to fix pal
This commit is contained in:
Shannon Romano 2019-02-22 16:36:17 -08:00 committed by GitHub
commit 5f99158c25
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 69 additions and 24 deletions

View file

@ -311,7 +311,11 @@ EntityItemProperties Overlays::convertOverlayToEntityProperties(QVariantMap& ove
RENAME_PROP(start, position); RENAME_PROP(start, position);
} }
RENAME_PROP(point, position); RENAME_PROP(point, position);
RENAME_PROP(scale, dimensions); if (type != "Model") {
RENAME_PROP(scale, dimensions);
} else {
RENAME_PROP(scale, modelScale);
}
RENAME_PROP(size, dimensions); RENAME_PROP(size, dimensions);
RENAME_PROP(orientation, rotation); RENAME_PROP(orientation, rotation);
RENAME_PROP(localOrientation, localRotation); RENAME_PROP(localOrientation, localRotation);
@ -636,7 +640,11 @@ QVariantMap Overlays::convertEntityToOverlayProperties(const EntityItemPropertie
RENAME_PROP(position, start); RENAME_PROP(position, start);
} }
RENAME_PROP(position, point); RENAME_PROP(position, point);
RENAME_PROP(dimensions, scale); if (type != "Model") {
RENAME_PROP(dimensions, scale);
} else {
RENAME_PROP(modelScale, scale);
}
RENAME_PROP(dimensions, size); RENAME_PROP(dimensions, size);
RENAME_PROP(ignorePickIntersection, ignoreRayIntersection); RENAME_PROP(ignorePickIntersection, ignoreRayIntersection);
@ -1718,7 +1726,8 @@ QVector<QUuid> Overlays::findOverlays(const glm::vec3& center, float radius) {
* *
* @property {Vec3} position - The position of the overlay center. Synonyms: <code>p1</code>, <code>point</code>, and * @property {Vec3} position - The position of the overlay center. Synonyms: <code>p1</code>, <code>point</code>, and
* <code>start</code>. * <code>start</code>.
* @property {Vec3} dimensions - The dimensions of the overlay. Synonyms: <code>scale</code>, <code>size</code>. * @property {Vec3} dimensions - The dimensions of the overlay. Synonyms: <code>size</code>.
* @property {Vec3} scale - The scale factor applied to the model's dimensions.
* @property {Quat} rotation - The orientation of the overlay. Synonym: <code>orientation</code>. * @property {Quat} rotation - The orientation of the overlay. Synonym: <code>orientation</code>.
* @property {Vec3} localPosition - The local position of the overlay relative to its parent if the overlay has a * @property {Vec3} localPosition - The local position of the overlay relative to its parent if the overlay has a
* <code>parentID</code> set, otherwise the same value as <code>position</code>. * <code>parentID</code> set, otherwise the same value as <code>position</code>.

View file

@ -267,7 +267,7 @@ OctreeElement::AppendState EntityItem::appendEntityData(OctreePacketData* packet
APPEND_ENTITY_PROPERTY(PROP_HREF, getHref()); APPEND_ENTITY_PROPERTY(PROP_HREF, getHref());
APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, getDescription()); APPEND_ENTITY_PROPERTY(PROP_DESCRIPTION, getDescription());
APPEND_ENTITY_PROPERTY(PROP_POSITION, getLocalPosition()); APPEND_ENTITY_PROPERTY(PROP_POSITION, getLocalPosition());
APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, getUnscaledDimensions()); APPEND_ENTITY_PROPERTY(PROP_DIMENSIONS, getScaledDimensions());
APPEND_ENTITY_PROPERTY(PROP_ROTATION, getLocalOrientation()); APPEND_ENTITY_PROPERTY(PROP_ROTATION, getLocalOrientation());
APPEND_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, getRegistrationPoint()); APPEND_ENTITY_PROPERTY(PROP_REGISTRATION_POINT, getRegistrationPoint());
APPEND_ENTITY_PROPERTY(PROP_CREATED, getCreated()); APPEND_ENTITY_PROPERTY(PROP_CREATED, getCreated());
@ -819,7 +819,7 @@ int EntityItem::readEntityDataFromBuffer(const unsigned char* data, int bytesLef
}; };
READ_ENTITY_PROPERTY(PROP_POSITION, glm::vec3, customUpdatePositionFromNetwork); READ_ENTITY_PROPERTY(PROP_POSITION, glm::vec3, customUpdatePositionFromNetwork);
} }
READ_ENTITY_PROPERTY(PROP_DIMENSIONS, glm::vec3, setUnscaledDimensions); READ_ENTITY_PROPERTY(PROP_DIMENSIONS, glm::vec3, setScaledDimensions);
{ // See comment above { // See comment above
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)) {
@ -1316,7 +1316,7 @@ EntityItemProperties EntityItem::getProperties(const EntityPropertyFlags& desire
COPY_ENTITY_PROPERTY_TO_PROPERTIES(href, getHref); COPY_ENTITY_PROPERTY_TO_PROPERTIES(href, getHref);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(description, getDescription); COPY_ENTITY_PROPERTY_TO_PROPERTIES(description, getDescription);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(position, getLocalPosition); COPY_ENTITY_PROPERTY_TO_PROPERTIES(position, getLocalPosition);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(dimensions, getUnscaledDimensions); COPY_ENTITY_PROPERTY_TO_PROPERTIES(dimensions, getScaledDimensions);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(rotation, getLocalOrientation); COPY_ENTITY_PROPERTY_TO_PROPERTIES(rotation, getLocalOrientation);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(registrationPoint, getRegistrationPoint); COPY_ENTITY_PROPERTY_TO_PROPERTIES(registrationPoint, getRegistrationPoint);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(created, getCreated); COPY_ENTITY_PROPERTY_TO_PROPERTIES(created, getCreated);
@ -1463,7 +1463,7 @@ bool EntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(href, setHref); SET_ENTITY_PROPERTY_FROM_PROPERTIES(href, setHref);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(description, setDescription); SET_ENTITY_PROPERTY_FROM_PROPERTIES(description, setDescription);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(position, setPosition); SET_ENTITY_PROPERTY_FROM_PROPERTIES(position, setPosition);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(dimensions, setUnscaledDimensions); SET_ENTITY_PROPERTY_FROM_PROPERTIES(dimensions, setScaledDimensions);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(rotation, setRotation); SET_ENTITY_PROPERTY_FROM_PROPERTIES(rotation, setRotation);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(registrationPoint, setRegistrationPoint); SET_ENTITY_PROPERTY_FROM_PROPERTIES(registrationPoint, setRegistrationPoint);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(created, setCreated); SET_ENTITY_PROPERTY_FROM_PROPERTIES(created, setCreated);
@ -1873,7 +1873,7 @@ glm::vec3 EntityItem::getScaledDimensions() const {
void EntityItem::setScaledDimensions(const glm::vec3& value) { void EntityItem::setScaledDimensions(const glm::vec3& value) {
glm::vec3 parentScale = getSNScale(); glm::vec3 parentScale = getSNScale();
setUnscaledDimensions(value * parentScale); setUnscaledDimensions(value / parentScale);
} }
void EntityItem::setUnscaledDimensions(const glm::vec3& value) { void EntityItem::setUnscaledDimensions(const glm::vec3& value) {

View file

@ -580,6 +580,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
// Model // Model
CHECK_PROPERTY_CHANGE(PROP_MODEL_URL, modelURL); CHECK_PROPERTY_CHANGE(PROP_MODEL_URL, modelURL);
CHECK_PROPERTY_CHANGE(PROP_MODEL_SCALE, modelScale);
CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet); CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet);
CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS, jointRotations); CHECK_PROPERTY_CHANGE(PROP_JOINT_ROTATIONS, jointRotations);
CHECK_PROPERTY_CHANGE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet); CHECK_PROPERTY_CHANGE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet);
@ -1012,6 +1013,7 @@ EntityPropertyFlags EntityItemProperties::getChangedProperties() const {
* @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity. When adding an entity, if no <code>dimensions</code> * @property {Vec3} dimensions=0.1,0.1,0.1 - The dimensions of the entity. When adding an entity, if no <code>dimensions</code>
* value is specified then the model is automatically sized to its * value is specified then the model is automatically sized to its
* <code>{@link Entities.EntityProperties|naturalDimensions}</code>. * <code>{@link Entities.EntityProperties|naturalDimensions}</code>.
* @property {Vec3} modelScale - The scale factor applied to the model's dimensions. Deprecated.
* @property {Color} color=255,255,255 - <em>Currently not used.</em> * @property {Color} color=255,255,255 - <em>Currently not used.</em>
* @property {string} modelURL="" - The URL of the FBX of OBJ model. Baked FBX models' URLs end in ".baked.fbx".<br /> * @property {string} modelURL="" - The URL of the FBX of OBJ model. Baked FBX models' URLs end in ".baked.fbx".<br />
* @property {string} textures="" - A JSON string of texture name, URL pairs used when rendering the model in place of the * @property {string} textures="" - A JSON string of texture name, URL pairs used when rendering the model in place of the
@ -1683,6 +1685,7 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_TEXTURES, textures);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_URL, modelURL); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_URL, modelURL);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_MODEL_SCALE, modelScale);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS, jointRotations); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS, jointRotations);
COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet);
@ -2078,6 +2081,7 @@ void EntityItemProperties::copyFromScriptValue(const QScriptValue& object, bool
// Model // Model
COPY_PROPERTY_FROM_QSCRIPTVALUE(modelURL, QString, setModelURL); COPY_PROPERTY_FROM_QSCRIPTVALUE(modelURL, QString, setModelURL);
COPY_PROPERTY_FROM_QSCRIPTVALUE(modelScale, vec3, setModelScale);
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotationsSet, qVectorBool, setJointRotationsSet); COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotationsSet, qVectorBool, setJointRotationsSet);
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotations, qVectorQuat, setJointRotations); COPY_PROPERTY_FROM_QSCRIPTVALUE(jointRotations, qVectorQuat, setJointRotations);
COPY_PROPERTY_FROM_QSCRIPTVALUE(jointTranslationsSet, qVectorBool, setJointTranslationsSet); COPY_PROPERTY_FROM_QSCRIPTVALUE(jointTranslationsSet, qVectorBool, setJointTranslationsSet);
@ -2357,6 +2361,7 @@ void EntityItemProperties::merge(const EntityItemProperties& other) {
// Model // Model
COPY_PROPERTY_IF_CHANGED(modelURL); COPY_PROPERTY_IF_CHANGED(modelURL);
COPY_PROPERTY_IF_CHANGED(modelScale);
COPY_PROPERTY_IF_CHANGED(jointRotationsSet); COPY_PROPERTY_IF_CHANGED(jointRotationsSet);
COPY_PROPERTY_IF_CHANGED(jointRotations); COPY_PROPERTY_IF_CHANGED(jointRotations);
COPY_PROPERTY_IF_CHANGED(jointTranslationsSet); COPY_PROPERTY_IF_CHANGED(jointTranslationsSet);
@ -2700,6 +2705,7 @@ bool EntityItemProperties::getPropertyInfo(const QString& propertyName, EntityPr
// Model // Model
ADD_PROPERTY_TO_MAP(PROP_MODEL_URL, ModelURL, modelURL, QString); ADD_PROPERTY_TO_MAP(PROP_MODEL_URL, ModelURL, modelURL, QString);
ADD_PROPERTY_TO_MAP(PROP_MODEL_SCALE, ModelScale, modelScale, vec3);
ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector<bool>); ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector<bool>);
ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector<quat>); ADD_PROPERTY_TO_MAP(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector<quat>);
ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector<bool>); ADD_PROPERTY_TO_MAP(PROP_JOINT_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector<bool>);
@ -3989,6 +3995,7 @@ void EntityItemProperties::markAllChanged() {
// Model // Model
_modelURLChanged = true; _modelURLChanged = true;
_modelScaleChanged = true;
_jointRotationsSetChanged = true; _jointRotationsSetChanged = true;
_jointRotationsChanged = true; _jointRotationsChanged = true;
_jointTranslationsSetChanged = true; _jointTranslationsSetChanged = true;
@ -4526,6 +4533,9 @@ QList<QString> EntityItemProperties::listChangedProperties() {
if (modelURLChanged()) { if (modelURLChanged()) {
out += "modelURL"; out += "modelURL";
} }
if (modelScaleChanged()) {
out += "scale";
}
if (jointRotationsSetChanged()) { if (jointRotationsSetChanged()) {
out += "jointRotationsSet"; out += "jointRotationsSet";
} }

View file

@ -279,6 +279,7 @@ public:
// Model // Model
DEFINE_PROPERTY_REF(PROP_MODEL_URL, ModelURL, modelURL, QString, ""); DEFINE_PROPERTY_REF(PROP_MODEL_URL, ModelURL, modelURL, QString, "");
DEFINE_PROPERTY_REF(PROP_MODEL_SCALE, ModelScale, modelScale, glm::vec3, glm::vec3(1.0f));
DEFINE_PROPERTY_REF(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector<bool>, QVector<bool>()); DEFINE_PROPERTY_REF(PROP_JOINT_ROTATIONS_SET, JointRotationsSet, jointRotationsSet, QVector<bool>, QVector<bool>());
DEFINE_PROPERTY_REF(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector<glm::quat>, QVector<glm::quat>()); DEFINE_PROPERTY_REF(PROP_JOINT_ROTATIONS, JointRotations, jointRotations, QVector<glm::quat>, QVector<glm::quat>());
DEFINE_PROPERTY_REF(PROP_JOINT_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector<bool>, QVector<bool>()); DEFINE_PROPERTY_REF(PROP_JOINT_TRANSLATIONS_SET, JointTranslationsSet, jointTranslationsSet, QVector<bool>, QVector<bool>());

View file

@ -202,22 +202,23 @@ enum EntityPropertyList {
// Model // Model
PROP_MODEL_URL = PROP_DERIVED_0, PROP_MODEL_URL = PROP_DERIVED_0,
PROP_JOINT_ROTATIONS_SET = PROP_DERIVED_1, PROP_MODEL_SCALE = PROP_DERIVED_1,
PROP_JOINT_ROTATIONS = PROP_DERIVED_2, PROP_JOINT_ROTATIONS_SET = PROP_DERIVED_2,
PROP_JOINT_TRANSLATIONS_SET = PROP_DERIVED_3, PROP_JOINT_ROTATIONS = PROP_DERIVED_3,
PROP_JOINT_TRANSLATIONS = PROP_DERIVED_4, PROP_JOINT_TRANSLATIONS_SET = PROP_DERIVED_4,
PROP_RELAY_PARENT_JOINTS = PROP_DERIVED_5, PROP_JOINT_TRANSLATIONS = PROP_DERIVED_5,
PROP_GROUP_CULLED = PROP_DERIVED_6, PROP_RELAY_PARENT_JOINTS = PROP_DERIVED_6,
PROP_GROUP_CULLED = PROP_DERIVED_7,
// Animation // Animation
PROP_ANIMATION_URL = PROP_DERIVED_7, PROP_ANIMATION_URL = PROP_DERIVED_8,
PROP_ANIMATION_ALLOW_TRANSLATION = PROP_DERIVED_8, PROP_ANIMATION_ALLOW_TRANSLATION = PROP_DERIVED_9,
PROP_ANIMATION_FPS = PROP_DERIVED_9, PROP_ANIMATION_FPS = PROP_DERIVED_10,
PROP_ANIMATION_FRAME_INDEX = PROP_DERIVED_10, PROP_ANIMATION_FRAME_INDEX = PROP_DERIVED_11,
PROP_ANIMATION_PLAYING = PROP_DERIVED_11, PROP_ANIMATION_PLAYING = PROP_DERIVED_12,
PROP_ANIMATION_LOOP = PROP_DERIVED_12, PROP_ANIMATION_LOOP = PROP_DERIVED_13,
PROP_ANIMATION_FIRST_FRAME = PROP_DERIVED_13, PROP_ANIMATION_FIRST_FRAME = PROP_DERIVED_14,
PROP_ANIMATION_LAST_FRAME = PROP_DERIVED_14, PROP_ANIMATION_LAST_FRAME = PROP_DERIVED_15,
PROP_ANIMATION_HOLD = PROP_DERIVED_15, PROP_ANIMATION_HOLD = PROP_DERIVED_16,
// Light // Light
PROP_IS_SPOTLIGHT = PROP_DERIVED_0, PROP_IS_SPOTLIGHT = PROP_DERIVED_0,

View file

@ -63,6 +63,7 @@ EntityItemProperties ModelEntityItem::getProperties(const EntityPropertyFlags& d
COPY_ENTITY_PROPERTY_TO_PROPERTIES(textures, getTextures); COPY_ENTITY_PROPERTY_TO_PROPERTIES(textures, getTextures);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(modelURL, getModelURL); COPY_ENTITY_PROPERTY_TO_PROPERTIES(modelURL, getModelURL);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(modelScale, getModelScale);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointRotationsSet, getJointRotationsSet); COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointRotationsSet, getJointRotationsSet);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointRotations, getJointRotations); COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointRotations, getJointRotations);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslationsSet, getJointTranslationsSet); COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslationsSet, getJointTranslationsSet);
@ -85,6 +86,7 @@ bool ModelEntityItem::setProperties(const EntityItemProperties& properties) {
SET_ENTITY_PROPERTY_FROM_PROPERTIES(textures, setTextures); SET_ENTITY_PROPERTY_FROM_PROPERTIES(textures, setTextures);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(modelURL, setModelURL); SET_ENTITY_PROPERTY_FROM_PROPERTIES(modelURL, setModelURL);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(modelScale, setModelScale);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointRotationsSet, setJointRotationsSet); SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointRotationsSet, setJointRotationsSet);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointRotations, setJointRotations); SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointRotations, setJointRotations);
SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointTranslationsSet, setJointTranslationsSet); SET_ENTITY_PROPERTY_FROM_PROPERTIES(jointTranslationsSet, setJointTranslationsSet);
@ -128,6 +130,7 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures); READ_ENTITY_PROPERTY(PROP_TEXTURES, QString, setTextures);
READ_ENTITY_PROPERTY(PROP_MODEL_URL, QString, setModelURL); READ_ENTITY_PROPERTY(PROP_MODEL_URL, QString, setModelURL);
READ_ENTITY_PROPERTY(PROP_MODEL_SCALE, glm::vec3, setModelScale);
READ_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, QVector<bool>, setJointRotationsSet); READ_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, QVector<bool>, setJointRotationsSet);
READ_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, QVector<glm::quat>, setJointRotations); READ_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, QVector<glm::quat>, setJointRotations);
READ_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, QVector<bool>, setJointTranslationsSet); READ_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, QVector<bool>, setJointTranslationsSet);
@ -165,6 +168,7 @@ EntityPropertyFlags ModelEntityItem::getEntityProperties(EncodeBitstreamParams&
requestedProperties += PROP_TEXTURES; requestedProperties += PROP_TEXTURES;
requestedProperties += PROP_MODEL_URL; requestedProperties += PROP_MODEL_URL;
requestedProperties += PROP_MODEL_SCALE;
requestedProperties += PROP_JOINT_ROTATIONS_SET; requestedProperties += PROP_JOINT_ROTATIONS_SET;
requestedProperties += PROP_JOINT_ROTATIONS; requestedProperties += PROP_JOINT_ROTATIONS;
requestedProperties += PROP_JOINT_TRANSLATIONS_SET; requestedProperties += PROP_JOINT_TRANSLATIONS_SET;
@ -192,6 +196,7 @@ void ModelEntityItem::appendSubclassData(OctreePacketData* packetData, EncodeBit
APPEND_ENTITY_PROPERTY(PROP_TEXTURES, getTextures()); APPEND_ENTITY_PROPERTY(PROP_TEXTURES, getTextures());
APPEND_ENTITY_PROPERTY(PROP_MODEL_URL, getModelURL()); APPEND_ENTITY_PROPERTY(PROP_MODEL_URL, getModelURL());
APPEND_ENTITY_PROPERTY(PROP_MODEL_SCALE, getModelScale());
APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, getJointRotationsSet()); APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS_SET, getJointRotationsSet());
APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, getJointRotations()); APPEND_ENTITY_PROPERTY(PROP_JOINT_ROTATIONS, getJointRotations());
APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, getJointTranslationsSet()); APPEND_ENTITY_PROPERTY(PROP_JOINT_TRANSLATIONS_SET, getJointTranslationsSet());
@ -708,3 +713,15 @@ bool ModelEntityItem::applyNewAnimationProperties(AnimationPropertyGroup newProp
} }
return somethingChanged; return somethingChanged;
} }
glm::vec3 ModelEntityItem::getModelScale() const {
return _modelScaleLock.resultWithReadLock<glm::vec3>([&] {
return getSNScale();
});
}
void ModelEntityItem::setModelScale(const glm::vec3& modelScale) {
_modelScaleLock.withWriteLock([&] {
setSNScale(modelScale);
});
}

View file

@ -126,6 +126,9 @@ public:
QVector<glm::vec3> getJointTranslations() const; QVector<glm::vec3> getJointTranslations() const;
QVector<bool> getJointTranslationsSet() const; QVector<bool> getJointTranslationsSet() const;
glm::vec3 getModelScale() const;
void setModelScale(const glm::vec3& modelScale);
private: private:
void setAnimationSettings(const QString& value); // only called for old bitstream format void setAnimationSettings(const QString& value); // only called for old bitstream format
bool applyNewAnimationProperties(AnimationPropertyGroup newProperties); bool applyNewAnimationProperties(AnimationPropertyGroup newProperties);
@ -141,6 +144,7 @@ protected:
// they aren't currently updated from data in the model/rig, and they don't have a direct effect // they aren't currently updated from data in the model/rig, and they don't have a direct effect
// on what's rendered. // on what's rendered.
ReadWriteLockable _jointDataLock; ReadWriteLockable _jointDataLock;
ReadWriteLockable _modelScaleLock;
bool _jointRotationsExplicitlySet { false }; // were the joints set as a property or just side effect of animations bool _jointRotationsExplicitlySet { false }; // were the joints set as a property or just side effect of animations
bool _jointTranslationsExplicitlySet{ false }; // were the joints set as a property or just side effect of animations bool _jointTranslationsExplicitlySet{ false }; // were the joints set as a property or just side effect of animations

View file

@ -262,6 +262,7 @@ enum class EntityVersion : PacketVersion {
RingGizmoEntities, RingGizmoEntities,
ShowKeyboardFocusHighlight, ShowKeyboardFocusHighlight,
WebBillboardMode, WebBillboardMode,
ModelScale,
// Add new versions above here // Add new versions above here
NUM_PACKET_TYPE, NUM_PACKET_TYPE,

View file

@ -178,6 +178,7 @@ void CauterizedModel::updateClusterMatrices() {
} }
} }
} }
computeMeshPartLocalBounds();
// post the blender if we're not currently waiting for one to finish // post the blender if we're not currently waiting for one to finish
auto modelBlender = DependencyManager::get<ModelBlender>(); auto modelBlender = DependencyManager::get<ModelBlender>();

View file

@ -1386,6 +1386,7 @@ void Model::updateClusterMatrices() {
} }
} }
} }
computeMeshPartLocalBounds();
// post the blender if we're not currently waiting for one to finish // post the blender if we're not currently waiting for one to finish
auto modelBlender = DependencyManager::get<ModelBlender>(); auto modelBlender = DependencyManager::get<ModelBlender>();

View file

@ -861,7 +861,7 @@ void SpatiallyNestable::setSNScale(const glm::vec3& scale, bool& success) {
} }
}); });
if (success && changed) { if (success && changed) {
locationChanged(); dimensionsChanged();
} }
} }