diff options
author | Jacques Lucke <jacques@blender.org> | 2020-10-23 16:18:20 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-10-23 16:18:20 +0300 |
commit | 9d7672be71cfff13ac240d11118f398ea5a1916f (patch) | |
tree | ff2a8111168f0afb8bdc99668db7162f057ec587 /source/blender/editors | |
parent | 994e7178bba482aa48ea8d25a050818d2afaf115 (diff) | |
parent | e4728d0a167c7e89c4d551dcd7b22b9b9b4567dd (diff) |
Merge branch 'master' into geometry-nodes
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 36 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 3 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_walk.c | 2 |
4 files changed, 26 insertions, 17 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 1ceeb3d1fed..47836d2e529 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -4233,24 +4233,26 @@ static Base *mesh_separate_arrays(Main *bmain, BMFace **faces, uint faces_len) { + const BMAllocTemplate bm_new_allocsize = { + .totvert = verts_len, + .totedge = edges_len, + .totloop = faces_len * 3, + .totface = faces_len, + }; + const bool use_custom_normals = (bm_old->lnor_spacearr != NULL); + Base *base_new; Object *obedit = base_old->object; - BMesh *bm_new; - bm_new = BM_mesh_create(&bm_mesh_allocsize_default, - &((struct BMeshCreateParams){ - .use_toolflags = true, - })); - - CustomData_copy(&bm_old->vdata, &bm_new->vdata, CD_MASK_BMESH.vmask, CD_CALLOC, 0); - CustomData_copy(&bm_old->edata, &bm_new->edata, CD_MASK_BMESH.emask, CD_CALLOC, 0); - CustomData_copy(&bm_old->ldata, &bm_new->ldata, CD_MASK_BMESH.lmask, CD_CALLOC, 0); - CustomData_copy(&bm_old->pdata, &bm_new->pdata, CD_MASK_BMESH.pmask, CD_CALLOC, 0); + BMesh *bm_new = BM_mesh_create(&bm_new_allocsize, &((struct BMeshCreateParams){0})); - CustomData_bmesh_init_pool(&bm_new->vdata, verts_len, BM_VERT); - CustomData_bmesh_init_pool(&bm_new->edata, edges_len, BM_EDGE); - CustomData_bmesh_init_pool(&bm_new->ldata, faces_len * 3, BM_LOOP); - CustomData_bmesh_init_pool(&bm_new->pdata, faces_len, BM_FACE); + if (use_custom_normals) { + /* Needed so the temporary normal layer is copied too. */ + BM_mesh_copy_init_customdata_all_layers(bm_new, bm_old, BM_ALL, &bm_new_allocsize); + } + else { + BM_mesh_copy_init_customdata(bm_new, bm_old, &bm_new_allocsize); + } /* Take into account user preferences for duplicating actions. */ const eDupli_ID_Flags dupflag = USER_DUP_MESH | (U.dupflag & USER_DUP_ACT); @@ -4270,6 +4272,10 @@ static Base *mesh_separate_arrays(Main *bmain, BM_mesh_copy_arrays(bm_old, bm_new, verts, verts_len, edges, edges_len, faces, faces_len); + if (use_custom_normals) { + BM_custom_loop_normals_from_vector_layer(bm_new, false); + } + for (uint i = 0; i < verts_len; i++) { BM_vert_kill(bm_old, verts[i]); } @@ -4432,6 +4438,8 @@ static bool mesh_separate_loose( ED_mesh_geometry_clear(base_old->object->data); } + BM_custom_loop_normals_to_vector_layer(bm_old); + /* Separate out all groups except the first. */ uint group_ofs[3] = {UNPACK3(groups[0])}; for (int i = 1; i < groups_len; i++) { diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 9dbdb37ef27..f5962f36412 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -550,10 +550,11 @@ void ED_region_do_draw(bContext *C, ARegion *region) * for drawing of borders/gestures etc */ ED_region_pixelspace(region); + /* Remove sRGB override by rebinding the framebuffer. */ GPUFrameBuffer *fb = GPU_framebuffer_active_get(); GPU_framebuffer_bind(fb); + ED_region_draw_cb_draw(C, region, REGION_DRAW_POST_PIXEL); - GPU_framebuffer_bind_no_srgb(fb); region_draw_azones(area, region); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8e7935e821d..76e5f8e7099 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -7195,7 +7195,7 @@ float SCULPT_raycast_init(ViewContext *vc, if ((rv3d->is_persp == false) && /* If the ray is clipped, don't adjust its start/end. */ - RV3D_CLIPPING_ENABLED(v3d, rv3d)) { + !RV3D_CLIPPING_ENABLED(v3d, rv3d)) { BKE_pbvh_raycast_project_ray_root(ob->sculpt->pbvh, original, ray_start, ray_end, ray_normal); /* rRecalculate the normal. */ diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index 1d89b040b85..3c9e4fa49b9 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -337,7 +337,7 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *region, voi immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - immUniformThemeColor3(TH_VIEW_OVERLAY); + immUniformThemeColorAlpha(TH_VIEW_OVERLAY, 1.0f); immBegin(GPU_PRIM_LINES, 8); |