use radians for 'spin' bmesh operator (since the rest of the py api uses radians). also rename BMO_OP_SLOT_SUBTYPE_MAP_FLOAT -> BMO_OP_SLOT_SUBTYPE_MAP_FLT for consistency.
This commit is contained in:
		@@ -887,7 +887,7 @@ static BMOpDefine bmo_dissolve_faces_def = {
 | 
			
		||||
static BMOpDefine bmo_dissolve_limit_def = {
 | 
			
		||||
	"dissolve_limit",
 | 
			
		||||
	/* slots_in */
 | 
			
		||||
	{{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (degrees) */
 | 
			
		||||
	{{"angle_limit", BMO_OP_SLOT_FLT}, /* total rotation angle (radians) */
 | 
			
		||||
	 {"use_dissolve_boundaries", BMO_OP_SLOT_BOOL},
 | 
			
		||||
	 {"verts", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT}},
 | 
			
		||||
	 {"edges", BMO_OP_SLOT_ELEMENT_BUF, {BM_EDGE}},
 | 
			
		||||
@@ -951,7 +951,7 @@ static BMOpDefine bmo_subdivide_edges_def = {
 | 
			
		||||
	 {"cuts", BMO_OP_SLOT_INT},
 | 
			
		||||
	 {"seed", BMO_OP_SLOT_INT},
 | 
			
		||||
	 {"custom_patterns", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL}},  /* uses custom pointers */
 | 
			
		||||
	 {"edge_percents", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_FLOAT}},
 | 
			
		||||
	 {"edge_percents", BMO_OP_SLOT_MAPPING, {BMO_OP_SLOT_SUBTYPE_MAP_FLT}},
 | 
			
		||||
 | 
			
		||||
	 {"quad_corner_type",  BMO_OP_SLOT_INT}, /* quad corner type, see bmesh_operators.h */
 | 
			
		||||
	 {"use_grid_fill", BMO_OP_SLOT_BOOL},   /* fill in fully-selected faces with a grid */
 | 
			
		||||
@@ -1054,7 +1054,7 @@ static BMOpDefine bmo_spin_def = {
 | 
			
		||||
	 {"cent", BMO_OP_SLOT_VEC},             /* rotation center */
 | 
			
		||||
	 {"axis", BMO_OP_SLOT_VEC},             /* rotation axis */
 | 
			
		||||
	 {"dvec", BMO_OP_SLOT_VEC},             /* translation delta per step */
 | 
			
		||||
	 {"angle", BMO_OP_SLOT_FLT},            /* total rotation angle (degrees) */
 | 
			
		||||
	 {"angle", BMO_OP_SLOT_FLT},            /* total rotation angle (radians) */
 | 
			
		||||
	 {"steps", BMO_OP_SLOT_INT},            /* number of steps */
 | 
			
		||||
	 {"use_duplicate", BMO_OP_SLOT_BOOL},   /* duplicate or extrude? */
 | 
			
		||||
	 {{'\0'}},
 | 
			
		||||
 
 | 
			
		||||
@@ -123,7 +123,7 @@ typedef enum eBMOpSlotSubType_Elem {
 | 
			
		||||
typedef enum eBMOpSlotSubType_Map {
 | 
			
		||||
	BMO_OP_SLOT_SUBTYPE_MAP_EMPTY    = 64,  /* use as a set(), unused value */
 | 
			
		||||
	BMO_OP_SLOT_SUBTYPE_MAP_ELEM     = 65,
 | 
			
		||||
	BMO_OP_SLOT_SUBTYPE_MAP_FLOAT    = 66,
 | 
			
		||||
	BMO_OP_SLOT_SUBTYPE_MAP_FLT      = 66,
 | 
			
		||||
	BMO_OP_SLOT_SUBTYPE_MAP_INT      = 67,
 | 
			
		||||
	BMO_OP_SLOT_SUBTYPE_MAP_BOOL     = 68,
 | 
			
		||||
	BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL = 69,  /* python can't convert these */
 | 
			
		||||
 
 | 
			
		||||
@@ -87,7 +87,7 @@ BLI_INLINE void BMO_slot_map_bool_insert(BMOperator *op, BMOpSlot *slot,
 | 
			
		||||
BLI_INLINE void BMO_slot_map_float_insert(BMOperator *op, BMOpSlot *slot,
 | 
			
		||||
                                          void *element, const float val)
 | 
			
		||||
{
 | 
			
		||||
	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_FLOAT);
 | 
			
		||||
	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_FLT);
 | 
			
		||||
	BMO_slot_map_insert(op, slot, element, &val, sizeof(float));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -154,7 +154,7 @@ BLI_INLINE void *BMO_slot_map_data_get(BMOpSlot *slot, const void *element)
 | 
			
		||||
BLI_INLINE float BMO_slot_map_float_get(BMOpSlot *slot, const void *element)
 | 
			
		||||
{
 | 
			
		||||
	float *val;
 | 
			
		||||
	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_FLOAT);
 | 
			
		||||
	BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_FLT);
 | 
			
		||||
 | 
			
		||||
	val = (float *) BMO_slot_map_data_get(slot, element);
 | 
			
		||||
	if (val) return *val;
 | 
			
		||||
 
 | 
			
		||||
@@ -494,7 +494,7 @@ void bmo_spin_exec(BMesh *bm, BMOperator *op)
 | 
			
		||||
	BMO_slot_vec_get(op->slots_in, "dvec", dvec);
 | 
			
		||||
	usedvec = !is_zero_v3(dvec);
 | 
			
		||||
	steps    = BMO_slot_int_get(op->slots_in,   "steps");
 | 
			
		||||
	phi      = BMO_slot_float_get(op->slots_in, "angle") * DEG2RADF(1.0f) / steps;
 | 
			
		||||
	phi      = BMO_slot_float_get(op->slots_in, "angle") / steps;
 | 
			
		||||
	do_dupli = BMO_slot_bool_get(op->slots_in,  "use_duplicate");
 | 
			
		||||
 | 
			
		||||
	axis_angle_to_mat3(rmat, axis, phi);
 | 
			
		||||
 
 | 
			
		||||
@@ -3636,14 +3636,14 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	float cent[3], axis[3], imat[3][3];
 | 
			
		||||
	float d[3] = {0.0f, 0.0f, 0.0f};
 | 
			
		||||
	int steps, dupli;
 | 
			
		||||
	float degr;
 | 
			
		||||
	float angle;
 | 
			
		||||
 | 
			
		||||
	RNA_float_get_array(op->ptr, "center", cent);
 | 
			
		||||
	RNA_float_get_array(op->ptr, "axis", axis);
 | 
			
		||||
	steps = RNA_int_get(op->ptr, "steps");
 | 
			
		||||
	degr = RNA_float_get(op->ptr, "degrees");
 | 
			
		||||
	angle = RNA_float_get(op->ptr, "angle");
 | 
			
		||||
	//if (ts->editbutflag & B_CLOCKWISE)
 | 
			
		||||
	degr = -degr;
 | 
			
		||||
	angle = -angle;
 | 
			
		||||
	dupli = RNA_boolean_get(op->ptr, "dupli");
 | 
			
		||||
 | 
			
		||||
	/* undo object transformation */
 | 
			
		||||
@@ -3654,7 +3654,7 @@ static int edbm_spin_exec(bContext *C, wmOperator *op)
 | 
			
		||||
 | 
			
		||||
	if (!EDBM_op_init(em, &spinop, op,
 | 
			
		||||
	                  "spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b",
 | 
			
		||||
	                  BM_ELEM_SELECT, cent, axis, d, steps, degr, dupli))
 | 
			
		||||
	                  BM_ELEM_SELECT, cent, axis, d, steps, angle, dupli))
 | 
			
		||||
	{
 | 
			
		||||
		return OPERATOR_CANCELLED;
 | 
			
		||||
	}
 | 
			
		||||
@@ -3685,6 +3685,8 @@ static int edbm_spin_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
 | 
			
		||||
 | 
			
		||||
void MESH_OT_spin(wmOperatorType *ot)
 | 
			
		||||
{
 | 
			
		||||
	PropertyRNA *prop;
 | 
			
		||||
 | 
			
		||||
	/* identifiers */
 | 
			
		||||
	ot->name = "Spin";
 | 
			
		||||
	ot->description = "Extrude selected vertices in a circle around the cursor in indicated viewport";
 | 
			
		||||
@@ -3701,7 +3703,8 @@ void MESH_OT_spin(wmOperatorType *ot)
 | 
			
		||||
	/* props */
 | 
			
		||||
	RNA_def_int(ot->srna, "steps", 9, 0, INT_MAX, "Steps", "Steps", 0, INT_MAX);
 | 
			
		||||
	RNA_def_boolean(ot->srna, "dupli", 0, "Dupli", "Make Duplicates");
 | 
			
		||||
	RNA_def_float(ot->srna, "degrees", 90.0f, -FLT_MAX, FLT_MAX, "Degrees", "Degrees", -360.0f, 360.0f);
 | 
			
		||||
	prop = RNA_def_float(ot->srna, "angle", DEG2RADF(90.0f), -FLT_MAX, FLT_MAX, "Angle", "Angle", DEG2RADF(-360.0f), DEG2RADF(360.0f));
 | 
			
		||||
	RNA_def_property_subtype(prop, PROP_ANGLE);
 | 
			
		||||
 | 
			
		||||
	RNA_def_float_vector(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX);
 | 
			
		||||
	RNA_def_float_vector(ot->srna, "axis", 3, NULL, -FLT_MAX, FLT_MAX, "Axis", "Axis in global view space", -1.0f, 1.0f);
 | 
			
		||||
@@ -3739,15 +3742,11 @@ static int edbm_screw_exec(bContext *C, wmOperator *op)
 | 
			
		||||
	v1 = NULL;
 | 
			
		||||
	v2 = NULL;
 | 
			
		||||
	for (eve = BM_iter_new(&iter, em->bm, BM_VERTS_OF_MESH, NULL); eve; eve = BM_iter_step(&iter)) {
 | 
			
		||||
 | 
			
		||||
		valence = 0;
 | 
			
		||||
 | 
			
		||||
		for (eed = BM_iter_new(&eiter, em->bm, BM_EDGES_OF_VERT, eve); eed; eed = BM_iter_step(&eiter)) {
 | 
			
		||||
 | 
			
		||||
			if (BM_elem_flag_test(eed, BM_ELEM_SELECT)) {
 | 
			
		||||
				valence++;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if (valence == 1) {
 | 
			
		||||
 
 | 
			
		||||
@@ -387,7 +387,7 @@ static int bpy_slot_from_py(BMesh *bm, BMOperator *bmop, BMOpSlot *slot, PyObjec
 | 
			
		||||
					}
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
				case BMO_OP_SLOT_SUBTYPE_MAP_FLOAT:
 | 
			
		||||
				case BMO_OP_SLOT_SUBTYPE_MAP_FLT:
 | 
			
		||||
				{
 | 
			
		||||
					if (PyDict_Size(value) > 0) {
 | 
			
		||||
						PyObject *arg_key, *arg_value;
 | 
			
		||||
@@ -593,7 +593,7 @@ static PyObject* bpy_slot_to_py(BMesh *bm, BMOpSlot *slot)
 | 
			
		||||
					}
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
				case BMO_OP_SLOT_SUBTYPE_MAP_FLOAT:
 | 
			
		||||
				case BMO_OP_SLOT_SUBTYPE_MAP_FLT:
 | 
			
		||||
				{
 | 
			
		||||
					item = PyDict_New();
 | 
			
		||||
					if (slot_hash) {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user