diff --git a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp index bbd1266513..7955b20728 100644 --- a/libraries/entities-renderer/src/RenderableModelEntityItem.cpp +++ b/libraries/entities-renderer/src/RenderableModelEntityItem.cpp @@ -748,6 +748,7 @@ glm::vec3 RenderableModelEntityItem::getAbsoluteJointTranslationInObjectFrame(in bool RenderableModelEntityItem::setAbsoluteJointRotationInObjectFrame(int index, const glm::quat& rotation) { bool result = false; _jointDataLock.withWriteLock([&] { + _jointRotationsExplicitlySet = true; resizeJointArrays(); if (index >= 0 && index < _absoluteJointRotationsInObjectFrame.size() && _absoluteJointRotationsInObjectFrame[index] != rotation) { @@ -764,6 +765,7 @@ bool RenderableModelEntityItem::setAbsoluteJointRotationInObjectFrame(int index, bool RenderableModelEntityItem::setAbsoluteJointTranslationInObjectFrame(int index, const glm::vec3& translation) { bool result = false; _jointDataLock.withWriteLock([&] { + _jointTranslationsExplicitlySet = true; resizeJointArrays(); if (index >= 0 && index < _absoluteJointTranslationsInObjectFrame.size() && _absoluteJointTranslationsInObjectFrame[index] != translation) { diff --git a/libraries/entities/src/EntityItemProperties.cpp b/libraries/entities/src/EntityItemProperties.cpp index 32aac1efe5..92849d6e2f 100644 --- a/libraries/entities/src/EntityItemProperties.cpp +++ b/libraries/entities/src/EntityItemProperties.cpp @@ -541,13 +541,6 @@ QScriptValue EntityItemProperties::copyToScriptValue(QScriptEngine* engine, bool COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_POSITION, localPosition); COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_LOCAL_ROTATION, localRotation); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS_SET, jointRotationsSet); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_ROTATIONS, jointRotations); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS_SET, jointTranslationsSet); - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_JOINT_TRANSLATIONS, jointTranslations); - - COPY_PROPERTY_TO_QSCRIPTVALUE(PROP_QUERY_AA_CUBE, queryAACube); - // FIXME - I don't think these properties are supported any more //COPY_PROPERTY_TO_QSCRIPTVALUE(glowLevel); //COPY_PROPERTY_TO_QSCRIPTVALUE(localRenderAlpha); diff --git a/libraries/entities/src/ModelEntityItem.cpp b/libraries/entities/src/ModelEntityItem.cpp index 8e45f4dd5e..2ec1f5e9ed 100644 --- a/libraries/entities/src/ModelEntityItem.cpp +++ b/libraries/entities/src/ModelEntityItem.cpp @@ -385,6 +385,7 @@ void ModelEntityItem::resizeJointArrays(int newSize) { void ModelEntityItem::setJointRotations(const QVector& rotations) { _jointDataLock.withWriteLock([&] { + _jointRotationsExplicitlySet = rotations.size() > 0; resizeJointArrays(rotations.size()); for (int index = 0; index < rotations.size(); index++) { if (_absoluteJointRotationsInObjectFrameSet[index]) { @@ -397,6 +398,7 @@ void ModelEntityItem::setJointRotations(const QVector& rotations) { void ModelEntityItem::setJointRotationsSet(const QVector& rotationsSet) { _jointDataLock.withWriteLock([&] { + _jointRotationsExplicitlySet = rotationsSet.size() > 0; resizeJointArrays(rotationsSet.size()); for (int index = 0; index < rotationsSet.size(); index++) { _absoluteJointRotationsInObjectFrameSet[index] = rotationsSet[index]; @@ -406,6 +408,7 @@ void ModelEntityItem::setJointRotationsSet(const QVector& rotationsSet) { void ModelEntityItem::setJointTranslations(const QVector& translations) { _jointDataLock.withWriteLock([&] { + _jointTranslationsExplicitlySet = translations.size() > 0; resizeJointArrays(translations.size()); for (int index = 0; index < translations.size(); index++) { if (_absoluteJointTranslationsInObjectFrameSet[index]) { @@ -418,6 +421,7 @@ void ModelEntityItem::setJointTranslations(const QVector& translation void ModelEntityItem::setJointTranslationsSet(const QVector& translationsSet) { _jointDataLock.withWriteLock([&] { + _jointTranslationsExplicitlySet = translationsSet.size() > 0; resizeJointArrays(translationsSet.size()); for (int index = 0; index < translationsSet.size(); index++) { _absoluteJointTranslationsInObjectFrameSet[index] = translationsSet[index]; @@ -428,7 +432,9 @@ void ModelEntityItem::setJointTranslationsSet(const QVector& translationsS QVector ModelEntityItem::getJointRotations() const { QVector result; _jointDataLock.withReadLock([&] { - result = _absoluteJointRotationsInObjectFrame; + if (_jointRotationsExplicitlySet) { + result = _absoluteJointRotationsInObjectFrame; + } }); return result; } @@ -436,15 +442,20 @@ QVector ModelEntityItem::getJointRotations() const { QVector ModelEntityItem::getJointRotationsSet() const { QVector result; _jointDataLock.withReadLock([&] { - result = _absoluteJointRotationsInObjectFrameSet; + if (_jointRotationsExplicitlySet) { + result = _absoluteJointRotationsInObjectFrameSet; + } }); + return result; } QVector ModelEntityItem::getJointTranslations() const { QVector result; _jointDataLock.withReadLock([&] { - result = _absoluteJointTranslationsInObjectFrame; + if (_jointTranslationsExplicitlySet) { + result = _absoluteJointTranslationsInObjectFrame; + } }); return result; } @@ -452,7 +463,9 @@ QVector ModelEntityItem::getJointTranslations() const { QVector ModelEntityItem::getJointTranslationsSet() const { QVector result; _jointDataLock.withReadLock([&] { - result = _absoluteJointTranslationsInObjectFrameSet; + if (_jointTranslationsExplicitlySet) { + result = _absoluteJointTranslationsInObjectFrameSet; + } }); return result; } diff --git a/libraries/entities/src/ModelEntityItem.h b/libraries/entities/src/ModelEntityItem.h index 82bb6ca47c..29730bf4df 100644 --- a/libraries/entities/src/ModelEntityItem.h +++ b/libraries/entities/src/ModelEntityItem.h @@ -139,9 +139,13 @@ protected: // they aren't currently updated from data in the model/rig, and they don't have a direct effect // on what's rendered. ReadWriteLockable _jointDataLock; + + bool _jointRotationsExplicitlySet { false }; // were the joints set as a property or just side effect of animations QVector _absoluteJointRotationsInObjectFrame; QVector _absoluteJointRotationsInObjectFrameSet; // ever set? QVector _absoluteJointRotationsInObjectFrameDirty; // needs a relay to model/rig? + + bool _jointTranslationsExplicitlySet { false }; // were the joints set as a property or just side effect of animations QVector _absoluteJointTranslationsInObjectFrame; QVector _absoluteJointTranslationsInObjectFrameSet; // ever set? QVector _absoluteJointTranslationsInObjectFrameDirty; // needs a relay to model/rig?