Fix: Vertex paint filter operators broken undo #106136
|
@ -1848,7 +1848,9 @@ static void sculpt_update_object(
|
|||
|
||||
if (is_paint_tool) {
|
||||
if (ss->vcol_domain == ATTR_DOMAIN_CORNER) {
|
||||
/* Ensure pbvh nodes have loop indices, needed for undo. */
|
||||
/* Ensure pbvh nodes have loop indices; the sculpt undo system
|
||||
|
||||
* needs them for color attributes.
|
||||
*/
|
||||
BKE_pbvh_ensure_node_loops(ss->pbvh);
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_index_mask_ops.hh"
|
||||
#include "BLI_index_range.hh"
|
||||
#include "BLI_math_base.h"
|
||||
Hans Goudey
commented
Not sure where this Not sure where this `BKE_mesh_mapping.h` include is coming from, it doesn't look necessary here.
Hans Goudey
commented
This header is still added in this patch. This header is still added in this patch.
|
||||
#include "BLI_math_color.h"
|
||||
#include "BLI_vector.hh"
|
||||
|
@ -308,11 +307,14 @@ static void transform_active_color(bContext *C, wmOperator *op, const TransformF
|
|||
BKE_pbvh_search_gather(obact->sculpt->pbvh, nullptr, nullptr, &nodes, &nodes_num);
|
||||
for (int i : IndexRange(nodes_num)) {
|
||||
SCULPT_undo_push_node(obact, nodes[i], SCULPT_UNDO_COLOR);
|
||||
Hans Goudey
commented
I'm not sure, but it seems more clear/common to add the update tags directly after the data is changed rather than before. I'm not sure, but it seems more clear/common to add the update tags directly after the data is changed rather than before.
|
||||
BKE_pbvh_node_mark_update_color(nodes[i]);
|
||||
}
|
||||
|
||||
transform_active_color_data(*BKE_mesh_from_object(obact), transform_fn);
|
||||
|
||||
for (int i : IndexRange(nodes_num)) {
|
||||
BKE_pbvh_node_mark_update_color(nodes[i]);
|
||||
}
|
||||
|
||||
SCULPT_undo_push_end(obact);
|
||||
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
This sort of comment ends up being confusing a year later, it says "needed for undo" but that brings up more questions than it answers-- why would "undo" need this data? what is meant by "undo" here? etc.
I don't know the actual reason, but I'd expect something like "needed in order to interpolate from face corners to vertices for undo step storage"
And one more question, could the sculpt undo system call this function directly rather than doing it here?