diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-12-06 03:17:17 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-12-06 03:22:17 +0300 |
commit | 8f12dad3093eb4393271d876a9db29b1a0b6dd66 (patch) | |
tree | a29d7b524b59679eb0766cea831e4fdd6dd2fd5a /source/blender/editors/mesh/editmesh_add.c | |
parent | ed5dbb0a7b2bc7bef3776d31eaf466ec8740560f (diff) |
Fix generate UV's adding extra layers
Adding a new meshes when there were no faces would always add a new uv-layer.
Diffstat (limited to 'source/blender/editors/mesh/editmesh_add.c')
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 32 |
1 files changed, 16 insertions, 16 deletions
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( |