Blender V5.3
transform_ops.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "MEM_guardedalloc.h"
10
11#include "DNA_curve_types.h"
12#include "DNA_object_types.h"
13#include "DNA_scene_types.h"
14
15#include "BLI_math_vector_c.hh"
16#include "BLI_string.hh"
17#include "BLI_utildefines.hh"
18
19#include "BLT_translation.hh"
20
21#include "BKE_context.hh"
22#include "BKE_global.hh"
23#include "BKE_report.hh"
24#include "BKE_scene.hh"
25#include "BKE_screen.hh"
26
27#include "RNA_access.hh"
28#include "RNA_define.hh"
29#include "RNA_enum_types.hh"
30
31#include "WM_api.hh"
32#include "WM_message.hh"
33#include "WM_toolsystem.hh"
34#include "WM_types.hh"
35
36#include "UI_interface.hh"
38#include "UI_resources.hh"
39
40#include "ED_screen.hh"
42#include "ED_mesh.hh"
43#include "ED_sequencer.hh"
44
45#include "transform.hh"
46#include "transform_convert.hh"
47
48namespace blender {
49
50namespace ed::transform {
51
53 const char *idname;
54 int mode;
56};
57
58static const float VecZero[3] = {0, 0, 0};
59static const float VecOne[3] = {1, 1, 1};
60
61static const char OP_TRANSLATION[] = "TRANSFORM_OT_translate";
62static const char OP_ROTATION[] = "TRANSFORM_OT_rotate";
63static const char OP_TOSPHERE[] = "TRANSFORM_OT_tosphere";
64static const char OP_RESIZE[] = "TRANSFORM_OT_resize";
65static const char OP_SKIN_RESIZE[] = "TRANSFORM_OT_skin_resize";
66static const char OP_SHEAR[] = "TRANSFORM_OT_shear";
67static const char OP_BEND[] = "TRANSFORM_OT_bend";
68static const char OP_SHRINK_FATTEN[] = "TRANSFORM_OT_shrink_fatten";
69static const char OP_PUSH_PULL[] = "TRANSFORM_OT_push_pull";
70static const char OP_TILT[] = "TRANSFORM_OT_tilt";
71static const char OP_TRACKBALL[] = "TRANSFORM_OT_trackball";
72static const char OP_MIRROR[] = "TRANSFORM_OT_mirror";
73static const char OP_BONE_SIZE[] = "TRANSFORM_OT_bbone_resize";
74static const char OP_EDGE_SLIDE[] = "TRANSFORM_OT_edge_slide";
75static const char OP_VERT_SLIDE[] = "TRANSFORM_OT_vert_slide";
76static const char OP_EDGE_CREASE[] = "TRANSFORM_OT_edge_crease";
77static const char OP_VERT_CREASE[] = "TRANSFORM_OT_vert_crease";
78static const char OP_EDGE_BWEIGHT[] = "TRANSFORM_OT_edge_bevelweight";
79static const char OP_SEQ_SLIDE[] = "TRANSFORM_OT_seq_slide";
80static const char OP_NORMAL_ROTATION[] = "TRANSFORM_OT_rotate_normal";
81
83static void TRANSFORM_OT_rotate(wmOperatorType *ot);
85static void TRANSFORM_OT_resize(wmOperatorType *ot);
87static void TRANSFORM_OT_shear(wmOperatorType *ot);
88static void TRANSFORM_OT_bend(wmOperatorType *ot);
91static void TRANSFORM_OT_tilt(wmOperatorType *ot);
93static void TRANSFORM_OT_mirror(wmOperatorType *ot);
102
126
127} // namespace ed::transform
128
130 {ed::transform::TFM_INIT, "INIT", 0, "Init", ""},
131 {ed::transform::TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
132 {ed::transform::TFM_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
133 {ed::transform::TFM_ROTATION, "ROTATION", 0, "Rotation", ""},
134 {ed::transform::TFM_RESIZE, "RESIZE", 0, "Resize", ""},
135 {ed::transform::TFM_SKIN_RESIZE, "SKIN_RESIZE", 0, "Skin Resize", ""},
136 {ed::transform::TFM_TOSPHERE, "TOSPHERE", 0, "To Sphere", ""},
137 {ed::transform::TFM_SHEAR, "SHEAR", 0, "Shear", ""},
138 {ed::transform::TFM_BEND, "BEND", 0, "Bend", ""},
139 {ed::transform::TFM_SHRINKFATTEN, "SHRINKFATTEN", 0, "Shrink/Fatten", ""},
140 {ed::transform::TFM_TILT, "TILT", 0, "Tilt", ""},
141 {ed::transform::TFM_TRACKBALL, "TRACKBALL", 0, "Trackball", ""},
142 {ed::transform::TFM_PUSHPULL, "PUSHPULL", 0, "Push/Pull", ""},
143 {ed::transform::TFM_EDGE_CREASE, "CREASE", 0, "Crease", ""},
144 {ed::transform::TFM_VERT_CREASE, "VERTEX_CREASE", 0, "Vertex Crease", ""},
145 {ed::transform::TFM_MIRROR, "MIRROR", 0, "Mirror", ""},
146 {ed::transform::TFM_BONESIZE, "BONE_SIZE", 0, "Bone Size", ""},
147 {ed::transform::TFM_BONE_ENVELOPE, "BONE_ENVELOPE", 0, "Bone Envelope", ""},
148 {ed::transform::TFM_BONE_ENVELOPE_DIST, "BONE_ENVELOPE_DIST", 0, "Bone Envelope Distance", ""},
149 {ed::transform::TFM_CURVE_SHRINKFATTEN, "CURVE_SHRINKFATTEN", 0, "Curve Shrink/Fatten", ""},
150 {ed::transform::TFM_MASK_SHRINKFATTEN, "MASK_SHRINKFATTEN", 0, "Mask Shrink/Fatten", ""},
151 {ed::transform::TFM_BONE_ROLL, "BONE_ROLL", 0, "Bone Roll", ""},
152 {ed::transform::TFM_TIME_TRANSLATE, "TIME_TRANSLATE", 0, "Time Translate", ""},
153 {ed::transform::TFM_TIME_SLIDE, "TIME_SLIDE", 0, "Time Slide", ""},
154 {ed::transform::TFM_TIME_SCALE, "TIME_SCALE", 0, "Time Scale", ""},
155 {ed::transform::TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time Extend", ""},
156 {ed::transform::TFM_BWEIGHT, "BWEIGHT", 0, "Bevel Weight", ""},
157 {ed::transform::TFM_ALIGN, "ALIGN", 0, "Align", ""},
158 {ed::transform::TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
159 {ed::transform::TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""},
160 {ed::transform::TFM_GPENCIL_OPACITY, "GPENCIL_OPACITY", 0, "Grease Pencil Opacity", ""},
161 {0, nullptr, 0, nullptr, nullptr},
162};
163
164namespace ed::transform {
165
167{
168 Scene *scene = CTX_data_scene(C);
169
170 int orientation = RNA_enum_get(op->ptr, "orientation");
171
173
176
178 WM_msg_publish_rna_prop(mbus, &scene->id, scene, TransformOrientationSlot, type);
179
180 return OPERATOR_FINISHED;
181}
182
184 wmOperator * /*op*/,
185 const wmEvent * /*event*/)
186{
187 ui::PopupMenu *pup = ui::popup_menu_begin(C, IFACE_("Orientation"), ICON_NONE);
188 ui::Layout &layout = *ui::popup_menu_layout(pup);
189 layout.op_enum("TRANSFORM_OT_select_orientation", "orientation");
190 popup_menu_end(C, pup);
191
192 return OPERATOR_INTERFACE;
193}
194
196{
197 PropertyRNA *prop;
198
199 /* Identifiers. */
200 ot->name = "Select Orientation";
201 ot->description = "Select transformation orientation";
202 ot->idname = "TRANSFORM_OT_select_orientation";
203 ot->flag = OPTYPE_UNDO;
204
205 /* API callbacks. */
209
210 prop = RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE);
211 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
213}
214
216{
217 Scene *scene = CTX_data_scene(C);
220
222
224 WM_msg_publish_rna_prop(mbus, &scene->id, scene, Scene, transform_orientation_slots);
225
226 return OPERATOR_FINISHED;
227}
228
230 wmOperator *op,
231 const wmEvent * /*event*/)
232{
233 return delete_orientation_exec(C, op);
234}
235
237{
238 if (ED_operator_areaactive(C) == 0) {
239 return false;
240 }
241
242 Scene *scene = CTX_data_scene(C);
245}
246
248{
249 /* Identifiers. */
250 ot->name = "Delete Orientation";
251 ot->description = "Delete transformation orientation";
252 ot->idname = "TRANSFORM_OT_delete_orientation";
253 ot->flag = OPTYPE_UNDO;
254
255 /* API callbacks. */
259}
260
262{
263 char name[MAX_NAME];
264 const bool use = RNA_boolean_get(op->ptr, "use");
265 const bool overwrite = RNA_boolean_get(op->ptr, "overwrite");
266 const bool use_view = RNA_boolean_get(op->ptr, "use_view");
267 View3D *v3d = CTX_wm_view3d(C);
268 Scene *scene = CTX_data_scene(C);
269
270 RNA_string_get(op->ptr, "name", name);
271
272 if (use && !v3d) {
274 RPT_ERROR,
275 "Create Orientation's 'use' parameter only valid in a 3DView context");
276 return OPERATOR_CANCELLED;
277 }
278
279 if (!BIF_createTransformOrientation(C, op->reports, name, use_view, use, overwrite)) {
280 BKE_report(op->reports, RPT_ERROR, "Unable to create orientation");
281 return OPERATOR_CANCELLED;
282 }
283
284 if (use) {
286 WM_msg_publish_rna_prop(mbus, &scene->id, scene, Scene, transform_orientation_slots);
288 }
289
291
292 return OPERATOR_FINISHED;
293}
294
296{
297 /* Identifiers. */
298 ot->name = "Create Orientation";
299 ot->description = "Create transformation orientation from selection";
300 ot->idname = "TRANSFORM_OT_create_orientation";
302
303 /* API callbacks. */
306
308 ot->srna, "name", nullptr, MAX_NAME, "Name", "Name of the new custom orientation");
310 ot->srna,
311 "use_view",
312 false,
313 "Use View",
314 "Use the current view instead of the active object to create the new orientation");
315
317
319 ot->srna, "use", false, "Use After Creation", "Select orientation after its creation");
321 "overwrite",
322 false,
323 "Overwrite Previous",
324 "Overwrite previously created orientation with same name");
325}
326
327#ifdef USE_LOOPSLIDE_HACK
334{
335 if (op->type->idname == OP_EDGE_SLIDE) {
336 if (op->opm && op->opm->opm && op->opm->opm->prev) {
337 wmOperator *op_prev = op->opm->opm->prev;
338 Scene *scene = CTX_data_scene(C);
339 bool mesh_select_mode[3];
340 PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init");
341
342 if (prop && RNA_property_is_set(op_prev->ptr, prop)) {
343 ToolSettings *ts = scene->toolsettings;
344 short selectmode_orig;
345
346 RNA_property_boolean_get_array(op_prev->ptr, prop, mesh_select_mode);
347 selectmode_orig = ((mesh_select_mode[0] ? SCE_SELECT_VERTEX : 0) |
348 (mesh_select_mode[1] ? SCE_SELECT_EDGE : 0) |
349 (mesh_select_mode[2] ? SCE_SELECT_FACE : 0));
350
351 /* Still switch if we were originally in face select mode. */
352 if ((ts->selectmode != selectmode_orig) && (selectmode_orig != SCE_SELECT_FACE)) {
353 ts->selectmode = selectmode_orig;
354 EDBM_selectmode_set_multi(C, selectmode_orig);
355 }
356 }
357 }
358 }
359}
360#else
361/* Prevent removal by cleanup. */
362# error "loopslide hack removed!"
363#endif /* USE_LOOPSLIDE_HACK */
364
366{
367#ifdef USE_LOOPSLIDE_HACK
369#endif
370
371 TransInfo *t = static_cast<TransInfo *>(op->customdata);
372 saveTransform(C, t, op);
373 MEM_delete(t);
374 op->customdata = nullptr;
375 G.moving = 0;
376}
377
379{
380 for (TransformModeItem *tmode = transform_modes; tmode->idname; tmode++) {
381 if (op->type->idname == tmode->idname) {
382 return tmode->mode;
383 }
384 }
385
386 return RNA_enum_get(op->ptr, "mode");
387}
388
389static int transformops_data(bContext *C, wmOperator *op, const wmEvent *event)
390{
391 int retval = 1;
392 if (op->customdata == nullptr) {
393 TransInfo *t = MEM_new_zeroed<TransInfo>("TransInfo data2");
394
395 t->undo_name = op->type->name;
396
397 int mode = transformops_mode(op);
398 retval = initTransform(C, t, op, event, mode);
399
400 /* Store data. */
401 if (retval) {
402 G.moving = special_transform_moving(t);
403 op->customdata = t;
404 }
405 else {
406 MEM_delete(t);
407 }
408 }
409
410 return retval; /* Return 0 on error. */
411}
412
414{
416
417 TransInfo *t = static_cast<TransInfo *>(op->customdata);
418 const eTfmMode mode_prev = t->mode;
419
420#if defined(WITH_INPUT_NDOF) && 0
421 /* Stable 2D mouse coords map to different 3D coords while the 3D mouse is active
422 * in other words, 2D deltas are no longer good enough!
423 * disable until individual 'transformers' behave better. */
424
425 if (event->type == NDOF_MOTION) {
427 }
428#endif
429
430 /* XXX insert keys are called here, and require context. */
431 t->context = C;
432
433 exit_code = transformEvent(t, op, event);
434 t->context = nullptr;
435
436 /* Allow navigation while transforming. */
437 if (t->vod && (exit_code & OPERATOR_PASS_THROUGH)) {
438 RegionView3D *rv3d = static_cast<RegionView3D *>(t->region->regiondata);
439 const bool is_navigating = (rv3d->rflag & RV3D_NAVIGATING) != 0;
440 if (ED_view3d_navigation_do(C, t->vod, event, t->center_global)) {
441 if (!is_navigating) {
442 /* Navigation has started. */
443
444 if (t->modifiers & MOD_PRECISION) {
445 /* WORKAROUND: Remove precision modification, it may have be unintentionally enabled. */
447 t->mouse.precision = false;
449 }
450 }
451
452 if (rv3d->rflag & RV3D_NAVIGATING) {
453 /* Navigation is running. */
454
455 /* Do not update transform while navigating. This can be distracting. */
457 }
458
459 {
460 /* Navigation has ended. */
461
462 /* Call before #applyMouseInput. */
464
465 /* Mouse input is outdated. */
466 t->mval = float2(event->mval);
467 applyMouseInput(t, &t->mouse, t->mval, t->values);
468 t->redraw |= TREDRAW_HARD;
469 }
470 }
471 }
472
473 transformApply(C, t);
474
475 exit_code |= transformEnd(C, t);
476
477 if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) {
478 transformops_exit(C, op);
479 exit_code &= ~OPERATOR_PASS_THROUGH; /* Preventively remove pass-through. */
480 }
481 else {
482 if (mode_prev != t->mode) {
483 /* WARNING: this is not normal to switch operator types
484 * normally it would not be supported but transform happens
485 * to share callbacks between different operators. */
486 wmOperatorType *ot_new = nullptr;
488 while (item->idname) {
489 if (item->mode == t->mode) {
490 ot_new = WM_operatortype_find(item->idname, false);
491 break;
492 }
493 item++;
494 }
495
496 BLI_assert(ot_new != nullptr);
497 if (ot_new) {
498 WM_operator_type_set(op, ot_new);
500 }
501 /* End suspicious code. */
502 }
503 }
504
505 return exit_code;
506}
507
509{
510 TransInfo *t = static_cast<TransInfo *>(op->customdata);
511
512 t->state = TRANS_CANCEL;
513 transformEnd(C, t);
514 transformops_exit(C, op);
515}
516
518{
519 TransInfo *t;
520
521 if (!transformops_data(C, op, nullptr)) {
522 G.moving = 0;
523 return OPERATOR_CANCELLED;
524 }
525
526 t = static_cast<TransInfo *>(op->customdata);
527
529
530 transformApply(C, t);
531
532 transformEnd(C, t);
533
534 transformops_exit(C, op);
535
537
538 return OPERATOR_FINISHED;
539}
540
542{
543 if (!transformops_data(C, op, event)) {
544 G.moving = 0;
545 return OPERATOR_CANCELLED;
546 }
547
548 /* When modal, allow 'value' to set initial offset. */
549 if ((event == nullptr) && RNA_struct_property_is_set(op->ptr, "value")) {
550 return transform_exec(C, op);
551 }
552
553 /* Add temp handler. */
555
556 /* Use when modal input has some transformation to begin with. */
557 TransInfo *t = static_cast<TransInfo *>(op->customdata);
558 if ((t->flag & T_NO_CURSOR_WRAP) == 0) {
559 op->flag |= OP_IS_MODAL_GRAB_CURSOR; /* XXX maybe we want this with the gizmo only? */
560 }
561 if (!is_zero_v4(t->values_modal_offset)) [[unlikely]] {
562 transformApply(C, t);
563 }
564
566}
567
568static bool transform_poll_property(const bContext *C, wmOperator *op, const PropertyRNA *prop)
569{
570 const char *prop_id = RNA_property_identifier(prop);
571
572 /* Orientation/Constraints. */
573 if (STRPREFIX(prop_id, "constraint")) {
574 /* Hide orientation axis if no constraints are set, since it won't be used. */
575 PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "orient_type");
576 if (!ELEM(prop_con, nullptr, prop)) {
577
578 /* Special case: show constraint axis if we don't have values,
579 * needed for mirror operator. */
580 if (STREQ(prop_id, "constraint_axis") &&
581 (RNA_struct_find_property(op->ptr, "value") == nullptr))
582 {
583 return true;
584 }
585
586 return false;
587 }
588 return true;
589 }
590
591 /* Orientation Axis. */
592 if (STREQ(prop_id, "orient_axis")) {
594 return mode != TFM_ALIGN;
595 }
596
597 /* Proportional Editing. */
598 if (STRPREFIX(prop_id, "proportional") || STRPREFIX(prop_id, "use_proportional")) {
599 ScrArea *area = CTX_wm_area(C);
600 if (area->spacetype == SPACE_NLA) {
601 /* Hide properties that are not supported in some spaces. */
602 return false;
603 }
604
605 PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "use_proportional_edit");
606 if ((prop_pet != prop) && (RNA_property_boolean_get(op->ptr, prop_pet) == false)) {
607 /* If "use_proportional_edit" is false, hide:
608 * - "proportional_edit_falloff",
609 * - "proportional_size",
610 * - "use_proportional_connected",
611 * - "use_proportional_projected". */
612 return false;
613 }
614 return true;
615 }
616
617 /* Snapping. */
618 if (STREQ(prop_id, "use_snap_project")) {
619 return RNA_boolean_get(op->ptr, "snap");
620 }
621
622 if (STREQ(prop_id, "use_even_offset")) {
623 /* Even offset isn't meaningful for individual faces. */
624 if (op->opm && STREQ(op->opm->idname, "MESH_OT_extrude_faces_move")) {
625 return false;
626 }
627 return true;
628 }
629
630 /* #P_CORRECT_UV. */
631 if (STREQ(prop_id, "correct_uv")) {
632 ScrArea *area = CTX_wm_area(C);
633 return area->spacetype == SPACE_VIEW3D;
634 }
635
636 return true;
637}
638
640{
641 PropertyRNA *prop;
642
643 if (flags & P_ORIENT_AXIS) {
644 prop = RNA_def_property(ot->srna, "orient_axis", PROP_ENUM, PROP_NONE);
645 RNA_def_property_ui_text(prop, "Axis", "");
649 }
650 if (flags & P_ORIENT_AXIS_ORTHO) {
651 prop = RNA_def_property(ot->srna, "orient_axis_ortho", PROP_ENUM, PROP_NONE);
652 RNA_def_property_ui_text(prop, "Axis Ortho", "");
656 }
657
658 if (flags & P_ORIENT_MATRIX) {
659 prop = RNA_def_property(ot->srna, "orient_type", PROP_ENUM, PROP_NONE);
660 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
662
663 /* Set by 'orient_type' or gizmo which acts on non-standard orientation. */
665 ot->srna, "orient_matrix", 3, 3, nullptr, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f);
667
668 /* Only use 'orient_matrix' when 'orient_matrix_type == orient_type',
669 * this allows us to reuse the orientation set by a gizmo for eg, without disabling the ability
670 * to switch over to other orientations. */
671 prop = RNA_def_property(ot->srna, "orient_matrix_type", PROP_ENUM, PROP_NONE);
672 RNA_def_property_ui_text(prop, "Matrix Orientation", "");
675 }
676
677 if (flags & P_CONSTRAINT) {
678 RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, nullptr, "Constraint Axis", "");
679 }
680
681 if (flags & P_MIRROR) {
682 prop = RNA_def_boolean(ot->srna, "mirror", false, "Mirror Editing", "");
683 if ((flags & P_MIRROR_DUMMY) == P_MIRROR_DUMMY) {
684 /* Only used so macros can disable this option. */
686 }
687 }
688
689 if (flags & P_PROPORTIONAL) {
690 RNA_def_boolean(ot->srna, "use_proportional_edit", false, "Proportional Editing", "");
691 prop = RNA_def_enum(ot->srna,
692 "proportional_edit_falloff",
694 0,
695 "Proportional Falloff",
696 "Falloff type for proportional editing mode");
697 /* Abusing id_curve :/ */
700 "proportional_size",
701 1,
704 "Proportional Size",
705 "",
706 0.001f,
707 100.0f);
708
709 RNA_def_boolean(ot->srna, "use_proportional_connected", false, "Connected", "");
710 RNA_def_boolean(ot->srna, "use_proportional_projected", false, "Projected (2D)", "");
711 }
712
713 if (flags & P_SNAP) {
714 prop = RNA_def_boolean(ot->srna, "snap", false, "Use Snapping Options", "");
716
717 if ((flags & P_GEO_SNAP) == P_GEO_SNAP) {
718 prop = RNA_def_enum_flag(ot->srna,
719 "snap_elements",
722 "Snap to Elements",
723 "");
725
726 RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual Elements", "");
727
728 /* TODO(@gfxcoder): Rename `snap_target` to `snap_base` to avoid previous ambiguity of
729 * "target" (now, "base" or "source" is geometry to be moved and "target" is geometry to
730 * which moved geometry is snapped). */
731 prop = RNA_def_enum(ot->srna,
732 "snap_target",
734 0,
735 "Snap Base",
736 "Point on source that will snap to target");
738
739 /* Target selection. */
740 prop = RNA_def_boolean(ot->srna, "use_snap_self", true, "Target: Include Active", "");
742 prop = RNA_def_boolean(ot->srna, "use_snap_edit", true, "Target: Include Edit", "");
744 prop = RNA_def_boolean(ot->srna, "use_snap_nonedit", true, "Target: Include Non-Edited", "");
746 prop = RNA_def_boolean(
747 ot->srna, "use_snap_selectable", false, "Target: Exclude Non-Selectable", "");
749
751 ot->srna, "snap_point", 3, nullptr, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
753
754 if ((flags & P_ALIGN_SNAP) == P_ALIGN_SNAP) {
755 prop = RNA_def_boolean(ot->srna, "snap_align", false, "Align with Point Normal", "");
757 prop = RNA_def_float_vector(ot->srna,
758 "snap_normal",
759 3,
760 nullptr,
761 -FLT_MAX,
762 FLT_MAX,
763 "Normal",
764 "",
765 -FLT_MAX,
766 FLT_MAX);
768 }
769 }
770 }
771
772 if (flags & P_GPENCIL_EDIT) {
773 prop = RNA_def_boolean(ot->srna,
774 "gpencil_strokes",
775 false,
776 "Edit Grease Pencil",
777 "Edit selected Grease Pencil strokes");
779 }
780
781 if (flags & P_CURSOR_EDIT) {
782 prop = RNA_def_boolean(ot->srna, "cursor_transform", false, "Transform Cursor", "");
784 }
785
786 if ((flags & P_OPTIONS) && !(flags & P_NO_TEXSPACE)) {
787 prop = RNA_def_boolean(
788 ot->srna, "texture_space", false, "Edit Texture Space", "Edit object data texture space");
790 prop = RNA_def_boolean(
791 ot->srna, "remove_on_cancel", false, "Remove on Cancel", "Remove elements on cancel");
793 prop = RNA_def_boolean(ot->srna,
794 "use_duplicated_keyframes",
795 false,
796 "Duplicated Keyframes",
797 "Transform duplicated keyframes");
799 }
800
801 if (flags & P_CORRECT_UV) {
803 ot->srna, "correct_uv", true, "Correct UVs", "Correct UV coordinates when transforming");
804 }
805
806 if (flags & P_CENTER) {
807 /* For gizmos that define their own center. */
808 prop = RNA_def_property(ot->srna, "center_override", PROP_FLOAT, PROP_XYZ);
809 RNA_def_property_array(prop, 3);
811 RNA_def_property_ui_text(prop, "Center Override", "Force using this center value (when set)");
812 }
813
814 if (flags & P_VIEW2D_EDGE_PAN) {
815 prop = RNA_def_boolean(
816 ot->srna, "view2d_edge_pan", false, "Edge Pan", "Enable edge panning in 2D view");
818 }
819
820 if ((flags & P_NO_DEFAULTS) == 0) {
821 prop = RNA_def_boolean(ot->srna,
822 "release_confirm",
823 false,
824 "Confirm on Release",
825 "Always confirm operation when releasing button");
827
828 prop = RNA_def_boolean(
829 ot->srna, "use_accurate", false, "Accurate", "Use accurate transformation");
831 }
832
833 if (flags & P_POST_TRANSFORM) {
834 prop = RNA_def_boolean(ot->srna,
835 "use_automerge_and_split",
836 false,
837 "Auto Merge & Split",
838 "Forces the use of Auto Merge and Split");
840 }
841
842 if (flags & P_TRANSLATE_ORIGIN) {
843 prop = RNA_def_boolean(ot->srna,
844 "translate_origin",
845 false,
846 "Translate Origin",
847 "Translate origin instead of selection");
849 }
850}
851
853{
854 /* Identifiers. */
855 ot->name = "Move";
856 ot->description = "Move selected items";
859
860 /* API callbacks. */
862 ot->exec = transform_exec;
867
869 ot->srna, "value", 3, nullptr, -FLT_MAX, FLT_MAX, "Move", "", -FLT_MAX, FLT_MAX);
870
872
877}
878
880{
881 /* Identifiers. */
882 ot->name = "Resize";
883 ot->description = "Scale (resize) selected items";
884 ot->idname = OP_RESIZE;
886
887 /* API callbacks. */
889 ot->exec = transform_exec;
894
896 ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Scale", "", -FLT_MAX, FLT_MAX);
897
898 PropertyRNA *prop;
899 prop = RNA_def_float_vector(ot->srna,
900 "mouse_dir_constraint",
901 3,
902 VecZero,
903 -FLT_MAX,
904 FLT_MAX,
905 "Mouse Directional Constraint",
906 "",
907 -FLT_MAX,
908 FLT_MAX);
910
912
916}
917
919{
920 /* Identifiers. */
921 ot->name = "Skin Resize";
922 ot->description = "Scale selected vertices' skin radii";
925
926 /* API callbacks. */
928 ot->exec = transform_exec;
933
935 ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Scale", "", -FLT_MAX, FLT_MAX);
936
938
942}
943
945{
946 /* Identifiers. */
947 ot->name = "Trackball";
948 ot->description = "Trackball style rotation of selected items";
949 ot->idname = OP_TRACKBALL;
951
952 /* API callbacks. */
954 ot->exec = transform_exec;
959
960 /* Maybe we could use float_vector_xyz here too? */
962 ot->srna, "value", 2, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
963
965
967}
968
970{
971 /* Identifiers. */
972 ot->name = "Rotate";
973 ot->description = "Rotate selected items";
974 ot->idname = OP_ROTATION;
976
977 /* API callbacks. */
979 ot->exec = transform_exec;
984
986 ot->srna, "value", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
987
989
993}
994
995static bool tilt_poll(bContext *C)
996{
997 Object *obedit = CTX_data_edit_object(C);
998 if (!obedit) {
999 return false;
1000 }
1001 if (obedit->type == OB_CURVES_LEGACY) {
1002 Curve *cu = id_cast<Curve *>(obedit->data);
1003 return (cu->flag & CU_3D) && (nullptr != cu->editnurb);
1004 }
1005 if (obedit->type == OB_CURVES) {
1006 return true;
1007 }
1008 return true;
1009}
1010
1012{
1013 /* Identifiers. */
1014 ot->name = "Tilt";
1015 /* Optional -
1016 * "Tilt selected vertices"
1017 * "Specify an extra axis rotation for selected vertices of 3D curve". */
1018 ot->description = "Tilt selected control vertices of 3D curve";
1019 ot->idname = OP_TILT;
1021
1022 /* API callbacks. */
1024 ot->exec = transform_exec;
1025 ot->modal = transform_modal;
1027 ot->poll = tilt_poll;
1029
1031 ot->srna, "value", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1032
1034
1036}
1037
1039{
1040 /* Identifiers. */
1041 ot->name = "Bend";
1042 ot->description = "Bend selected items between the 3D cursor and the mouse";
1043 ot->idname = OP_BEND;
1044 /* Depend on cursor location because the cursor location is used to define the region to bend. */
1046
1047 /* API callbacks. */
1049 // ot->exec = transform_exec; /* Unsupported. */
1050 ot->modal = transform_modal;
1054
1056 ot->srna, "value", 1, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1057
1059
1061}
1062
1064{
1066 return false;
1067 }
1068
1069 ScrArea *area = CTX_wm_area(C);
1070 return area && !ELEM(area->spacetype, SPACE_ACTION);
1071}
1072
1074{
1075 /* Identifiers. */
1076 ot->name = "Shear";
1077 ot->description = "Shear selected items along the given axis";
1078 ot->idname = OP_SHEAR;
1080
1081 /* API callbacks. */
1083 ot->exec = transform_exec;
1084 ot->modal = transform_modal;
1088
1090 ot->srna, "angle", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1091
1093
1097}
1098
1100{
1101 /* Identifiers. */
1102 ot->name = "Push/Pull";
1103 ot->description = "Push/Pull selected items";
1104 ot->idname = OP_PUSH_PULL;
1106
1107 /* API callbacks. */
1109 ot->exec = transform_exec;
1110 ot->modal = transform_modal;
1114
1115 RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX);
1116
1118
1120}
1121
1123{
1124 /* Identifiers. */
1125 ot->name = "Shrink/Fatten";
1126 ot->description = "Shrink/fatten selected vertices along normals";
1129
1130 /* API callbacks. */
1132 ot->exec = transform_exec;
1133 ot->modal = transform_modal;
1137
1138 RNA_def_float_distance(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
1139
1141 "use_even_offset",
1142 false,
1143 "Offset Even",
1144 "Scale the offset to give more even thickness");
1145
1147
1149}
1150
1152{
1153 /* Identifiers. */
1154 ot->name = "To Sphere";
1155 ot->description = "Move selected items outward in a spherical shape around geometric center";
1156 ot->idname = OP_TOSPHERE;
1158
1159 /* API callbacks. */
1161 ot->exec = transform_exec;
1162 ot->modal = transform_modal;
1166
1167 RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1);
1168
1170
1172}
1173
1175{
1176 /* Identifiers. */
1177 ot->name = "Mirror";
1178 ot->description = "Mirror selected items around one or more axes";
1179 ot->idname = OP_MIRROR;
1181
1182 /* API callbacks. */
1184 ot->exec = transform_exec;
1185 ot->modal = transform_modal;
1189
1191}
1192
1194{
1195 /* Identifiers. */
1196 ot->name = "Scale B-Bone";
1197 ot->description = "Scale selected bendy bones display size";
1198 ot->idname = OP_BONE_SIZE;
1200
1201 /* API callbacks. */
1203 ot->exec = transform_exec;
1204 ot->modal = transform_modal;
1208
1210 ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Display Size", "", -FLT_MAX, FLT_MAX);
1211
1213
1215}
1216
1218{
1219 PropertyRNA *prop;
1220
1221 /* Identifiers. */
1222 ot->name = "Edge Slide";
1223 ot->description = "Slide an edge loop along a mesh";
1224 ot->idname = OP_EDGE_SLIDE;
1226
1227 /* API callbacks. */
1229 ot->exec = transform_exec;
1230 ot->modal = transform_modal;
1234
1235 RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f);
1236
1237 prop = RNA_def_boolean(ot->srna, "single_side", false, "Single Side", "");
1240 "use_even",
1241 false,
1242 "Even",
1243 "Make the edge loop match the shape of the adjacent edge loop");
1244
1246
1248 "flipped",
1249 false,
1250 "Flipped",
1251 "When Even mode is active, flips between the two adjacent edge loops");
1252 RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
1253
1255}
1256
1258{
1259 /* Identifiers. */
1260 ot->name = "Vertex Slide";
1261 ot->description = "Slide a vertex along a mesh";
1262 ot->idname = OP_VERT_SLIDE;
1264
1265 /* API callbacks. */
1267 ot->exec = transform_exec;
1268 ot->modal = transform_modal;
1272
1273 PropertyRNA *prop;
1274 RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f);
1276 "use_even",
1277 false,
1278 "Even",
1279 "Make the edge loop match the shape of the adjacent edge loop");
1280
1282
1284 "flipped",
1285 false,
1286 "Flipped",
1287 "When Even mode is active, flips between the two adjacent edge loops");
1288 RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
1289 /* The direction is only needed to support "redo", see: #147956. */
1290 prop = RNA_def_float_vector(ot->srna,
1291 "direction",
1292 3,
1293 nullptr,
1294 -FLT_MAX,
1295 FLT_MAX,
1296 "Slide Direction",
1297 "World-space direction",
1298 -FLT_MAX,
1299 FLT_MAX);
1301
1303}
1304
1306{
1307 /* Identifiers. */
1308 ot->name = "Edge Crease";
1309 ot->description = "Change the crease of edges";
1310 ot->idname = OP_EDGE_CREASE;
1312
1313 /* API callbacks. */
1315 ot->exec = transform_exec;
1316 ot->modal = transform_modal;
1320
1321 RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
1322
1324
1326}
1327
1329{
1330 /* Identifiers. */
1331 ot->name = "Vertex Crease";
1332 ot->description = "Change the crease of vertices";
1333 ot->idname = OP_VERT_CREASE;
1335
1336 /* API callbacks. */
1338 ot->exec = transform_exec;
1339 ot->modal = transform_modal;
1343
1344 RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
1345
1347
1349}
1350
1352{
1353 /* Identifiers. */
1354 ot->name = "Edge Bevel Weight";
1355 ot->description = "Change the bevel weight of edges";
1356 ot->idname = OP_EDGE_BWEIGHT;
1358
1359 /* API callbacks. */
1361 ot->exec = transform_exec;
1362 ot->modal = transform_modal;
1365
1366 RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
1367
1369
1371}
1372
1373static bool seq_slide_poll_property(const bContext * /*C*/,
1374 wmOperator *op,
1375 const PropertyRNA *prop)
1376{
1377 const char *prop_id = RNA_property_identifier(prop);
1378 if (STR_ELEM(prop_id, "all_channels", "markers", "insert")) {
1379 return RNA_enum_get(op->ptr, "overlap_mode") == SEQ_OVERLAP_RIPPLE;
1380 }
1381 return true;
1382}
1383
1385{
1386 /* Identifiers. */
1387 ot->name = "Sequence Slide";
1388 ot->description = "Slide a sequence strip in time";
1389 ot->idname = OP_SEQ_SLIDE;
1391
1392 /* API callbacks. */
1394 ot->exec = transform_exec;
1395 ot->modal = transform_modal;
1399
1400 /* Properties. */
1401 PropertyRNA *prop;
1402
1403 prop = RNA_def_float_vector(
1404 ot->srna, "value", 2, nullptr, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
1405 RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 100, 0);
1406
1407 prop = RNA_def_boolean(ot->srna,
1408 "use_restore_handle_selection",
1409 false,
1410 "Restore Handle Selection",
1411 "Restore handle selection after tweaking");
1413
1414 prop = RNA_def_enum(ot->srna,
1415 "overlap_mode",
1418 "Overlap Mode",
1419 "How to resolve overlap after transformation");
1421
1424
1426
1428}
1429
1431{
1432 /* Identifiers. */
1433 ot->name = "Rotate Normals";
1434 ot->description = "Rotate custom normal of selected items";
1437
1438 /* API callbacks. */
1440 ot->exec = transform_exec;
1441 ot->modal = transform_modal;
1445
1447 ot->srna, "value", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1448
1450}
1451
1453{
1454 PropertyRNA *prop;
1455
1456 /* Identifiers. */
1457 ot->name = "Transform";
1458 ot->description = "Transform selected items by mode type";
1459 ot->idname = "TRANSFORM_OT_transform";
1461
1462 /* API callbacks. */
1464 ot->exec = transform_exec;
1465 ot->modal = transform_modal;
1469
1470 prop = RNA_def_enum(
1471 ot->srna, "mode", rna_enum_transform_mode_type_items, TFM_TRANSLATION, "Mode", "");
1473
1475 ot->srna, "value", 4, nullptr, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);
1476
1478
1482}
1483
1485 wmOperator * /*op*/,
1486 const wmEvent *event)
1487{
1489 if (tref) {
1490 ARegion *region = CTX_wm_region(C);
1491 wmGizmoMap *gzmap = region->runtime->gizmo_map;
1492 wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_xform_gizmo") :
1493 nullptr;
1494 if (gzgroup != nullptr) {
1495 PointerRNA gzg_ptr;
1497 const int drag_action = RNA_enum_get(&gzg_ptr, "drag_action");
1498 const char *op_id = nullptr;
1499 switch (drag_action) {
1501 op_id = "TRANSFORM_OT_translate";
1502 break;
1504 op_id = "TRANSFORM_OT_rotate";
1505 break;
1507 op_id = "TRANSFORM_OT_resize";
1508 break;
1509 default:
1510 break;
1511 }
1512 if (op_id) {
1513 wmOperatorType *ot = WM_operatortype_find(op_id, true);
1515 RNA_boolean_set(&op_ptr, "release_confirm", true);
1518 return OPERATOR_FINISHED;
1519 }
1520 }
1521 }
1522 return OPERATOR_PASS_THROUGH;
1523}
1524
1525/* Use with 'TRANSFORM_GGT_gizmo'. */
1527{
1528 /* Identifiers. */
1529 ot->name = "Transform from Gizmo";
1530 ot->description = "Transform selected items by mode type";
1531 ot->idname = "TRANSFORM_OT_from_gizmo";
1532 ot->flag = 0;
1533
1534 /* API callbacks. */
1537}
1538
1555
1557{
1558 wmKeyMap *modalmap = transform_modal_keymap(keyconf);
1559
1560 TransformModeItem *tmode;
1561
1562 for (tmode = transform_modes; tmode->idname; tmode++) {
1563 WM_modalkeymap_assign(modalmap, tmode->idname);
1564 }
1565 WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform");
1566}
1567
1568} // namespace ed::transform
1569} // namespace blender
#define M_PI
#define STR_ELEM(...)
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define IFACE_(msgid)
#define MAX_NAME
Definition DNA_defs.h:63
Object is a sort of wrapper for general info.
#define P_PROPORTIONAL
#define P_CURSOR_EDIT
#define P_CENTER
#define P_ALIGN_SNAP
#define P_NO_DEFAULTS
#define P_POST_TRANSFORM
#define P_VIEW2D_EDGE_PAN
#define P_CORRECT_UV
#define P_TRANSLATE_ORIGIN
#define P_ORIENT_MATRIX
#define P_ORIENT_AXIS_ORTHO
#define P_NO_TEXSPACE
#define P_MIRROR
#define P_CONSTRAINT
#define P_SNAP
#define P_GEO_SNAP
#define P_GPENCIL_EDIT
#define P_ORIENT_AXIS
#define P_MIRROR_DUMMY
#define P_OPTIONS
Read Blender memory allocation and freeing.
#define C
Definition RandGen.cpp:29
#define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr)
#define NC_SCENE
Definition WM_types.hh:391
#define ND_TOOLSETTINGS
Definition WM_types.hh:468
#define NA_EDITED
Definition WM_types.hh:634
#define ND_TRANSFORM
Definition WM_types.hh:475
#define ND_SPACE_VIEW3D
Definition WM_types.hh:571
#define NC_OBJECT
Definition WM_types.hh:392
#define NC_SPACE
Definition WM_types.hh:405
#define STRPREFIX(a, b)
#define ELEM(...)
#define STREQ(a, b)
#define FLT_MAX
static const char OP_SEQ_SLIDE[]
void transformApply(bContext *C, TransInfo *t)
static void TRANSFORM_OT_select_orientation(wmOperatorType *ot)
static void TRANSFORM_OT_rotate_normal(wmOperatorType *ot)
void properties_register(wmOperatorType *ot, int flags)
static void TRANSFORM_OT_seq_slide(wmOperatorType *ot)
wmKeyMap * transform_modal_keymap(wmKeyConfig *keyconf)
static void TRANSFORM_OT_shrink_fatten(wmOperatorType *ot)
static int transformops_mode(wmOperator *op)
static void TRANSFORM_OT_translate(wmOperatorType *ot)
static const char OP_NORMAL_ROTATION[]
static const char OP_VERT_CREASE[]
static const char OP_BEND[]
static wmOperatorStatus delete_orientation_invoke(bContext *C, wmOperator *op, const wmEvent *)
static void TRANSFORM_OT_rotate(wmOperatorType *ot)
static void TRANSFORM_OT_skin_resize(wmOperatorType *ot)
static void TRANSFORM_OT_shear(wmOperatorType *ot)
static void transformops_exit(bContext *C, wmOperator *op)
static void TRANSFORM_OT_bbone_resize(wmOperatorType *ot)
static bool transform_shear_poll(bContext *C)
static const char OP_TILT[]
static const char OP_BONE_SIZE[]
static const char OP_EDGE_BWEIGHT[]
static wmOperatorStatus delete_orientation_exec(bContext *C, wmOperator *)
static void TRANSFORM_OT_delete_orientation(wmOperatorType *ot)
static wmOperatorStatus select_orientation_exec(bContext *C, wmOperator *op)
static void TRANSFORM_OT_trackball(wmOperatorType *ot)
void transform_input_virtual_mval_reset(TransInfo *t)
static void TRANSFORM_OT_tosphere(wmOperatorType *ot)
bool BIF_createTransformOrientation(bContext *C, ReportList *reports, const char *name, bool use_view, bool activate, bool overwrite)
static const float VecOne[3]
static const float VecZero[3]
static const char OP_PUSH_PULL[]
static const char OP_EDGE_SLIDE[]
void BIF_removeTransformOrientationIndex(bContext *C, int index)
static const char OP_SHRINK_FATTEN[]
static void TRANSFORM_OT_vert_slide(wmOperatorType *ot)
static const char OP_TRACKBALL[]
static void TRANSFORM_OT_resize(wmOperatorType *ot)
static void TRANSFORM_OT_transform(wmOperatorType *ot)
void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
static const char OP_EDGE_CREASE[]
static const char OP_ROTATION[]
static const char OP_SKIN_RESIZE[]
static bool seq_slide_poll_property(const bContext *, wmOperator *op, const PropertyRNA *prop)
static wmOperatorStatus transform_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void TRANSFORM_OT_edge_crease(wmOperatorType *ot)
static const char OP_RESIZE[]
static const char OP_VERT_SLIDE[]
static wmOperatorStatus transform_from_gizmo_invoke(bContext *C, wmOperator *, const wmEvent *event)
static bool tilt_poll(bContext *C)
void applyMouseInput(TransInfo *t, MouseInput *mi, const float2 &mval, float output[3])
static const char OP_MIRROR[]
static void TRANSFORM_OT_vert_crease(wmOperatorType *ot)
void transformViewUpdate(TransInfo *t)
wmOperatorStatus transformEvent(TransInfo *t, wmOperator *op, const wmEvent *event)
static void TRANSFORM_OT_create_orientation(wmOperatorType *ot)
static wmOperatorStatus create_orientation_exec(bContext *C, wmOperator *op)
static const char OP_TOSPHERE[]
void keymap_transform(wmKeyConfig *keyconf)
static const char OP_TRANSLATION[]
static void TRANSFORM_OT_push_pull(wmOperatorType *ot)
static void transform_cancel(bContext *C, wmOperator *op)
static void transformops_loopsel_hack(bContext *C, wmOperator *op)
static void TRANSFORM_OT_tilt(wmOperatorType *ot)
static void TRANSFORM_OT_edge_bevelweight(wmOperatorType *ot)
wmOperatorStatus transformEnd(bContext *C, TransInfo *t)
bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event, int mode)
static wmOperatorStatus select_orientation_invoke(bContext *C, wmOperator *, const wmEvent *)
static TransformModeItem transform_modes[]
static void TRANSFORM_OT_edge_slide(wmOperatorType *ot)
static wmOperatorStatus transform_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void TRANSFORM_OT_from_gizmo(wmOperatorType *ot)
static void TRANSFORM_OT_bend(wmOperatorType *ot)
static const char OP_SHEAR[]
static void TRANSFORM_OT_mirror(wmOperatorType *ot)
int special_transform_moving(TransInfo *t)
static bool transform_poll_property(const bContext *C, wmOperator *op, const PropertyRNA *prop)
static int transformops_data(bContext *C, wmOperator *op, const wmEvent *event)
static bool delete_orientation_poll(bContext *C)
static wmOperatorStatus transform_exec(bContext *C, wmOperator *op)
void operator_properties_ripple(wmOperatorType *ot, eSeqRippleFlag options)
PopupMenu * popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
Layout * popup_menu_layout(PopupMenu *pup)
BMesh Iterators.
wmKeyMap * WM_keymap_active(const wmWindowManager *wm, wmKeyMap *keymap)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
ScrArea * CTX_wm_area(const bContext *C)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
const EnumPropertyItem rna_enum_snap_source_items[]
Definition rna_scene.cc:94
@ V3D_GIZMO_SHOW_OBJECT_TRANSLATE
@ V3D_GIZMO_SHOW_OBJECT_SCALE
@ V3D_GIZMO_SHOW_OBJECT_ROTATE
void WM_operator_properties_free(PointerRNA *ptr)
const char * RNA_property_identifier(const PropertyRNA *prop)
void WM_operator_type_set(wmOperator *op, wmOperatorType *ot)
Definition wm.cc:323
void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values)
PropertyRNA * RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const bool *default_value, const char *ui_name, const char *ui_description)
bool ED_operator_areaactive(bContext *C)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PointerRNA WM_operator_properties_create_ptr(wmOperatorType *ot)
PropertyRNA * RNA_def_float_translation(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
bool ED_view3d_navigation_do(bContext *C, ViewOpsData *vod, const wmEvent *event, const float depth_loc_override[3])
bool EDBM_selectmode_set_multi(bContext *C, short selectmode)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
MINLINE bool is_zero_v4(const float v[4]) ATTR_WARN_UNUSED_RESULT
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
Global G
Definition blender.cc:57
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
bool ED_operator_editmesh(bContext *C)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
VecBase< float, 2 > float2
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
wmWindowManager * CTX_wm_manager(const bContext *C)
bool ED_operator_object_active_only_from_view_layer(bContext *C)
Object * CTX_data_edit_object(const bContext *C)
bool ED_operator_regionactive(bContext *C)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool ED_operator_view3d_active(bContext *C)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
const EnumPropertyItem * rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
@ SEQ_RIPPLE_ALL_CHANNELS
const EnumPropertyItem rna_enum_transform_mode_type_items[]
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
bToolRef * WM_toolsystem_ref_from_context(const bContext *C)
void BKE_scene_orientation_slot_set_index(TransformOrientationSlot *orient_slot, int orientation)
Definition scene.cc:2664
PropertyRNA * RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
bool ED_operator_active_screen_and_scene(bContext *C)
const EnumPropertyItem rna_enum_snap_element_items[]
Definition rna_scene.cc:163
void WM_operatortype_props_advanced_begin(wmOperatorType *ot)
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
@ PROP_SKIP_SAVE
Definition RNA_types.hh:414
@ PROP_HIDDEN
Definition RNA_types.hh:408
bool ED_operator_region_view3d_active(bContext *C)
PropertyRNA * RNA_def_float_distance(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
PropertyRNA * RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
const EnumPropertyItem rna_enum_strip_overlap_mode_items[]
Scene * CTX_data_scene(const bContext *C)
@ OPTYPE_REGISTER
Definition WM_types.hh:188
@ OPTYPE_UNDO
Definition WM_types.hh:190
@ OPTYPE_BLOCKING
Definition WM_types.hh:192
@ OPTYPE_DEPENDS_ON_CURSOR
Definition WM_types.hh:228
std::string RNA_string_get(PointerRNA *ptr, const char *name)
bool ED_operator_sequencer_active(bContext *C)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identifier, const int rows, const int columns, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
void RNA_def_property_array(PropertyRNA *prop, int length)
ARegion * CTX_wm_region(const bContext *C)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
const EnumPropertyItem rna_enum_proportional_falloff_items[]
Definition rna_scene.cc:102
View3D * CTX_wm_view3d(const bContext *C)
bool ED_operator_screenactive(bContext *C)
const EnumPropertyItem rna_enum_axis_xyz_items[]
bke::ARegionRuntime * runtime
EditNurb * editnurb
eRegionView3D_Flag rflag
TransformOrientationSlot orientation_slots[4]
struct ToolSettings * toolsettings
void op_enum(StringRefNull opname, StringRefNull propname, IDProperty *properties, wm::OpCallContext context, eUI_Item_Flag flag, const int active=-1)
wmEventType type
Definition WM_types.hh:817
wmGizmoGroupType * type
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1125
bool(*) poll_property(const bContext *C, wmOperator *op, const PropertyRNA *prop) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1171
const char * description
Definition WM_types.hh:1115
void(*) cancel(bContext *C, wmOperator *op)
Definition WM_types.hh:1149
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1165
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1141
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1157
struct ReportList * reports
struct wmOperatorType * type
#define T_PROP_SIZE_MIN
Definition transform.hh:37
#define T_PROP_SIZE_MAX
Definition transform.hh:38
conversion and adaptation of different datablocks to a common struct.
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)