Fix T52923: Circle diameter is in fact radius

This commit is contained in:
Campbell Barton
2017-10-04 18:01:53 +11:00
parent 08f728a3e9
commit d1dfed206b
4 changed files with 7 additions and 7 deletions

View File

@@ -12,7 +12,7 @@ bm = bmesh.new()
bmesh.ops.create_circle( bmesh.ops.create_circle(
bm, bm,
cap_ends=False, cap_ends=False,
diameter=0.2, radius=0.2,
segments=8) segments=8)

View File

@@ -1684,7 +1684,7 @@ static BMOpDefine bmo_create_circle_def = {
{{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */ {{"cap_ends", BMO_OP_SLOT_BOOL}, /* whether or not to fill in the ends with faces */
{"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */ {"cap_tris", BMO_OP_SLOT_BOOL}, /* fill ends with triangles instead of ngons */
{"segments", BMO_OP_SLOT_INT}, {"segments", BMO_OP_SLOT_INT},
{"diameter", BMO_OP_SLOT_FLT}, /* diameter of one end */ {"radius", BMO_OP_SLOT_FLT}, /* Radius of the circle. */
{"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */ {"matrix", BMO_OP_SLOT_MAT}, /* matrix to multiply the new geometry with */
{"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */ {"calc_uvs", BMO_OP_SLOT_BOOL}, /* calculate default UVs */
{{'\0'}}, {{'\0'}},

View File

@@ -1285,7 +1285,7 @@ void bmo_create_monkey_exec(BMesh *bm, BMOperator *op)
void bmo_create_circle_exec(BMesh *bm, BMOperator *op) void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
{ {
const float dia = BMO_slot_float_get(op->slots_in, "diameter"); const float radius = BMO_slot_float_get(op->slots_in, "radius");
const int segs = BMO_slot_int_get(op->slots_in, "segments"); const int segs = BMO_slot_int_get(op->slots_in, "segments");
const bool cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends"); const bool cap_ends = BMO_slot_bool_get(op->slots_in, "cap_ends");
const bool cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris"); const bool cap_tris = BMO_slot_bool_get(op->slots_in, "cap_tris");
@@ -1315,8 +1315,8 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
for (a = 0; a < segs; a++, phi += phid) { for (a = 0; a < segs; a++, phi += phid) {
/* Going this way ends up with normal(s) upward */ /* Going this way ends up with normal(s) upward */
vec[0] = -dia * sinf(phi); vec[0] = -radius * sinf(phi);
vec[1] = dia * cosf(phi); vec[1] = radius * cosf(phi);
vec[2] = 0.0f; vec[2] = 0.0f;
mul_m4_v3(mat, vec); mul_m4_v3(mat, vec);
v1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP); v1 = BM_vert_create(bm, vec, NULL, BM_CREATE_NOP);
@@ -1351,7 +1351,7 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op)
BMO_face_flag_enable(bm, f, FACE_NEW); BMO_face_flag_enable(bm, f, FACE_NEW);
if (calc_uvs) { if (calc_uvs) {
BM_mesh_calc_uvs_circle(bm, mat, dia, FACE_NEW, cd_loop_uv_offset); BM_mesh_calc_uvs_circle(bm, mat, radius, FACE_NEW, cd_loop_uv_offset);
} }
} }

View File

@@ -233,7 +233,7 @@ static int add_primitive_circle_exec(bContext *C, wmOperator *op)
if (!EDBM_op_call_and_selectf( if (!EDBM_op_call_and_selectf(
em, op, "verts.out", false, em, op, "verts.out", false,
"create_circle segments=%i diameter=%f cap_ends=%b cap_tris=%b matrix=%m4 calc_uvs=%b", "create_circle segments=%i radius=%f cap_ends=%b cap_tris=%b matrix=%m4 calc_uvs=%b",
RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"), RNA_int_get(op->ptr, "vertices"), RNA_float_get(op->ptr, "radius"),
cap_end, cap_tri, mat, calc_uvs)) cap_end, cap_tri, mat, calc_uvs))
{ {