From 8f12dad3093eb4393271d876a9db29b1a0b6dd66 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 6 Dec 2015 11:17:17 +1100 Subject: Fix generate UV's adding extra layers Adding a new meshes when there were no faces would always add a new uv-layer. --- source/blender/editors/mesh/editmesh_add.c | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'source/blender/editors/mesh/editmesh_add.c') diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index b0369c6f5ad..2a9f9c830f4 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -114,8 +114,8 @@ static int add_primitive_plane_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Plane"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (calc_uvs && !ED_uvedit_test(obedit)) { - ED_mesh_uv_texture_add(obedit->data, NULL, true); + if (calc_uvs) { + ED_mesh_uv_texture_ensure(obedit->data, NULL); } if (!EDBM_op_call_and_selectf( @@ -165,8 +165,8 @@ static int add_primitive_cube_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Cube"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (calc_uvs && !ED_uvedit_test(obedit)) { - ED_mesh_uv_texture_add(obedit->data, NULL, true); + if (calc_uvs) { + ED_mesh_uv_texture_ensure(obedit->data, NULL); } if (!EDBM_op_call_and_selectf( @@ -227,8 +227,8 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Circle"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (calc_uvs && !ED_uvedit_test(obedit)) { - ED_mesh_uv_texture_add(obedit->data, NULL, true); + if (calc_uvs) { + ED_mesh_uv_texture_ensure(obedit->data, NULL); } if (!EDBM_op_call_and_selectf( @@ -286,8 +286,8 @@ static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Cylinder"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (calc_uvs && !ED_uvedit_test(obedit)) { - ED_mesh_uv_texture_add(obedit->data, NULL, true); + if (calc_uvs) { + ED_mesh_uv_texture_ensure(obedit->data, NULL); } if (!EDBM_op_call_and_selectf( @@ -349,8 +349,8 @@ static int add_primitive_cone_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Cone"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (calc_uvs && !ED_uvedit_test(obedit)) { - ED_mesh_uv_texture_add(obedit->data, NULL, true); + if (calc_uvs) { + ED_mesh_uv_texture_ensure(obedit->data, NULL); } if (!EDBM_op_call_and_selectf( @@ -407,8 +407,8 @@ static int add_primitive_grid_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Grid"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (calc_uvs && !ED_uvedit_test(obedit)) { - ED_mesh_uv_texture_add(obedit->data, NULL, true); + if (calc_uvs) { + ED_mesh_uv_texture_ensure(obedit->data, NULL); } if (!EDBM_op_call_and_selectf( @@ -516,8 +516,8 @@ static int add_primitive_uvsphere_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Sphere"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (calc_uvs && !ED_uvedit_test(obedit)) { - ED_mesh_uv_texture_add(obedit->data, NULL, true); + if (calc_uvs) { + ED_mesh_uv_texture_ensure(obedit->data, NULL); } if (!EDBM_op_call_and_selectf( @@ -572,8 +572,8 @@ static int add_primitive_icosphere_exec(bContext *C, wmOperator *op) obedit = make_prim_init(C, CTX_DATA_(BLT_I18NCONTEXT_ID_MESH, "Icosphere"), &dia, mat, &was_editmode, loc, rot, layer); em = BKE_editmesh_from_object(obedit); - if (calc_uvs && !ED_uvedit_test(obedit)) { - ED_mesh_uv_texture_add(obedit->data, NULL, true); + if (calc_uvs) { + ED_mesh_uv_texture_ensure(obedit->data, NULL); } if (!EDBM_op_call_and_selectf( -- cgit v1.2.3