1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
|
/**
* $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Contributor(s): none yet.
*
* ***** END GPL LICENSE BLOCK *****
*/
#include "MEM_guardedalloc.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "BLI_arithb.h"
#include "BKE_utildefines.h"
#include "BKE_context.h"
#include "WM_api.h"
#include "WM_types.h"
#include "UI_interface.h"
#include "ED_screen.h"
#include "transform.h"
typedef struct TransformModeItem
{
char *idname;
int mode;
} TransformModeItem;
static float VecOne[3] = {1, 1, 1};
/* need constants for this */
EnumPropertyItem proportional_mode_types[] = {
{0, "OFF", 0, "Off", ""},
{1, "ON", 0, "On", ""},
{2, "CONNECTED", 0, "Connected", ""},
{0, NULL, 0, NULL, NULL}
};
EnumPropertyItem snap_mode_types[] = {
{SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", ""},
{SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", ""},
{SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", ""},
{SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", ""},
{0, NULL, 0, NULL, NULL}
};
EnumPropertyItem proportional_falloff_types[] = {
{PROP_SMOOTH, "SMOOTH", 0, "Smooth", ""},
{PROP_SPHERE, "SPHERE", 0, "Sphere", ""},
{PROP_ROOT, "ROOT", 0, "Root", ""},
{PROP_SHARP, "SHARP", 0, "Sharp", ""},
{PROP_LIN, "LINEAR", 0, "Linear", ""},
{PROP_CONST, "CONSTANT", 0, "Constant", ""},
{PROP_RANDOM, "RANDOM", 0, "Random", ""},
{0, NULL, 0, NULL, NULL}
};
char OP_TRANSLATION[] = "TFM_OT_translation";
char OP_ROTATION[] = "TFM_OT_rotation";
char OP_TOSPHERE[] = "TFM_OT_tosphere";
char OP_RESIZE[] = "TFM_OT_resize";
char OP_SHEAR[] = "TFM_OT_shear";
char OP_WARP[] = "TFM_OT_warp";
char OP_SHRINK_FATTEN[] = "TFM_OT_shrink_fatten";
char OP_TILT[] = "TFM_OT_tilt";
char OP_TRACKBALL[] = "TFM_OT_trackball";
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},
{NULL, 0}
};
static int select_orientation_exec(bContext *C, wmOperator *op)
{
int orientation = RNA_enum_get(op->ptr, "orientation");
BIF_selectTransformOrientationValue(C, orientation);
return OPERATOR_FINISHED;
}
static int select_orientation_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
uiPopupMenu *pup;
uiLayout *layout;
pup= uiPupMenuBegin(C, "Orientation", 0);
layout= uiPupMenuLayout(pup);
uiItemsEnumO(layout, "TFM_OT_select_orientation", "orientation");
uiPupMenuEnd(C, pup);
return OPERATOR_CANCELLED;
}
static EnumPropertyItem *select_orientation_itemf(bContext *C, PointerRNA *ptr, int *free)
{
*free= 1;
return BIF_enumTransformOrientation(C);
}
void TFM_OT_select_orientation(struct wmOperatorType *ot)
{
PropertyRNA *prop;
static EnumPropertyItem orientation_items[]= {
{V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", ""},
{V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""},
{V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""},
{V3D_MANIP_VIEW, "VIEW", 0, "View", ""},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
ot->name = "Select Orientation";
ot->idname = "TFM_OT_select_orientation";
/* api callbacks */
ot->invoke = select_orientation_invoke;
ot->exec = select_orientation_exec;
ot->poll = ED_operator_areaactive;
prop= RNA_def_enum(ot->srna, "orientation", orientation_items, V3D_MANIP_GLOBAL, "Orientation", "DOC_BROKEN");
RNA_def_enum_funcs(prop, select_orientation_itemf);
}
static void transformops_exit(bContext *C, wmOperator *op)
{
saveTransform(C, op->customdata, op);
MEM_freeN(op->customdata);
op->customdata = NULL;
}
static int transformops_data(bContext *C, wmOperator *op, wmEvent *event)
{
int retval = 1;
if (op->customdata == NULL)
{
TransInfo *t = MEM_callocN(sizeof(TransInfo), "TransInfo data");
TransformModeItem *tmode;
int mode = -1;
for (tmode = transform_modes; tmode->idname; tmode++)
{
if (op->type->idname == tmode->idname)
{
mode = tmode->mode;
}
}
if (mode == -1)
{
mode = RNA_int_get(op->ptr, "mode");
}
retval = initTransform(C, t, op, event, mode);
/* store data */
op->customdata = t;
}
return retval; /* return 0 on error */
}
static int transform_modal(bContext *C, wmOperator *op, wmEvent *event)
{
int exit_code;
TransInfo *t = op->customdata;
transformEvent(t, event);
transformApply(C, t);
exit_code = transformEnd(C, t);
if (exit_code != OPERATOR_RUNNING_MODAL)
{
transformops_exit(C, op);
}
return exit_code;
}
static int 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)
{
TransInfo *t;
if (!transformops_data(C, op, NULL))
{
return OPERATOR_CANCELLED;
}
t = op->customdata;
t->options |= CTX_AUTOCONFIRM;
transformApply(C, t);
transformEnd(C, t);
transformops_exit(C, op);
return OPERATOR_FINISHED;
}
static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
if (!transformops_data(C, op, event))
{
return OPERATOR_CANCELLED;
}
if(RNA_property_is_set(op->ptr, "value")) {
return transform_exec(C, op);
}
else {
TransInfo *t = op->customdata;
/* add temp handler */
WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op);
t->flag |= T_MODAL; // XXX meh maybe somewhere else
return OPERATOR_RUNNING_MODAL;
}
}
void Properties_Proportional(struct wmOperatorType *ot)
{
RNA_def_enum(ot->srna, "proportional", proportional_mode_types, 0, "Proportional Editing", "");
RNA_def_enum(ot->srna, "proportional_editing_falloff", prop_mode_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode.");
RNA_def_float(ot->srna, "proportional_size", 1, 0, FLT_MAX, "Proportional Size", "", 0, 100);
}
void Properties_Snapping(struct wmOperatorType *ot, short align)
{
RNA_def_boolean(ot->srna, "snap", 0, "Snap to Point", "");
RNA_def_enum(ot->srna, "snap_mode", snap_mode_types, 0, "Mode", "");
RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
if (align)
{
RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX);
}
}
void Properties_Constraints(struct wmOperatorType *ot)
{
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
RNA_def_int(ot->srna, "constraint_orientation", 0, 0, INT_MAX, "Constraint Orientation", "", 0, INT_MAX);
}
void TFM_OT_translation(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Translation";
ot->idname = OP_TRANSLATION;
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_areaactive;
RNA_def_float_vector(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
Properties_Constraints(ot);
Properties_Snapping(ot, 1);
}
void TFM_OT_resize(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Resize";
ot->idname = OP_RESIZE;
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_areaactive;
RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
Properties_Constraints(ot);
Properties_Snapping(ot, 0);
}
void TFM_OT_trackball(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Trackball";
ot->idname = OP_TRACKBALL;
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_areaactive;
RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "angle", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
}
void TFM_OT_rotation(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Rotation";
ot->idname = OP_ROTATION;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_areaactive;
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
Properties_Constraints(ot);
Properties_Snapping(ot, 0);
}
void TFM_OT_tilt(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Tilt";
ot->idname = OP_TILT;
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_editcurve;
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
Properties_Constraints(ot);
}
void TFM_OT_warp(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Warp";
ot->idname = OP_WARP;
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_areaactive;
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", 0, 1);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
// XXX Shear axis?
// Properties_Constraints(ot);
}
void TFM_OT_shear(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Shear";
ot->idname = OP_SHEAR;
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_areaactive;
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
// XXX Shear axis?
// Properties_Constraints(ot);
}
void TFM_OT_shrink_fatten(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "Shrink/Fatten";
ot->idname = OP_SHRINK_FATTEN;
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING;
/* api callbacks */
ot->invoke = transform_invoke;
ot->exec = transform_exec;
ot->modal = transform_modal;
ot->cancel = transform_cancel;
ot->poll = ED_operator_editmesh;
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
}
void TFM_OT_tosphere(struct wmOperatorType *ot)
{
/* identifiers */
ot->name = "To Sphere";
ot->idname = OP_TOSPHERE;
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_areaactive;
RNA_def_float_percentage(ot->srna, "value", 0, 0, 1, "Percentage", "", 0, 1);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
}
void TFM_OT_transform(struct wmOperatorType *ot)
{
static EnumPropertyItem transform_mode_types[] = {
{TFM_INIT, "INIT", 0, "Init", ""},
{TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
{TFM_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
{TFM_ROTATION, "ROTATION", 0, "Rotation", ""},
{TFM_RESIZE, "RESIZE", 0, "Resize", ""},
{TFM_TOSPHERE, "TOSPHERE", 0, "Tosphere", ""},
{TFM_SHEAR, "SHEAR", 0, "Shear", ""},
{TFM_WARP, "WARP", 0, "Warp", ""},
{TFM_SHRINKFATTEN, "SHRINKFATTEN", 0, "Shrinkfatten", ""},
{TFM_TILT, "TILT", 0, "Tilt", ""},
{TFM_TRACKBALL, "TRACKBALL", 0, "Trackball", ""},
{TFM_PUSHPULL, "PUSHPULL", 0, "Pushpull", ""},
{TFM_CREASE, "CREASE", 0, "Crease", ""},
{TFM_MIRROR, "MIRROR", 0, "Mirror", ""},
{TFM_BONESIZE, "BONESIZE", 0, "Bonesize", ""},
{TFM_BONE_ENVELOPE, "BONE_ENVELOPE", 0, "Bone_Envelope", ""},
{TFM_CURVE_SHRINKFATTEN, "CURVE_SHRINKFATTEN", 0, "Curve_Shrinkfatten", ""},
{TFM_BONE_ROLL, "BONE_ROLL", 0, "Bone_Roll", ""},
{TFM_TIME_TRANSLATE, "TIME_TRANSLATE", 0, "Time_Translate", ""},
{TFM_TIME_SLIDE, "TIME_SLIDE", 0, "Time_Slide", ""},
{TFM_TIME_SCALE, "TIME_SCALE", 0, "Time_Scale", ""},
{TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time_Extend", ""},
{TFM_BAKE_TIME, "BAKE_TIME", 0, "Bake_Time", ""},
{TFM_BEVEL, "BEVEL", 0, "Bevel", ""},
{TFM_BWEIGHT, "BWEIGHT", 0, "Bweight", ""},
{TFM_ALIGN, "ALIGN", 0, "Align", ""},
{0, NULL, 0, NULL, NULL}
};
/* identifiers */
ot->name = "Transform";
ot->idname = "TFM_OT_transform";
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_areaactive;
RNA_def_enum(ot->srna, "mode", transform_mode_types, 0, "Mode", "");
RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
RNA_def_int(ot->srna, "constraint_orientation", 0, 0, INT_MAX, "Constraint Orientation", "", 0, INT_MAX);
}
void transform_operatortypes(void)
{
WM_operatortype_append(TFM_OT_transform);
WM_operatortype_append(TFM_OT_translation);
WM_operatortype_append(TFM_OT_rotation);
WM_operatortype_append(TFM_OT_tosphere);
WM_operatortype_append(TFM_OT_resize);
WM_operatortype_append(TFM_OT_shear);
WM_operatortype_append(TFM_OT_warp);
WM_operatortype_append(TFM_OT_shrink_fatten);
WM_operatortype_append(TFM_OT_tilt);
WM_operatortype_append(TFM_OT_trackball);
WM_operatortype_append(TFM_OT_select_orientation);
}
void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *keymap, int spaceid)
{
wmKeymapItem *km;
switch(spaceid)
{
case SPACE_VIEW3D:
km = WM_keymap_add_item(keymap, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_rotation", RKEY, KM_PRESS, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_resize", SKEY, KM_PRESS, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_warp", WKEY, KM_PRESS, KM_SHIFT, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_tosphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_shear", SKEY, KM_PRESS, KM_ALT|KM_CTRL|KM_SHIFT, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_shrink_fatten", SKEY, KM_PRESS, KM_ALT, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_tilt", TKEY, KM_PRESS, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_select_orientation", SPACEKEY, KM_PRESS, KM_ALT, 0);
break;
case SPACE_ACTION:
km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_TRANSLATE);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_SCALE);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", TKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_SLIDE);
break;
case SPACE_IPO:
km= WM_keymap_add_item(keymap, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
// XXX the 'mode' identifier here is not quite right
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
km = WM_keymap_add_item(keymap, "TFM_OT_rotation", RKEY, KM_PRESS, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_resize", SKEY, KM_PRESS, 0, 0);
break;
case SPACE_NLA:
km= WM_keymap_add_item(keymap, "TFM_OT_transform", GKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EVT_TWEAK_S, KM_ANY, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TRANSLATION);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", EKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_EXTEND);
km= WM_keymap_add_item(keymap, "TFM_OT_transform", SKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_TIME_SCALE);
break;
case SPACE_NODE:
km= WM_keymap_add_item(keymap, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_A, KM_ANY, 0, 0);
km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_rotation", RKEY, KM_PRESS, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_resize", SKEY, KM_PRESS, 0, 0);
break;
case SPACE_SEQ:
km= WM_keymap_add_item(keymap, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
km= WM_keymap_add_item(keymap, "TFM_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, "TFM_OT_translation", GKEY, KM_PRESS, 0, 0);
km= WM_keymap_add_item(keymap, "TFM_OT_translation", EVT_TWEAK_S, KM_ANY, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_rotation", RKEY, KM_PRESS, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_resize", SKEY, KM_PRESS, 0, 0);
km = WM_keymap_add_item(keymap, "TFM_OT_transform", MKEY, KM_PRESS, 0, 0);
RNA_int_set(km->ptr, "mode", TFM_MIRROR);
break;
default:
break;
}
}
|