diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint')
10 files changed, 125 insertions, 57 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index 3db0bd61f03..db6380e920f 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -154,7 +154,7 @@ static void partialvis_update_grids(Object *ob, { CCGElem **grids; CCGKey key; - BLI_bitmap *grid_hidden; + BLI_bitmap **grid_hidden; int any_visible = 0; int *grid_indices, totgrid, any_changed, i; @@ -171,7 +171,7 @@ static void partialvis_update_grids(Object *ob, for (i = 0; i < totgrid; i++) { int any_hidden = 0; int g = grid_indices[i], x, y; - BLI_bitmap gh = grid_hidden[g]; + BLI_bitmap *gh = grid_hidden[g]; if (!gh) { switch (action) { diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 553a5cbe9ac..db55dc271f1 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -245,7 +245,8 @@ typedef struct ProjPaintState { float normal_angle_inner; float normal_angle_range; /* difference between normal_angle and normal_angle_inner, for easy access */ - short is_ortho; + bool do_face_sel; /* quick access to (me->editflag & ME_EDIT_PAINT_FACE_SEL) */ + bool is_ortho; bool do_masking; /* use masking during painting. Some operations such as airbrush may disable */ bool is_texbrush; /* only to avoid running */ bool is_maskbrush; /* mask brush is applied before masking */ @@ -2809,22 +2810,32 @@ static void project_paint_begin(ProjPaintState *ps) Image *tpage_last = NULL, *tpage; /* Face vars */ + MPoly *mpoly_orig; MFace *mf; MTFace *tf; int a, i; /* generic looping vars */ int image_index = -1, face_index; + + /* double lookup */ + const int *index_mf_to_mpoly = NULL; + const int *index_mp_to_orig = NULL; + MVert *mv; MemArena *arena; /* at the moment this is just ps->arena_mt[0], but use this to show were not multithreading */ const int diameter = 2 * BKE_brush_size_get(ps->scene, ps->brush); + bool reset_threads = false; + /* ---- end defines ---- */ if (ps->source == PROJ_SRC_VIEW) ED_view3d_clipping_local(ps->rv3d, ps->ob->obmat); /* faster clipping lookups */ + ps->do_face_sel = ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_FACE_SEL) != 0); + /* paint onto the derived mesh */ /* Workaround for subsurf selection, try the display mesh first */ @@ -2833,12 +2844,17 @@ static void project_paint_begin(ProjPaintState *ps) ps->dm = mesh_create_derived_render(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE); ps->dm_release = TRUE; } - else if (ps->ob->derivedFinal && CustomData_has_layer(&ps->ob->derivedFinal->faceData, CD_MTFACE)) { + else if (ps->ob->derivedFinal && + CustomData_has_layer(&ps->ob->derivedFinal->faceData, CD_MTFACE) && + (ps->do_face_sel == false || CustomData_has_layer(&ps->ob->derivedFinal->polyData, CD_ORIGINDEX))) + { ps->dm = ps->ob->derivedFinal; ps->dm_release = FALSE; } else { - ps->dm = mesh_get_derived_final(ps->scene, ps->ob, ps->scene->customdata_mask | CD_MASK_MTFACE); + ps->dm = mesh_get_derived_final( + ps->scene, ps->ob, + ps->scene->customdata_mask | CD_MASK_MTFACE | (ps->do_face_sel ? CD_ORIGINDEX : 0)); ps->dm_release = TRUE; } @@ -2858,6 +2874,20 @@ static void project_paint_begin(ProjPaintState *ps) ps->dm_totvert = ps->dm->getNumVerts(ps->dm); ps->dm_totface = ps->dm->getNumTessFaces(ps->dm); + if (ps->do_face_sel) { + index_mf_to_mpoly = ps->dm->getTessFaceDataArray(ps->dm, CD_ORIGINDEX); + index_mp_to_orig = ps->dm->getPolyDataArray(ps->dm, CD_ORIGINDEX); + if (index_mf_to_mpoly == NULL) { + index_mp_to_orig = NULL; + } + else { + mpoly_orig = ((Mesh *)ps->ob->data)->mpoly; + } + } + else { + mpoly_orig = NULL; + } + /* use clone mtface? */ @@ -3064,6 +3094,10 @@ static void project_paint_begin(ProjPaintState *ps) /* printf("\tscreenspace bucket division x:%d y:%d\n", ps->buckets_x, ps->buckets_y); */ + if (ps->buckets_x > PROJ_BUCKET_RECT_MAX || ps->buckets_y > PROJ_BUCKET_RECT_MAX) { + reset_threads = true; + } + /* really high values could cause problems since it has to allocate a few * (ps->buckets_x*ps->buckets_y) sized arrays */ CLAMP(ps->buckets_x, PROJ_BUCKET_RECT_MIN, PROJ_BUCKET_RECT_MAX); @@ -3089,6 +3123,11 @@ static void project_paint_begin(ProjPaintState *ps) ps->thread_tot = BKE_scene_num_threads(ps->scene); + /* workaround for #35057, disable threading if diameter is less than is possible for + * optimum bucket number generation */ + if (reset_threads) + ps->thread_tot = 1; + for (a = 0; a < ps->thread_tot; a++) { ps->arena_mt[a] = BLI_memarena_new(1 << 16, "project paint arena"); } @@ -3118,8 +3157,8 @@ static void project_paint_begin(ProjPaintState *ps) } } - for (face_index = 0, tf = ps->dm_mtface, mf = ps->dm_mface; face_index < ps->dm_totface; mf++, tf++, face_index++) { + bool is_face_sel; #ifndef PROJ_DEBUG_NOSEAMBLEED /* add face user if we have bleed enabled, set the UV seam flags later */ @@ -3134,10 +3173,23 @@ static void project_paint_begin(ProjPaintState *ps) } #endif - tpage = project_paint_face_image(ps, ps->dm_mtface, face_index); - - if (tpage && ((((Mesh *)ps->ob->data)->editflag & ME_EDIT_PAINT_FACE_SEL) == 0 || mf->flag & ME_FACE_SEL)) { + if (ps->do_face_sel) { + int orig_index; + if (index_mp_to_orig && ((orig_index = DM_origindex_mface_mpoly(index_mf_to_mpoly, index_mp_to_orig, + face_index))) != ORIGINDEX_NONE) + { + MPoly *mp = &mpoly_orig[orig_index]; + is_face_sel = ((mp->flag & ME_FACE_SEL) != 0); + } + else { + is_face_sel = ((mf->flag & ME_FACE_SEL) != 0); + } + } + else { + is_face_sel = true; + } + if (is_face_sel && (tpage = project_paint_face_image(ps, ps->dm_mtface, face_index))) { float *v1coSS, *v2coSS, *v3coSS, *v4coSS = NULL; v1coSS = ps->screenCoords[mf->v1]; diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index 6de6734f975..bdf542526ee 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -695,6 +695,7 @@ static int stencil_control_modal(bContext *C, wmOperator *op, const wmEvent *eve WM_event_add_notifier(C, NC_WINDOW, NULL); return OPERATOR_CANCELLED; } + break; case XKEY: if (event->val == KM_PRESS) { @@ -846,7 +847,7 @@ static void BRUSH_OT_stencil_fit_image_aspect(wmOperatorType *ot) } -static int stencil_reset_transform(bContext *C, wmOperator *op) +static int stencil_reset_transform_exec(bContext *C, wmOperator *op) { Paint *paint = BKE_paint_get_active_from_context(C); Brush *br = BKE_paint_brush(paint); @@ -888,7 +889,7 @@ static void BRUSH_OT_stencil_reset_transform(wmOperatorType *ot) ot->idname = "BRUSH_OT_stencil_reset_transform"; /* api callbacks */ - ot->exec = stencil_reset_transform; + ot->exec = stencil_reset_transform_exec; ot->poll = stencil_control_poll; /* flags */ diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index d82606f52f0..576bbecb561 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -540,8 +540,9 @@ bool paint_supports_dynamic_size(Brush *br, PaintMode mode) case PAINT_SCULPT: if (sculpt_is_grab_tool(br)) return false; + break; default: - ; + break; } return true; } @@ -559,8 +560,9 @@ bool paint_supports_smooth_stroke(Brush *br, PaintMode mode) case PAINT_SCULPT: if (sculpt_is_grab_tool(br)) return false; + break; default: - ; + break; } return true; } @@ -575,9 +577,10 @@ bool paint_supports_dynamic_tex_coords(Brush *br, PaintMode mode) case PAINT_SCULPT: if (sculpt_is_grab_tool(br)) return false; + break; default: - ; - } + break; + } return true; } diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 8db9215a376..3ecde56b5d0 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -333,7 +333,7 @@ int imapaint_pick_face(ViewContext *vc, const int mval[2], unsigned int *index, /* sample only on the exact position */ *index = view3d_sample_backbuf(vc, mval[0], mval[1]); - if ((*index) <= 0 || (*index) > (unsigned int)totface) { + if ((*index) == 0 || (*index) > (unsigned int)totface) { return 0; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 173a76a54e8..3ac3564ed45 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -380,11 +380,9 @@ static int wpaint_mirror_vgroup_ensure(Object *ob, const int vgroup_active) flip_side_name(name, defgroup->name, FALSE); mirrdef = defgroup_name_index(ob, name); if (mirrdef == -1) { - int olddef = ob->actdef; /* tsk, ED_vgroup_add sets the active defgroup */ - if (ED_vgroup_add_name(ob, name)) { + if (BKE_defgroup_new(ob, name)) { mirrdef = BLI_countlist(&ob->defbase) - 1; } - ob->actdef = olddef; } /* curdef should never be NULL unless this is @@ -2027,7 +2025,7 @@ static void do_weight_paint_vertex( /* *************** set wpaint operator ****************** */ -static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ +static int wpaint_mode_toggle_exec(bContext *C, wmOperator *UNUSED(op)) /* toggle */ { Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); @@ -2049,8 +2047,6 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ DAG_id_tag_update(&me->id, 0); if (ob->mode & OB_MODE_WEIGHT_PAINT) { - Object *par; - if (wp == NULL) wp = scene->toolsettings->wpaint = new_vpaint(1); @@ -2059,14 +2055,7 @@ static int set_wpaint(bContext *C, wmOperator *UNUSED(op)) /* toggle */ mesh_octree_table(ob, NULL, NULL, 's'); - /* verify if active weight group is also active bone */ - par = modifiers_isDeformedByArmature(ob); - if (par && (par->mode & OB_MODE_POSE)) { - bArmature *arm = par->data; - - if (arm->act_bone) - ED_vgroup_select_by_name(ob, arm->act_bone->name); - } + ED_vgroup_sync_from_pose(ob); } else { mesh_octree_table(NULL, NULL, NULL, 'e'); @@ -2107,7 +2096,7 @@ void PAINT_OT_weight_paint_toggle(wmOperatorType *ot) ot->description = "Toggle weight paint mode in 3D view"; /* api callbacks */ - ot->exec = set_wpaint; + ot->exec = wpaint_mode_toggle_exec; ot->poll = paint_poll_test; /* flags */ @@ -2653,7 +2642,7 @@ void PAINT_OT_weight_set(wmOperatorType *ot) /* ************ set / clear vertex paint mode ********** */ -static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ +static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op) /* toggle */ { Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); @@ -2684,7 +2673,7 @@ static int set_vpaint(bContext *C, wmOperator *op) /* toggle */ ob->mode |= OB_MODE_VERTEX_PAINT; /* Turn off weight painting */ if (ob->mode & OB_MODE_WEIGHT_PAINT) - set_wpaint(C, op); + wpaint_mode_toggle_exec(C, op); if (vp == NULL) vp = scene->toolsettings->vpaint = new_vpaint(0); @@ -2711,7 +2700,7 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot) ot->description = "Toggle the vertex paint mode in 3D view"; /* api callbacks */ - ot->exec = set_vpaint; + ot->exec = vpaint_mode_toggle_exec; ot->poll = paint_poll_test; /* flags */ @@ -3424,7 +3413,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op) ED_view3d_init_mats_rv3d(ob, ar->regiondata); - dm->foreachMappedVert(dm, gradientVert__mapFunc, &data); + dm->foreachMappedVert(dm, gradientVert__mapFunc, &data, DM_FOREACH_NOP); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c index 2d5de80efeb..4c06cb8ea0d 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c @@ -107,7 +107,7 @@ static void vpaint_proj_dm_map_cosnos_init(Scene *scene, Object *ob, if (dm->foreachMappedVert) { memset(vp_handle->vcosnos, 0, sizeof(DMCoNo) * me->totvert); - dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle); + dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_init__map_cb, vp_handle, DM_FOREACH_USE_NORMAL); } else { DMCoNo *v_co_no = vp_handle->vcosnos; @@ -183,7 +183,7 @@ static void vpaint_proj_dm_map_cosnos_update(struct VertProjHandle *vp_handle, if (LIKELY(dm->foreachMappedVert)) { fill_vn_fl(vp_handle->dists, me->totvert, FLT_MAX); - dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update); + dm->foreachMappedVert(dm, vpaint_proj_dm_map_cosnos_update__map_cb, &vp_update, DM_FOREACH_USE_NORMAL); } dm->release(dm); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8e2a29964ee..4b7c2995ea7 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1177,6 +1177,7 @@ static void calc_sculpt_normal(Sculpt *sd, Object *ob, case SCULPT_DISP_DIR_AREA: calc_area_normal(sd, ob, an, nodes, totnode); + break; default: break; @@ -1528,7 +1529,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no float *tmpgrid_mask, *tmprow_mask; int v1, v2, v3, v4; int thread_num; - BLI_bitmap *grid_hidden; + BLI_bitmap **grid_hidden; int *grid_indices, totgrid, gridsize, i, x, y; sculpt_brush_test_init(ss, &test); @@ -1553,7 +1554,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no for (i = 0; i < totgrid; ++i) { int gi = grid_indices[i]; - BLI_bitmap gh = grid_hidden[gi]; + BLI_bitmap *gh = grid_hidden[gi]; data = griddata[gi]; adj = &gridadj[gi]; @@ -2457,6 +2458,7 @@ static void calc_sculpt_plane(Sculpt *sd, Object *ob, PBVHNode **nodes, int totn case SCULPT_DISP_DIR_AREA: calc_area_normal_and_flatten_center(sd, ob, nodes, totnode, an, fc); + break; default: break; @@ -3534,7 +3536,14 @@ int sculpt_mode_poll(bContext *C) int sculpt_mode_poll_view3d(bContext *C) { - return (sculpt_mode_poll(C) && CTX_wm_region_view3d(C)); + return (sculpt_mode_poll(C) && + CTX_wm_region_view3d(C)); +} + +int sculpt_poll_view3d(bContext *C) +{ + return (sculpt_poll(C) && + CTX_wm_region_view3d(C)); } int sculpt_poll(bContext *C) @@ -4514,7 +4523,7 @@ static void SCULPT_OT_brush_stroke(wmOperatorType *ot) /**** Reset the copy of the mesh that is being sculpted on (currently just for the layer brush) ****/ -static int sculpt_set_persistent_base(bContext *C, wmOperator *UNUSED(op)) +static int sculpt_set_persistent_base_exec(bContext *C, wmOperator *UNUSED(op)) { SculptSession *ss = CTX_data_active_object(C)->sculpt; @@ -4535,7 +4544,7 @@ static void SCULPT_OT_set_persistent_base(wmOperatorType *ot) ot->description = "Reset the copy of the mesh that is being sculpted on"; /* api callbacks */ - ot->exec = sculpt_set_persistent_base; + ot->exec = sculpt_set_persistent_base_exec; ot->poll = sculpt_mode_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4579,14 +4588,21 @@ void sculpt_dynamic_topology_enable(bContext *C) Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; Mesh *me = ob->data; + const BMAllocTemplate allocsize = {me->totvert, + me->totedge, + me->totloop, + me->totpoly}; sculpt_pbvh_clear(ob); ss->bm_smooth_shading = (scene->toolsettings->sculpt->flags & SCULPT_DYNTOPO_SMOOTH_SHADING); + /* Dynamic topology doesn't ensure selection state is valid, so remove [#36280] */ + BKE_mesh_mselect_clear(me); + /* Create triangles-only BMesh */ - ss->bm = BM_mesh_create(&bm_mesh_allocsize_default); + ss->bm = BM_mesh_create(&allocsize); BM_mesh_bm_from_me(ss->bm, me, true, true, ob->shapenr); sculpt_dynamic_topology_triangulate(ss->bm); @@ -4645,13 +4661,18 @@ void sculpt_dynamic_topology_disable(bContext *C, sculptsession_bm_to_me(ob, TRUE); } - BM_mesh_free(ss->bm); - /* Clear data */ me->flag &= ~ME_SCULPT_DYNAMIC_TOPOLOGY; - ss->bm = NULL; - BM_log_free(ss->bm_log); - ss->bm_log = NULL; + + /* typically valid but with global-undo they can be NULL, [#36234] */ + if (ss->bm) { + BM_mesh_free(ss->bm); + ss->bm = NULL; + } + if (ss->bm_log) { + BM_log_free(ss->bm_log); + ss->bm_log = NULL; + } /* Refresh */ sculpt_update_after_dynamic_topology_toggle(C); @@ -4879,7 +4900,7 @@ int ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd) return ret; } -static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op)) +static int sculpt_mode_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -4951,7 +4972,7 @@ static int sculpt_toggle_mode(bContext *C, wmOperator *UNUSED(op)) BKE_paint_init(&ts->sculpt->paint, PAINT_CURSOR_SCULPT); - paint_cursor_start(C, sculpt_mode_poll_view3d); + paint_cursor_start(C, sculpt_poll_view3d); } WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); @@ -4967,7 +4988,7 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot) ot->description = "Toggle sculpt mode in 3D view"; /* api callbacks */ - ot->exec = sculpt_toggle_mode; + ot->exec = sculpt_mode_toggle_exec; ot->poll = ED_operator_object_active_editable_mesh; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 1060999e13f..d904ec3bc96 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -56,7 +56,9 @@ struct MultiresModifierData *sculpt_multires_active(struct Scene *scene, struct int sculpt_mode_poll(struct bContext *C); int sculpt_mode_poll_view3d(struct bContext *C); +/* checks for a brush, not just sculpt mode */ int sculpt_poll(struct bContext *C); +int sculpt_poll_view3d(struct bContext *C); void sculpt_update_mesh_elements(struct Scene *scene, struct Sculpt *sd, struct Object *ob, int need_pmap, int need_mask); @@ -98,14 +100,14 @@ typedef struct SculptUndoNode { /* non-multires */ int maxvert; /* to verify if totvert it still the same */ int *index; /* to restore into right location */ - BLI_bitmap vert_hidden; + BLI_bitmap *vert_hidden; /* multires */ int maxgrid; /* same for grid */ int gridsize; /* same for grid */ int totgrid; /* to restore into right location */ int *grids; /* to restore into right location */ - BLI_bitmap *grid_hidden; + BLI_bitmap **grid_hidden; /* bmesh */ struct BMLogEntry *bm_entry; diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 2cc09ea2aa9..8861777f326 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -210,10 +210,10 @@ static int sculpt_undo_restore_hidden(bContext *C, DerivedMesh *dm, } } else if (unode->maxgrid && dm->getGridData) { - BLI_bitmap *grid_hidden = dm->getGridHidden(dm); + BLI_bitmap **grid_hidden = dm->getGridHidden(dm); for (i = 0; i < unode->totgrid; i++) { - SWAP(BLI_bitmap, + SWAP(BLI_bitmap *, unode->grid_hidden[i], grid_hidden[unode->grids[i]]); @@ -531,7 +531,7 @@ static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh, SculptUndoNode *unode) { PBVHNode *node = unode->node; - BLI_bitmap *grid_hidden; + BLI_bitmap **grid_hidden; int i, *grid_indices, totgrid; grid_hidden = BKE_pbvh_grid_hidden(pbvh); @@ -539,7 +539,7 @@ static void sculpt_undo_alloc_and_store_hidden(PBVH *pbvh, BKE_pbvh_node_get_grids(pbvh, node, &grid_indices, &totgrid, NULL, NULL, NULL, NULL); - unode->grid_hidden = MEM_mapallocN(sizeof(BLI_bitmap) * totgrid, + unode->grid_hidden = MEM_mapallocN(sizeof(*unode->grid_hidden) * totgrid, "unode->grid_hidden"); for (i = 0; i < totgrid; i++) { |