Sequence Slide transformation (easier to do special sequence code there than in a...
authorMartin Poirier <theeth@yahoo.com>
Mon, 21 Dec 2009 17:23:44 +0000 (17:23 +0000)
committerMartin Poirier <theeth@yahoo.com>
Mon, 21 Dec 2009 17:23:44 +0000 (17:23 +0000)
Also make the transform operator creation a bit more automagic (I always forget either operator registration or modal keymap registration, this is all automatic now).

source/blender/editors/transform/transform.c
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_ops.c

index a6b5e677ca23f5e409a7cb6b602cd116d0f089ad..40db0f7b2721216388f6a5225ff294bdb308cd87 100644 (file)
@@ -450,55 +450,6 @@ static void view_editmove(unsigned short event)
 #endif
 }
 
-#if 0
-static char *transform_to_undostr(TransInfo *t)
-{
-       switch (t->mode) {
-               case TFM_TRANSLATION:
-                       return "Translate";
-               case TFM_ROTATION:
-                       return "Rotate";
-               case TFM_RESIZE:
-                       return "Scale";
-               case TFM_TOSPHERE:
-                       return "To Sphere";
-               case TFM_SHEAR:
-                       return "Shear";
-               case TFM_WARP:
-                       return "Warp";
-               case TFM_SHRINKFATTEN:
-                       return "Shrink/Fatten";
-               case TFM_TILT:
-                       return "Tilt";
-               case TFM_TRACKBALL:
-                       return "Trackball";
-               case TFM_PUSHPULL:
-                       return "Push/Pull";
-               case TFM_BEVEL:
-                       return "Bevel";
-               case TFM_BWEIGHT:
-                       return "Bevel Weight";
-               case TFM_CREASE:
-                       return "Crease";
-               case TFM_BONESIZE:
-                       return "Bone Width";
-               case TFM_BONE_ENVELOPE:
-                       return "Bone Envelope";
-               case TFM_TIME_TRANSLATE:
-                       return "Translate Anim. Data";
-               case TFM_TIME_SCALE:
-                       return "Scale Anim. Data";
-               case TFM_TIME_SLIDE:
-                       return "Time Slide";
-               case TFM_BAKE_TIME:
-                       return "Key Time";
-               case TFM_MIRROR:
-                       return "Mirror";
-       }
-       return "Transform";
-}
-#endif
-
 /* ************************************************* */
 
 /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */
@@ -521,7 +472,7 @@ static char *transform_to_undostr(TransInfo *t)
 #define TFM_MODAL_REMOVE_SNAP  17
 
 /* called in transform_ops.c, on each regeneration of keymaps */
-void transform_modal_keymap(wmKeyConfig *keyconf)
+wmKeyMap* transform_modal_keymap(wmKeyConfig *keyconf)
 {
        static EnumPropertyItem modal_items[] = {
        {TFM_MODAL_CANCEL, "CANCEL", 0, "Cancel", ""},
@@ -546,7 +497,7 @@ void transform_modal_keymap(wmKeyConfig *keyconf)
        wmKeyMap *keymap= WM_modalkeymap_get(keyconf, "Transform Modal Map");
        
        /* this function is called for each spacetype, only needs to add map once */
-       if(keymap) return;
+       if(keymap) return NULL;
        
        keymap= WM_modalkeymap_add(keyconf, "Transform Modal Map", modal_items);
        
@@ -568,19 +519,7 @@ void transform_modal_keymap(wmKeyConfig *keyconf)
        WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, 0, 0, TFM_MODAL_ADD_SNAP);
        WM_modalkeymap_add_item(keymap, AKEY, KM_PRESS, KM_ALT, 0, TFM_MODAL_REMOVE_SNAP);
 
-       /* assign map to operators */
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_transform");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_translate");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_rotate");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_tosphere");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_resize");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_shear");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_warp");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_shrink_fatten");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_tilt");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_trackball");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_mirror");
-       WM_modalkeymap_assign(keymap, "TRANSFORM_OT_edge_slide");
+       return keymap;
 }
 
 
@@ -1620,6 +1559,9 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
        case TFM_ALIGN:
                initAlign(t);
                break;
+       case TFM_SEQ_SLIDE:
+               initSeqSlide(t);
+               break;
        }
 
        /* overwrite initial values if operator supplied a non-null vector */
@@ -3290,11 +3232,11 @@ static void applyTranslation(TransInfo *t, float vec[3]) {
 /* uses t->vec to store actual translation in */
 int Translation(TransInfo *t, short mval[2])
 {
-       float tvec[3];
        char str[250];
 
        if (t->con.mode & CON_APPLY) {
                float pvec[3] = {0.0f, 0.0f, 0.0f};
+               float tvec[3];
                applySnapping(t, t->values);
                t->con.applyVec(t, NULL, t->values, tvec, pvec);
                VECCOPY(t->values, tvec);
@@ -5018,6 +4960,90 @@ int Align(TransInfo *t, short mval[2])
        return 1;
 }
 
+/* ************************** SEQ SLIDE *************************** */
+
+void initSeqSlide(TransInfo *t)
+{
+       t->transform = SeqSlide;
+
+       initMouseInputMode(t, &t->mouse, INPUT_VECTOR);
+
+       t->idx_max = 1;
+       t->num.flag = 0;
+       t->num.idx_max = t->idx_max;
+
+       t->ndof.axis = 1|2;
+
+       t->snap[0] = 0.0f;
+       t->snap[1] = floor(t->scene->r.frs_sec / t->scene->r.frs_sec_base);
+       t->snap[2] = 10.0f;
+}
+
+static void headerSeqSlide(TransInfo *t, float val[2], char *str)
+{
+       char tvec[60];
+
+       if (hasNumInput(&t->num)) {
+               outputNumInput(&(t->num), tvec);
+       }
+       else {
+               sprintf(&tvec[0], "%.0f, %.0f", val[0], val[1]);
+       }
+
+       sprintf(str, "Sequence Slide: %s%s", &tvec[0], t->con.text);
+}
+
+static void applySeqSlide(TransInfo *t, float val[2]) {
+       TransData *td = t->data;
+       int i;
+
+       for(i = 0 ; i < t->total; i++, td++) {
+               float tvec[2];
+
+               if (td->flag & TD_NOACTION)
+                       break;
+
+               if (td->flag & TD_SKIP)
+                       continue;
+
+               copy_v2_v2(tvec, val);
+
+               mul_v2_fl(tvec, td->factor);
+
+               td->loc[0] = td->iloc[0] + tvec[0];
+               td->loc[1] = td->iloc[1] + tvec[1];
+       }
+}
+
+int SeqSlide(TransInfo *t, short mval[2])
+{
+       char str[200];
+
+       if (t->con.mode & CON_APPLY) {
+               float pvec[3] = {0.0f, 0.0f, 0.0f};
+               float tvec[3];
+               t->con.applyVec(t, NULL, t->values, tvec, pvec);
+               VECCOPY(t->values, tvec);
+       }
+       else {
+               applyNDofInput(&t->ndof, t->values);
+               snapGrid(t, t->values);
+               applyNumInput(&t->num, t->values);
+       }
+
+       t->values[0] = floor(t->values[0] + 0.5);
+       t->values[1] = floor(t->values[1] + 0.5);
+
+       headerSeqSlide(t, t->values, str);
+       applySeqSlide(t, t->values);
+
+       recalcData(t);
+
+       ED_area_headerprint(t->sa, str);
+
+       return 1;
+}
+
 /* ************************** ANIM EDITORS - TRANSFORM TOOLS *************************** */
 
 /* ---------------- Special Helpers for Various Settings ------------- */
index b7e1b2e499639947388af6260a9f8ca1104dba92..72d970c967aab95f7364083cc1fe0ded914860a3 100644 (file)
@@ -53,6 +53,8 @@ struct BezTriple;
 struct wmOperatorType;
 struct wmOperator;
 struct wmWindowManager;
+struct wmKeyMap;
+struct wmKeyConfig;
 struct bContext;
 struct wmEvent;
 struct wmTimer;
@@ -522,9 +524,12 @@ int Mirror(TransInfo *t, short mval[2]);
 void initAlign(TransInfo *t);
 int Align(TransInfo *t, short mval[2]);
 
+void initSeqSlide(TransInfo *t);
+int SeqSlide(TransInfo *t, short mval[2]);
+
 void drawPropCircle(const struct bContext *C, TransInfo *t);
 
-void transform_modal_keymap(struct wmKeyConfig *keyconf);
+struct wmKeyMap *transform_modal_keymap(struct wmKeyConfig *keyconf);
 
 
 /*********************** transform_conversions.c ********** */
index f9dcd6f87f41cd0c847a2c249b5196fbe9ef5496..63218369a90f53a0ba0f109233a00f3f6410853a 100644 (file)
@@ -51,6 +51,7 @@ typedef struct TransformModeItem
 {
        char *idname;
        int             mode;
+       void (*opfunc)(wmOperatorType*);
 } TransformModeItem;
 
 static float VecOne[3] = {1, 1, 1};
@@ -66,21 +67,35 @@ char OP_TILT[] = "TRANSFORM_OT_tilt";
 char OP_TRACKBALL[] = "TRANSFORM_OT_trackball";
 char OP_MIRROR[] = "TRANSFORM_OT_mirror";
 char OP_EDGE_SLIDE[] = "TRANSFORM_OT_edge_slide";
-
+char OP_SEQ_SLIDE[] = "TRANSFORM_OT_seq_slide";
+
+void TRANSFORM_OT_translate(struct wmOperatorType *ot);
+void TRANSFORM_OT_rotate(struct wmOperatorType *ot);
+void TRANSFORM_OT_tosphere(struct wmOperatorType *ot);
+void TRANSFORM_OT_resize(struct wmOperatorType *ot);
+void TRANSFORM_OT_shear(struct wmOperatorType *ot);
+void TRANSFORM_OT_warp(struct wmOperatorType *ot);
+void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot);
+void TRANSFORM_OT_tilt(struct wmOperatorType *ot);
+void TRANSFORM_OT_trackball(struct wmOperatorType *ot);
+void TRANSFORM_OT_mirror(struct wmOperatorType *ot);
+void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot);
+void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot);
 
 TransformModeItem transform_modes[] =
 {
-       {OP_TRANSLATION, TFM_TRANSLATION},
-       {OP_ROTATION, TFM_ROTATION},
-       {OP_TOSPHERE, TFM_TOSPHERE},
-       {OP_RESIZE, TFM_RESIZE},
-       {OP_SHEAR, TFM_SHEAR},
-       {OP_WARP, TFM_WARP},
-       {OP_SHRINK_FATTEN, TFM_SHRINKFATTEN},
-       {OP_TILT, TFM_TILT},
-       {OP_TRACKBALL, TFM_TRACKBALL},
-       {OP_MIRROR, TFM_MIRROR},
-       {OP_EDGE_SLIDE, TFM_EDGE_SLIDE},
+       {OP_TRANSLATION, TFM_TRANSLATION, TRANSFORM_OT_translate},
+       {OP_ROTATION, TFM_ROTATION, TRANSFORM_OT_rotate},
+       {OP_TOSPHERE, TFM_TOSPHERE, TRANSFORM_OT_tosphere},
+       {OP_RESIZE, TFM_RESIZE, TRANSFORM_OT_resize},
+       {OP_SHEAR, TFM_SHEAR, TRANSFORM_OT_shear},
+       {OP_WARP, TFM_WARP, TRANSFORM_OT_warp},
+       {OP_SHRINK_FATTEN, TFM_SHRINKFATTEN, TRANSFORM_OT_shrink_fatten},
+       {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_SEQ_SLIDE, TFM_SEQ_SLIDE, TRANSFORM_OT_seq_slide},
        {NULL, 0}
 };
 
@@ -671,6 +686,26 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
        Properties_Snapping(ot, 0, 0);
 }
 
+void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
+{
+       /* identifiers */
+       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;
+
+       /* api callbacks */
+       ot->invoke = transform_invoke;
+       ot->exec   = transform_exec;
+       ot->modal  = transform_modal;
+       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);
+
+       Properties_Snapping(ot, 0, 0);
+}
+
 void TRANSFORM_OT_transform(struct wmOperatorType *ot)
 {
        static EnumPropertyItem transform_mode_types[] = {
@@ -701,6 +736,7 @@ void TRANSFORM_OT_transform(struct wmOperatorType *ot)
                        {TFM_BWEIGHT, "BWEIGHT", 0, "Bweight", ""},
                        {TFM_ALIGN, "ALIGN", 0, "Align", ""},
                        {TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
+                       {TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""},
                        {0, NULL, 0, NULL, NULL}
        };
 
@@ -729,18 +765,14 @@ void TRANSFORM_OT_transform(struct wmOperatorType *ot)
 
 void transform_operatortypes(void)
 {
+       TransformModeItem *tmode;
+
+       for (tmode = transform_modes; tmode->idname; tmode++)
+       {
+               WM_operatortype_append(tmode->opfunc);
+       }
+
        WM_operatortype_append(TRANSFORM_OT_transform);
-       WM_operatortype_append(TRANSFORM_OT_translate);
-       WM_operatortype_append(TRANSFORM_OT_rotate);
-       WM_operatortype_append(TRANSFORM_OT_tosphere);
-       WM_operatortype_append(TRANSFORM_OT_resize);
-       WM_operatortype_append(TRANSFORM_OT_shear);
-       WM_operatortype_append(TRANSFORM_OT_warp);
-       WM_operatortype_append(TRANSFORM_OT_shrink_fatten);
-       WM_operatortype_append(TRANSFORM_OT_tilt);
-       WM_operatortype_append(TRANSFORM_OT_trackball);
-       WM_operatortype_append(TRANSFORM_OT_mirror);
-       WM_operatortype_append(TRANSFORM_OT_edge_slide);
 
        WM_operatortype_append(TRANSFORM_OT_select_orientation);
        WM_operatortype_append(TRANSFORM_OT_create_orientation);
@@ -749,36 +781,48 @@ void transform_operatortypes(void)
        WM_operatortype_append(TRANSFORM_OT_snap_type);
 }
 
-void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int spaceid)
+void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spaceid)
 {
        wmKeyMapItem *km;
+       wmKeyMap *modalmap;
        
        /* transform.c, only adds modal map once, checks if it's there */
-       transform_modal_keymap(keyconf);
+       modalmap = transform_modal_keymap(keyconf);
+
+       /* assign map to operators only the first time */
+       if (modalmap) {
+               TransformModeItem *tmode;
+
+               for (tmode = transform_modes; tmode->idname; tmode++)
+               {
+                       WM_modalkeymap_assign(modalmap, tmode->idname);
+               }
+               WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform");
+       }
        
        switch(spaceid)
        {
                case SPACE_VIEW3D:
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
 
-                       km= WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_S, KM_ANY, 0, 0);
+                       km= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_rotate", RKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_resize", SKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_warp", WKEY, KM_PRESS, KM_SHIFT, 0);
+                       km = WM_keymap_add_item(keymap, OP_WARP, WKEY, KM_PRESS, KM_SHIFT, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_tosphere", SKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
+                       km = WM_keymap_add_item(keymap, OP_TOSPHERE, SKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_shear", SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
+                       km = WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
 
                        km = WM_keymap_add_item(keymap, "TRANSFORM_OT_select_orientation", SPACEKEY, KM_PRESS, KM_ALT, 0);
 
                        km = WM_keymap_add_item(keymap, "TRANSFORM_OT_create_orientation", SPACEKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
                        RNA_boolean_set(km->ptr, "use", 1);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
+                       km = WM_keymap_add_item(keymap, OP_MIRROR, MKEY, KM_PRESS, KM_CTRL, 0);
 
                        km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
                        RNA_string_set(km->ptr, "path", "scene.tool_settings.snap");
@@ -803,17 +847,17 @@ void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *ke
                        RNA_int_set(km->ptr, "mode", TFM_TIME_SLIDE);
                        break;
                case SPACE_IPO:
-                       km= WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, KM_PRESS, 0, 0);
+                       km= WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
 
-                       km= WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_S, KM_ANY, 0, 0);
+                       km= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
 
                                // XXX the 'mode' identifier here is not quite right
                        km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
                        RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_rotate", RKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_resize", SKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
                        break;
                case SPACE_NLA:
                        km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
@@ -829,31 +873,31 @@ void transform_keymap_for_space(struct wmKeyConfig *keyconf, struct wmKeyMap *ke
                        RNA_int_set(km->ptr, "mode", TFM_TIME_SCALE);
                        break;
                case SPACE_NODE:
-                       km= WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, KM_PRESS, 0, 0);
+                       km= WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
 
-                       km= WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_A, KM_ANY, 0, 0);
-                       km= WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_S, KM_ANY, 0, 0);
+                       km= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_A, KM_ANY, 0, 0);
+                       km= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_rotate", RKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_resize", SKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
                        break;
                case SPACE_SEQ:
-                       km= WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, KM_PRESS, 0, 0);
+                       km= WM_keymap_add_item(keymap, OP_SEQ_SLIDE, GKEY, KM_PRESS, 0, 0);
 
-                       km= WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_S, KM_ANY, 0, 0);
+                       km= WM_keymap_add_item(keymap, OP_SEQ_SLIDE, EVT_TWEAK_S, KM_ANY, 0, 0);
 
                        km= WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
                        RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
                        break;
                case SPACE_IMAGE:
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", GKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
 
-                       km= WM_keymap_add_item(keymap, "TRANSFORM_OT_translate", EVT_TWEAK_S, KM_ANY, 0, 0);
+                       km= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_rotate", RKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
 
-                       km = WM_keymap_add_item(keymap, "TRANSFORM_OT_resize", SKEY, KM_PRESS, 0, 0);
+                       km = WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
 
                        km = WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);