don't dirty motion-type if lock value isn't actually changing

This commit is contained in:
Seth Alves 2017-05-20 14:14:33 -07:00
parent 8f38ea8c6a
commit 2512b39848

View file

@ -2764,13 +2764,19 @@ bool EntityItem::getLocked() const {
} }
void EntityItem::setLocked(bool value) { void EntityItem::setLocked(bool value) {
bool changed { false };
withWriteLock([&] { withWriteLock([&] {
_locked = value; if (_locked != value) {
_locked = value;
changed = true;
}
}); });
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE); if (changed) {
EntityTreePointer tree = getTree(); markDirtyFlags(Simulation::DIRTY_MOTION_TYPE);
if (tree) { EntityTreePointer tree = getTree();
tree->entityChanged(getThisPointer()); if (tree) {
tree->entityChanged(getThisPointer());
}
} }
} }