713
713
BMEditMesh *em = BKE_editmesh_from_object(obedit);
714
714
BMesh *bm = em->bm;
715
715
BMOperator spinop;
716
float cent[3], axis[3], imat[3][3];
716
float cent[3], axis[3];
717
717
float d[3] = {0.0f, 0.0f, 0.0f};
718
718
int steps, dupli;
727
727
dupli = RNA_boolean_get(op->ptr, "dupli");
729
/* undo object transformation */
730
copy_m3_m4(imat, obedit->imat);
731
sub_v3_v3(cent, obedit->obmat[3]);
732
mul_m3_v3(imat, cent);
733
mul_m3_v3(imat, axis);
729
/* keep the values in worldspace since we're passing the obmat */
735
730
if (!EDBM_op_init(em, &spinop, op,
736
"spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b",
737
BM_ELEM_SELECT, cent, axis, d, steps, angle, dupli))
731
"spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f space=%m4 use_duplicate=%b",
732
BM_ELEM_SELECT, cent, axis, d, steps, angle, obedit->obmat, dupli))
739
734
return OPERATOR_CANCELLED;
800
795
BMVert *eve, *v1, *v2;
801
796
BMIter iter, eiter;
802
797
BMOperator spinop;
803
float dvec[3], nor[3], cent[3], axis[3];
798
float dvec[3], nor[3], cent[3], axis[3], v1_co_global[3], v2_co_global[3];
805
799
int steps, turns;
811
805
RNA_float_get_array(op->ptr, "center", cent);
812
806
RNA_float_get_array(op->ptr, "axis", axis);
814
/* undo object transformation */
815
copy_m3_m4(imat, obedit->imat);
816
sub_v3_v3(cent, obedit->obmat[3]);
817
mul_m3_v3(imat, cent);
818
mul_m3_v3(imat, axis);
821
808
/* find two vertices with valence count == 1, more or less is wrong */
849
836
return OPERATOR_CANCELLED;
839
copy_v3_v3(nor, obedit->obmat[2]);
852
841
/* calculate dvec */
853
sub_v3_v3v3(dvec, v1->co, v2->co);
842
mul_v3_m4v3(v1_co_global, obedit->obmat, v1->co);
843
mul_v3_m4v3(v2_co_global, obedit->obmat, v2->co);
844
sub_v3_v3v3(dvec, v1_co_global, v2_co_global);
854
845
mul_v3_fl(dvec, 1.0f / steps);
856
if (dot_v3v3(nor, dvec) > 0.000f)
847
if (dot_v3v3(nor, dvec) > 0.0f)
859
850
if (!EDBM_op_init(em, &spinop, op,
860
"spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f use_duplicate=%b",
861
BM_ELEM_SELECT, cent, axis, dvec, turns * steps, DEG2RADF(360.0f * turns), false))
851
"spin geom=%hvef cent=%v axis=%v dvec=%v steps=%i angle=%f space=%m4 use_duplicate=%b",
852
BM_ELEM_SELECT, cent, axis, dvec, turns * steps, DEG2RADF(360.0f * turns), obedit->obmat, false))
863
854
return OPERATOR_CANCELLED;