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) {
bool changed { false };
withWriteLock([&] {
_locked = value;
if (_locked != value) {
_locked = value;
changed = true;
}
});
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE);
EntityTreePointer tree = getTree();
if (tree) {
tree->entityChanged(getThisPointer());
if (changed) {
markDirtyFlags(Simulation::DIRTY_MOTION_TYPE);
EntityTreePointer tree = getTree();
if (tree) {
tree->entityChanged(getThisPointer());
}
}
}