Merge branch 'blender2.8' into soc-2018-bevel
[blender.git] / source / blender / editors / transform / transform_ops.c
index c9a97c8530cc9c4c386e36ccf44d3d6307a22b2d..9a9526537d1669992a3004b9a545d104d6502de4 100644 (file)
@@ -82,6 +82,7 @@ static const char OP_VERT_SLIDE[] = "TRANSFORM_OT_vert_slide";
 static const char OP_EDGE_CREASE[] = "TRANSFORM_OT_edge_crease";
 static const char OP_EDGE_BWEIGHT[] = "TRANSFORM_OT_edge_bevelweight";
 static const char OP_SEQ_SLIDE[] = "TRANSFORM_OT_seq_slide";
+static const char OP_NORMAL_ROTATION[] = "TRANSFORM_OT_rotate_normal";
 
 static void TRANSFORM_OT_translate(struct wmOperatorType *ot);
 static void TRANSFORM_OT_rotate(struct wmOperatorType *ot);
@@ -100,6 +101,7 @@ static void TRANSFORM_OT_vert_slide(struct wmOperatorType *ot);
 static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot);
 static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot);
 static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot);
+static void TRANSFORM_OT_rotate_normal(struct wmOperatorType *ot);
 
 static TransformModeItem transform_modes[] =
 {
@@ -120,6 +122,7 @@ static TransformModeItem transform_modes[] =
        {OP_EDGE_CREASE, TFM_CREASE, TRANSFORM_OT_edge_crease},
        {OP_EDGE_BWEIGHT, TFM_BWEIGHT, TRANSFORM_OT_edge_bevelweight},
        {OP_SEQ_SLIDE, TFM_SEQ_SLIDE, TRANSFORM_OT_seq_slide},
+       {OP_NORMAL_ROTATION, TFM_NORMAL_ROTATION, TRANSFORM_OT_rotate_normal},
        {NULL, 0}
 };
 
@@ -1034,6 +1037,27 @@ static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
        Transform_Properties(ot, P_SNAP);
 }
 
+static void TRANSFORM_OT_rotate_normal(struct wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name = "Normal Rotate";
+       ot->description = "Rotate split normal of selected items";
+       ot->idname = OP_NORMAL_ROTATION;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
+
+       /* api callbacks */
+       ot->invoke = transform_invoke;
+       ot->exec = transform_exec;
+       ot->modal = transform_modal;
+       ot->cancel = transform_cancel;
+       ot->poll = ED_operator_editmesh_auto_smooth;
+
+       RNA_def_float_rotation(ot->srna, "value", 0, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
+
+       Transform_Properties(ot, P_AXIS | P_CONSTRAINT | P_MIRROR);
+}
+
+
 static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
 {
        PropertyRNA *prop;