Fix #115024: Anchored brushes repeat action with incorrect normals
Before 111e586424, the normals were written back to the mesh
from the values stored in the undo step. Now though, due to caching of
normals and better const correct-ness, this is not so simple or safe.
That still may be a nice optimization to apply in the future, but for
now the simplicity of just recalculating them is much more feasible.
Since the recalculation is localized to the brush action, performance
should be okay. And maybe normals won't have to be stored in undo steps
in the future as well, since they're derived data.
This commit is contained in:
@@ -1420,6 +1420,13 @@ static void paint_mesh_restore_co(Sculpt *sd, Object *ob)
|
||||
});
|
||||
}
|
||||
|
||||
if (type == undo::Type::Position) {
|
||||
/* Update normals for potentially-changed positions. Theoretically this may be unnecessary if
|
||||
* the tool restoring to the initial state doesn't use the normals, but we have no easy way to
|
||||
* know that from here. */
|
||||
bke::pbvh::update_normals(*ss->pbvh, ss->subdiv_ccg);
|
||||
}
|
||||
|
||||
BKE_pbvh_node_color_buffer_free(ss->pbvh);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user