mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
fix a crash from previous commit
This commit is contained in:
parent
9b54924524
commit
3402585d1a
2 changed files with 19 additions and 19 deletions
|
@ -90,8 +90,10 @@ const QUrl& AvatarData::defaultFullAvatarModelUrl() {
|
|||
// There are a number of possible strategies for this set of tools through endRender, below.
|
||||
void AvatarData::nextAttitude(glm::vec3 position, glm::quat orientation) {
|
||||
avatarLock.lock();
|
||||
SpatiallyNestable::setPosition(position);
|
||||
SpatiallyNestable::setOrientation(orientation);
|
||||
Transform trans;
|
||||
trans.setTranslation(position);
|
||||
trans.setRotation(orientation);
|
||||
SpatiallyNestable::setTransform(trans);
|
||||
avatarLock.unlock();
|
||||
updateAttitude();
|
||||
}
|
||||
|
@ -478,6 +480,12 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
|||
}
|
||||
|
||||
// TODO is this safe? will the floats not exactly match?
|
||||
// Andrew says:
|
||||
// Yes, there is a possibility that the transmitted will not quite match the extracted despite being originally
|
||||
// extracted from the exact same quaternion. I followed the code through and it appears the risk is that the
|
||||
// avatar's SkeletonModel might fall into the CPU expensive part of Model::updateClusterMatrices() when otherwise it
|
||||
// would not have required it. However, we know we can update many simultaneously animating avatars, and most
|
||||
// avatars will be moving constantly anyway, so I don't think we need to worry.
|
||||
if (getBodyYaw() != yaw || getBodyPitch() != pitch || getBodyRoll() != roll) {
|
||||
_hasNewJointRotations = true;
|
||||
glm::vec3 eulerAngles(pitch, yaw, roll);
|
||||
|
|
|
@ -191,7 +191,7 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit
|
|||
}
|
||||
|
||||
QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties scriptSideProperties) {
|
||||
EntityItemProperties properties = convertLocationFromScriptSemantics(scriptSideProperties);
|
||||
EntityItemProperties properties = scriptSideProperties;
|
||||
EntityItemID entityID(id);
|
||||
// If we have a local entity tree set, then also update it.
|
||||
if (!_entityTree) {
|
||||
|
@ -204,25 +204,17 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties script
|
|||
if (scriptSideProperties.parentDependentPropertyChanged()) {
|
||||
// if the script sets a location property but didn't include parent information, grab the needed
|
||||
// properties from the entity.
|
||||
bool recompute = false;
|
||||
EntityItemPointer entity = nullptr;
|
||||
if (!scriptSideProperties.parentIDChanged()) {
|
||||
entity = _entityTree->findEntityByEntityItemID(entityID);
|
||||
scriptSideProperties.setParentID(entity->getParentID());
|
||||
recompute = true;
|
||||
}
|
||||
if (!scriptSideProperties.parentJointIndexChanged()) {
|
||||
if (!entity) {
|
||||
entity = _entityTree->findEntityByEntityItemID(entityID);
|
||||
if (!scriptSideProperties.parentIDChanged() || !scriptSideProperties.parentJointIndexChanged()) {
|
||||
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
|
||||
if (entity && !scriptSideProperties.parentIDChanged()) {
|
||||
properties.setParentID(entity->getParentID());
|
||||
}
|
||||
if (entity && !scriptSideProperties.parentJointIndexChanged()) {
|
||||
properties.setParentJointIndex(entity->getParentJointIndex());
|
||||
}
|
||||
scriptSideProperties.setParentJointIndex(entity->getParentJointIndex());
|
||||
recompute = true;
|
||||
}
|
||||
if (recompute) {
|
||||
properties = convertLocationFromScriptSemantics(scriptSideProperties);
|
||||
}
|
||||
}
|
||||
|
||||
properties = convertLocationFromScriptSemantics(properties);
|
||||
updatedEntity = _entityTree->updateEntity(entityID, properties);
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue