diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-10-09 12:49:27 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-10-09 12:49:27 +0300 |
commit | a5b4b0f21c1ae8c96e4fea9abdcfac2fab1cf300 (patch) | |
tree | 0658d8bdfb8ec03652aa04f82ee8a4d243ec6370 /source/blender/editors/uvedit | |
parent | d68f698cf0321477c0734474150eb4bc43c4e85f (diff) | |
parent | abcda06934aba054de8540b66b13c2bbc5f8f515 (diff) |
Merge branch '28' into custom-manipulatorscustom-manipulators
Diffstat (limited to 'source/blender/editors/uvedit')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_draw.c | 6 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_ops.c | 11 | ||||
-rw-r--r-- | source/blender/editors/uvedit/uvedit_smart_stitch.c | 44 |
3 files changed, 37 insertions, 24 deletions
diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index f8c0e24c061..1e557236bfd 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -89,7 +89,7 @@ void ED_image_draw_cursor(ARegion *ar, const float cursor[2]) const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); + immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); float viewport_size[4]; glGetFloatv(GL_VIEWPORT, viewport_size); @@ -655,7 +655,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe /* 1. draw shadow mesh */ if (sima->flag & SI_DRAWSHADOW) { - Object *ob_cage = DEG_get_object(depsgraph, obedit); + Object *ob_cage = DEG_get_evaluated_object(depsgraph, obedit); /* XXX TODO: Need to check if shadow mesh is different than original mesh. */ bool is_cage_like_final_meshes = (ob_cage == obedit); @@ -743,7 +743,7 @@ static void draw_uvs(SpaceImage *sima, Scene *scene, SceneLayer *sl, Object *obe { const uint shdr_pos = GWN_vertformat_attr_add(immVertexFormat(), "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT); - immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_COLOR); + immBindBuiltinProgram(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR); float viewport_size[4]; glGetFloatv(GL_VIEWPORT, viewport_size); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 0e33525ceff..2a0eed6f438 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -222,7 +222,7 @@ void ED_uvedit_assign_image(Main *UNUSED(bmain), Scene *scene, Object *obedit, I if (!CustomData_has_layer(&em->bm->ldata, CD_MLOOPUV)) { BM_data_layer_add(em->bm, &em->bm->ldata, CD_MLOOPUV); /* make UVs all nice 0-1 */ - ED_mesh_uv_loop_reset_ex(obedit->data, CustomData_get_active_layer_index(&em->bm->ldata, CD_MLOOPUV)); + ED_mesh_uv_loop_reset_ex(obedit->data, CustomData_get_active_layer(&em->bm->ldata, CD_MLOOPUV)); update = true; } @@ -1062,8 +1062,13 @@ static void uv_select_linked(Scene *scene, Image *ima, BMEditMesh *em, const flo BM_mesh_elem_table_ensure(em->bm, BM_FACE); /* we can use this too */ - /* use winding so we don't consider overlapping islands as connected, see T44320 */ - vmap = BM_uv_vert_map_create(em->bm, limit, !select_faces, true); + /* Note, we had 'use winding' so we don't consider overlapping islands as connected, see T44320 + * this made *every* projection split the island into front/back islands. + * Keep 'use_winding' to false, see: T50970. + * + * Better solve this by having a delimit option for select-linked operator, + * keeping island-select working as is. */ + vmap = BM_uv_vert_map_create(em->bm, limit, !select_faces, false); if (vmap == NULL) return; diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 55c439924cd..4ff4c3223f0 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -1541,13 +1541,15 @@ static void stitch_calculate_edge_normal(BMEditMesh *em, UvEdge *edge, float *no normalize_v2(normal); } +/** + */ static void stitch_draw_vbo(Gwn_VertBuf *vbo, Gwn_PrimType prim_type, const float col[4]) { - Gwn_Batch *batch = GWN_batch_create(prim_type, vbo, NULL); - Batch_set_builtin_program(batch, GPU_SHADER_2D_UNIFORM_COLOR); + Gwn_Batch *batch = GWN_batch_create_ex(prim_type, vbo, NULL, GWN_BATCH_OWNS_VBO); + GWN_batch_program_set_builtin(batch, GPU_SHADER_2D_UNIFORM_COLOR); GWN_batch_uniform_4fv(batch, "color", col); GWN_batch_draw(batch); - GWN_batch_discard_all(batch); + GWN_batch_discard(batch); } /* TODO make things pretier : store batches inside StitchPreviewer instead of the bare verts pos */ @@ -1572,8 +1574,9 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar UI_GetThemeColor4fv(TH_STITCH_PREVIEW_ACTIVE, col); vbo = GWN_vertbuf_create_with_format(&format); GWN_vertbuf_data_alloc(vbo, stitch_preview->num_static_tris * 3); - for (int i = 0; i < stitch_preview->num_static_tris * 3; i++) - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->static_tris[i*2]); + for (int i = 0; i < stitch_preview->num_static_tris * 3; i++) { + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->static_tris[i * 2]); + } stitch_draw_vbo(vbo, GWN_PRIM_TRIS, col); @@ -1599,16 +1602,17 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar for (j = 1; j < stitch_preview->uvs_per_polygon[i] - 1; ++j) { GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index]); - GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); - GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); + GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j + 0) * 2]); + GWN_vertbuf_attr_set(vbo, pos_id, tri_idx++, &stitch_preview->preview_polys[index + (j + 1) * 2]); - GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+0)*2]); - GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j+1)*2]); + GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j + 0) * 2]); + GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + (j + 1) * 2]); } /* Closing line */ GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); - GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j*2]); /* j = uvs_per_polygon[i] - 1*/ + /* j = uvs_per_polygon[i] - 1*/ + GWN_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j * 2]); index += stitch_preview->uvs_per_polygon[i] * 2; } @@ -1627,30 +1631,34 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(ar), void *ar UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col); vbo = GWN_vertbuf_create_with_format(&format); GWN_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable); - for (int i = 0; i < stitch_preview->num_stitchable; i++) - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); + for (int i = 0; i < stitch_preview->num_stitchable; i++) { + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i * 2]); + } stitch_draw_vbo(vbo, GWN_PRIM_POINTS, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); vbo = GWN_vertbuf_create_with_format(&format); GWN_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable); - for (int i = 0; i < stitch_preview->num_unstitchable; i++) - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); + for (int i = 0; i < stitch_preview->num_unstitchable; i++) { + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i * 2]); + } stitch_draw_vbo(vbo, GWN_PRIM_POINTS, col); } else { UI_GetThemeColor4fv(TH_STITCH_PREVIEW_STITCHABLE, col); vbo = GWN_vertbuf_create_with_format(&format); GWN_vertbuf_data_alloc(vbo, stitch_preview->num_stitchable * 2); - for (int i = 0; i < stitch_preview->num_stitchable * 2; i++) - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i*2]); + for (int i = 0; i < stitch_preview->num_stitchable * 2; i++) { + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_stitchable[i * 2]); + } stitch_draw_vbo(vbo, GWN_PRIM_LINES, col); UI_GetThemeColor4fv(TH_STITCH_PREVIEW_UNSTITCHABLE, col); vbo = GWN_vertbuf_create_with_format(&format); GWN_vertbuf_data_alloc(vbo, stitch_preview->num_unstitchable * 2); - for (int i = 0; i < stitch_preview->num_unstitchable * 2; i++) - GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i*2]); + for (int i = 0; i < stitch_preview->num_unstitchable * 2; i++) { + GWN_vertbuf_attr_set(vbo, pos_id, i, &stitch_preview->preview_unstitchable[i * 2]); + } stitch_draw_vbo(vbo, GWN_PRIM_LINES, col); } } |