Blender V4.5
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.h"
16#include "BLI_utildefines.h"
17
18#include "BLT_translation.hh"
19
20#include "BKE_context.hh"
21#include "BKE_global.hh"
22#include "BKE_report.hh"
23#include "BKE_scene.hh"
24#include "BKE_screen.hh"
25
26#include "RNA_access.hh"
27#include "RNA_define.hh"
28#include "RNA_enum_types.hh"
29
30#include "WM_api.hh"
31#include "WM_message.hh"
32#include "WM_toolsystem.hh"
33#include "WM_types.hh"
34
35#include "UI_interface.hh"
36#include "UI_resources.hh"
37
38#include "ED_screen.hh"
40#include "ED_mesh.hh"
41
42#include "transform.hh"
43#include "transform_convert.hh"
44
45namespace blender::ed::transform {
46
48 const char *idname;
49 int mode;
51};
52
53static const float VecZero[3] = {0, 0, 0};
54static const float VecOne[3] = {1, 1, 1};
55
56static const char OP_TRANSLATION[] = "TRANSFORM_OT_translate";
57static const char OP_ROTATION[] = "TRANSFORM_OT_rotate";
58static const char OP_TOSPHERE[] = "TRANSFORM_OT_tosphere";
59static const char OP_RESIZE[] = "TRANSFORM_OT_resize";
60static const char OP_SKIN_RESIZE[] = "TRANSFORM_OT_skin_resize";
61static const char OP_SHEAR[] = "TRANSFORM_OT_shear";
62static const char OP_BEND[] = "TRANSFORM_OT_bend";
63static const char OP_SHRINK_FATTEN[] = "TRANSFORM_OT_shrink_fatten";
64static const char OP_PUSH_PULL[] = "TRANSFORM_OT_push_pull";
65static const char OP_TILT[] = "TRANSFORM_OT_tilt";
66static const char OP_TRACKBALL[] = "TRANSFORM_OT_trackball";
67static const char OP_MIRROR[] = "TRANSFORM_OT_mirror";
68static const char OP_BONE_SIZE[] = "TRANSFORM_OT_bbone_resize";
69static const char OP_EDGE_SLIDE[] = "TRANSFORM_OT_edge_slide";
70static const char OP_VERT_SLIDE[] = "TRANSFORM_OT_vert_slide";
71static const char OP_EDGE_CREASE[] = "TRANSFORM_OT_edge_crease";
72static const char OP_VERT_CREASE[] = "TRANSFORM_OT_vert_crease";
73static const char OP_EDGE_BWEIGHT[] = "TRANSFORM_OT_edge_bevelweight";
74static const char OP_SEQ_SLIDE[] = "TRANSFORM_OT_seq_slide";
75static const char OP_NORMAL_ROTATION[] = "TRANSFORM_OT_rotate_normal";
76
97
121
122} // namespace blender::ed::transform
123
125 {blender::ed::transform::TFM_INIT, "INIT", 0, "Init", ""},
126 {blender::ed::transform::TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
127 {blender::ed::transform::TFM_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
128 {blender::ed::transform::TFM_ROTATION, "ROTATION", 0, "Rotation", ""},
129 {blender::ed::transform::TFM_RESIZE, "RESIZE", 0, "Resize", ""},
130 {blender::ed::transform::TFM_SKIN_RESIZE, "SKIN_RESIZE", 0, "Skin Resize", ""},
131 {blender::ed::transform::TFM_TOSPHERE, "TOSPHERE", 0, "To Sphere", ""},
132 {blender::ed::transform::TFM_SHEAR, "SHEAR", 0, "Shear", ""},
133 {blender::ed::transform::TFM_BEND, "BEND", 0, "Bend", ""},
134 {blender::ed::transform::TFM_SHRINKFATTEN, "SHRINKFATTEN", 0, "Shrink/Fatten", ""},
135 {blender::ed::transform::TFM_TILT, "TILT", 0, "Tilt", ""},
136 {blender::ed::transform::TFM_TRACKBALL, "TRACKBALL", 0, "Trackball", ""},
137 {blender::ed::transform::TFM_PUSHPULL, "PUSHPULL", 0, "Push/Pull", ""},
138 {blender::ed::transform::TFM_EDGE_CREASE, "CREASE", 0, "Crease", ""},
139 {blender::ed::transform::TFM_VERT_CREASE, "VERTEX_CREASE", 0, "Vertex Crease", ""},
140 {blender::ed::transform::TFM_MIRROR, "MIRROR", 0, "Mirror", ""},
141 {blender::ed::transform::TFM_BONESIZE, "BONE_SIZE", 0, "Bone Size", ""},
142 {blender::ed::transform::TFM_BONE_ENVELOPE, "BONE_ENVELOPE", 0, "Bone Envelope", ""},
144 "BONE_ENVELOPE_DIST",
145 0,
146 "Bone Envelope Distance",
147 ""},
149 "CURVE_SHRINKFATTEN",
150 0,
151 "Curve Shrink/Fatten",
152 ""},
154 "MASK_SHRINKFATTEN",
155 0,
156 "Mask Shrink/Fatten",
157 ""},
158 {blender::ed::transform::TFM_BONE_ROLL, "BONE_ROLL", 0, "Bone Roll", ""},
159 {blender::ed::transform::TFM_TIME_TRANSLATE, "TIME_TRANSLATE", 0, "Time Translate", ""},
160 {blender::ed::transform::TFM_TIME_SLIDE, "TIME_SLIDE", 0, "Time Slide", ""},
161 {blender::ed::transform::TFM_TIME_SCALE, "TIME_SCALE", 0, "Time Scale", ""},
162 {blender::ed::transform::TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time Extend", ""},
163 {blender::ed::transform::TFM_BAKE_TIME, "BAKE_TIME", 0, "Bake Time", ""},
164 {blender::ed::transform::TFM_BWEIGHT, "BWEIGHT", 0, "Bevel Weight", ""},
165 {blender::ed::transform::TFM_ALIGN, "ALIGN", 0, "Align", ""},
166 {blender::ed::transform::TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
167 {blender::ed::transform::TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""},
169 "GPENCIL_OPACITY",
170 0,
171 "Grease Pencil Opacity",
172 ""},
173 {0, nullptr, 0, nullptr, nullptr},
174};
175
176namespace blender::ed::transform {
177
179{
180 Scene *scene = CTX_data_scene(C);
181
182 int orientation = RNA_enum_get(op->ptr, "orientation");
183
185
188
190 WM_msg_publish_rna_prop(mbus, &scene->id, scene, TransformOrientationSlot, type);
191
192 return OPERATOR_FINISHED;
193}
194
196 wmOperator * /*op*/,
197 const wmEvent * /*event*/)
198{
199 uiPopupMenu *pup;
200 uiLayout *layout;
201
202 pup = UI_popup_menu_begin(C, IFACE_("Orientation"), ICON_NONE);
203 layout = UI_popup_menu_layout(pup);
204 uiItemsEnumO(layout, "TRANSFORM_OT_select_orientation", "orientation");
205 UI_popup_menu_end(C, pup);
206
207 return OPERATOR_INTERFACE;
208}
209
211{
212 PropertyRNA *prop;
213
214 /* Identifiers. */
215 ot->name = "Select Orientation";
216 ot->description = "Select transformation orientation";
217 ot->idname = "TRANSFORM_OT_select_orientation";
218 ot->flag = OPTYPE_UNDO;
219
220 /* API callbacks. */
224
225 prop = RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE);
226 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
228}
229
231{
232 Scene *scene = CTX_data_scene(C);
235
237
239 WM_msg_publish_rna_prop(mbus, &scene->id, scene, Scene, transform_orientation_slots);
240
241 return OPERATOR_FINISHED;
242}
243
245 wmOperator *op,
246 const wmEvent * /*event*/)
247{
248 return delete_orientation_exec(C, op);
249}
250
252{
253 if (ED_operator_areaactive(C) == 0) {
254 return false;
255 }
256
257 Scene *scene = CTX_data_scene(C);
260}
261
263{
264 /* Identifiers. */
265 ot->name = "Delete Orientation";
266 ot->description = "Delete transformation orientation";
267 ot->idname = "TRANSFORM_OT_delete_orientation";
268 ot->flag = OPTYPE_UNDO;
269
270 /* API callbacks. */
274}
275
277{
278 char name[MAX_NAME];
279 const bool use = RNA_boolean_get(op->ptr, "use");
280 const bool overwrite = RNA_boolean_get(op->ptr, "overwrite");
281 const bool use_view = RNA_boolean_get(op->ptr, "use_view");
282 View3D *v3d = CTX_wm_view3d(C);
283 Scene *scene = CTX_data_scene(C);
284
285 RNA_string_get(op->ptr, "name", name);
286
287 if (use && !v3d) {
289 RPT_ERROR,
290 "Create Orientation's 'use' parameter only valid in a 3DView context");
291 return OPERATOR_CANCELLED;
292 }
293
294 if (!BIF_createTransformOrientation(C, op->reports, name, use_view, use, overwrite)) {
295 BKE_report(op->reports, RPT_ERROR, "Unable to create orientation");
296 return OPERATOR_CANCELLED;
297 }
298
299 if (use) {
301 WM_msg_publish_rna_prop(mbus, &scene->id, scene, Scene, transform_orientation_slots);
303 }
304
306
307 return OPERATOR_FINISHED;
308}
309
311{
312 /* Identifiers. */
313 ot->name = "Create Orientation";
314 ot->description = "Create transformation orientation from selection";
315 ot->idname = "TRANSFORM_OT_create_orientation";
317
318 /* API callbacks. */
321
323 ot->srna, "name", nullptr, MAX_NAME, "Name", "Name of the new custom orientation");
325 ot->srna,
326 "use_view",
327 false,
328 "Use View",
329 "Use the current view instead of the active object to create the new orientation");
330
332
334 ot->srna, "use", false, "Use After Creation", "Select orientation after its creation");
335 RNA_def_boolean(ot->srna,
336 "overwrite",
337 false,
338 "Overwrite Previous",
339 "Overwrite previously created orientation with same name");
340}
341
342#ifdef USE_LOOPSLIDE_HACK
349{
350 if (op->type->idname == OP_EDGE_SLIDE) {
351 if (op->opm && op->opm->opm && op->opm->opm->prev) {
352 wmOperator *op_prev = op->opm->opm->prev;
353 Scene *scene = CTX_data_scene(C);
354 bool mesh_select_mode[3];
355 PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init");
356
357 if (prop && RNA_property_is_set(op_prev->ptr, prop)) {
358 ToolSettings *ts = scene->toolsettings;
359 short selectmode_orig;
360
361 RNA_property_boolean_get_array(op_prev->ptr, prop, mesh_select_mode);
362 selectmode_orig = ((mesh_select_mode[0] ? SCE_SELECT_VERTEX : 0) |
363 (mesh_select_mode[1] ? SCE_SELECT_EDGE : 0) |
364 (mesh_select_mode[2] ? SCE_SELECT_FACE : 0));
365
366 /* Still switch if we were originally in face select mode. */
367 if ((ts->selectmode != selectmode_orig) && (selectmode_orig != SCE_SELECT_FACE)) {
368 ts->selectmode = selectmode_orig;
369 EDBM_selectmode_set_multi(C, selectmode_orig);
370 }
371 }
372 }
373 }
374}
375#else
376/* Prevent removal by cleanup. */
377# error "loopslide hack removed!"
378#endif /* USE_LOOPSLIDE_HACK */
379
381{
382#ifdef USE_LOOPSLIDE_HACK
384#endif
385
386 TransInfo *t = static_cast<TransInfo *>(op->customdata);
387 saveTransform(C, t, op);
388 MEM_freeN(t);
389 op->customdata = nullptr;
390 G.moving = 0;
391}
392
394{
395 for (TransformModeItem *tmode = transform_modes; tmode->idname; tmode++) {
396 if (op->type->idname == tmode->idname) {
397 return tmode->mode;
398 }
399 }
400
401 return RNA_enum_get(op->ptr, "mode");
402}
403
404static int transformops_data(bContext *C, wmOperator *op, const wmEvent *event)
405{
406 int retval = 1;
407 if (op->customdata == nullptr) {
408 TransInfo *t = MEM_callocN<TransInfo>("TransInfo data2");
409
410 t->undo_name = op->type->name;
411
412 int mode = transformops_mode(op);
413 retval = initTransform(C, t, op, event, mode);
414
415 /* Store data. */
416 if (retval) {
417 G.moving = special_transform_moving(t);
418 op->customdata = t;
419 }
420 else {
421 MEM_freeN(t);
422 }
423 }
424
425 return retval; /* Return 0 on error. */
426}
427
429{
431
432 TransInfo *t = static_cast<TransInfo *>(op->customdata);
433 const eTfmMode mode_prev = t->mode;
434
435#if defined(WITH_INPUT_NDOF) && 0
436 /* Stable 2D mouse coords map to different 3D coords while the 3D mouse is active
437 * in other words, 2D deltas are no longer good enough!
438 * disable until individual 'transformers' behave better. */
439
440 if (event->type == NDOF_MOTION) {
442 }
443#endif
444
445 /* XXX insert keys are called here, and require context. */
446 t->context = C;
447
448 exit_code = transformEvent(t, op, event);
449 t->context = nullptr;
450
451 /* Allow navigation while transforming. */
452 if (t->vod && (exit_code & OPERATOR_PASS_THROUGH)) {
453 RegionView3D *rv3d = static_cast<RegionView3D *>(t->region->regiondata);
454 const bool is_navigating = (rv3d->rflag & RV3D_NAVIGATING) != 0;
455 if (ED_view3d_navigation_do(C, t->vod, event, t->center_global)) {
456 if (!is_navigating) {
457 /* Navigation has started. */
458
459 if (t->modifiers & MOD_PRECISION) {
460 /* WORKAROUND: Remove precision modification, it may have be unintentionally enabled. */
462 t->mouse.precision = false;
464 }
465 }
466
467 if (rv3d->rflag & RV3D_NAVIGATING) {
468 /* Navigation is running. */
469
470 /* Do not update transform while navigating. This can be distracting. */
472 }
473
474 {
475 /* Navigation has ended. */
476
477 /* Call before #applyMouseInput. */
479
480 /* Mouse input is outdated. */
481 t->mval = float2(event->mval);
482 applyMouseInput(t, &t->mouse, t->mval, t->values);
483 t->redraw |= TREDRAW_HARD;
484 }
485 }
486 }
487
488 transformApply(C, t);
489
490 exit_code |= transformEnd(C, t);
491
492 if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) {
493 transformops_exit(C, op);
494 exit_code &= ~OPERATOR_PASS_THROUGH; /* Preventively remove pass-through. */
495 }
496 else {
497 if (mode_prev != t->mode) {
498 /* WARNING: this is not normal to switch operator types
499 * normally it would not be supported but transform happens
500 * to share callbacks between different operators. */
501 wmOperatorType *ot_new = nullptr;
503 while (item->idname) {
504 if (item->mode == t->mode) {
505 ot_new = WM_operatortype_find(item->idname, false);
506 break;
507 }
508 item++;
509 }
510
511 BLI_assert(ot_new != nullptr);
512 if (ot_new) {
513 WM_operator_type_set(op, ot_new);
514 }
515 /* End suspicious code. */
516 }
517 }
518
519 return exit_code;
520}
521
523{
524 TransInfo *t = static_cast<TransInfo *>(op->customdata);
525
526 t->state = TRANS_CANCEL;
527 transformEnd(C, t);
528 transformops_exit(C, op);
529}
530
532{
533 TransInfo *t;
534
535 if (!transformops_data(C, op, nullptr)) {
536 G.moving = 0;
537 return OPERATOR_CANCELLED;
538 }
539
540 t = static_cast<TransInfo *>(op->customdata);
541
543
544 transformApply(C, t);
545
546 transformEnd(C, t);
547
548 transformops_exit(C, op);
549
551
552 return OPERATOR_FINISHED;
553}
554
556{
557 if (!transformops_data(C, op, event)) {
558 G.moving = 0;
559 return OPERATOR_CANCELLED;
560 }
561
562 /* When modal, allow 'value' to set initial offset. */
563 if ((event == nullptr) && RNA_struct_property_is_set(op->ptr, "value")) {
564 return transform_exec(C, op);
565 }
566
567 /* Add temp handler. */
569
570 /* Use when modal input has some transformation to begin with. */
571 TransInfo *t = static_cast<TransInfo *>(op->customdata);
572 if ((t->flag & T_NO_CURSOR_WRAP) == 0) {
573 op->flag |= OP_IS_MODAL_GRAB_CURSOR; /* XXX maybe we want this with the gizmo only? */
574 }
576 transformApply(C, t);
577 }
578
580}
581
582static bool transform_poll_property(const bContext *C, wmOperator *op, const PropertyRNA *prop)
583{
584 const char *prop_id = RNA_property_identifier(prop);
585
586 /* Orientation/Constraints. */
587 if (STRPREFIX(prop_id, "constraint")) {
588 /* Hide orientation axis if no constraints are set, since it won't be used. */
589 PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "orient_type");
590 if (!ELEM(prop_con, nullptr, prop)) {
591
592 /* Special case: show constraint axis if we don't have values,
593 * needed for mirror operator. */
594 if (STREQ(prop_id, "constraint_axis") &&
595 (RNA_struct_find_property(op->ptr, "value") == nullptr))
596 {
597 return true;
598 }
599
600 return false;
601 }
602 return true;
603 }
604
605 /* Orientation Axis. */
606 if (STREQ(prop_id, "orient_axis")) {
608 return mode != TFM_ALIGN;
609 }
610
611 /* Proportional Editing. */
612 if (STRPREFIX(prop_id, "proportional") || STRPREFIX(prop_id, "use_proportional")) {
613 ScrArea *area = CTX_wm_area(C);
614 if (area->spacetype == SPACE_NLA) {
615 /* Hide properties that are not supported in some spaces. */
616 return false;
617 }
618
619 PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "use_proportional_edit");
620 if ((prop_pet != prop) && (RNA_property_boolean_get(op->ptr, prop_pet) == false)) {
621 /* If "use_proportional_edit" is false, hide:
622 * - "proportional_edit_falloff",
623 * - "proportional_size",
624 * - "use_proportional_connected",
625 * - "use_proportional_projected". */
626 return false;
627 }
628 return true;
629 }
630
631 /* Snapping. */
632 if (STREQ(prop_id, "use_snap_project")) {
633 return RNA_boolean_get(op->ptr, "snap");
634 }
635
636 if (STREQ(prop_id, "use_even_offset")) {
637 /* Even offset isn't meaningful for individual faces. */
638 if (op->opm && STREQ(op->opm->idname, "MESH_OT_extrude_faces_move")) {
639 return false;
640 }
641 return true;
642 }
643
644 /* #P_CORRECT_UV. */
645 if (STREQ(prop_id, "correct_uv")) {
646 ScrArea *area = CTX_wm_area(C);
647 return area->spacetype == SPACE_VIEW3D;
648 }
649
650 return true;
651}
652
654{
655 PropertyRNA *prop;
656
657 if (flags & P_ORIENT_AXIS) {
658 prop = RNA_def_property(ot->srna, "orient_axis", PROP_ENUM, PROP_NONE);
659 RNA_def_property_ui_text(prop, "Axis", "");
663 }
664 if (flags & P_ORIENT_AXIS_ORTHO) {
665 prop = RNA_def_property(ot->srna, "orient_axis_ortho", PROP_ENUM, PROP_NONE);
666 RNA_def_property_ui_text(prop, "Axis Ortho", "");
670 }
671
672 if (flags & P_ORIENT_MATRIX) {
673 prop = RNA_def_property(ot->srna, "orient_type", PROP_ENUM, PROP_NONE);
674 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
676
677 /* Set by 'orient_type' or gizmo which acts on non-standard orientation. */
679 ot->srna, "orient_matrix", 3, 3, nullptr, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f);
681
682 /* Only use 'orient_matrix' when 'orient_matrix_type == orient_type',
683 * this allows us to reuse the orientation set by a gizmo for eg, without disabling the ability
684 * to switch over to other orientations. */
685 prop = RNA_def_property(ot->srna, "orient_matrix_type", PROP_ENUM, PROP_NONE);
686 RNA_def_property_ui_text(prop, "Matrix Orientation", "");
689 }
690
691 if (flags & P_CONSTRAINT) {
692 RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, nullptr, "Constraint Axis", "");
693 }
694
695 if (flags & P_MIRROR) {
696 prop = RNA_def_boolean(ot->srna, "mirror", false, "Mirror Editing", "");
697 if ((flags & P_MIRROR_DUMMY) == P_MIRROR_DUMMY) {
698 /* Only used so macros can disable this option. */
700 }
701 }
702
703 if (flags & P_PROPORTIONAL) {
704 RNA_def_boolean(ot->srna, "use_proportional_edit", false, "Proportional Editing", "");
705 prop = RNA_def_enum(ot->srna,
706 "proportional_edit_falloff",
708 0,
709 "Proportional Falloff",
710 "Falloff type for proportional editing mode");
711 /* Abusing id_curve :/ */
713 RNA_def_float(ot->srna,
714 "proportional_size",
715 1,
718 "Proportional Size",
719 "",
720 0.001f,
721 100.0f);
722
723 RNA_def_boolean(ot->srna, "use_proportional_connected", false, "Connected", "");
724 RNA_def_boolean(ot->srna, "use_proportional_projected", false, "Projected (2D)", "");
725 }
726
727 if (flags & P_SNAP) {
728 prop = RNA_def_boolean(ot->srna, "snap", false, "Use Snapping Options", "");
730
731 if ((flags & P_GEO_SNAP) == P_GEO_SNAP) {
732 prop = RNA_def_enum(ot->srna,
733 "snap_elements",
736 "Snap to Elements",
737 "");
739
740 RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual Elements", "");
741
742 /* TODO(@gfxcoder): Rename `snap_target` to `snap_base` to avoid previous ambiguity of
743 * "target" (now, "base" or "source" is geometry to be moved and "target" is geometry to
744 * which moved geometry is snapped). */
745 prop = RNA_def_enum(ot->srna,
746 "snap_target",
748 0,
749 "Snap Base",
750 "Point on source that will snap to target");
752
753 /* Target selection. */
754 prop = RNA_def_boolean(ot->srna, "use_snap_self", true, "Target: Include Active", "");
756 prop = RNA_def_boolean(ot->srna, "use_snap_edit", true, "Target: Include Edit", "");
758 prop = RNA_def_boolean(ot->srna, "use_snap_nonedit", true, "Target: Include Non-Edited", "");
760 prop = RNA_def_boolean(
761 ot->srna, "use_snap_selectable", false, "Target: Exclude Non-Selectable", "");
763
765 ot->srna, "snap_point", 3, nullptr, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
767
768 if ((flags & P_ALIGN_SNAP) == P_ALIGN_SNAP) {
769 prop = RNA_def_boolean(ot->srna, "snap_align", false, "Align with Point Normal", "");
771 prop = RNA_def_float_vector(ot->srna,
772 "snap_normal",
773 3,
774 nullptr,
775 -FLT_MAX,
776 FLT_MAX,
777 "Normal",
778 "",
779 -FLT_MAX,
780 FLT_MAX);
782 }
783 }
784 }
785
786 if (flags & P_GPENCIL_EDIT) {
787 prop = RNA_def_boolean(ot->srna,
788 "gpencil_strokes",
789 false,
790 "Edit Grease Pencil",
791 "Edit selected Grease Pencil strokes");
793 }
794
795 if (flags & P_CURSOR_EDIT) {
796 prop = RNA_def_boolean(ot->srna, "cursor_transform", false, "Transform Cursor", "");
798 }
799
800 if ((flags & P_OPTIONS) && !(flags & P_NO_TEXSPACE)) {
801 prop = RNA_def_boolean(
802 ot->srna, "texture_space", false, "Edit Texture Space", "Edit object data texture space");
804 prop = RNA_def_boolean(
805 ot->srna, "remove_on_cancel", false, "Remove on Cancel", "Remove elements on cancel");
807 prop = RNA_def_boolean(ot->srna,
808 "use_duplicated_keyframes",
809 false,
810 "Duplicated Keyframes",
811 "Transform duplicated keyframes");
813 }
814
815 if (flags & P_CORRECT_UV) {
817 ot->srna, "correct_uv", true, "Correct UVs", "Correct UV coordinates when transforming");
818 }
819
820 if (flags & P_CENTER) {
821 /* For gizmos that define their own center. */
822 prop = RNA_def_property(ot->srna, "center_override", PROP_FLOAT, PROP_XYZ);
823 RNA_def_property_array(prop, 3);
825 RNA_def_property_ui_text(prop, "Center Override", "Force using this center value (when set)");
826 }
827
828 if (flags & P_VIEW2D_EDGE_PAN) {
829 prop = RNA_def_boolean(
830 ot->srna, "view2d_edge_pan", false, "Edge Pan", "Enable edge panning in 2D view");
832 }
833
834 if ((flags & P_NO_DEFAULTS) == 0) {
835 prop = RNA_def_boolean(ot->srna,
836 "release_confirm",
837 false,
838 "Confirm on Release",
839 "Always confirm operation when releasing button");
841
842 prop = RNA_def_boolean(
843 ot->srna, "use_accurate", false, "Accurate", "Use accurate transformation");
845 }
846
847 if (flags & P_POST_TRANSFORM) {
848 prop = RNA_def_boolean(ot->srna,
849 "use_automerge_and_split",
850 false,
851 "Auto Merge & Split",
852 "Forces the use of Auto Merge and Split");
854 }
855
856 if (flags & P_TRANSLATE_ORIGIN) {
857 prop = RNA_def_boolean(ot->srna,
858 "translate_origin",
859 false,
860 "Translate Origin",
861 "Translate origin instead of selection");
863 }
864}
865
867{
868 /* Identifiers. */
869 ot->name = "Move";
870 ot->description = "Move selected items";
871 ot->idname = OP_TRANSLATION;
873
874 /* API callbacks. */
875 ot->invoke = transform_invoke;
876 ot->exec = transform_exec;
877 ot->modal = transform_modal;
878 ot->cancel = transform_cancel;
880 ot->poll_property = transform_poll_property;
881
883 ot->srna, "value", 3, nullptr, -FLT_MAX, FLT_MAX, "Move", "", -FLT_MAX, FLT_MAX);
884
886
891}
892
894{
895 /* Identifiers. */
896 ot->name = "Resize";
897 ot->description = "Scale (resize) selected items";
898 ot->idname = OP_RESIZE;
900
901 /* API callbacks. */
902 ot->invoke = transform_invoke;
903 ot->exec = transform_exec;
904 ot->modal = transform_modal;
905 ot->cancel = transform_cancel;
907 ot->poll_property = transform_poll_property;
908
910 ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Scale", "", -FLT_MAX, FLT_MAX);
911
912 PropertyRNA *prop;
913 prop = RNA_def_float_vector(ot->srna,
914 "mouse_dir_constraint",
915 3,
916 VecZero,
917 -FLT_MAX,
918 FLT_MAX,
919 "Mouse Directional Constraint",
920 "",
921 -FLT_MAX,
922 FLT_MAX);
924
926
930}
931
933{
934 /* Identifiers. */
935 ot->name = "Skin Resize";
936 ot->description = "Scale selected vertices' skin radii";
937 ot->idname = OP_SKIN_RESIZE;
939
940 /* API callbacks. */
941 ot->invoke = transform_invoke;
942 ot->exec = transform_exec;
943 ot->modal = transform_modal;
944 ot->cancel = transform_cancel;
945 ot->poll = ED_operator_editmesh;
946 ot->poll_property = transform_poll_property;
947
949 ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Scale", "", -FLT_MAX, FLT_MAX);
950
952
956}
957
959{
960 /* Identifiers. */
961 ot->name = "Trackball";
962 ot->description = "Trackball style rotation of selected items";
963 ot->idname = OP_TRACKBALL;
965
966 /* API callbacks. */
967 ot->invoke = transform_invoke;
968 ot->exec = transform_exec;
969 ot->modal = transform_modal;
970 ot->cancel = transform_cancel;
972 ot->poll_property = transform_poll_property;
973
974 /* Maybe we could use float_vector_xyz here too? */
976 ot->srna, "value", 2, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
977
979
981}
982
984{
985 /* Identifiers. */
986 ot->name = "Rotate";
987 ot->description = "Rotate selected items";
988 ot->idname = OP_ROTATION;
990
991 /* API callbacks. */
992 ot->invoke = transform_invoke;
993 ot->exec = transform_exec;
994 ot->modal = transform_modal;
995 ot->cancel = transform_cancel;
997 ot->poll_property = transform_poll_property;
998
1000 ot->srna, "value", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1001
1003
1007}
1008
1009static bool tilt_poll(bContext *C)
1010{
1011 Object *obedit = CTX_data_edit_object(C);
1012 if (!obedit) {
1013 return false;
1014 }
1015 if (obedit->type == OB_CURVES_LEGACY) {
1016 Curve *cu = (Curve *)obedit->data;
1017 return (cu->flag & CU_3D) && (nullptr != cu->editnurb);
1018 }
1019 if (obedit->type == OB_CURVES) {
1020 return true;
1021 }
1022 return true;
1023}
1024
1026{
1027 /* Identifiers. */
1028 ot->name = "Tilt";
1029 /* Optional -
1030 * "Tilt selected vertices"
1031 * "Specify an extra axis rotation for selected vertices of 3D curve". */
1032 ot->description = "Tilt selected control vertices of 3D curve";
1033 ot->idname = OP_TILT;
1035
1036 /* API callbacks. */
1037 ot->invoke = transform_invoke;
1038 ot->exec = transform_exec;
1039 ot->modal = transform_modal;
1040 ot->cancel = transform_cancel;
1041 ot->poll = tilt_poll;
1042 ot->poll_property = transform_poll_property;
1043
1045 ot->srna, "value", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1046
1048
1050}
1051
1053{
1054 /* Identifiers. */
1055 ot->name = "Bend";
1056 ot->description = "Bend selected items between the 3D cursor and the mouse";
1057 ot->idname = OP_BEND;
1058 /* Depend on cursor location because the cursor location is used to define the region to bend. */
1060
1061 /* API callbacks. */
1062 ot->invoke = transform_invoke;
1063 // ot->exec = transform_exec; /* Unsupported. */
1064 ot->modal = transform_modal;
1065 ot->cancel = transform_cancel;
1067 ot->poll_property = transform_poll_property;
1068
1070 ot->srna, "value", 1, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1071
1073
1075}
1076
1078{
1080 return false;
1081 }
1082
1083 ScrArea *area = CTX_wm_area(C);
1084 return area && !ELEM(area->spacetype, SPACE_ACTION);
1085}
1086
1088{
1089 /* Identifiers. */
1090 ot->name = "Shear";
1091 ot->description = "Shear selected items along the given axis";
1092 ot->idname = OP_SHEAR;
1094
1095 /* API callbacks. */
1096 ot->invoke = transform_invoke;
1097 ot->exec = transform_exec;
1098 ot->modal = transform_modal;
1099 ot->cancel = transform_cancel;
1100 ot->poll = transform_shear_poll;
1101 ot->poll_property = transform_poll_property;
1102
1103 RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
1104
1106
1110}
1111
1113{
1114 /* Identifiers. */
1115 ot->name = "Push/Pull";
1116 ot->description = "Push/Pull selected items";
1117 ot->idname = OP_PUSH_PULL;
1119
1120 /* API callbacks. */
1121 ot->invoke = transform_invoke;
1122 ot->exec = transform_exec;
1123 ot->modal = transform_modal;
1124 ot->cancel = transform_cancel;
1126 ot->poll_property = transform_poll_property;
1127
1128 RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX);
1129
1131
1133}
1134
1136{
1137 /* Identifiers. */
1138 ot->name = "Shrink/Fatten";
1139 ot->description = "Shrink/fatten selected vertices along normals";
1140 ot->idname = OP_SHRINK_FATTEN;
1142
1143 /* API callbacks. */
1144 ot->invoke = transform_invoke;
1145 ot->exec = transform_exec;
1146 ot->modal = transform_modal;
1147 ot->cancel = transform_cancel;
1148 ot->poll = ED_operator_editmesh;
1149 ot->poll_property = transform_poll_property;
1150
1151 RNA_def_float_distance(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
1152
1153 RNA_def_boolean(ot->srna,
1154 "use_even_offset",
1155 false,
1156 "Offset Even",
1157 "Scale the offset to give more even thickness");
1158
1160
1162}
1163
1165{
1166 /* Identifiers. */
1167 ot->name = "To Sphere";
1168 ot->description = "Move selected items outward in a spherical shape around geometric center";
1169 ot->idname = OP_TOSPHERE;
1171
1172 /* API callbacks. */
1173 ot->invoke = transform_invoke;
1174 ot->exec = transform_exec;
1175 ot->modal = transform_modal;
1176 ot->cancel = transform_cancel;
1178 ot->poll_property = transform_poll_property;
1179
1180 RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1);
1181
1183
1185}
1186
1188{
1189 /* Identifiers. */
1190 ot->name = "Mirror";
1191 ot->description = "Mirror selected items around one or more axes";
1192 ot->idname = OP_MIRROR;
1194
1195 /* API callbacks. */
1196 ot->invoke = transform_invoke;
1197 ot->exec = transform_exec;
1198 ot->modal = transform_modal;
1199 ot->cancel = transform_cancel;
1201 ot->poll_property = transform_poll_property;
1202
1204}
1205
1207{
1208 /* Identifiers. */
1209 ot->name = "Scale B-Bone";
1210 ot->description = "Scale selected bendy bones display size";
1211 ot->idname = OP_BONE_SIZE;
1213
1214 /* API callbacks. */
1215 ot->invoke = transform_invoke;
1216 ot->exec = transform_exec;
1217 ot->modal = transform_modal;
1218 ot->cancel = transform_cancel;
1220 ot->poll_property = transform_poll_property;
1221
1223 ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Display Size", "", -FLT_MAX, FLT_MAX);
1224
1226
1228}
1229
1231{
1232 PropertyRNA *prop;
1233
1234 /* Identifiers. */
1235 ot->name = "Edge Slide";
1236 ot->description = "Slide an edge loop along a mesh";
1237 ot->idname = OP_EDGE_SLIDE;
1239
1240 /* API callbacks. */
1241 ot->invoke = transform_invoke;
1242 ot->exec = transform_exec;
1243 ot->modal = transform_modal;
1244 ot->cancel = transform_cancel;
1245 ot->poll = ED_operator_editmesh;
1246 ot->poll_property = transform_poll_property;
1247
1248 RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f);
1249
1250 prop = RNA_def_boolean(ot->srna, "single_side", false, "Single Side", "");
1252 RNA_def_boolean(ot->srna,
1253 "use_even",
1254 false,
1255 "Even",
1256 "Make the edge loop match the shape of the adjacent edge loop");
1257
1259
1260 RNA_def_boolean(ot->srna,
1261 "flipped",
1262 false,
1263 "Flipped",
1264 "When Even mode is active, flips between the two adjacent edge loops");
1265 RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
1266
1268}
1269
1271{
1272 /* Identifiers. */
1273 ot->name = "Vertex Slide";
1274 ot->description = "Slide a vertex along a mesh";
1275 ot->idname = OP_VERT_SLIDE;
1277
1278 /* API callbacks. */
1279 ot->invoke = transform_invoke;
1280 ot->exec = transform_exec;
1281 ot->modal = transform_modal;
1282 ot->cancel = transform_cancel;
1283 ot->poll = ED_operator_editmesh;
1284 ot->poll_property = transform_poll_property;
1285
1286 RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f);
1287 RNA_def_boolean(ot->srna,
1288 "use_even",
1289 false,
1290 "Even",
1291 "Make the edge loop match the shape of the adjacent edge loop");
1292
1294
1295 RNA_def_boolean(ot->srna,
1296 "flipped",
1297 false,
1298 "Flipped",
1299 "When Even mode is active, flips between the two adjacent edge loops");
1300 RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
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. */
1314 ot->invoke = transform_invoke;
1315 ot->exec = transform_exec;
1316 ot->modal = transform_modal;
1317 ot->cancel = transform_cancel;
1318 ot->poll = ED_operator_editmesh;
1319 ot->poll_property = transform_poll_property;
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. */
1337 ot->invoke = transform_invoke;
1338 ot->exec = transform_exec;
1339 ot->modal = transform_modal;
1340 ot->cancel = transform_cancel;
1341 ot->poll = ED_operator_editmesh;
1342 ot->poll_property = transform_poll_property;
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. */
1360 ot->invoke = transform_invoke;
1361 ot->exec = transform_exec;
1362 ot->modal = transform_modal;
1363 ot->cancel = transform_cancel;
1364 ot->poll = ED_operator_editmesh;
1365
1366 RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
1367
1369
1371}
1372
1374{
1375 /* Identifiers. */
1376 ot->name = "Sequence Slide";
1377 ot->description = "Slide a sequence strip in time";
1378 ot->idname = OP_SEQ_SLIDE;
1380
1381 /* API callbacks. */
1382 ot->invoke = transform_invoke;
1383 ot->exec = transform_exec;
1384 ot->modal = transform_modal;
1385 ot->cancel = transform_cancel;
1387
1388 /* Properties. */
1389 PropertyRNA *prop;
1390
1391 prop = RNA_def_float_vector(
1392 ot->srna, "value", 2, nullptr, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
1394
1395 prop = RNA_def_boolean(ot->srna,
1396 "use_restore_handle_selection",
1397 false,
1398 "Restore Handle Selection",
1399 "Restore handle selection after tweaking");
1401
1403
1405}
1406
1408{
1409 /* Identifiers. */
1410 ot->name = "Rotate Normals";
1411 ot->description = "Rotate split normal of selected items";
1412 ot->idname = OP_NORMAL_ROTATION;
1414
1415 /* API callbacks. */
1416 ot->invoke = transform_invoke;
1417 ot->exec = transform_exec;
1418 ot->modal = transform_modal;
1419 ot->cancel = transform_cancel;
1420 ot->poll = ED_operator_editmesh;
1421
1423 ot->srna, "value", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1424
1426}
1427
1429{
1430 PropertyRNA *prop;
1431
1432 /* Identifiers. */
1433 ot->name = "Transform";
1434 ot->description = "Transform selected items by mode type";
1435 ot->idname = "TRANSFORM_OT_transform";
1437
1438 /* API callbacks. */
1439 ot->invoke = transform_invoke;
1440 ot->exec = transform_exec;
1441 ot->modal = transform_modal;
1442 ot->cancel = transform_cancel;
1444 ot->poll_property = transform_poll_property;
1445
1446 prop = RNA_def_enum(
1447 ot->srna, "mode", rna_enum_transform_mode_type_items, TFM_TRANSLATION, "Mode", "");
1449
1451 ot->srna, "value", 4, nullptr, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);
1452
1454
1458}
1459
1461 wmOperator * /*op*/,
1462 const wmEvent *event)
1463{
1465 if (tref) {
1466 ARegion *region = CTX_wm_region(C);
1467 wmGizmoMap *gzmap = region->runtime->gizmo_map;
1468 wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_xform_gizmo") :
1469 nullptr;
1470 if (gzgroup != nullptr) {
1471 PointerRNA gzg_ptr;
1473 const int drag_action = RNA_enum_get(&gzg_ptr, "drag_action");
1474 const char *op_id = nullptr;
1475 switch (drag_action) {
1477 op_id = "TRANSFORM_OT_translate";
1478 break;
1480 op_id = "TRANSFORM_OT_rotate";
1481 break;
1483 op_id = "TRANSFORM_OT_resize";
1484 break;
1485 default:
1486 break;
1487 }
1488 if (op_id) {
1489 wmOperatorType *ot = WM_operatortype_find(op_id, true);
1490 PointerRNA op_ptr;
1492 RNA_boolean_set(&op_ptr, "release_confirm", true);
1495 return OPERATOR_FINISHED;
1496 }
1497 }
1498 }
1499 return OPERATOR_PASS_THROUGH;
1500}
1501
1502/* Use with 'TRANSFORM_GGT_gizmo'. */
1504{
1505 /* Identifiers. */
1506 ot->name = "Transform from Gizmo";
1507 ot->description = "Transform selected items by mode type";
1508 ot->idname = "TRANSFORM_OT_from_gizmo";
1509 ot->flag = 0;
1510
1511 /* API callbacks. */
1514}
1515
1532
1534{
1535 wmKeyMap *modalmap = transform_modal_keymap(keyconf);
1536
1537 TransformModeItem *tmode;
1538
1539 for (tmode = transform_modes; tmode->idname; tmode++) {
1540 WM_modalkeymap_assign(modalmap, tmode->idname);
1541 }
1542 WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform");
1543}
1544
1545} // namespace blender::ed::transform
ScrArea * CTX_wm_area(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:126
void BKE_scene_orientation_slot_set_index(TransformOrientationSlot *orient_slot, int orientation)
Definition scene.cc:2422
#define BLI_assert(a)
Definition BLI_assert.h:46
#define M_PI
MINLINE bool is_zero_v4(const float v[4]) ATTR_WARN_UNUSED_RESULT
#define STRPREFIX(a, b)
#define UNLIKELY(x)
#define ELEM(...)
#define STREQ(a, b)
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define IFACE_(msgid)
@ CU_3D
Object is a sort of wrapper for general info.
@ OB_CURVES_LEGACY
@ OB_CURVES
@ SCE_SELECT_FACE
@ SCE_SELECT_VERTEX
@ SCE_SELECT_EDGE
@ SCE_ORIENT_DEFAULT
@ SCE_SNAP_TO_INCREMENT
@ SPACE_ACTION
@ SPACE_NLA
@ SPACE_VIEW3D
@ V3D_ORIENT_CUSTOM
@ V3D_GIZMO_SHOW_OBJECT_ROTATE
@ V3D_GIZMO_SHOW_OBJECT_SCALE
@ V3D_GIZMO_SHOW_OBJECT_TRANSLATE
@ RV3D_NAVIGATING
@ OPERATOR_CANCELLED
@ OPERATOR_INTERFACE
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
@ OPERATOR_PASS_THROUGH
@ OP_IS_MODAL_GRAB_CURSOR
bool EDBM_selectmode_set_multi(bContext *C, short selectmode)
bool ED_operator_screenactive(bContext *C)
bool ED_operator_regionactive(bContext *C)
Definition screen_ops.cc:98
bool ED_operator_object_active(bContext *C)
bool ED_operator_sequencer_active(bContext *C)
bool ED_operator_view3d_active(bContext *C)
bool ED_operator_region_view3d_active(bContext *C)
bool ED_operator_areaactive(bContext *C)
bool ED_operator_editmesh(bContext *C)
#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
bool ED_view3d_navigation_do(bContext *C, ViewOpsData *vod, const wmEvent *event, const float depth_loc_override[3])
Read Guarded memory(de)allocation.
const EnumPropertyItem * rna_TransformOrientation_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
@ PROP_FLOAT
Definition RNA_types.hh:152
@ PROP_ENUM
Definition RNA_types.hh:154
@ PROP_ENUM_FLAG
Definition RNA_types.hh:378
@ PROP_SKIP_SAVE
Definition RNA_types.hh:330
@ PROP_HIDDEN
Definition RNA_types.hh:324
@ PROP_XYZ
Definition RNA_types.hh:257
@ PROP_NONE
Definition RNA_types.hh:221
#define C
Definition RandGen.cpp:29
void UI_popup_menu_end(bContext *C, uiPopupMenu *pup)
uiPopupMenu * UI_popup_menu_begin(bContext *C, const char *title, int icon) ATTR_NONNULL()
uiLayout * UI_popup_menu_layout(uiPopupMenu *pup)
void uiItemsEnumO(uiLayout *layout, blender::StringRefNull opname, blender::StringRefNull propname)
#define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr)
@ OPTYPE_BLOCKING
Definition WM_types.hh:184
@ OPTYPE_DEPENDS_ON_CURSOR
Definition WM_types.hh:218
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_REGISTER
Definition WM_types.hh:180
#define NC_SCENE
Definition WM_types.hh:375
#define ND_TOOLSETTINGS
Definition WM_types.hh:446
#define NA_EDITED
Definition WM_types.hh:581
#define ND_TRANSFORM
Definition WM_types.hh:453
@ WM_OP_INVOKE_DEFAULT
Definition WM_types.hh:238
#define ND_SPACE_VIEW3D
Definition WM_types.hh:525
#define NC_OBJECT
Definition WM_types.hh:376
#define NC_SPACE
Definition WM_types.hh:389
#define MAX_NAME
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
#define G(x, y, z)
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 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)
VecBase< float, 2 > float2
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
const char * RNA_property_identifier(const PropertyRNA *prop)
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_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)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
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)
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)
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)
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)
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)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
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)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
void RNA_def_property_array(PropertyRNA *prop, int length)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
const EnumPropertyItem rna_enum_axis_xyz_items[]
const EnumPropertyItem rna_enum_proportional_falloff_items[]
Definition rna_scene.cc:95
const EnumPropertyItem rna_enum_snap_source_items[]
Definition rna_scene.cc:87
const EnumPropertyItem rna_enum_snap_element_items[]
Definition rna_scene.cc:151
#define FLT_MAX
Definition stdcycles.h:14
void * regiondata
ARegionRuntimeHandle * runtime
EditNurb * editnurb
struct ToolSettings * toolsettings
TransformOrientationSlot orientation_slots[4]
wmEventType type
Definition WM_types.hh:754
int mval[2]
Definition WM_types.hh:760
wmGizmoGroupType * type
const char * name
Definition WM_types.hh:1030
const char * idname
Definition WM_types.hh:1032
struct ReportList * reports
struct wmOperator * prev
struct wmOperatorType * type
struct PointerRNA * ptr
struct wmOperator * opm
#define T_PROP_SIZE_MIN
Definition transform.hh:31
#define T_PROP_SIZE_MAX
Definition transform.hh:32
conversion and adaptation of different datablocks to a common struct.
const EnumPropertyItem rna_enum_transform_mode_type_items[]
void WM_operator_type_set(wmOperator *op, wmOperatorType *ot)
Definition wm.cc:321
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
@ NDOF_MOTION
wmOperatorType * ot
Definition wm_files.cc:4225
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
#define WM_msg_publish_rna_prop(mbus, id_, data_, type_, prop_)
void WM_operatortype_props_advanced_begin(wmOperatorType *ot)
void WM_operatortype_append(void(*opfunc)(wmOperatorType *))
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
void WM_operator_properties_free(PointerRNA *ptr)
bToolRef * WM_toolsystem_ref_from_context(const bContext *C)