Cleanup: use `rna_enum_` prefix for RNA enums
[blender.git] / source / blender / editors / transform / transform_ops.c
index 52b32ae66fcdbeb9ed41bb957af0cd854b6da36c..454fffd69267d16f0dd6ab670b0bfa9efb0671de 100644 (file)
  *  \ingroup edtransform
  */
 
-
 #include "MEM_guardedalloc.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 
-#include "RNA_access.h"
-#include "RNA_define.h"
-#include "RNA_enum_types.h"
-
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
+#include "BLT_translation.h"
+
 #include "BKE_context.h"
 #include "BKE_global.h"
-#include "BKE_armature.h"
+#include "BKE_report.h"
+#include "BKE_editmesh.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
 
 #include "WM_api.h"
 #include "WM_types.h"
 #include "UI_resources.h"
 
 #include "ED_screen.h"
+/* for USE_LOOPSLIDE_HACK only */
+#include "ED_mesh.h"
 
 #include "transform.h"
 
 typedef struct TransformModeItem {
-       char *idname;
-       int             mode;
-       void (*opfunc)(wmOperatorType*);
+       const char *idname;
+       int mode;
+       void (*opfunc)(wmOperatorType *);
 } TransformModeItem;
 
-static float VecOne[3] = {1, 1, 1};
-
-static char OP_TRANSLATION[] = "TRANSFORM_OT_translate";
-static char OP_ROTATION[] = "TRANSFORM_OT_rotate";
-static char OP_TOSPHERE[] = "TRANSFORM_OT_tosphere";
-static char OP_RESIZE[] = "TRANSFORM_OT_resize";
-static char OP_SKIN_RESIZE[] = "TRANSFORM_OT_skin_resize";
-static char OP_SHEAR[] = "TRANSFORM_OT_shear";
-static char OP_WARP[] = "TRANSFORM_OT_warp";
-static char OP_SHRINK_FATTEN[] = "TRANSFORM_OT_shrink_fatten";
-static char OP_PUSH_PULL[] = "TRANSFORM_OT_push_pull";
-static char OP_TILT[] = "TRANSFORM_OT_tilt";
-static char OP_TRACKBALL[] = "TRANSFORM_OT_trackball";
-static char OP_MIRROR[] = "TRANSFORM_OT_mirror";
-static char OP_EDGE_SLIDE[] = "TRANSFORM_OT_edge_slide";
-static char OP_EDGE_CREASE[] = "TRANSFORM_OT_edge_crease";
-static char OP_EDGE_BWEIGHT[] = "TRANSFORM_OT_edge_bevelweight";
-static char OP_SEQ_SLIDE[] = "TRANSFORM_OT_seq_slide";
+static const float VecOne[3] = {1, 1, 1};
+
+static const char OP_TRANSLATION[] = "TRANSFORM_OT_translate";
+static const char OP_ROTATION[] = "TRANSFORM_OT_rotate";
+static const char OP_TOSPHERE[] = "TRANSFORM_OT_tosphere";
+static const char OP_RESIZE[] = "TRANSFORM_OT_resize";
+static const char OP_SKIN_RESIZE[] = "TRANSFORM_OT_skin_resize";
+static const char OP_SHEAR[] = "TRANSFORM_OT_shear";
+static const char OP_BEND[] = "TRANSFORM_OT_bend";
+static const char OP_SHRINK_FATTEN[] = "TRANSFORM_OT_shrink_fatten";
+static const char OP_PUSH_PULL[] = "TRANSFORM_OT_push_pull";
+static const char OP_TILT[] = "TRANSFORM_OT_tilt";
+static const char OP_TRACKBALL[] = "TRANSFORM_OT_trackball";
+static const char OP_MIRROR[] = "TRANSFORM_OT_mirror";
+static const char OP_EDGE_SLIDE[] = "TRANSFORM_OT_edge_slide";
+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 void TRANSFORM_OT_translate(struct wmOperatorType *ot);
 static void TRANSFORM_OT_rotate(struct wmOperatorType *ot);
@@ -82,13 +88,14 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot);
 static void TRANSFORM_OT_resize(struct wmOperatorType *ot);
 static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot);
 static void TRANSFORM_OT_shear(struct wmOperatorType *ot);
-static void TRANSFORM_OT_warp(struct wmOperatorType *ot);
+static void TRANSFORM_OT_bend(struct wmOperatorType *ot);
 static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot);
 static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot);
 static void TRANSFORM_OT_tilt(struct wmOperatorType *ot);
 static void TRANSFORM_OT_trackball(struct wmOperatorType *ot);
 static void TRANSFORM_OT_mirror(struct wmOperatorType *ot);
 static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot);
+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);
@@ -101,20 +108,21 @@ static TransformModeItem transform_modes[] =
        {OP_RESIZE, TFM_RESIZE, TRANSFORM_OT_resize},
        {OP_SKIN_RESIZE, TFM_SKIN_RESIZE, TRANSFORM_OT_skin_resize},
        {OP_SHEAR, TFM_SHEAR, TRANSFORM_OT_shear},
-       {OP_WARP, TFM_WARP, TRANSFORM_OT_warp},
+       {OP_BEND, TFM_BEND, TRANSFORM_OT_bend},
        {OP_SHRINK_FATTEN, TFM_SHRINKFATTEN, TRANSFORM_OT_shrink_fatten},
        {OP_PUSH_PULL, TFM_PUSHPULL, TRANSFORM_OT_push_pull},
        {OP_TILT, TFM_TILT, TRANSFORM_OT_tilt},
        {OP_TRACKBALL, TFM_TRACKBALL, TRANSFORM_OT_trackball},
        {OP_MIRROR, TFM_MIRROR, TRANSFORM_OT_mirror},
        {OP_EDGE_SLIDE, TFM_EDGE_SLIDE, TRANSFORM_OT_edge_slide},
+       {OP_VERT_SLIDE, TFM_VERT_SLIDE, TRANSFORM_OT_vert_slide},
        {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},
        {NULL, 0}
 };
 
-EnumPropertyItem transform_mode_types[] =
+EnumPropertyItem rna_enum_transform_mode_types[] =
 {
        {TFM_INIT, "INIT", 0, "Init", ""},
        {TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
@@ -124,7 +132,7 @@ EnumPropertyItem transform_mode_types[] =
        {TFM_SKIN_RESIZE, "SKIN_RESIZE", 0, "Skin Resize", ""},
        {TFM_TOSPHERE, "TOSPHERE", 0, "Tosphere", ""},
        {TFM_SHEAR, "SHEAR", 0, "Shear", ""},
-       {TFM_WARP, "WARP", 0, "Warp", ""},
+       {TFM_BEND, "BEND", 0, "Bend", ""},
        {TFM_SHRINKFATTEN, "SHRINKFATTEN", 0, "Shrinkfatten", ""},
        {TFM_TILT, "TILT", 0, "Tilt", ""},
        {TFM_TRACKBALL, "TRACKBALL", 0, "Trackball", ""},
@@ -133,15 +141,16 @@ EnumPropertyItem transform_mode_types[] =
        {TFM_MIRROR, "MIRROR", 0, "Mirror", ""},
        {TFM_BONESIZE, "BONE_SIZE", 0, "Bonesize", ""},
        {TFM_BONE_ENVELOPE, "BONE_ENVELOPE", 0, "Bone_Envelope", ""},
+       {TFM_BONE_ENVELOPE_DIST, "BONE_ENVELOPE_DIST", 0, "Bone_Envelope_Distance", ""},
        {TFM_CURVE_SHRINKFATTEN, "CURVE_SHRINKFATTEN", 0, "Curve_Shrinkfatten", ""},
        {TFM_MASK_SHRINKFATTEN, "MASK_SHRINKFATTEN", 0, "Mask_Shrinkfatten", ""},
+       {TFM_GPENCIL_SHRINKFATTEN, "GPENCIL_SHRINKFATTEN", 0, "GPencil_Shrinkfatten", ""},
        {TFM_BONE_ROLL, "BONE_ROLL", 0, "Bone_Roll", ""},
        {TFM_TIME_TRANSLATE, "TIME_TRANSLATE", 0, "Time_Translate", ""},
        {TFM_TIME_SLIDE, "TIME_SLIDE", 0, "Time_Slide", ""},
        {TFM_TIME_SCALE, "TIME_SCALE", 0, "Time_Scale", ""},
        {TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time_Extend", ""},
        {TFM_BAKE_TIME, "BAKE_TIME", 0, "Bake_Time", ""},
-       {TFM_BEVEL, "BEVEL", 0, "Bevel", ""},
        {TFM_BWEIGHT, "BWEIGHT", 0, "Bweight", ""},
        {TFM_ALIGN, "ALIGN", 0, "Align", ""},
        {TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
@@ -149,60 +158,28 @@ EnumPropertyItem transform_mode_types[] =
        {0, NULL, 0, NULL, NULL}
 };
 
-static int snap_type_exec(bContext *C, wmOperator *op)
-{
-       ToolSettings *ts= CTX_data_tool_settings(C);
-
-       ts->snap_mode = RNA_enum_get(op->ptr, "type");
-
-       WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
-
-       return OPERATOR_FINISHED;
-}
-
-static void TRANSFORM_OT_snap_type(wmOperatorType *ot)
-{
-       /* identifiers */
-       ot->name = "Snap Type";
-       ot->description = "Set the snap element type";
-       ot->idname = "TRANSFORM_OT_snap_type";
-
-       /* api callbacks */
-       ot->invoke = WM_menu_invoke;
-       ot->exec = snap_type_exec;
-
-       ot->poll = ED_operator_areaactive;
-
-       /* flags */
-       ot->flag = OPTYPE_UNDO;
-
-       /* props */
-       ot->prop = RNA_def_enum(ot->srna, "type", snap_element_items, 0, "Type", "Set the snap element type");
-
-}
-
 static int select_orientation_exec(bContext *C, wmOperator *op)
 {
        int orientation = RNA_enum_get(op->ptr, "orientation");
 
        BIF_selectTransformOrientationValue(C, orientation);
        
-       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
+       WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, CTX_wm_view3d(C));
 
        return OPERATOR_FINISHED;
 }
 
-static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
+static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), const wmEvent *UNUSED(event))
 {
        uiPopupMenu *pup;
        uiLayout *layout;
 
-       pup= uiPupMenuBegin(C, "Orientation", ICON_NONE);
-       layout= uiPupMenuLayout(pup);
+       pup = UI_popup_menu_begin(C, IFACE_("Orientation"), ICON_NONE);
+       layout = UI_popup_menu_layout(pup);
        uiItemsEnumO(layout, "TRANSFORM_OT_select_orientation", "orientation");
-       uiPupMenuEnd(C, pup);
+       UI_popup_menu_end(C, pup);
 
-       return OPERATOR_CANCELLED;
+       return OPERATOR_INTERFACE;
 }
 
 static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot)
@@ -220,7 +197,7 @@ static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot)
        ot->exec   = select_orientation_exec;
        ot->poll   = ED_operator_view3d_active;
 
-       prop= RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE);
+       prop = RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE);
        RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
        RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
 }
@@ -233,13 +210,13 @@ static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op))
 
        BIF_removeTransformOrientationIndex(C, selected_index);
        
-       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
-       WM_event_add_notifier(C, NC_SCENE|NA_EDITED, CTX_data_scene(C));
+       WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
+       WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C));
 
        return OPERATOR_FINISHED;
 }
 
-static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
+static int delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
 {
        return delete_orientation_exec(C, op);
 }
@@ -277,52 +254,98 @@ static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot)
 static int create_orientation_exec(bContext *C, wmOperator *op)
 {
        char name[MAX_NAME];
-       int use = RNA_boolean_get(op->ptr, "use");
-       int overwrite = RNA_boolean_get(op->ptr, "overwrite");
-       
+       const bool use = RNA_boolean_get(op->ptr, "use");
+       const bool overwrite = RNA_boolean_get(op->ptr, "overwrite");
+       const bool use_view = RNA_boolean_get(op->ptr, "use_view");
+       View3D *v3d = CTX_wm_view3d(C);
+
        RNA_string_get(op->ptr, "name", name);
 
-       BIF_createTransformOrientation(C, op->reports, name, use, overwrite);
+       if (use && !v3d) {
+               BKE_report(op->reports, RPT_ERROR, "Create Orientation's 'use' parameter only valid in a 3DView context");
+               return OPERATOR_CANCELLED;
+       }
+
+       BIF_createTransformOrientation(C, op->reports, name, use_view, use, overwrite);
 
-       WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
-       WM_event_add_notifier(C, NC_SCENE|NA_EDITED, CTX_data_scene(C));
+       WM_event_add_notifier(C, NC_SPACE | ND_SPACE_VIEW3D, v3d);
+       WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C));
        
        return OPERATOR_FINISHED;
 }
 
-static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
-{
-       return create_orientation_exec(C, op);
-}
-
 static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot)
 {
        /* identifiers */
        ot->name   = "Create Orientation";
        ot->description = "Create transformation orientation from selection";
        ot->idname = "TRANSFORM_OT_create_orientation";
-       ot->flag   = OPTYPE_REGISTER|OPTYPE_UNDO;
+       ot->flag   = OPTYPE_REGISTER | OPTYPE_UNDO;
 
        /* api callbacks */
-       ot->invoke = create_orientation_invoke;
        ot->exec   = create_orientation_exec;
        ot->poll   = ED_operator_areaactive;
-       ot->flag   = OPTYPE_REGISTER|OPTYPE_UNDO;
 
-       RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Text to insert at the cursor position");
-       RNA_def_boolean(ot->srna, "use", 0, "Use after creation", "Select orientation after its creation");
-       RNA_def_boolean(ot->srna, "overwrite", 0, "Overwrite previous", "Overwrite previously created orientation with same name");
+       RNA_def_string(ot->srna, "name", NULL, MAX_NAME, "Name", "Name of the new custom orientation");
+       RNA_def_boolean(ot->srna, "use_view", false, "Use View",
+                       "Use the current view instead of the active object to create the new orientation");
+       RNA_def_boolean(ot->srna, "use", false, "Use after creation", "Select orientation after its creation");
+       RNA_def_boolean(ot->srna, "overwrite", false, "Overwrite previous",
+                       "Overwrite previously created orientation with same name");
+}
+
+
+#ifdef USE_LOOPSLIDE_HACK
+/**
+ * Special hack for MESH_OT_loopcut_slide so we get back to the selection mode
+ */
+static void transformops_loopsel_hack(bContext *C, wmOperator *op)
+{
+       if (op->type->idname == OP_EDGE_SLIDE) {
+               if (op->opm && op->opm->opm && op->opm->opm->prev) {
+                       wmOperator *op_prev = op->opm->opm->prev;
+                       Scene *scene = CTX_data_scene(C);
+                       int mesh_select_mode[3];
+                       PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init");
+
+                       if (prop && RNA_property_is_set(op_prev->ptr, prop)) {
+                               ToolSettings *ts = scene->toolsettings;
+                               short selectmode_orig;
+
+                               RNA_property_boolean_get_array(op_prev->ptr, prop, mesh_select_mode);
+                               selectmode_orig = ((mesh_select_mode[0] ? SCE_SELECT_VERTEX : 0) |
+                                                  (mesh_select_mode[1] ? SCE_SELECT_EDGE   : 0) |
+                                                  (mesh_select_mode[2] ? SCE_SELECT_FACE   : 0));
+
+                               /* still switch if we were originally in face select mode */
+                               if ((ts->selectmode != selectmode_orig) && (selectmode_orig != SCE_SELECT_FACE)) {
+                                       BMEditMesh *em = BKE_editmesh_from_object(scene->obedit);
+                                       em->selectmode = ts->selectmode = selectmode_orig;
+                                       EDBM_selectmode_set(em);
+                               }
+                       }
+               }
+       }
 }
+#else
+/* prevent removal by cleanup */
+#  error "loopslide hack removed!"
+#endif  /* USE_LOOPSLIDE_HACK */
+
 
 static void transformops_exit(bContext *C, wmOperator *op)
 {
+#ifdef USE_LOOPSLIDE_HACK
+       transformops_loopsel_hack(C, op);
+#endif
+
        saveTransform(C, op->customdata, op);
        MEM_freeN(op->customdata);
        op->customdata = NULL;
        G.moving = 0;
 }
 
-static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
+static int transformops_data(bContext *C, wmOperator *op, const wmEvent *event)
 {
        int retval = 1;
        if (op->customdata == NULL) {
@@ -342,10 +365,10 @@ static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
                }
 
                retval = initTransform(C, t, op, event, mode);
-               G.moving = 1;
 
                /* store data */
                if (retval) {
+                       G.moving = special_transform_moving(t);
                        op->customdata = t;
                }
                else {
@@ -356,11 +379,12 @@ static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
        return retval; /* return 0 on error */
 }
 
-static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
+static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
 {
        int exit_code;
 
        TransInfo *t = op->customdata;
+       const enum TfmMode mode_prev = t->mode;
 
 #if 0
        // stable 2D mouse coords map to different 3D coords while the 3D mouse is active
@@ -372,9 +396,18 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
 #endif
 
        /* XXX insert keys are called here, and require context */
-       t->context= C;
+       t->context = C;
        exit_code = transformEvent(t, event);
-       t->context= NULL;
+       t->context = NULL;
+
+       /* XXX, workaround: active needs to be calculated before transforming,
+        * since we're not reading from 'td->center' in this case. see: T40241 */
+       if (t->tsnap.target == SCE_SNAP_TARGET_ACTIVE) {
+               /* In camera view, tsnap callback is not set (see initSnappingMode() in transfrom_snap.c, and T40348). */
+               if (t->tsnap.targetSnap && ((t->tsnap.status & TARGET_INIT) == 0)) {
+                       t->tsnap.targetSnap(t);
+               }
+       }
 
        transformApply(C, t);
 
@@ -384,19 +417,39 @@ static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
                transformops_exit(C, op);
                exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */
        }
+       else {
+               if (mode_prev != t->mode) {
+                       /* WARNING: this is not normal to switch operator types
+                        * normally it would not be supported but transform happens
+                        * to share callbacks between different operators. */
+                       wmOperatorType *ot_new = NULL;
+                       TransformModeItem *item = transform_modes;
+                       while (item->idname) {
+                               if (item->mode == t->mode) {
+                                       ot_new = WM_operatortype_find(item->idname, false);
+                                       break;
+                               }
+                               item++;
+                       }
+
+                       BLI_assert(ot_new != NULL);
+                       if (ot_new) {
+                               WM_operator_type_set(op, ot_new);
+                       }
+                       /* end suspicious code */
+               }
+       }
 
        return exit_code;
 }
 
-static int transform_cancel(bContext *C, wmOperator *op)
+static void transform_cancel(bContext *C, wmOperator *op)
 {
        TransInfo *t = op->customdata;
 
        t->state = TRANS_CANCEL;
        transformEnd(C, t);
        transformops_exit(C, op);
-
-       return OPERATOR_CANCELLED;
 }
 
 static int transform_exec(bContext *C, wmOperator *op)
@@ -418,12 +471,12 @@ static int transform_exec(bContext *C, wmOperator *op)
 
        transformops_exit(C, op);
        
-       WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
+       WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL);
 
        return OPERATOR_FINISHED;
 }
 
-static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
+static int transform_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 {
        if (!transformops_data(C, op, event)) {
                G.moving = 0;
@@ -437,7 +490,7 @@ static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
                /* add temp handler */
                WM_event_add_modal_handler(C, op);
 
-               op->flag |= OP_GRAB_POINTER; // XXX maybe we want this with the manipulator only?
+               op->flag |= OP_IS_MODAL_GRAB_CURSOR; // XXX maybe we want this with the manipulator only?
                return OPERATOR_RUNNING_MODAL;
        }
 }
@@ -447,64 +500,75 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
        PropertyRNA *prop;
 
        if (flags & P_AXIS) {
-               prop= RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
+               prop = RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
                RNA_def_property_array(prop, 3);
                /* Make this not hidden when there's a nice axis selection widget */
                RNA_def_property_flag(prop, PROP_HIDDEN);
                RNA_def_property_ui_text(prop, "Axis", "The axis around which the transformation occurs");
-
        }
 
        if (flags & P_CONSTRAINT) {
                RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
-               prop= RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
+               prop = RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
                RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
                RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
-
-               
        }
 
        if (flags & P_MIRROR) {
-               RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
+               prop = RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
+               if (flags & P_MIRROR_DUMMY) {
+                       /* only used so macros can disable this option */
+                       RNA_def_property_flag(prop, PROP_HIDDEN);
+               }
        }
 
 
        if (flags & P_PROPORTIONAL) {
-               RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", "");
-               RNA_def_enum(ot->srna, "proportional_edit_falloff", proportional_falloff_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
+               RNA_def_enum(ot->srna, "proportional", rna_enum_proportional_editing_items, 0, "Proportional Editing", "");
+               prop = RNA_def_enum(ot->srna, "proportional_edit_falloff", rna_enum_proportional_falloff_items, 0,
+                                   "Proportional Editing Falloff", "Falloff type for proportional editing mode");
+               RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
                RNA_def_float(ot->srna, "proportional_size", 1, 0.00001f, FLT_MAX, "Proportional Size", "", 0.001, 100);
        }
 
        if (flags & P_SNAP) {
-               prop= RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
+               prop = RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
                RNA_def_property_flag(prop, PROP_HIDDEN);
 
                if (flags & P_GEO_SNAP) {
-                       prop= RNA_def_enum(ot->srna, "snap_target", snap_target_items, 0, "Target", "");
+                       prop = RNA_def_enum(ot->srna, "snap_target", rna_enum_snap_target_items, 0, "Target", "");
                        RNA_def_property_flag(prop, PROP_HIDDEN);
-                       prop= RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
+                       prop = RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
                        RNA_def_property_flag(prop, PROP_HIDDEN);
                        
                        if (flags & P_ALIGN_SNAP) {
-                               prop= RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
+                               prop = RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
                                RNA_def_property_flag(prop, PROP_HIDDEN);
-                               prop= RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX);
+                               prop = RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX);
                                RNA_def_property_flag(prop, PROP_HIDDEN);
                        }
                }
        }
-
-       if (flags & P_OPTIONS) {
+       
+       if (flags & P_GPENCIL_EDIT) {
+               RNA_def_boolean(ot->srna, "gpencil_strokes", 0, "Edit Grease Pencil", "Edit selected Grease Pencil strokes");
+       }
+       
+       if ((flags & P_OPTIONS) && !(flags & P_NO_TEXSPACE)) {
                RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
+               prop = RNA_def_boolean(ot->srna, "remove_on_cancel", 0, "Remove on Cancel", "Remove elements on cancel");
+               RNA_def_property_flag(prop, PROP_HIDDEN);
        }
 
        if (flags & P_CORRECT_UV) {
                RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UVs", "Correct UV coordinates when transforming");
        }
 
-       // Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
-       /*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
-       //RNA_def_property_flag(prop, PROP_HIDDEN);
+       if ((flags & P_NO_DEFAULTS) == 0) {
+               // Add confirm method all the time. At the end because it's not really that important and should be hidden only in log, not in keymap edit
+               /*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
+               //RNA_def_property_flag(prop, PROP_HIDDEN);
+       }
 }
 
 static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
@@ -513,7 +577,7 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
        ot->name   = "Translate";
        ot->description = "Translate (move) selected items";
        ot->idname = OP_TRANSLATION;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -524,7 +588,7 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
 
        RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP|P_OPTIONS);
+       Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_OPTIONS | P_GPENCIL_EDIT);
 }
 
 static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
@@ -533,7 +597,7 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
        ot->name   = "Resize";
        ot->description = "Scale (resize) selected items"; 
        ot->idname = OP_RESIZE;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -544,14 +608,14 @@ static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
 
        RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP|P_OPTIONS);
+       Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_GPENCIL_EDIT);
 }
 
 static int skin_resize_poll(bContext *C)
 {
        struct Object *obedit = CTX_data_edit_object(C);
        if (obedit && obedit->type == OB_MESH) {
-               BMEditMesh *em = BMEdit_FromObject(obedit);
+               BMEditMesh *em = BKE_editmesh_from_object(obedit);
                return (em && CustomData_has_layer(&em->bm->vdata, CD_MVERT_SKIN));
        }
        return 0;
@@ -563,7 +627,7 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot)
        ot->name   = "Skin Resize";
        ot->description = "Scale selected vertices' skin radii"; 
        ot->idname = OP_SKIN_RESIZE;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -574,7 +638,7 @@ static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot)
 
        RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP|P_OPTIONS);
+       Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_OPTIONS | P_NO_TEXSPACE);
 }
 
 static void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
@@ -583,7 +647,7 @@ static void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
        ot->name   = "Trackball";
        ot->description = "Trackball style rotation of selected items";
        ot->idname = OP_TRACKBALL;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -592,18 +656,19 @@ static void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
        ot->cancel = transform_cancel;
        ot->poll   = ED_operator_screenactive;
 
-       RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
+       /* Maybe we could use float_vector_xyz here too? */
+       RNA_def_float_rotation(ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
+       Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT);
 }
 
 static void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name   = "Rotate";
+       ot->name = "Rotate";
        ot->description = "Rotate selected items";
        ot->idname = OP_ROTATION;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -612,21 +677,23 @@ static void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
        ot->cancel = transform_cancel;
        ot->poll   = ED_operator_screenactive;
 
-       RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
+       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_PROPORTIONAL|P_MIRROR|P_GEO_SNAP);
+       Transform_Properties(ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_GEO_SNAP | P_GPENCIL_EDIT);
 }
 
 static void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
 {
+       PropertyRNA *prop;
+
        /* identifiers */
-       ot->name   = "Tilt";
+       ot->name = "Tilt";
        /* optionals - 
         * "Tilt selected vertices"
-        * "Specify an extra axis rotation for selected vertices of 3d curve" */
-       ot->description = "Tilt selected control vertices of 3d curve"; 
+        * "Specify an extra axis rotation for selected vertices of 3D curve" */
+       ot->description = "Tilt selected control vertices of 3D curve"; 
        ot->idname = OP_TILT;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -635,30 +702,30 @@ static void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
        ot->cancel = transform_cancel;
        ot->poll   = ED_operator_editcurve_3d;
 
-       RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
+       prop = RNA_def_float(ot->srna, "value", 0.0, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
+       RNA_def_property_subtype(prop, PROP_ANGLE);
 
-       Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_SNAP);
+       Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP);
 }
 
-static void TRANSFORM_OT_warp(struct wmOperatorType *ot)
+static void TRANSFORM_OT_bend(struct wmOperatorType *ot)
 {
        /* identifiers */
-       ot->name   = "Warp";
-       ot->description = "Warp selected items around the cursor";
-       ot->idname = OP_WARP;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->name   = "Bend";
+       ot->description = "Bend selected items between the 3D cursor and the mouse";
+       ot->idname = OP_BEND;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
-       ot->exec   = transform_exec;
+       // ot->exec   = transform_exec;  // unsupported
        ot->modal  = transform_modal;
        ot->cancel = transform_cancel;
-       ot->poll   = ED_operator_screenactive;
+       ot->poll   = ED_operator_region_view3d_active;
 
-       RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
+       RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
 
-       Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
-       // XXX Warp axis?
+       Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT);
 }
 
 static void TRANSFORM_OT_shear(struct wmOperatorType *ot)
@@ -667,7 +734,7 @@ static void TRANSFORM_OT_shear(struct wmOperatorType *ot)
        ot->name   = "Shear";
        ot->description = "Shear selected items along the horizontal screen axis";
        ot->idname = OP_SHEAR;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -678,7 +745,7 @@ static void TRANSFORM_OT_shear(struct wmOperatorType *ot)
 
        RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
+       Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT);
        // XXX Shear axis?
 }
 
@@ -688,7 +755,7 @@ static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
        ot->name   = "Push/Pull";
        ot->description = "Push/Pull selected items";
        ot->idname = OP_PUSH_PULL;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -699,7 +766,7 @@ static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
 
        RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
+       Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP);
 }
 
 static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
@@ -708,7 +775,7 @@ static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
        ot->name   = "Shrink/Fatten";
        ot->description = "Shrink/fatten selected vertices along normals";
        ot->idname = OP_SHRINK_FATTEN;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -719,7 +786,9 @@ static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
 
        RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
+       RNA_def_boolean(ot->srna, "use_even_offset", true, "Offset Even", "Scale the offset to give more even thickness");
+
+       Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP);
 }
 
 static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
@@ -729,7 +798,7 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
        //added "around mesh center" to differentiate between "MESH_OT_vertices_to_sphere()" 
        ot->description = "Move selected vertices outward in a spherical shape around mesh center";
        ot->idname = OP_TOSPHERE;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -740,7 +809,7 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
 
        RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1);
 
-       Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
+       Transform_Properties(ot, P_PROPORTIONAL | P_MIRROR | P_SNAP | P_GPENCIL_EDIT);
 }
 
 static void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
@@ -749,7 +818,7 @@ static void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
        ot->name   = "Mirror";
        ot->description = "Mirror selected vertices around one or more axes";
        ot->idname = OP_MIRROR;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -758,27 +827,64 @@ static void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
        ot->cancel = transform_cancel;
        ot->poll   = ED_operator_screenactive;
 
-       Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL);
+       Transform_Properties(ot, P_CONSTRAINT | P_PROPORTIONAL | P_GPENCIL_EDIT);
 }
 
 static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
 {
+       PropertyRNA *prop;
+
        /* identifiers */
        ot->name   = "Edge Slide";
        ot->description = "Slide an edge loop along a mesh"; 
        ot->idname = OP_EDGE_SLIDE;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       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;
+       ot->poll   = ED_operator_editmesh_region_view3d;
 
-       RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
+       RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f);
+
+       prop = RNA_def_boolean(ot->srna, "single_side", false, "Single Side", "");
+       RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+       RNA_def_boolean(ot->srna, "use_even", false, "Even",
+                       "Make the edge loop match the shape of the adjacent edge loop");
+       RNA_def_boolean(ot->srna, "flipped", false, "Flipped",
+                       "When Even mode is active, flips between the two adjacent edge loops");
+       RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp",
+                       "Clamp within the edge extents");
 
-       Transform_Properties(ot, P_MIRROR|P_SNAP|P_CORRECT_UV);
+       Transform_Properties(ot, P_MIRROR | P_SNAP | P_CORRECT_UV);
+}
+
+static void TRANSFORM_OT_vert_slide(struct wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name   = "Vertex Slide";
+       ot->description = "Slide a vertex along a mesh";
+       ot->idname = OP_VERT_SLIDE;
+       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_region_view3d;
+
+       RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f);
+       RNA_def_boolean(ot->srna, "use_even", false, "Even",
+                       "Make the edge loop match the shape of the adjacent edge loop");
+       RNA_def_boolean(ot->srna, "flipped", false, "Flipped",
+                       "When Even mode is active, flips between the two adjacent edge loops");
+       RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp",
+                       "Clamp within the edge extents");
+
+       Transform_Properties(ot, P_MIRROR | P_SNAP | P_CORRECT_UV);
 }
 
 static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
@@ -787,7 +893,7 @@ static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
        ot->name   = "Edge Crease";
        ot->description = "Change the crease of edges";
        ot->idname = OP_EDGE_CREASE;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -801,17 +907,38 @@ static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
        Transform_Properties(ot, P_SNAP);
 }
 
+static int edge_bevelweight_exec(bContext *C, wmOperator *op)
+{
+       Mesh *me = (Mesh *)CTX_data_edit_object(C)->data;
+
+       /* auto-enable bevel edge weight drawing, then chain to common transform code */
+       me->drawflag |= ME_DRAWBWEIGHTS;
+
+       return transform_exec(C, op);
+}
+
+static int edge_bevelweight_invoke(bContext *C, wmOperator *op, const wmEvent *event)
+{
+       Mesh *me = (Mesh *)CTX_data_edit_object(C)->data;
+
+       /* auto-enable bevel edge weight drawing, then chain to common transform code */
+       me->drawflag |= ME_DRAWBWEIGHTS;
+
+       return transform_invoke(C, op, event);
+}
+
+
 static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot)
 {
        /* identifiers */
        ot->name   = "Edge Bevel Weight";
        ot->description = "Change the bevel weight of edges";
        ot->idname = OP_EDGE_BWEIGHT;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
-       ot->invoke = transform_invoke;
-       ot->exec   = transform_exec;
+       ot->invoke = edge_bevelweight_invoke;
+       ot->exec   = edge_bevelweight_exec;
        ot->modal  = transform_modal;
        ot->cancel = transform_cancel;
        ot->poll   = ED_operator_editmesh;
@@ -827,7 +954,7 @@ static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
        ot->name   = "Sequence Slide";
        ot->description = "Slide a sequence strip in time";
        ot->idname = OP_SEQ_SLIDE;
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -836,7 +963,7 @@ static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
        ot->cancel = transform_cancel;
        ot->poll   = ED_operator_sequencer_active;
 
-       RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
+       RNA_def_float_vector_xyz(ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
 
        Transform_Properties(ot, P_SNAP);
 }
@@ -849,7 +976,7 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
        ot->name   = "Transform";
        ot->description = "Transform selected items by mode type";
        ot->idname = "TRANSFORM_OT_transform";
-       ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
+       ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
 
        /* api callbacks */
        ot->invoke = transform_invoke;
@@ -858,12 +985,12 @@ static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
        ot->cancel = transform_cancel;
        ot->poll   = ED_operator_screenactive;
 
-       prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
+       prop = RNA_def_enum(ot->srna, "mode", rna_enum_transform_mode_types, TFM_TRANSLATION, "Mode", "");
        RNA_def_property_flag(prop, PROP_HIDDEN);
 
        RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);
 
-       Transform_Properties(ot, P_AXIS|P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP);
+       Transform_Properties(ot, P_AXIS | P_CONSTRAINT | P_PROPORTIONAL | P_MIRROR | P_ALIGN_SNAP | P_GPENCIL_EDIT);
 }
 
 void transform_operatortypes(void)
@@ -879,8 +1006,6 @@ void transform_operatortypes(void)
        WM_operatortype_append(TRANSFORM_OT_select_orientation);
        WM_operatortype_append(TRANSFORM_OT_create_orientation);
        WM_operatortype_append(TRANSFORM_OT_delete_orientation);
-
-       WM_operatortype_append(TRANSFORM_OT_snap_type);
 }
 
 void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spaceid)
@@ -911,29 +1036,31 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
 
                        WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
 
-                       WM_keymap_add_item(keymap, OP_WARP, WKEY, KM_PRESS, KM_SHIFT, 0);
+                       WM_keymap_add_item(keymap, OP_BEND, WKEY, KM_PRESS, KM_SHIFT, 0);
 
-                       WM_keymap_add_item(keymap, OP_TOSPHERE, SKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+                       WM_keymap_add_item(keymap, OP_TOSPHERE, SKEY, KM_PRESS, KM_ALT | KM_SHIFT, 0);
 
-                       WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
+                       WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT | KM_CTRL | KM_SHIFT, 0);
 
                        WM_keymap_add_item(keymap, "TRANSFORM_OT_select_orientation", SPACEKEY, KM_PRESS, KM_ALT, 0);
 
-                       kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_create_orientation", SPACEKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
-                       RNA_boolean_set(kmi->ptr, "use", TRUE);
+                       kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_create_orientation", SPACEKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
+                       RNA_boolean_set(kmi->ptr, "use", true);
 
                        WM_keymap_add_item(keymap, OP_MIRROR, MKEY, KM_PRESS, KM_CTRL, 0);
 
                        kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
                        RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_snap");
 
-                       WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
+                       kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", TABKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+                       RNA_string_set(kmi->ptr, "data_path", "tool_settings.snap_element");
+
 
                        kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, TKEY, KM_PRESS, KM_SHIFT, 0);
-                       RNA_boolean_set(kmi->ptr, "texture_space", TRUE);
+                       RNA_boolean_set(kmi->ptr, "texture_space", true);
 
-                       kmi = WM_keymap_add_item(keymap, OP_RESIZE, TKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
-                       RNA_boolean_set(kmi->ptr, "texture_space", TRUE);
+                       kmi = WM_keymap_add_item(keymap, OP_RESIZE, TKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);
+                       RNA_boolean_set(kmi->ptr, "texture_space", true);
 
                        WM_keymap_add_item(keymap, OP_SKIN_RESIZE, AKEY, KM_PRESS, KM_CTRL, 0);
 
@@ -983,6 +1110,15 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
                        WM_keymap_add_item(keymap, "NODE_OT_translate_attach", GKEY, KM_PRESS, 0, 0);
                        WM_keymap_add_item(keymap, "NODE_OT_translate_attach", EVT_TWEAK_A, KM_ANY, 0, 0);
                        WM_keymap_add_item(keymap, "NODE_OT_translate_attach", EVT_TWEAK_S, KM_ANY, 0, 0);
+                       /* NB: small trick: macro operator poll may fail due to library data edit,
+                        * in that case the secondary regular operators are called with same keymap.
+                        */
+                       kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, KM_PRESS, 0, 0);
+                       RNA_boolean_set(kmi->ptr, "release_confirm", true);
+                       kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_A, KM_ANY, 0, 0);
+                       RNA_boolean_set(kmi->ptr, "release_confirm", true);
+                       kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_S, KM_ANY, 0, 0);
+                       RNA_boolean_set(kmi->ptr, "release_confirm", true);
 
                        WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
 
@@ -994,8 +1130,10 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
                        WM_keymap_add_item(keymap, "NODE_OT_move_detach_links_release", EVT_TWEAK_A, KM_ANY, KM_ALT, 0);
                        WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_S, KM_ANY, KM_ALT, 0);
 
-                       /* dettach and translate */
-                       WM_keymap_add_item(keymap, "NODE_OT_detach_translate_attach", FKEY, KM_PRESS, KM_ALT, 0);
+                       kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
+                       RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_snap");
+                       kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", TABKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+                       RNA_string_set(kmi->ptr, "data_path", "tool_settings.snap_node_element");
                        break;
                case SPACE_SEQ:
                        WM_keymap_add_item(keymap, OP_SEQ_SLIDE, GKEY, KM_PRESS, 0, 0);
@@ -1014,12 +1152,15 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
 
                        WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
 
-                       WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
+                       WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT | KM_CTRL | KM_SHIFT, 0);
 
                        WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
 
                        kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
                        RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_snap");
+
+                       kmi = WM_keymap_add_item(keymap, "WM_OT_context_menu_enum", TABKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
+                       RNA_string_set(kmi->ptr, "data_path", "tool_settings.snap_uv_element");
                        break;
                case SPACE_CLIP:
                        WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);