diff options
Diffstat (limited to 'source/blender/bmesh/operators')
-rw-r--r-- | source/blender/bmesh/operators/bmo_primitive.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 8d5963cfb1c..d8047499780 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -854,7 +854,7 @@ void BM_mesh_calc_uvs_grid(BMesh *bm, void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) { - const float dia = BMO_slot_float_get(op->slots_in, "diameter"); + const float rad = BMO_slot_float_get(op->slots_in, "radius"); const int seg = BMO_slot_int_get(op->slots_in, "u_segments"); const int tot = BMO_slot_int_get(op->slots_in, "v_segments"); @@ -881,8 +881,8 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) const float phi = M_PI * ((double)a / (double)tot); vec[0] = 0.0; - vec[1] = dia * sinf(phi); - vec[2] = dia * cosf(phi); + vec[1] = rad * sinf(phi); + vec[2] = rad * cosf(phi); eve = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); BMO_vert_flag_enable(bm, eve, VERT_MARK); @@ -921,12 +921,12 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) { float len, len2, vec2[3]; - len = 2 * dia * sinf(phid / 2.0f); + len = 2 * rad * sinf(phid / 2.0f); /* Length of one segment in shortest parallel. */ - vec[0] = dia * sinf(phid); + vec[0] = rad * sinf(phid); vec[1] = 0.0f; - vec[2] = dia * cosf(phid); + vec[2] = rad * cosf(phid); mul_v3_m3v3(vec2, cmat, vec); len2 = len_v3v3(vec, vec2); @@ -973,8 +973,8 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) { - const float dia = BMO_slot_float_get(op->slots_in, "diameter"); - const float dia_div = dia / 200.0f; + const float rad = BMO_slot_float_get(op->slots_in, "radius"); + const float rad_div = rad / 200.0f; const int subdiv = BMO_slot_int_get(op->slots_in, "subdivisions"); const int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); @@ -994,9 +994,9 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) /* phi = 0.25f * (float)M_PI; */ /* UNUSED */ for (a = 0; a < 12; a++) { - vec[0] = dia_div * icovert[a][0]; - vec[1] = dia_div * icovert[a][1]; - vec[2] = dia_div * icovert[a][2]; + vec[0] = rad_div * icovert[a][0]; + vec[1] = rad_div * icovert[a][1]; + vec[2] = rad_div * icovert[a][2]; eva[a] = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); BMO_vert_flag_enable(bm, eva[a], VERT_MARK); @@ -1041,7 +1041,7 @@ void bmo_create_icosphere_exec(BMesh *bm, BMOperator *op) "cuts=%i " "use_grid_fill=%b use_sphere=%b", EDGE_MARK, - dia, + rad, (1 << (subdiv - 1)) - 1, true, true); @@ -1392,8 +1392,8 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) BMVert *v1, *v2, *lastv1 = NULL, *lastv2 = NULL, *cent1, *cent2, *firstv1, *firstv2; BMFace *f; float vec[3], mat[4][4]; - const float dia1 = BMO_slot_float_get(op->slots_in, "diameter1"); - const float dia2 = BMO_slot_float_get(op->slots_in, "diameter2"); + const float rad1 = BMO_slot_float_get(op->slots_in, "radius1"); + const float rad2 = BMO_slot_float_get(op->slots_in, "radius2"); const float depth_half = 0.5f * BMO_slot_float_get(op->slots_in, "depth"); int segs = BMO_slot_int_get(op->slots_in, "segments"); const bool cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends"); @@ -1431,15 +1431,14 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) for (int i = 0; i < segs; i++) { /* Calculate with doubles for higher precision, see: T87779. */ const float phi = (2.0 * M_PI) * ((double)i / (double)segs); - - vec[0] = dia1 * sinf(phi); - vec[1] = dia1 * cosf(phi); + vec[0] = rad1 * sinf(phi); + vec[1] = rad1 * cosf(phi); vec[2] = -depth_half; mul_m4_v3(mat, vec); v1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); - vec[0] = dia2 * sinf(phi); - vec[1] = dia2 * cosf(phi); + vec[0] = rad2 * sinf(phi); + vec[1] = rad2 * cosf(phi); vec[2] = depth_half; mul_m4_v3(mat, vec); v2 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); @@ -1497,11 +1496,11 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) } if (calc_uvs) { - BM_mesh_calc_uvs_cone(bm, mat, dia2, dia1, segs, cap_ends, FACE_MARK, cd_loop_uv_offset); + BM_mesh_calc_uvs_cone(bm, mat, rad2, rad1, segs, cap_ends, FACE_MARK, cd_loop_uv_offset); } /* Collapse vertices at the first end. */ - if (dia1 == 0.0f) { + if (rad1 == 0.0f) { if (cap_ends) { BM_vert_kill(bm, cent1); } @@ -1513,7 +1512,7 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) } /* Collapse vertices at the second end. */ - if (dia2 == 0.0f) { + if (rad2 == 0.0f) { if (cap_ends) { BM_vert_kill(bm, cent2); } |