Commit: 8f12dad3093eb4393271d876a9db29b1a0b6dd66
Author: Campbell Barton
Date:   Sun Dec 6 11:17:17 2015 +1100
Branches: master
https://developer.blender.org/rB8f12dad3093eb4393271d876a9db29b1a0b6dd66

Fix generate UV's adding extra layers

Adding a new meshes when there were no faces would always add a new uv-layer.

===================================================================

M       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 b0369c6..2a9f9c8 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(

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to