Merge branch 'master' of https://github.com/highfidelity/hifi into fixMainTextContainerQML

This commit is contained in:
Wayne Chen 2018-09-18 15:21:01 -07:00
commit 085e6a16fd
4 changed files with 91 additions and 66 deletions

View file

@ -1322,6 +1322,8 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
emit DependencyManager::get<scriptable::ModelProviderFactory>()-> emit DependencyManager::get<scriptable::ModelProviderFactory>()->
modelRemovedFromScene(entity->getEntityItemID(), NestableType::Entity, _model); modelRemovedFromScene(entity->getEntityItemID(), NestableType::Entity, _model);
} }
setKey(false);
_didLastVisualGeometryRequestSucceed = false;
return; return;
} }
@ -1347,6 +1349,7 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
if (_parsedModelURL != model->getURL()) { if (_parsedModelURL != model->getURL()) {
withWriteLock([&] { withWriteLock([&] {
_texturesLoaded = false; _texturesLoaded = false;
_jointMappingCompleted = false;
model->setURL(_parsedModelURL); model->setURL(_parsedModelURL);
}); });
} }
@ -1457,7 +1460,6 @@ void ModelEntityRenderer::doRenderUpdateSynchronousTyped(const ScenePointer& sce
mapJoints(entity, model->getJointNames()); mapJoints(entity, model->getJointNames());
//else the joint have been mapped before but we have a new animation to load //else the joint have been mapped before but we have a new animation to load
} else if (_animation && (_animation->getURL().toString() != entity->getAnimationURL())) { } else if (_animation && (_animation->getURL().toString() != entity->getAnimationURL())) {
_animation = DependencyManager::get<AnimationCache>()->getAnimation(entity->getAnimationURL());
_jointMappingCompleted = false; _jointMappingCompleted = false;
mapJoints(entity, model->getJointNames()); mapJoints(entity, model->getJointNames());
} }

View file

@ -187,7 +187,7 @@ private:
const void* _collisionMeshKey { nullptr }; const void* _collisionMeshKey { nullptr };
// used on client side // used on client side
bool _jointMappingCompleted{ false }; bool _jointMappingCompleted { false };
QVector<int> _jointMapping; // domain is index into model-joints, range is index into animation-joints QVector<int> _jointMapping; // domain is index into model-joints, range is index into animation-joints
AnimationPointer _animation; AnimationPointer _animation;
QUrl _parsedModelURL; QUrl _parsedModelURL;

View file

@ -66,7 +66,9 @@ EntityItemProperties ModelEntityItem::getProperties(EntityPropertyFlags desiredP
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslationsSet, getJointTranslationsSet); COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslationsSet, getJointTranslationsSet);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslations, getJointTranslations); COPY_ENTITY_PROPERTY_TO_PROPERTIES(jointTranslations, getJointTranslations);
COPY_ENTITY_PROPERTY_TO_PROPERTIES(relayParentJoints, getRelayParentJoints); COPY_ENTITY_PROPERTY_TO_PROPERTIES(relayParentJoints, getRelayParentJoints);
withReadLock([&] {
_animationProperties.getProperties(properties); _animationProperties.getProperties(properties);
});
return properties; return properties;
} }
@ -123,15 +125,18 @@ int ModelEntityItem::readEntitySubclassDataFromBuffer(const unsigned char* data,
// grab a local copy of _animationProperties to avoid multiple locks // grab a local copy of _animationProperties to avoid multiple locks
int bytesFromAnimation; int bytesFromAnimation;
AnimationPropertyGroup animationProperties;
withReadLock([&] { withReadLock([&] {
AnimationPropertyGroup animationProperties = _animationProperties; animationProperties = _animationProperties;
bytesFromAnimation = animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args, bytesFromAnimation = animationProperties.readEntitySubclassDataFromBuffer(dataAt, (bytesLeftToRead - bytesRead), args,
propertyFlags, overwriteLocalData, animationPropertiesChanged); propertyFlags, overwriteLocalData, animationPropertiesChanged);
});
if (animationPropertiesChanged) { if (animationPropertiesChanged) {
withWriteLock([&] {
applyNewAnimationProperties(animationProperties); applyNewAnimationProperties(animationProperties);
});
somethingChanged = true; somethingChanged = true;
} }
});
bytesRead += bytesFromAnimation; bytesRead += bytesFromAnimation;
dataAt += bytesFromAnimation; dataAt += bytesFromAnimation;
@ -305,8 +310,10 @@ void ModelEntityItem::setAnimationURL(const QString& url) {
void ModelEntityItem::setAnimationSettings(const QString& value) { void ModelEntityItem::setAnimationSettings(const QString& value) {
// NOTE: this method only called for old bitstream format // NOTE: this method only called for old bitstream format
withWriteLock([&] { AnimationPropertyGroup animationProperties;
auto animationProperties = _animationProperties; withReadLock([&] {
animationProperties = _animationProperties;
});
// the animations setting is a JSON string that may contain various animation settings. // the animations setting is a JSON string that may contain various animation settings.
// if it includes fps, currentFrame, or running, those values will be parsed out and // if it includes fps, currentFrame, or running, those values will be parsed out and
@ -356,18 +363,24 @@ void ModelEntityItem::setAnimationSettings(const QString& value) {
bool allowTranslation = settingsMap["allowTranslation"].toBool(); bool allowTranslation = settingsMap["allowTranslation"].toBool();
animationProperties.setAllowTranslation(allowTranslation); animationProperties.setAllowTranslation(allowTranslation);
} }
withWriteLock([&] {
applyNewAnimationProperties(animationProperties); applyNewAnimationProperties(animationProperties);
}); });
} }
void ModelEntityItem::setAnimationIsPlaying(bool value) { void ModelEntityItem::setAnimationIsPlaying(bool value) {
_flags |= Simulation::DIRTY_UPDATEABLE; _flags |= Simulation::DIRTY_UPDATEABLE;
withWriteLock([&] {
_animationProperties.setRunning(value); _animationProperties.setRunning(value);
});
} }
void ModelEntityItem::setAnimationFPS(float value) { void ModelEntityItem::setAnimationFPS(float value) {
_flags |= Simulation::DIRTY_UPDATEABLE; _flags |= Simulation::DIRTY_UPDATEABLE;
withWriteLock([&] {
_animationProperties.setFPS(value); _animationProperties.setFPS(value);
});
} }
// virtual // virtual
@ -557,11 +570,9 @@ void ModelEntityItem::setColor(const xColor& value) {
// Animation related items... // Animation related items...
AnimationPropertyGroup ModelEntityItem::getAnimationProperties() const { AnimationPropertyGroup ModelEntityItem::getAnimationProperties() const {
AnimationPropertyGroup result; return resultWithReadLock<AnimationPropertyGroup>([&] {
withReadLock([&] { return _animationProperties;
result = _animationProperties;
}); });
return result;
} }
bool ModelEntityItem::hasAnimation() const { bool ModelEntityItem::hasAnimation() const {
@ -582,6 +593,18 @@ void ModelEntityItem::setAnimationCurrentFrame(float value) {
}); });
} }
void ModelEntityItem::setAnimationAllowTranslation(bool value) {
withWriteLock([&] {
_animationProperties.setAllowTranslation(value);
});
}
bool ModelEntityItem::getAnimationAllowTranslation() const {
return resultWithReadLock<bool>([&] {
return _animationProperties.getAllowTranslation();
});
}
void ModelEntityItem::setAnimationLoop(bool loop) { void ModelEntityItem::setAnimationLoop(bool loop) {
withWriteLock([&] { withWriteLock([&] {
_animationProperties.setLoop(loop); _animationProperties.setLoop(loop);

View file

@ -88,8 +88,8 @@ public:
void setAnimationIsPlaying(bool value); void setAnimationIsPlaying(bool value);
void setAnimationFPS(float value); void setAnimationFPS(float value);
void setAnimationAllowTranslation(bool value) { _animationProperties.setAllowTranslation(value); }; void setAnimationAllowTranslation(bool value);
bool getAnimationAllowTranslation() const { return _animationProperties.getAllowTranslation(); }; bool getAnimationAllowTranslation() const;
void setAnimationLoop(bool loop); void setAnimationLoop(bool loop);
bool getAnimationLoop() const; bool getAnimationLoop() const;