mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 06:15:46 +02:00
dont run code if not nesscassry
This commit is contained in:
parent
c58286d371
commit
8af1d8d8d0
1 changed files with 18 additions and 19 deletions
|
@ -1968,17 +1968,19 @@ bool EntityItem::addActionInternal(EntitySimulationPointer simulation, EntityDyn
|
||||||
if (success) {
|
if (success) {
|
||||||
_allActionsDataCache = newDataCache;
|
_allActionsDataCache = newDataCache;
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
|
||||||
|
|
||||||
auto actionType = action->getType();
|
auto actionType = action->getType();
|
||||||
if (actionType == DYNAMIC_TYPE_HOLD || actionType == DYNAMIC_TYPE_FAR_GRAB) {
|
if (actionType == DYNAMIC_TYPE_HOLD || actionType == DYNAMIC_TYPE_FAR_GRAB) {
|
||||||
_dirtyFlags |= Simulation::NO_BOOTSTRAPPING;
|
if (!(bool)(_dirtyFlags & Simulation::NO_BOOTSTRAPPING)) {
|
||||||
forEachDescendant([&](SpatiallyNestablePointer child) {
|
_dirtyFlags |= Simulation::NO_BOOTSTRAPPING;
|
||||||
if (child->getNestableType() == NestableType::Entity) {
|
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
forEachDescendant([&](SpatiallyNestablePointer child) {
|
||||||
entity->markDirtyFlags(Simulation::NO_BOOTSTRAPPING | Simulation::DIRTY_COLLISION_GROUP);
|
if (child->getNestableType() == NestableType::Entity) {
|
||||||
}
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
||||||
});
|
entity->markDirtyFlags(Simulation::NO_BOOTSTRAPPING | Simulation::DIRTY_COLLISION_GROUP);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCDebug(entities) << "EntityItem::addActionInternal -- serializeActions failed";
|
qCDebug(entities) << "EntityItem::addActionInternal -- serializeActions failed";
|
||||||
|
@ -2056,7 +2058,6 @@ bool EntityItem::removeActionInternal(const QUuid& actionID, EntitySimulationPoi
|
||||||
|
|
||||||
action->setOwnerEntity(nullptr);
|
action->setOwnerEntity(nullptr);
|
||||||
action->setIsMine(false);
|
action->setIsMine(false);
|
||||||
_objectActions.remove(actionID);
|
|
||||||
|
|
||||||
if (simulation) {
|
if (simulation) {
|
||||||
action->removeFromSimulation(simulation);
|
action->removeFromSimulation(simulation);
|
||||||
|
@ -2065,17 +2066,10 @@ bool EntityItem::removeActionInternal(const QUuid& actionID, EntitySimulationPoi
|
||||||
bool success = true;
|
bool success = true;
|
||||||
serializeActions(success, _allActionsDataCache);
|
serializeActions(success, _allActionsDataCache);
|
||||||
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
_dirtyFlags |= Simulation::DIRTY_PHYSICS_ACTIVATION;
|
||||||
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
auto removedActionType = action->getType();
|
||||||
if (stillHasGrabActions()) {
|
if ((removedActionType == DYNAMIC_TYPE_HOLD || removedActionType == DYNAMIC_TYPE_FAR_GRAB) && !stillHasGrabActions()) {
|
||||||
_dirtyFlags |= Simulation::NO_BOOTSTRAPPING;
|
|
||||||
forEachDescendant([&](SpatiallyNestablePointer child) {
|
|
||||||
if (child->getNestableType() == NestableType::Entity) {
|
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
|
||||||
entity->markDirtyFlags(Simulation::NO_BOOTSTRAPPING | Simulation::DIRTY_COLLISION_GROUP);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else if ((bool)(_dirtyFlags & Simulation::NO_BOOTSTRAPPING)) {
|
|
||||||
_dirtyFlags &= ~Simulation::NO_BOOTSTRAPPING;
|
_dirtyFlags &= ~Simulation::NO_BOOTSTRAPPING;
|
||||||
|
_dirtyFlags |= Simulation::DIRTY_COLLISION_GROUP; // may need to not collide with own avatar
|
||||||
forEachDescendant([&](SpatiallyNestablePointer child) {
|
forEachDescendant([&](SpatiallyNestablePointer child) {
|
||||||
if (child->getNestableType() == NestableType::Entity) {
|
if (child->getNestableType() == NestableType::Entity) {
|
||||||
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
EntityItemPointer entity = std::static_pointer_cast<EntityItem>(child);
|
||||||
|
@ -2083,7 +2077,12 @@ bool EntityItem::removeActionInternal(const QUuid& actionID, EntitySimulationPoi
|
||||||
entity->clearDirtyFlags(Simulation::NO_BOOTSTRAPPING);
|
entity->clearDirtyFlags(Simulation::NO_BOOTSTRAPPING);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
// NO-OP: we assume NO_BOOTSTRAPPING bits and collision group are correct
|
||||||
|
// because they should have been set correctly when the action was added
|
||||||
|
// and/or when children were linked
|
||||||
}
|
}
|
||||||
|
_objectActions.remove(actionID);
|
||||||
setDynamicDataNeedsTransmit(true);
|
setDynamicDataNeedsTransmit(true);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue