Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_undo.c
| Show First 20 Lines • Show All 492 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| View3D *v3d = CTX_wm_view3d(C); | View3D *v3d = CTX_wm_view3d(C); | ||||
| Object *ob = OBACT(view_layer); | Object *ob = OBACT(view_layer); | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| SubdivCCG *subdiv_ccg = ss->subdiv_ccg; | SubdivCCG *subdiv_ccg = ss->subdiv_ccg; | ||||
| SculptUndoNode *unode; | SculptUndoNode *unode; | ||||
| bool update = false, rebuild = false, update_mask = false; | bool update = false, rebuild = false, update_mask = false, update_visibility = false; | ||||
| bool need_mask = false; | bool need_mask = false; | ||||
| for (unode = lb->first; unode; unode = unode->next) { | for (unode = lb->first; unode; unode = unode->next) { | ||||
| /* restore pivot */ | /* restore pivot */ | ||||
| copy_v3_v3(ss->pivot_pos, unode->pivot_pos); | copy_v3_v3(ss->pivot_pos, unode->pivot_pos); | ||||
| copy_v3_v3(ss->pivot_rot, unode->pivot_rot); | copy_v3_v3(ss->pivot_rot, unode->pivot_rot); | ||||
| if (STREQ(unode->idname, ob->id.name)) { | if (STREQ(unode->idname, ob->id.name)) { | ||||
| if (unode->type == SCULPT_UNDO_MASK) { | if (unode->type == SCULPT_UNDO_MASK) { | ||||
| ▲ Show 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | switch (unode->type) { | ||||
| case SCULPT_UNDO_COORDS: | case SCULPT_UNDO_COORDS: | ||||
| if (sculpt_undo_restore_coords(C, depsgraph, unode)) { | if (sculpt_undo_restore_coords(C, depsgraph, unode)) { | ||||
| update = true; | update = true; | ||||
| } | } | ||||
| break; | break; | ||||
| case SCULPT_UNDO_HIDDEN: | case SCULPT_UNDO_HIDDEN: | ||||
| if (sculpt_undo_restore_hidden(C, unode)) { | if (sculpt_undo_restore_hidden(C, unode)) { | ||||
| rebuild = true; | rebuild = true; | ||||
| update_visibility = true; | |||||
| } | } | ||||
| break; | break; | ||||
| case SCULPT_UNDO_MASK: | case SCULPT_UNDO_MASK: | ||||
| if (sculpt_undo_restore_mask(C, unode)) { | if (sculpt_undo_restore_mask(C, unode)) { | ||||
| update = true; | update = true; | ||||
| update_mask = true; | update_mask = true; | ||||
| } | } | ||||
| break; | break; | ||||
| ▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | if (update || rebuild) { | ||||
| if (ss->shapekey_active || ss->deform_modifiers_active) { | if (ss->shapekey_active || ss->deform_modifiers_active) { | ||||
| Mesh *mesh = ob->data; | Mesh *mesh = ob->data; | ||||
| BKE_mesh_calc_normals(mesh); | BKE_mesh_calc_normals(mesh); | ||||
| BKE_sculptsession_free_deformMats(ss); | BKE_sculptsession_free_deformMats(ss); | ||||
| tag_update |= true; | tag_update |= true; | ||||
| } | } | ||||
| if (BKE_pbvh_type(ss->pbvh) == PBVH_FACES && update_visibility) { | |||||
| Mesh *mesh = ob->data; | |||||
| BKE_mesh_flush_hidden_from_verts(mesh); | |||||
| } | |||||
| if (tag_update) { | if (tag_update) { | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| } | } | ||||
| else { | else { | ||||
| sculpt_update_object_bounding_box(ob); | sculpt_update_object_bounding_box(ob); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 676 Lines • Show Last 20 Lines | |||||