mirror of
https://github.com/lubosz/overte.git
synced 2025-08-29 11:49:10 +02:00
call entityChanged after settings flags
This commit is contained in:
parent
99dfd9ded1
commit
0c12baa258
2 changed files with 20 additions and 2 deletions
|
@ -1609,11 +1609,19 @@ void EntityItem::updateRegistrationPoint(const glm::vec3& value) {
|
|||
void EntityItem::updatePosition(const glm::vec3& value) {
|
||||
if (getLocalPosition() != value) {
|
||||
setLocalPosition(value);
|
||||
|
||||
EntityTreePointer tree = getTree();
|
||||
if (!tree) {
|
||||
return;
|
||||
}
|
||||
|
||||
markDirtyFlags(Simulation::DIRTY_POSITION);
|
||||
tree->entityChanged(getThisPointer());
|
||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
if (object->getNestableType() == NestableType::Entity) {
|
||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||
entity->markDirtyFlags(Simulation::DIRTY_POSITION);
|
||||
tree->entityChanged(entity);
|
||||
}
|
||||
});
|
||||
locationChanged();
|
||||
|
@ -1623,13 +1631,21 @@ void EntityItem::updatePosition(const glm::vec3& value) {
|
|||
void EntityItem::updateParentID(const QUuid& value) {
|
||||
if (getParentID() != value) {
|
||||
setParentID(value);
|
||||
|
||||
EntityTreePointer tree = getTree();
|
||||
if (!tree) {
|
||||
return;
|
||||
}
|
||||
|
||||
// children are forced to be kinematic
|
||||
// may need to not collide with own avatar
|
||||
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE | Simulation::DIRTY_COLLISION_GROUP | Simulation::DIRTY_POSITION);
|
||||
tree->entityChanged(getThisPointer());
|
||||
forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
if (object->getNestableType() == NestableType::Entity) {
|
||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||
entity->markDirtyFlags(Simulation::DIRTY_POSITION);
|
||||
tree->entityChanged(entity);
|
||||
}
|
||||
});
|
||||
locationChanged();
|
||||
|
|
|
@ -1254,10 +1254,12 @@ void EntityTree::fixupMissingParents() {
|
|||
entity->markDirtyFlags(Simulation::DIRTY_MOTION_TYPE |
|
||||
Simulation::DIRTY_COLLISION_GROUP |
|
||||
Simulation::DIRTY_POSITION);
|
||||
entityChanged(entity);
|
||||
entity->forEachDescendant([&](SpatiallyNestablePointer object) {
|
||||
if (object->getNestableType() == NestableType::Entity) {
|
||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(object);
|
||||
entity->markDirtyFlags(Simulation::DIRTY_POSITION);
|
||||
EntityItemPointer descendantEntity = std::static_pointer_cast<EntityItem>(object);
|
||||
descendantEntity->markDirtyFlags(Simulation::DIRTY_POSITION);
|
||||
entityChanged(descendantEntity);
|
||||
}
|
||||
});
|
||||
entity->locationChanged(true);
|
||||
|
|
Loading…
Reference in a new issue