mirror of
https://github.com/overte-org/overte.git
synced 2025-07-29 16:20:00 +02:00
Merge pull request #14897 from danteruiz/fix-soft-entity
Case 21142: Wearer and observer disagree on whether a worn item is correctly placed
This commit is contained in:
commit
e8c70cc782
1 changed files with 15 additions and 0 deletions
|
@ -447,6 +447,10 @@ void OtherAvatar::handleChangedAvatarEntityData() {
|
||||||
EntityItemProperties properties;
|
EntityItemProperties properties;
|
||||||
int32_t bytesLeftToRead = data.size();
|
int32_t bytesLeftToRead = data.size();
|
||||||
unsigned char* dataAt = (unsigned char*)(data.data());
|
unsigned char* dataAt = (unsigned char*)(data.data());
|
||||||
|
// FIXME: This function will cause unintented changes in SpaillyNestable
|
||||||
|
// E.g overriding the ID index of an exisiting entity to temporary entity
|
||||||
|
// in the following map QHash<QUuid, SpatiallyNestableWeakPointer> _children;
|
||||||
|
// Andrew Meadows will address this issue
|
||||||
if (!properties.constructFromBuffer(dataAt, bytesLeftToRead)) {
|
if (!properties.constructFromBuffer(dataAt, bytesLeftToRead)) {
|
||||||
// properties are corrupt
|
// properties are corrupt
|
||||||
continue;
|
continue;
|
||||||
|
@ -489,6 +493,17 @@ void OtherAvatar::handleChangedAvatarEntityData() {
|
||||||
bool success = true;
|
bool success = true;
|
||||||
if (entity) {
|
if (entity) {
|
||||||
QUuid oldParentID = entity->getParentID();
|
QUuid oldParentID = entity->getParentID();
|
||||||
|
|
||||||
|
// Since has overwrtiiten the back pointer
|
||||||
|
// from the parent children map (see comment for function call above),
|
||||||
|
// we need to for reset the back pointer in the map correctly by setting the parentID, but
|
||||||
|
// since the parentID of the entity has not changed we first need to set it some ither ID,
|
||||||
|
// then set the the original ID for the changes to take effect
|
||||||
|
// TODO: This is a horrible hack and once properties.constructFromBuffer no longer causes
|
||||||
|
// side effects...remove the following three lines
|
||||||
|
const QUuid NULL_ID = QUuid("{00000000-0000-0000-0000-000000000005}");
|
||||||
|
entity->setParentID(NULL_ID);
|
||||||
|
entity->setParentID(oldParentID);
|
||||||
if (entityTree->updateEntity(entityID, properties)) {
|
if (entityTree->updateEntity(entityID, properties)) {
|
||||||
entity->updateLastEditedFromRemote();
|
entity->updateLastEditedFromRemote();
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue