mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:40:11 +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.
|
// There are a number of possible strategies for this set of tools through endRender, below.
|
||||||
void AvatarData::nextAttitude(glm::vec3 position, glm::quat orientation) {
|
void AvatarData::nextAttitude(glm::vec3 position, glm::quat orientation) {
|
||||||
avatarLock.lock();
|
avatarLock.lock();
|
||||||
SpatiallyNestable::setPosition(position);
|
Transform trans;
|
||||||
SpatiallyNestable::setOrientation(orientation);
|
trans.setTranslation(position);
|
||||||
|
trans.setRotation(orientation);
|
||||||
|
SpatiallyNestable::setTransform(trans);
|
||||||
avatarLock.unlock();
|
avatarLock.unlock();
|
||||||
updateAttitude();
|
updateAttitude();
|
||||||
}
|
}
|
||||||
|
@ -478,6 +480,12 @@ int AvatarData::parseDataFromBuffer(const QByteArray& buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO is this safe? will the floats not exactly match?
|
// 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) {
|
if (getBodyYaw() != yaw || getBodyPitch() != pitch || getBodyRoll() != roll) {
|
||||||
_hasNewJointRotations = true;
|
_hasNewJointRotations = true;
|
||||||
glm::vec3 eulerAngles(pitch, yaw, roll);
|
glm::vec3 eulerAngles(pitch, yaw, roll);
|
||||||
|
|
|
@ -191,7 +191,7 @@ EntityItemProperties EntityScriptingInterface::getEntityProperties(QUuid identit
|
||||||
}
|
}
|
||||||
|
|
||||||
QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties scriptSideProperties) {
|
QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties scriptSideProperties) {
|
||||||
EntityItemProperties properties = convertLocationFromScriptSemantics(scriptSideProperties);
|
EntityItemProperties properties = scriptSideProperties;
|
||||||
EntityItemID entityID(id);
|
EntityItemID entityID(id);
|
||||||
// If we have a local entity tree set, then also update it.
|
// If we have a local entity tree set, then also update it.
|
||||||
if (!_entityTree) {
|
if (!_entityTree) {
|
||||||
|
@ -204,25 +204,17 @@ QUuid EntityScriptingInterface::editEntity(QUuid id, EntityItemProperties script
|
||||||
if (scriptSideProperties.parentDependentPropertyChanged()) {
|
if (scriptSideProperties.parentDependentPropertyChanged()) {
|
||||||
// if the script sets a location property but didn't include parent information, grab the needed
|
// if the script sets a location property but didn't include parent information, grab the needed
|
||||||
// properties from the entity.
|
// properties from the entity.
|
||||||
bool recompute = false;
|
if (!scriptSideProperties.parentIDChanged() || !scriptSideProperties.parentJointIndexChanged()) {
|
||||||
EntityItemPointer entity = nullptr;
|
EntityItemPointer entity = _entityTree->findEntityByEntityItemID(entityID);
|
||||||
if (!scriptSideProperties.parentIDChanged()) {
|
if (entity && !scriptSideProperties.parentIDChanged()) {
|
||||||
entity = _entityTree->findEntityByEntityItemID(entityID);
|
properties.setParentID(entity->getParentID());
|
||||||
scriptSideProperties.setParentID(entity->getParentID());
|
}
|
||||||
recompute = true;
|
if (entity && !scriptSideProperties.parentJointIndexChanged()) {
|
||||||
}
|
properties.setParentJointIndex(entity->getParentJointIndex());
|
||||||
if (!scriptSideProperties.parentJointIndexChanged()) {
|
|
||||||
if (!entity) {
|
|
||||||
entity = _entityTree->findEntityByEntityItemID(entityID);
|
|
||||||
}
|
}
|
||||||
scriptSideProperties.setParentJointIndex(entity->getParentJointIndex());
|
|
||||||
recompute = true;
|
|
||||||
}
|
|
||||||
if (recompute) {
|
|
||||||
properties = convertLocationFromScriptSemantics(scriptSideProperties);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
properties = convertLocationFromScriptSemantics(properties);
|
||||||
updatedEntity = _entityTree->updateEntity(entityID, properties);
|
updatedEntity = _entityTree->updateEntity(entityID, properties);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue