Skip to content

Commit

Permalink
Don't update modifiers when terrain is moved
Browse files Browse the repository at this point in the history
  • Loading branch information
sjkillen committed Sep 30, 2023
1 parent 2763bb8 commit e3b9137
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions modifiers/godot/voxel_modifier_gd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,15 +133,15 @@ void VoxelModifier::_notification(int p_what) {

const AABB prev_aabb = modifier->get_aabb();
Transform3D terrain_local = _volume->get_global_transform().affine_inverse() * get_global_transform();
// If the terrain moved, the modifiers do not need to be updated.
if (terrain_local == modifier->get_transform()) {
break;
}
WARN_PRINT("MODIFIER WAS UPDATED");
modifier->set_transform(terrain_local);
const AABB aabb = modifier->get_aabb();
post_edit_modifier(*_volume, prev_aabb);
post_edit_modifier(*_volume, aabb);

// TODO Handle nesting properly, though it's a pain in the ass
// When the terrain is moved, the local transform of modifiers technically changes too.
// However it did not change relative to the terrain. But because we don't have a way to check that,
// all modifiers will trigger updates at the same time...
}
} break;
}
Expand Down

0 comments on commit e3b9137

Please sign in to comment.