Cleanup: use `rna_enum_` prefix for RNA enums
[blender.git] / source / blender / editors / transform / transform_ops.c
index eb204be322088fbf3474526c5c1d7d1ffb6c4ca4..454fffd69267d16f0dd6ab670b0bfa9efb0671de 100644 (file)
 
 #include "MEM_guardedalloc.h"
 
+#include "DNA_mesh_types.h"
 #include "DNA_object_types.h"
 #include "DNA_scene_types.h"
 
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
-#include "BLF_translation.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 "UI_resources.h"
 
 #include "ED_screen.h"
+/* for USE_LOOPSLIDE_HACK only */
 #include "ED_mesh.h"
 
 #include "transform.h"
 
 typedef struct TransformModeItem {
-       char *idname;
+       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_VERT_SLIDE[] = "TRANSFORM_OT_vert_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);
@@ -86,7 +88,7 @@ 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);
@@ -106,7 +108,7 @@ 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},
@@ -120,7 +122,7 @@ static TransformModeItem transform_modes[] =
        {NULL, 0}
 };
 
-EnumPropertyItem transform_mode_types[] =
+EnumPropertyItem rna_enum_transform_mode_types[] =
 {
        {TFM_INIT, "INIT", 0, "Init", ""},
        {TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
@@ -130,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", ""},
@@ -139,8 +141,10 @@ 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", ""},
@@ -170,12 +174,12 @@ static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), const
        uiPopupMenu *pup;
        uiLayout *layout;
 
-       pup = uiPupMenuBegin(C, IFACE_("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)
@@ -206,7 +210,7 @@ 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_SPACE | ND_SPACE_VIEW3D, v3d);
        WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C));
 
        return OPERATOR_FINISHED;
@@ -250,20 +254,21 @@ 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");
-       int use_view = RNA_boolean_get(op->ptr, "use_view");
+       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);
 
-       if (use && !CTX_wm_view3d(C)) {
+       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_SPACE | ND_SPACE_VIEW3D, v3d);
        WM_event_add_notifier(C, NC_SCENE | NA_EDITED, CTX_data_scene(C));
        
        return OPERATOR_FINISHED;
@@ -281,11 +286,11 @@ static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot)
        ot->exec   = create_orientation_exec;
        ot->poll   = ED_operator_areaactive;
 
-       RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Name of the new custom orientation");
-       RNA_def_boolean(ot->srna, "use_view", FALSE, "Use View",
+       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",
+       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");
 }
 
@@ -322,6 +327,9 @@ static void transformops_loopsel_hack(bContext *C, wmOperator *op)
                }
        }
 }
+#else
+/* prevent removal by cleanup */
+#  error "loopslide hack removed!"
 #endif  /* USE_LOOPSLIDE_HACK */
 
 
@@ -392,6 +400,15 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
        exit_code = transformEvent(t, event);
        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);
 
        exit_code |= transformEnd(C, t);
@@ -404,7 +421,7 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
                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 differernt operators. */
+                        * to share callbacks between different operators. */
                        wmOperatorType *ot_new = NULL;
                        TransformModeItem *item = transform_modes;
                        while (item->idname) {
@@ -426,15 +443,13 @@ static int transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
        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)
@@ -475,7 +490,7 @@ static int transform_invoke(bContext *C, wmOperator *op, const 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;
        }
 }
@@ -509,10 +524,10 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
 
 
        if (flags & P_PROPORTIONAL) {
-               RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", "");
-               prop = RNA_def_enum(ot->srna, "proportional_edit_falloff", proportional_falloff_items, 0,
+               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, BLF_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+               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);
        }
 
@@ -521,7 +536,7 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
                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);
                        RNA_def_property_flag(prop, PROP_HIDDEN);
@@ -534,9 +549,15 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
                        }
                }
        }
-
-       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) {
@@ -567,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)
@@ -587,7 +608,7 @@ 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)
@@ -617,13 +638,11 @@ 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)
 {
-       PropertyRNA *prop;
-
        /* identifiers */
        ot->name   = "Trackball";
        ot->description = "Trackball style rotation of selected items";
@@ -638,16 +657,13 @@ static void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
        ot->poll   = ED_operator_screenactive;
 
        /* Maybe we could use float_vector_xyz here too? */
-       prop = RNA_def_float_vector(ot->srna, "value", 2, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
-       RNA_def_property_subtype(prop, PROP_ANGLE);
+       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)
 {
-       PropertyRNA *prop;
-
        /* identifiers */
        ot->name = "Rotate";
        ot->description = "Rotate selected items";
@@ -661,10 +677,9 @@ static void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
        ot->cancel = transform_cancel;
        ot->poll   = ED_operator_screenactive;
 
-       prop = RNA_def_float(ot->srna, "value", 0.0f, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
-       RNA_def_property_subtype(prop, PROP_ANGLE);
+       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)
@@ -693,25 +708,24 @@ static void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
        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->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);
 
-       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)
@@ -731,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?
 }
 
@@ -772,6 +786,8 @@ 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);
 
+       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);
 }
 
@@ -793,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)
@@ -811,11 +827,13 @@ 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"; 
@@ -827,9 +845,18 @@ static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
        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);
 }
@@ -847,11 +874,17 @@ static void TRANSFORM_OT_vert_slide(struct wmOperatorType *ot)
        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, -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);
+       Transform_Properties(ot, P_MIRROR | P_SNAP | P_CORRECT_UV);
 }
 
 static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
@@ -874,6 +907,27 @@ 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 */
@@ -883,8 +937,8 @@ static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot)
        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;
@@ -931,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)
@@ -982,7 +1036,7 @@ 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);
 
@@ -991,7 +1045,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
                        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);
+                       RNA_boolean_set(kmi->ptr, "use", true);
 
                        WM_keymap_add_item(keymap, OP_MIRROR, MKEY, KM_PRESS, KM_CTRL, 0);
 
@@ -1003,10 +1057,10 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
 
 
                        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);
+                       RNA_boolean_set(kmi->ptr, "texture_space", true);
 
                        WM_keymap_add_item(keymap, OP_SKIN_RESIZE, AKEY, KM_PRESS, KM_CTRL, 0);
 
@@ -1060,11 +1114,11 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
                         * 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);
+                       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);
+                       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);
+                       RNA_boolean_set(kmi->ptr, "release_confirm", true);
 
                        WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
 
@@ -1076,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);