shrink/fatten transform for mask - adjusts the feather weight.
[blender.git] / source / blender / editors / transform / transform_ops.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * Contributor(s): none yet.
19  *
20  * ***** END GPL LICENSE BLOCK *****
21  */
22
23 /** \file blender/editors/transform/transform_ops.c
24  *  \ingroup edtransform
25  */
26
27
28 #include "MEM_guardedalloc.h"
29
30 #include "DNA_object_types.h"
31 #include "DNA_scene_types.h"
32
33 #include "RNA_access.h"
34 #include "RNA_define.h"
35 #include "RNA_enum_types.h"
36
37 #include "BLI_math.h"
38 #include "BLI_utildefines.h"
39
40 #include "BKE_context.h"
41 #include "BKE_global.h"
42 #include "BKE_armature.h"
43
44 #include "WM_api.h"
45 #include "WM_types.h"
46
47 #include "UI_interface.h"
48 #include "UI_resources.h"
49
50 #include "ED_screen.h"
51
52 #include "transform.h"
53
54 typedef struct TransformModeItem
55 {
56         char *idname;
57         int             mode;
58         void (*opfunc)(wmOperatorType*);
59 } TransformModeItem;
60
61 static float VecOne[3] = {1, 1, 1};
62
63 static char OP_TRANSLATION[] = "TRANSFORM_OT_translate";
64 static char OP_ROTATION[] = "TRANSFORM_OT_rotate";
65 static char OP_TOSPHERE[] = "TRANSFORM_OT_tosphere";
66 static char OP_RESIZE[] = "TRANSFORM_OT_resize";
67 static char OP_SKIN_RESIZE[] = "TRANSFORM_OT_skin_resize";
68 static char OP_SHEAR[] = "TRANSFORM_OT_shear";
69 static char OP_WARP[] = "TRANSFORM_OT_warp";
70 static char OP_SHRINK_FATTEN[] = "TRANSFORM_OT_shrink_fatten";
71 static char OP_PUSH_PULL[] = "TRANSFORM_OT_push_pull";
72 static char OP_TILT[] = "TRANSFORM_OT_tilt";
73 static char OP_TRACKBALL[] = "TRANSFORM_OT_trackball";
74 static char OP_MIRROR[] = "TRANSFORM_OT_mirror";
75 static char OP_EDGE_SLIDE[] = "TRANSFORM_OT_edge_slide";
76 static char OP_EDGE_CREASE[] = "TRANSFORM_OT_edge_crease";
77 static char OP_EDGE_BWEIGHT[] = "TRANSFORM_OT_edge_bevelweight";
78 static char OP_SEQ_SLIDE[] = "TRANSFORM_OT_seq_slide";
79
80 static void TRANSFORM_OT_translate(struct wmOperatorType *ot);
81 static void TRANSFORM_OT_rotate(struct wmOperatorType *ot);
82 static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot);
83 static void TRANSFORM_OT_resize(struct wmOperatorType *ot);
84 static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot);
85 static void TRANSFORM_OT_shear(struct wmOperatorType *ot);
86 static void TRANSFORM_OT_warp(struct wmOperatorType *ot);
87 static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot);
88 static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot);
89 static void TRANSFORM_OT_tilt(struct wmOperatorType *ot);
90 static void TRANSFORM_OT_trackball(struct wmOperatorType *ot);
91 static void TRANSFORM_OT_mirror(struct wmOperatorType *ot);
92 static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot);
93 static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot);
94 static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot);
95 static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot);
96
97 static TransformModeItem transform_modes[] =
98 {
99         {OP_TRANSLATION, TFM_TRANSLATION, TRANSFORM_OT_translate},
100         {OP_ROTATION, TFM_ROTATION, TRANSFORM_OT_rotate},
101         {OP_TOSPHERE, TFM_TOSPHERE, TRANSFORM_OT_tosphere},
102         {OP_RESIZE, TFM_RESIZE, TRANSFORM_OT_resize},
103         {OP_SKIN_RESIZE, TFM_SKIN_RESIZE, TRANSFORM_OT_skin_resize},
104         {OP_SHEAR, TFM_SHEAR, TRANSFORM_OT_shear},
105         {OP_WARP, TFM_WARP, TRANSFORM_OT_warp},
106         {OP_SHRINK_FATTEN, TFM_SHRINKFATTEN, TRANSFORM_OT_shrink_fatten},
107         {OP_PUSH_PULL, TFM_PUSHPULL, TRANSFORM_OT_push_pull},
108         {OP_TILT, TFM_TILT, TRANSFORM_OT_tilt},
109         {OP_TRACKBALL, TFM_TRACKBALL, TRANSFORM_OT_trackball},
110         {OP_MIRROR, TFM_MIRROR, TRANSFORM_OT_mirror},
111         {OP_EDGE_SLIDE, TFM_EDGE_SLIDE, TRANSFORM_OT_edge_slide},
112         {OP_EDGE_CREASE, TFM_CREASE, TRANSFORM_OT_edge_crease},
113         {OP_EDGE_BWEIGHT, TFM_BWEIGHT, TRANSFORM_OT_edge_bevelweight},
114         {OP_SEQ_SLIDE, TFM_SEQ_SLIDE, TRANSFORM_OT_seq_slide},
115         {NULL, 0}
116 };
117
118 EnumPropertyItem transform_mode_types[] =
119 {
120         {TFM_INIT, "INIT", 0, "Init", ""},
121         {TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
122         {TFM_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
123         {TFM_ROTATION, "ROTATION", 0, "Rotation", ""},
124         {TFM_RESIZE, "RESIZE", 0, "Resize", ""},
125         {TFM_SKIN_RESIZE, "SKIN_RESIZE", 0, "Skin Resize", ""},
126         {TFM_TOSPHERE, "TOSPHERE", 0, "Tosphere", ""},
127         {TFM_SHEAR, "SHEAR", 0, "Shear", ""},
128         {TFM_WARP, "WARP", 0, "Warp", ""},
129         {TFM_SHRINKFATTEN, "SHRINKFATTEN", 0, "Shrinkfatten", ""},
130         {TFM_TILT, "TILT", 0, "Tilt", ""},
131         {TFM_TRACKBALL, "TRACKBALL", 0, "Trackball", ""},
132         {TFM_PUSHPULL, "PUSHPULL", 0, "Pushpull", ""},
133         {TFM_CREASE, "CREASE", 0, "Crease", ""},
134         {TFM_MIRROR, "MIRROR", 0, "Mirror", ""},
135         {TFM_BONESIZE, "BONE_SIZE", 0, "Bonesize", ""},
136         {TFM_BONE_ENVELOPE, "BONE_ENVELOPE", 0, "Bone_Envelope", ""},
137         {TFM_CURVE_SHRINKFATTEN, "CURVE_SHRINKFATTEN", 0, "Curve_Shrinkfatten", ""},
138         {TFM_MASK_SHRINKFATTEN, "MASK_SHRINKFATTEN", 0, "Mask_Shrinkfatten", ""},
139         {TFM_BONE_ROLL, "BONE_ROLL", 0, "Bone_Roll", ""},
140         {TFM_TIME_TRANSLATE, "TIME_TRANSLATE", 0, "Time_Translate", ""},
141         {TFM_TIME_SLIDE, "TIME_SLIDE", 0, "Time_Slide", ""},
142         {TFM_TIME_SCALE, "TIME_SCALE", 0, "Time_Scale", ""},
143         {TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time_Extend", ""},
144         {TFM_BAKE_TIME, "BAKE_TIME", 0, "Bake_Time", ""},
145         {TFM_BEVEL, "BEVEL", 0, "Bevel", ""},
146         {TFM_BWEIGHT, "BWEIGHT", 0, "Bweight", ""},
147         {TFM_ALIGN, "ALIGN", 0, "Align", ""},
148         {TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
149         {TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""},
150         {0, NULL, 0, NULL, NULL}
151 };
152
153 static int snap_type_exec(bContext *C, wmOperator *op)
154 {
155         ToolSettings *ts= CTX_data_tool_settings(C);
156
157         ts->snap_mode = RNA_enum_get(op->ptr, "type");
158
159         WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
160
161         return OPERATOR_FINISHED;
162 }
163
164 static void TRANSFORM_OT_snap_type(wmOperatorType *ot)
165 {
166         /* identifiers */
167         ot->name = "Snap Type";
168         ot->description = "Set the snap element type";
169         ot->idname = "TRANSFORM_OT_snap_type";
170
171         /* api callbacks */
172         ot->invoke = WM_menu_invoke;
173         ot->exec = snap_type_exec;
174
175         ot->poll = ED_operator_areaactive;
176
177         /* flags */
178         ot->flag = OPTYPE_UNDO;
179
180         /* props */
181         ot->prop = RNA_def_enum(ot->srna, "type", snap_element_items, 0, "Type", "Set the snap element type");
182
183 }
184
185 static int select_orientation_exec(bContext *C, wmOperator *op)
186 {
187         int orientation = RNA_enum_get(op->ptr, "orientation");
188
189         BIF_selectTransformOrientationValue(C, orientation);
190         
191         WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
192
193         return OPERATOR_FINISHED;
194 }
195
196 static int select_orientation_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *UNUSED(event))
197 {
198         uiPopupMenu *pup;
199         uiLayout *layout;
200
201         pup= uiPupMenuBegin(C, "Orientation", ICON_NONE);
202         layout= uiPupMenuLayout(pup);
203         uiItemsEnumO(layout, "TRANSFORM_OT_select_orientation", "orientation");
204         uiPupMenuEnd(C, pup);
205
206         return OPERATOR_CANCELLED;
207 }
208
209 static void TRANSFORM_OT_select_orientation(struct wmOperatorType *ot)
210 {
211         PropertyRNA *prop;
212
213         /* identifiers */
214         ot->name   = "Select Orientation";
215         ot->description = "Select transformation orientation";
216         ot->idname = "TRANSFORM_OT_select_orientation";
217         ot->flag   = OPTYPE_UNDO;
218
219         /* api callbacks */
220         ot->invoke = select_orientation_invoke;
221         ot->exec   = select_orientation_exec;
222         ot->poll   = ED_operator_view3d_active;
223
224         prop= RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE);
225         RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
226         RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
227 }
228
229
230 static int delete_orientation_exec(bContext *C, wmOperator *UNUSED(op))
231 {
232         View3D *v3d = CTX_wm_view3d(C);
233         int selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
234
235         BIF_removeTransformOrientationIndex(C, selected_index);
236         
237         WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
238         WM_event_add_notifier(C, NC_SCENE|NA_EDITED, CTX_data_scene(C));
239
240         return OPERATOR_FINISHED;
241 }
242
243 static int delete_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
244 {
245         return delete_orientation_exec(C, op);
246 }
247
248 static int delete_orientation_poll(bContext *C)
249 {
250         int selected_index = -1;
251         View3D *v3d = CTX_wm_view3d(C);
252         
253         if (ED_operator_areaactive(C) == 0)
254                 return 0;
255         
256         
257         if (v3d) {
258                 selected_index = (v3d->twmode - V3D_MANIP_CUSTOM);
259         }
260         
261         return selected_index >= 0;
262 }
263
264 static void TRANSFORM_OT_delete_orientation(struct wmOperatorType *ot)
265 {
266         /* identifiers */
267         ot->name   = "Delete Orientation";
268         ot->description = "Delete transformation orientation";
269         ot->idname = "TRANSFORM_OT_delete_orientation";
270         ot->flag   = OPTYPE_UNDO;
271
272         /* api callbacks */
273         ot->invoke = delete_orientation_invoke;
274         ot->exec   = delete_orientation_exec;
275         ot->poll   = delete_orientation_poll;
276 }
277
278 static int create_orientation_exec(bContext *C, wmOperator *op)
279 {
280         char name[MAX_NAME];
281         int use = RNA_boolean_get(op->ptr, "use");
282         int overwrite = RNA_boolean_get(op->ptr, "overwrite");
283         
284         RNA_string_get(op->ptr, "name", name);
285
286         BIF_createTransformOrientation(C, op->reports, name, use, overwrite);
287
288         WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
289         WM_event_add_notifier(C, NC_SCENE|NA_EDITED, CTX_data_scene(C));
290         
291         return OPERATOR_FINISHED;
292 }
293
294 static int create_orientation_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event))
295 {
296         return create_orientation_exec(C, op);
297 }
298
299 static void TRANSFORM_OT_create_orientation(struct wmOperatorType *ot)
300 {
301         /* identifiers */
302         ot->name   = "Create Orientation";
303         ot->description = "Create transformation orientation from selection";
304         ot->idname = "TRANSFORM_OT_create_orientation";
305         ot->flag   = OPTYPE_REGISTER|OPTYPE_UNDO;
306
307         /* api callbacks */
308         ot->invoke = create_orientation_invoke;
309         ot->exec   = create_orientation_exec;
310         ot->poll   = ED_operator_areaactive;
311         ot->flag   = OPTYPE_REGISTER|OPTYPE_UNDO;
312
313         RNA_def_string(ot->srna, "name", "", MAX_NAME, "Name", "Text to insert at the cursor position");
314         RNA_def_boolean(ot->srna, "use", 0, "Use after creation", "Select orientation after its creation");
315         RNA_def_boolean(ot->srna, "overwrite", 0, "Overwrite previous", "Overwrite previously created orientation with same name");
316 }
317
318 static void transformops_exit(bContext *C, wmOperator *op)
319 {
320         saveTransform(C, op->customdata, op);
321         MEM_freeN(op->customdata);
322         op->customdata = NULL;
323         G.moving = 0;
324 }
325
326 static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
327 {
328         int retval = 1;
329         if (op->customdata == NULL) {
330                 TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data2");
331                 TransformModeItem *tmode;
332                 int mode = -1;
333
334                 for (tmode = transform_modes; tmode->idname; tmode++) {
335                         if (op->type->idname == tmode->idname) {
336                                 mode = tmode->mode;
337                                 break;
338                         }
339                 }
340
341                 if (mode == -1) {
342                         mode = RNA_enum_get(op->ptr, "mode");
343                 }
344
345                 retval = initTransform(C, t, op, event, mode);
346                 G.moving = 1;
347
348                 /* store data */
349                 if (retval) {
350                         op->customdata = t;
351                 }
352                 else {
353                         MEM_freeN(t);
354                 }
355         }
356
357         return retval; /* return 0 on error */
358 }
359
360 static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
361 {
362         int exit_code;
363
364         TransInfo *t = op->customdata;
365
366 #if 0
367         // stable 2D mouse coords map to different 3D coords while the 3D mouse is active
368         // in other words, 2D deltas are no longer good enough!
369         // disable until individual 'transformers' behave better
370
371         if (event->type == NDOF_MOTION)
372                 return OPERATOR_PASS_THROUGH;
373 #endif
374
375         /* XXX insert keys are called here, and require context */
376         t->context= C;
377         exit_code = transformEvent(t, event);
378         t->context= NULL;
379
380         transformApply(C, t);
381
382         exit_code |= transformEnd(C, t);
383
384         if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) {
385                 transformops_exit(C, op);
386                 exit_code &= ~OPERATOR_PASS_THROUGH; /* preventively remove passthrough */
387         }
388
389         return exit_code;
390 }
391
392 static int transform_cancel(bContext *C, wmOperator *op)
393 {
394         TransInfo *t = op->customdata;
395
396         t->state = TRANS_CANCEL;
397         transformEnd(C, t);
398         transformops_exit(C, op);
399
400         return OPERATOR_CANCELLED;
401 }
402
403 static int transform_exec(bContext *C, wmOperator *op)
404 {
405         TransInfo *t;
406
407         if (!transformops_data(C, op, NULL)) {
408                 G.moving = 0;
409                 return OPERATOR_CANCELLED;
410         }
411
412         t = op->customdata;
413
414         t->options |= CTX_AUTOCONFIRM;
415
416         transformApply(C, t);
417
418         transformEnd(C, t);
419
420         transformops_exit(C, op);
421         
422         WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL);
423
424         return OPERATOR_FINISHED;
425 }
426
427 static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
428 {
429         if (!transformops_data(C, op, event)) {
430                 G.moving = 0;
431                 return OPERATOR_CANCELLED;
432         }
433
434         if (RNA_struct_property_is_set(op->ptr, "value")) {
435                 return transform_exec(C, op);
436         }
437         else {
438                 /* add temp handler */
439                 WM_event_add_modal_handler(C, op);
440
441                 op->flag |= OP_GRAB_POINTER; // XXX maybe we want this with the manipulator only?
442                 return OPERATOR_RUNNING_MODAL;
443         }
444 }
445
446 void Transform_Properties(struct wmOperatorType *ot, int flags)
447 {
448         PropertyRNA *prop;
449
450         if (flags & P_AXIS) {
451                 prop= RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
452                 RNA_def_property_array(prop, 3);
453                 /* Make this not hidden when there's a nice axis selection widget */
454                 RNA_def_property_flag(prop, PROP_HIDDEN);
455                 RNA_def_property_ui_text(prop, "Axis", "The axis around which the transformation occurs");
456
457         }
458
459         if (flags & P_CONSTRAINT) {
460                 RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
461                 prop= RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
462                 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
463                 RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
464
465                 
466         }
467
468         if (flags & P_MIRROR) {
469                 RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
470         }
471
472
473         if (flags & P_PROPORTIONAL) {
474                 RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", "");
475                 RNA_def_enum(ot->srna, "proportional_edit_falloff", proportional_falloff_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
476                 RNA_def_float(ot->srna, "proportional_size", 1, 0.00001f, FLT_MAX, "Proportional Size", "", 0.001, 100);
477         }
478
479         if (flags & P_SNAP) {
480                 prop= RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
481                 RNA_def_property_flag(prop, PROP_HIDDEN);
482
483                 if (flags & P_GEO_SNAP) {
484                         prop= RNA_def_enum(ot->srna, "snap_target", snap_target_items, 0, "Target", "");
485                         RNA_def_property_flag(prop, PROP_HIDDEN);
486                         prop= RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
487                         RNA_def_property_flag(prop, PROP_HIDDEN);
488                         
489                         if (flags & P_ALIGN_SNAP) {
490                                 prop= RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
491                                 RNA_def_property_flag(prop, PROP_HIDDEN);
492                                 prop= RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX);
493                                 RNA_def_property_flag(prop, PROP_HIDDEN);
494                         }
495                 }
496         }
497
498         if (flags & P_OPTIONS) {
499                 RNA_def_boolean(ot->srna, "texture_space", 0, "Edit Texture Space", "Edit Object data texture space");
500         }
501
502         if (flags & P_CORRECT_UV) {
503                 RNA_def_boolean(ot->srna, "correct_uv", 0, "Correct UVs", "Correct UV coordinates when transforming");
504         }
505
506         // 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
507         /*prop =*/ RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Always confirm operation when releasing button");
508         //RNA_def_property_flag(prop, PROP_HIDDEN);
509 }
510
511 static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
512 {
513         /* identifiers */
514         ot->name   = "Translate";
515         ot->description = "Translate (move) selected items";
516         ot->idname = OP_TRANSLATION;
517         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
518
519         /* api callbacks */
520         ot->invoke = transform_invoke;
521         ot->exec   = transform_exec;
522         ot->modal  = transform_modal;
523         ot->cancel = transform_cancel;
524         ot->poll   = ED_operator_screenactive;
525
526         RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
527
528         Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP|P_OPTIONS);
529 }
530
531 static void TRANSFORM_OT_resize(struct wmOperatorType *ot)
532 {
533         /* identifiers */
534         ot->name   = "Resize";
535         ot->description = "Scale (resize) selected items"; 
536         ot->idname = OP_RESIZE;
537         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
538
539         /* api callbacks */
540         ot->invoke = transform_invoke;
541         ot->exec   = transform_exec;
542         ot->modal  = transform_modal;
543         ot->cancel = transform_cancel;
544         ot->poll   = ED_operator_screenactive;
545
546         RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
547
548         Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP|P_OPTIONS);
549 }
550
551 static int skin_resize_poll(bContext *C)
552 {
553         struct Object *obedit = CTX_data_edit_object(C);
554         if (obedit && obedit->type == OB_MESH) {
555                 BMEditMesh *em = BMEdit_FromObject(obedit);
556                 return (em && CustomData_has_layer(&em->bm->vdata, CD_MVERT_SKIN));
557         }
558         return 0;
559 }
560
561 static void TRANSFORM_OT_skin_resize(struct wmOperatorType *ot)
562 {
563         /* identifiers */
564         ot->name   = "Skin Resize";
565         ot->description = "Scale selected vertices' skin radii"; 
566         ot->idname = OP_SKIN_RESIZE;
567         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
568
569         /* api callbacks */
570         ot->invoke = transform_invoke;
571         ot->exec   = transform_exec;
572         ot->modal  = transform_modal;
573         ot->cancel = transform_cancel;
574         ot->poll   = skin_resize_poll;
575
576         RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
577
578         Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP|P_OPTIONS);
579 }
580
581 static void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
582 {
583         /* identifiers */
584         ot->name   = "Trackball";
585         ot->description = "Trackball style rotation of selected items";
586         ot->idname = OP_TRACKBALL;
587         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
588
589         /* api callbacks */
590         ot->invoke = transform_invoke;
591         ot->exec   = transform_exec;
592         ot->modal  = transform_modal;
593         ot->cancel = transform_cancel;
594         ot->poll   = ED_operator_screenactive;
595
596         RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
597
598         Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
599 }
600
601 static void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
602 {
603         /* identifiers */
604         ot->name   = "Rotate";
605         ot->description = "Rotate selected items";
606         ot->idname = OP_ROTATION;
607         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
608
609         /* api callbacks */
610         ot->invoke = transform_invoke;
611         ot->exec   = transform_exec;
612         ot->modal  = transform_modal;
613         ot->cancel = transform_cancel;
614         ot->poll   = ED_operator_screenactive;
615
616         RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
617
618         Transform_Properties(ot, P_AXIS|P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP);
619 }
620
621 static void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
622 {
623         /* identifiers */
624         ot->name   = "Tilt";
625         /* optionals - 
626          * "Tilt selected vertices"
627          * "Specify an extra axis rotation for selected vertices of 3d curve" */
628         ot->description = "Tilt selected control vertices of 3d curve"; 
629         ot->idname = OP_TILT;
630         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
631
632         /* api callbacks */
633         ot->invoke = transform_invoke;
634         ot->exec   = transform_exec;
635         ot->modal  = transform_modal;
636         ot->cancel = transform_cancel;
637         ot->poll   = ED_operator_editcurve_3d;
638
639         RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
640
641         Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_SNAP);
642 }
643
644 static void TRANSFORM_OT_warp(struct wmOperatorType *ot)
645 {
646         /* identifiers */
647         ot->name   = "Warp";
648         ot->description = "Warp selected items around the cursor";
649         ot->idname = OP_WARP;
650         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
651
652         /* api callbacks */
653         ot->invoke = transform_invoke;
654         ot->exec   = transform_exec;
655         ot->modal  = transform_modal;
656         ot->cancel = transform_cancel;
657         ot->poll   = ED_operator_screenactive;
658
659         RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
660
661         Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
662         // XXX Warp axis?
663 }
664
665 static void TRANSFORM_OT_shear(struct wmOperatorType *ot)
666 {
667         /* identifiers */
668         ot->name   = "Shear";
669         ot->description = "Shear selected items along the horizontal screen axis";
670         ot->idname = OP_SHEAR;
671         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
672
673         /* api callbacks */
674         ot->invoke = transform_invoke;
675         ot->exec   = transform_exec;
676         ot->modal  = transform_modal;
677         ot->cancel = transform_cancel;
678         ot->poll   = ED_operator_screenactive;
679
680         RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
681
682         Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
683         // XXX Shear axis?
684 }
685
686 static void TRANSFORM_OT_push_pull(struct wmOperatorType *ot)
687 {
688         /* identifiers */
689         ot->name   = "Push/Pull";
690         ot->description = "Push/Pull selected items";
691         ot->idname = OP_PUSH_PULL;
692         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
693
694         /* api callbacks */
695         ot->invoke = transform_invoke;
696         ot->exec   = transform_exec;
697         ot->modal  = transform_modal;
698         ot->cancel = transform_cancel;
699         ot->poll   = ED_operator_screenactive;
700
701         RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX);
702
703         Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
704 }
705
706 static void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
707 {
708         /* identifiers */
709         ot->name   = "Shrink/Fatten";
710         ot->description = "Shrink/fatten selected vertices along normals";
711         ot->idname = OP_SHRINK_FATTEN;
712         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
713
714         /* api callbacks */
715         ot->invoke = transform_invoke;
716         ot->exec   = transform_exec;
717         ot->modal  = transform_modal;
718         ot->cancel = transform_cancel;
719         ot->poll   = ED_operator_editmesh;
720
721         RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
722
723         Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
724 }
725
726 static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
727 {
728         /* identifiers */
729         ot->name   = "To Sphere";
730         //added "around mesh center" to differentiate between "MESH_OT_vertices_to_sphere()" 
731         ot->description = "Move selected vertices outward in a spherical shape around mesh center";
732         ot->idname = OP_TOSPHERE;
733         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
734
735         /* api callbacks */
736         ot->invoke = transform_invoke;
737         ot->exec   = transform_exec;
738         ot->modal  = transform_modal;
739         ot->cancel = transform_cancel;
740         ot->poll   = ED_operator_screenactive;
741
742         RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1);
743
744         Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
745 }
746
747 static void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
748 {
749         /* identifiers */
750         ot->name   = "Mirror";
751         ot->description = "Mirror selected vertices around one or more axes";
752         ot->idname = OP_MIRROR;
753         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
754
755         /* api callbacks */
756         ot->invoke = transform_invoke;
757         ot->exec   = transform_exec;
758         ot->modal  = transform_modal;
759         ot->cancel = transform_cancel;
760         ot->poll   = ED_operator_screenactive;
761
762         Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL);
763 }
764
765 static void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
766 {
767         /* identifiers */
768         ot->name   = "Edge Slide";
769         ot->description = "Slide an edge loop along a mesh"; 
770         ot->idname = OP_EDGE_SLIDE;
771         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
772
773         /* api callbacks */
774         ot->invoke = transform_invoke;
775         ot->exec   = transform_exec;
776         ot->modal  = transform_modal;
777         ot->cancel = transform_cancel;
778         ot->poll   = ED_operator_editmesh;
779
780         RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
781
782         Transform_Properties(ot, P_MIRROR|P_SNAP|P_CORRECT_UV);
783 }
784
785 static void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
786 {
787         /* identifiers */
788         ot->name   = "Edge Crease";
789         ot->description = "Change the crease of edges";
790         ot->idname = OP_EDGE_CREASE;
791         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
792
793         /* api callbacks */
794         ot->invoke = transform_invoke;
795         ot->exec   = transform_exec;
796         ot->modal  = transform_modal;
797         ot->cancel = transform_cancel;
798         ot->poll   = ED_operator_editmesh;
799
800         RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
801
802         Transform_Properties(ot, P_SNAP);
803 }
804
805 static void TRANSFORM_OT_edge_bevelweight(struct wmOperatorType *ot)
806 {
807         /* identifiers */
808         ot->name   = "Edge Bevel Weight";
809         ot->description = "Change the bevel weight of edges";
810         ot->idname = OP_EDGE_BWEIGHT;
811         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
812
813         /* api callbacks */
814         ot->invoke = transform_invoke;
815         ot->exec   = transform_exec;
816         ot->modal  = transform_modal;
817         ot->cancel = transform_cancel;
818         ot->poll   = ED_operator_editmesh;
819
820         RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
821
822         Transform_Properties(ot, P_SNAP);
823 }
824
825 static void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
826 {
827         /* identifiers */
828         ot->name   = "Sequence Slide";
829         ot->description = "Slide a sequence strip in time";
830         ot->idname = OP_SEQ_SLIDE;
831         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
832
833         /* api callbacks */
834         ot->invoke = transform_invoke;
835         ot->exec   = transform_exec;
836         ot->modal  = transform_modal;
837         ot->cancel = transform_cancel;
838         ot->poll   = ED_operator_sequencer_active;
839
840         RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
841
842         Transform_Properties(ot, P_SNAP);
843 }
844
845 static void TRANSFORM_OT_transform(struct wmOperatorType *ot)
846 {
847         PropertyRNA *prop;
848
849         /* identifiers */
850         ot->name   = "Transform";
851         ot->description = "Transform selected items by mode type";
852         ot->idname = "TRANSFORM_OT_transform";
853         ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
854
855         /* api callbacks */
856         ot->invoke = transform_invoke;
857         ot->exec   = transform_exec;
858         ot->modal  = transform_modal;
859         ot->cancel = transform_cancel;
860         ot->poll   = ED_operator_screenactive;
861
862         prop= RNA_def_enum(ot->srna, "mode", transform_mode_types, TFM_TRANSLATION, "Mode", "");
863         RNA_def_property_flag(prop, PROP_HIDDEN);
864
865         RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);
866
867         Transform_Properties(ot, P_AXIS|P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP);
868 }
869
870 void transform_operatortypes(void)
871 {
872         TransformModeItem *tmode;
873
874         for (tmode = transform_modes; tmode->idname; tmode++) {
875                 WM_operatortype_append(tmode->opfunc);
876         }
877
878         WM_operatortype_append(TRANSFORM_OT_transform);
879
880         WM_operatortype_append(TRANSFORM_OT_select_orientation);
881         WM_operatortype_append(TRANSFORM_OT_create_orientation);
882         WM_operatortype_append(TRANSFORM_OT_delete_orientation);
883
884         WM_operatortype_append(TRANSFORM_OT_snap_type);
885 }
886
887 void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spaceid)
888 {
889         wmKeyMapItem *kmi;
890         wmKeyMap *modalmap;
891         
892         /* transform.c, only adds modal map once, checks if it's there */
893         modalmap = transform_modal_keymap(keyconf);
894
895         /* assign map to operators only the first time */
896         if (modalmap) {
897                 TransformModeItem *tmode;
898
899                 for (tmode = transform_modes; tmode->idname; tmode++) {
900                         WM_modalkeymap_assign(modalmap, tmode->idname);
901                 }
902                 WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform");
903         }
904         
905         switch (spaceid) {
906                 case SPACE_VIEW3D:
907                         WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
908
909                         WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
910
911                         WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
912
913                         WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
914
915                         WM_keymap_add_item(keymap, OP_WARP, WKEY, KM_PRESS, KM_SHIFT, 0);
916
917                         WM_keymap_add_item(keymap, OP_TOSPHERE, SKEY, KM_PRESS, KM_ALT|KM_SHIFT, 0);
918
919                         WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
920
921                         WM_keymap_add_item(keymap, "TRANSFORM_OT_select_orientation", SPACEKEY, KM_PRESS, KM_ALT, 0);
922
923                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_create_orientation", SPACEKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
924                         RNA_boolean_set(kmi->ptr, "use", TRUE);
925
926                         WM_keymap_add_item(keymap, OP_MIRROR, MKEY, KM_PRESS, KM_CTRL, 0);
927
928                         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
929                         RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_snap");
930
931                         WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
932
933                         kmi = WM_keymap_add_item(keymap, OP_TRANSLATION, TKEY, KM_PRESS, KM_SHIFT, 0);
934                         RNA_boolean_set(kmi->ptr, "texture_space", TRUE);
935
936                         kmi = WM_keymap_add_item(keymap, OP_RESIZE, TKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
937                         RNA_boolean_set(kmi->ptr, "texture_space", TRUE);
938
939                         WM_keymap_add_item(keymap, OP_SKIN_RESIZE, AKEY, KM_PRESS, KM_CTRL, 0);
940
941                         break;
942                 case SPACE_ACTION:
943                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
944                         RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
945                         
946                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
947                         RNA_enum_set(kmi->ptr, "mode", TFM_TIME_TRANSLATE);
948                         
949                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
950                         RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
951                         
952                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
953                         RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
954                         
955                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", TKEY, KM_PRESS, KM_SHIFT, 0);
956                         RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SLIDE);
957                         break;
958                 case SPACE_IPO:
959                         WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
960                         
961                         WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
962                         
963                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
964                         RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
965                         
966                         WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
967                         
968                         WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
969                         break;
970                 case SPACE_NLA:
971                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", GKEY, KM_PRESS, 0, 0);
972                         RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
973                         
974                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
975                         RNA_enum_set(kmi->ptr, "mode", TFM_TRANSLATION);
976                         
977                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
978                         RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
979                         
980                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, 0, 0);
981                         RNA_enum_set(kmi->ptr, "mode", TFM_TIME_SCALE);
982                         break;
983                 case SPACE_NODE:
984                         WM_keymap_add_item(keymap, "NODE_OT_translate_attach", GKEY, KM_PRESS, 0, 0);
985                         WM_keymap_add_item(keymap, "NODE_OT_translate_attach", EVT_TWEAK_A, KM_ANY, 0, 0);
986                         WM_keymap_add_item(keymap, "NODE_OT_translate_attach", EVT_TWEAK_S, KM_ANY, 0, 0);
987
988                         WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
989
990                         WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
991
992                         /* detach and translate */
993                         WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", DKEY, KM_PRESS, KM_ALT, 0);
994                         /* XXX release_confirm is set in the macro operator definition */
995                         WM_keymap_add_item(keymap, "NODE_OT_move_detach_links_release", EVT_TWEAK_A, KM_ANY, KM_ALT, 0);
996                         WM_keymap_add_item(keymap, "NODE_OT_move_detach_links", EVT_TWEAK_S, KM_ANY, KM_ALT, 0);
997
998                         /* dettach and translate */
999                         WM_keymap_add_item(keymap, "NODE_OT_detach_translate_attach", FKEY, KM_PRESS, KM_ALT, 0);
1000                         break;
1001                 case SPACE_SEQ:
1002                         WM_keymap_add_item(keymap, OP_SEQ_SLIDE, GKEY, KM_PRESS, 0, 0);
1003
1004                         WM_keymap_add_item(keymap, OP_SEQ_SLIDE, EVT_TWEAK_S, KM_ANY, 0, 0);
1005
1006                         kmi = WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", EKEY, KM_PRESS, 0, 0);
1007                         RNA_enum_set(kmi->ptr, "mode", TFM_TIME_EXTEND);
1008                         break;
1009                 case SPACE_IMAGE:
1010                         WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
1011
1012                         WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
1013
1014                         WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
1015
1016                         WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
1017
1018                         WM_keymap_add_item(keymap, OP_SHEAR, SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
1019
1020                         WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0);
1021
1022                         kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0);
1023                         RNA_string_set(kmi->ptr, "data_path", "tool_settings.use_snap");
1024                         break;
1025                 case SPACE_CLIP:
1026                         WM_keymap_add_item(keymap, OP_TRANSLATION, GKEY, KM_PRESS, 0, 0);
1027                         WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
1028                         WM_keymap_add_item(keymap, OP_RESIZE, SKEY, KM_PRESS, 0, 0);
1029                         break;
1030                 default:
1031                         break;
1032         }
1033 }
1034