Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_undo.c
| Show First 20 Lines • Show All 1,559 Lines • ▼ Show 20 Lines | static bool sculpt_undo_use_multires_mesh(bContext *C) | ||||
| SculptSession *sculpt_session = object->sculpt; | SculptSession *sculpt_session = object->sculpt; | ||||
| return sculpt_session->multires.active; | return sculpt_session->multires.active; | ||||
| } | } | ||||
| static void sculpt_undo_push_all_grids(Object *object) | static void sculpt_undo_push_all_grids(Object *object) | ||||
| { | { | ||||
| SculptSession *ss = object->sculpt; | SculptSession *ss = object->sculpt; | ||||
| /* It is possible that undo push is done from an object state where there is no PBVH. This | |||||
| * happens, for example, when an operation which tagged for geometry update was performed prior | |||||
| * to the current operation without making any stroke inbetween. | |||||
| * | |||||
| * Skip pushing nodes based on the following logic: on redo SCULPT_UNDO_COORDS will ensure | |||||
| * PBVH for the new base geometry, which will have same coordinates as if we create PBVH here. */ | |||||
| if (ss->pbvh == NULL) { | |||||
| return; | |||||
| } | |||||
| PBVHNode **nodes; | PBVHNode **nodes; | ||||
| int totnodes; | int totnodes; | ||||
| BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnodes); | BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnodes); | ||||
| for (int i = 0; i < totnodes; i++) { | for (int i = 0; i < totnodes; i++) { | ||||
| SculptUndoNode *unode = SCULPT_undo_push_node(object, nodes[i], SCULPT_UNDO_COORDS); | SculptUndoNode *unode = SCULPT_undo_push_node(object, nodes[i], SCULPT_UNDO_COORDS); | ||||
| unode->node = NULL; | unode->node = NULL; | ||||
| } | } | ||||
| Show All 36 Lines | |||||