Blender V5.0
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"
37#include "UI_resources.hh"
38
39#include "ED_screen.hh"
41#include "ED_mesh.hh"
42
43#include "transform.hh"
44#include "transform_convert.hh"
45
46namespace blender::ed::transform {
47
49 const char *idname;
50 int mode;
52};
53
54static const float VecZero[3] = {0, 0, 0};
55static const float VecOne[3] = {1, 1, 1};
56
57static const char OP_TRANSLATION[] = "TRANSFORM_OT_translate";
58static const char OP_ROTATION[] = "TRANSFORM_OT_rotate";
59static const char OP_TOSPHERE[] = "TRANSFORM_OT_tosphere";
60static const char OP_RESIZE[] = "TRANSFORM_OT_resize";
61static const char OP_SKIN_RESIZE[] = "TRANSFORM_OT_skin_resize";
62static const char OP_SHEAR[] = "TRANSFORM_OT_shear";
63static const char OP_BEND[] = "TRANSFORM_OT_bend";
64static const char OP_SHRINK_FATTEN[] = "TRANSFORM_OT_shrink_fatten";
65static const char OP_PUSH_PULL[] = "TRANSFORM_OT_push_pull";
66static const char OP_TILT[] = "TRANSFORM_OT_tilt";
67static const char OP_TRACKBALL[] = "TRANSFORM_OT_trackball";
68static const char OP_MIRROR[] = "TRANSFORM_OT_mirror";
69static const char OP_BONE_SIZE[] = "TRANSFORM_OT_bbone_resize";
70static const char OP_EDGE_SLIDE[] = "TRANSFORM_OT_edge_slide";
71static const char OP_VERT_SLIDE[] = "TRANSFORM_OT_vert_slide";
72static const char OP_EDGE_CREASE[] = "TRANSFORM_OT_edge_crease";
73static const char OP_VERT_CREASE[] = "TRANSFORM_OT_vert_crease";
74static const char OP_EDGE_BWEIGHT[] = "TRANSFORM_OT_edge_bevelweight";
75static const char OP_SEQ_SLIDE[] = "TRANSFORM_OT_seq_slide";
76static const char OP_NORMAL_ROTATION[] = "TRANSFORM_OT_rotate_normal";
77
98
122
123} // namespace blender::ed::transform
124
126 {blender::ed::transform::TFM_INIT, "INIT", 0, "Init", ""},
127 {blender::ed::transform::TFM_DUMMY, "DUMMY", 0, "Dummy", ""},
128 {blender::ed::transform::TFM_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
129 {blender::ed::transform::TFM_ROTATION, "ROTATION", 0, "Rotation", ""},
130 {blender::ed::transform::TFM_RESIZE, "RESIZE", 0, "Resize", ""},
131 {blender::ed::transform::TFM_SKIN_RESIZE, "SKIN_RESIZE", 0, "Skin Resize", ""},
132 {blender::ed::transform::TFM_TOSPHERE, "TOSPHERE", 0, "To Sphere", ""},
133 {blender::ed::transform::TFM_SHEAR, "SHEAR", 0, "Shear", ""},
134 {blender::ed::transform::TFM_BEND, "BEND", 0, "Bend", ""},
135 {blender::ed::transform::TFM_SHRINKFATTEN, "SHRINKFATTEN", 0, "Shrink/Fatten", ""},
136 {blender::ed::transform::TFM_TILT, "TILT", 0, "Tilt", ""},
137 {blender::ed::transform::TFM_TRACKBALL, "TRACKBALL", 0, "Trackball", ""},
138 {blender::ed::transform::TFM_PUSHPULL, "PUSHPULL", 0, "Push/Pull", ""},
139 {blender::ed::transform::TFM_EDGE_CREASE, "CREASE", 0, "Crease", ""},
140 {blender::ed::transform::TFM_VERT_CREASE, "VERTEX_CREASE", 0, "Vertex Crease", ""},
141 {blender::ed::transform::TFM_MIRROR, "MIRROR", 0, "Mirror", ""},
142 {blender::ed::transform::TFM_BONESIZE, "BONE_SIZE", 0, "Bone Size", ""},
143 {blender::ed::transform::TFM_BONE_ENVELOPE, "BONE_ENVELOPE", 0, "Bone Envelope", ""},
145 "BONE_ENVELOPE_DIST",
146 0,
147 "Bone Envelope Distance",
148 ""},
150 "CURVE_SHRINKFATTEN",
151 0,
152 "Curve Shrink/Fatten",
153 ""},
155 "MASK_SHRINKFATTEN",
156 0,
157 "Mask Shrink/Fatten",
158 ""},
159 {blender::ed::transform::TFM_BONE_ROLL, "BONE_ROLL", 0, "Bone Roll", ""},
160 {blender::ed::transform::TFM_TIME_TRANSLATE, "TIME_TRANSLATE", 0, "Time Translate", ""},
161 {blender::ed::transform::TFM_TIME_SLIDE, "TIME_SLIDE", 0, "Time Slide", ""},
162 {blender::ed::transform::TFM_TIME_SCALE, "TIME_SCALE", 0, "Time Scale", ""},
163 {blender::ed::transform::TFM_TIME_EXTEND, "TIME_EXTEND", 0, "Time Extend", ""},
164 {blender::ed::transform::TFM_BAKE_TIME, "BAKE_TIME", 0, "Bake Time", ""},
165 {blender::ed::transform::TFM_BWEIGHT, "BWEIGHT", 0, "Bevel Weight", ""},
166 {blender::ed::transform::TFM_ALIGN, "ALIGN", 0, "Align", ""},
167 {blender::ed::transform::TFM_EDGE_SLIDE, "EDGESLIDE", 0, "Edge Slide", ""},
168 {blender::ed::transform::TFM_SEQ_SLIDE, "SEQSLIDE", 0, "Sequence Slide", ""},
170 "GPENCIL_OPACITY",
171 0,
172 "Grease Pencil Opacity",
173 ""},
174 {0, nullptr, 0, nullptr, nullptr},
175};
176
177namespace blender::ed::transform {
178
180{
181 Scene *scene = CTX_data_scene(C);
182
183 int orientation = RNA_enum_get(op->ptr, "orientation");
184
186
189
191 WM_msg_publish_rna_prop(mbus, &scene->id, scene, TransformOrientationSlot, type);
192
193 return OPERATOR_FINISHED;
194}
195
197 wmOperator * /*op*/,
198 const wmEvent * /*event*/)
199{
200 uiPopupMenu *pup;
201 uiLayout *layout;
202
203 pup = UI_popup_menu_begin(C, IFACE_("Orientation"), ICON_NONE);
204 layout = UI_popup_menu_layout(pup);
205 layout->op_enum("TRANSFORM_OT_select_orientation", "orientation");
206 UI_popup_menu_end(C, pup);
207
208 return OPERATOR_INTERFACE;
209}
210
212{
213 PropertyRNA *prop;
214
215 /* Identifiers. */
216 ot->name = "Select Orientation";
217 ot->description = "Select transformation orientation";
218 ot->idname = "TRANSFORM_OT_select_orientation";
219 ot->flag = OPTYPE_UNDO;
220
221 /* API callbacks. */
225
226 prop = RNA_def_property(ot->srna, "orientation", PROP_ENUM, PROP_NONE);
227 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
229}
230
232{
233 Scene *scene = CTX_data_scene(C);
236
238
240 WM_msg_publish_rna_prop(mbus, &scene->id, scene, Scene, transform_orientation_slots);
241
242 return OPERATOR_FINISHED;
243}
244
246 wmOperator *op,
247 const wmEvent * /*event*/)
248{
249 return delete_orientation_exec(C, op);
250}
251
253{
254 if (ED_operator_areaactive(C) == 0) {
255 return false;
256 }
257
258 Scene *scene = CTX_data_scene(C);
261}
262
264{
265 /* Identifiers. */
266 ot->name = "Delete Orientation";
267 ot->description = "Delete transformation orientation";
268 ot->idname = "TRANSFORM_OT_delete_orientation";
269 ot->flag = OPTYPE_UNDO;
270
271 /* API callbacks. */
275}
276
278{
279 char name[MAX_NAME];
280 const bool use = RNA_boolean_get(op->ptr, "use");
281 const bool overwrite = RNA_boolean_get(op->ptr, "overwrite");
282 const bool use_view = RNA_boolean_get(op->ptr, "use_view");
283 View3D *v3d = CTX_wm_view3d(C);
284 Scene *scene = CTX_data_scene(C);
285
286 RNA_string_get(op->ptr, "name", name);
287
288 if (use && !v3d) {
290 RPT_ERROR,
291 "Create Orientation's 'use' parameter only valid in a 3DView context");
292 return OPERATOR_CANCELLED;
293 }
294
295 if (!BIF_createTransformOrientation(C, op->reports, name, use_view, use, overwrite)) {
296 BKE_report(op->reports, RPT_ERROR, "Unable to create orientation");
297 return OPERATOR_CANCELLED;
298 }
299
300 if (use) {
302 WM_msg_publish_rna_prop(mbus, &scene->id, scene, Scene, transform_orientation_slots);
304 }
305
307
308 return OPERATOR_FINISHED;
309}
310
312{
313 /* Identifiers. */
314 ot->name = "Create Orientation";
315 ot->description = "Create transformation orientation from selection";
316 ot->idname = "TRANSFORM_OT_create_orientation";
318
319 /* API callbacks. */
322
324 ot->srna, "name", nullptr, MAX_NAME, "Name", "Name of the new custom orientation");
326 ot->srna,
327 "use_view",
328 false,
329 "Use View",
330 "Use the current view instead of the active object to create the new orientation");
331
333
335 ot->srna, "use", false, "Use After Creation", "Select orientation after its creation");
336 RNA_def_boolean(ot->srna,
337 "overwrite",
338 false,
339 "Overwrite Previous",
340 "Overwrite previously created orientation with same name");
341}
342
343#ifdef USE_LOOPSLIDE_HACK
350{
351 if (op->type->idname == OP_EDGE_SLIDE) {
352 if (op->opm && op->opm->opm && op->opm->opm->prev) {
353 wmOperator *op_prev = op->opm->opm->prev;
354 Scene *scene = CTX_data_scene(C);
355 bool mesh_select_mode[3];
356 PropertyRNA *prop = RNA_struct_find_property(op_prev->ptr, "mesh_select_mode_init");
357
358 if (prop && RNA_property_is_set(op_prev->ptr, prop)) {
359 ToolSettings *ts = scene->toolsettings;
360 short selectmode_orig;
361
362 RNA_property_boolean_get_array(op_prev->ptr, prop, mesh_select_mode);
363 selectmode_orig = ((mesh_select_mode[0] ? SCE_SELECT_VERTEX : 0) |
364 (mesh_select_mode[1] ? SCE_SELECT_EDGE : 0) |
365 (mesh_select_mode[2] ? SCE_SELECT_FACE : 0));
366
367 /* Still switch if we were originally in face select mode. */
368 if ((ts->selectmode != selectmode_orig) && (selectmode_orig != SCE_SELECT_FACE)) {
369 ts->selectmode = selectmode_orig;
370 EDBM_selectmode_set_multi(C, selectmode_orig);
371 }
372 }
373 }
374 }
375}
376#else
377/* Prevent removal by cleanup. */
378# error "loopslide hack removed!"
379#endif /* USE_LOOPSLIDE_HACK */
380
382{
383#ifdef USE_LOOPSLIDE_HACK
385#endif
386
387 TransInfo *t = static_cast<TransInfo *>(op->customdata);
388 saveTransform(C, t, op);
389 MEM_freeN(t);
390 op->customdata = nullptr;
391 G.moving = 0;
392}
393
395{
396 for (TransformModeItem *tmode = transform_modes; tmode->idname; tmode++) {
397 if (op->type->idname == tmode->idname) {
398 return tmode->mode;
399 }
400 }
401
402 return RNA_enum_get(op->ptr, "mode");
403}
404
405static int transformops_data(bContext *C, wmOperator *op, const wmEvent *event)
406{
407 int retval = 1;
408 if (op->customdata == nullptr) {
409 TransInfo *t = MEM_callocN<TransInfo>("TransInfo data2");
410
411 t->undo_name = op->type->name;
412
413 int mode = transformops_mode(op);
414 retval = initTransform(C, t, op, event, mode);
415
416 /* Store data. */
417 if (retval) {
418 G.moving = special_transform_moving(t);
419 op->customdata = t;
420 }
421 else {
422 MEM_freeN(t);
423 }
424 }
425
426 return retval; /* Return 0 on error. */
427}
428
430{
432
433 TransInfo *t = static_cast<TransInfo *>(op->customdata);
434 const eTfmMode mode_prev = t->mode;
435
436#if defined(WITH_INPUT_NDOF) && 0
437 /* Stable 2D mouse coords map to different 3D coords while the 3D mouse is active
438 * in other words, 2D deltas are no longer good enough!
439 * disable until individual 'transformers' behave better. */
440
441 if (event->type == NDOF_MOTION) {
443 }
444#endif
445
446 /* XXX insert keys are called here, and require context. */
447 t->context = C;
448
449 exit_code = transformEvent(t, op, event);
450 t->context = nullptr;
451
452 /* Allow navigation while transforming. */
453 if (t->vod && (exit_code & OPERATOR_PASS_THROUGH)) {
454 RegionView3D *rv3d = static_cast<RegionView3D *>(t->region->regiondata);
455 const bool is_navigating = (rv3d->rflag & RV3D_NAVIGATING) != 0;
456 if (ED_view3d_navigation_do(C, t->vod, event, t->center_global)) {
457 if (!is_navigating) {
458 /* Navigation has started. */
459
460 if (t->modifiers & MOD_PRECISION) {
461 /* WORKAROUND: Remove precision modification, it may have be unintentionally enabled. */
463 t->mouse.precision = false;
465 }
466 }
467
468 if (rv3d->rflag & RV3D_NAVIGATING) {
469 /* Navigation is running. */
470
471 /* Do not update transform while navigating. This can be distracting. */
473 }
474
475 {
476 /* Navigation has ended. */
477
478 /* Call before #applyMouseInput. */
480
481 /* Mouse input is outdated. */
482 t->mval = float2(event->mval);
483 applyMouseInput(t, &t->mouse, t->mval, t->values);
484 t->redraw |= TREDRAW_HARD;
485 }
486 }
487 }
488
489 transformApply(C, t);
490
491 exit_code |= transformEnd(C, t);
492
493 if ((exit_code & OPERATOR_RUNNING_MODAL) == 0) {
494 transformops_exit(C, op);
495 exit_code &= ~OPERATOR_PASS_THROUGH; /* Preventively remove pass-through. */
496 }
497 else {
498 if (mode_prev != t->mode) {
499 /* WARNING: this is not normal to switch operator types
500 * normally it would not be supported but transform happens
501 * to share callbacks between different operators. */
502 wmOperatorType *ot_new = nullptr;
504 while (item->idname) {
505 if (item->mode == t->mode) {
506 ot_new = WM_operatortype_find(item->idname, false);
507 break;
508 }
509 item++;
510 }
511
512 BLI_assert(ot_new != nullptr);
513 if (ot_new) {
514 WM_operator_type_set(op, ot_new);
515 }
516 /* End suspicious code. */
517 }
518 }
519
520 return exit_code;
521}
522
524{
525 TransInfo *t = static_cast<TransInfo *>(op->customdata);
526
527 t->state = TRANS_CANCEL;
528 transformEnd(C, t);
529 transformops_exit(C, op);
530}
531
533{
534 TransInfo *t;
535
536 if (!transformops_data(C, op, nullptr)) {
537 G.moving = 0;
538 return OPERATOR_CANCELLED;
539 }
540
541 t = static_cast<TransInfo *>(op->customdata);
542
544
545 transformApply(C, t);
546
547 transformEnd(C, t);
548
549 transformops_exit(C, op);
550
552
553 return OPERATOR_FINISHED;
554}
555
557{
558 if (!transformops_data(C, op, event)) {
559 G.moving = 0;
560 return OPERATOR_CANCELLED;
561 }
562
563 /* When modal, allow 'value' to set initial offset. */
564 if ((event == nullptr) && RNA_struct_property_is_set(op->ptr, "value")) {
565 return transform_exec(C, op);
566 }
567
568 /* Add temp handler. */
570
571 /* Use when modal input has some transformation to begin with. */
572 TransInfo *t = static_cast<TransInfo *>(op->customdata);
573 if ((t->flag & T_NO_CURSOR_WRAP) == 0) {
574 op->flag |= OP_IS_MODAL_GRAB_CURSOR; /* XXX maybe we want this with the gizmo only? */
575 }
577 transformApply(C, t);
578 }
579
581}
582
583static bool transform_poll_property(const bContext *C, wmOperator *op, const PropertyRNA *prop)
584{
585 const char *prop_id = RNA_property_identifier(prop);
586
587 /* Orientation/Constraints. */
588 if (STRPREFIX(prop_id, "constraint")) {
589 /* Hide orientation axis if no constraints are set, since it won't be used. */
590 PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "orient_type");
591 if (!ELEM(prop_con, nullptr, prop)) {
592
593 /* Special case: show constraint axis if we don't have values,
594 * needed for mirror operator. */
595 if (STREQ(prop_id, "constraint_axis") &&
596 (RNA_struct_find_property(op->ptr, "value") == nullptr))
597 {
598 return true;
599 }
600
601 return false;
602 }
603 return true;
604 }
605
606 /* Orientation Axis. */
607 if (STREQ(prop_id, "orient_axis")) {
609 return mode != TFM_ALIGN;
610 }
611
612 /* Proportional Editing. */
613 if (STRPREFIX(prop_id, "proportional") || STRPREFIX(prop_id, "use_proportional")) {
614 ScrArea *area = CTX_wm_area(C);
615 if (area->spacetype == SPACE_NLA) {
616 /* Hide properties that are not supported in some spaces. */
617 return false;
618 }
619
620 PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "use_proportional_edit");
621 if ((prop_pet != prop) && (RNA_property_boolean_get(op->ptr, prop_pet) == false)) {
622 /* If "use_proportional_edit" is false, hide:
623 * - "proportional_edit_falloff",
624 * - "proportional_size",
625 * - "use_proportional_connected",
626 * - "use_proportional_projected". */
627 return false;
628 }
629 return true;
630 }
631
632 /* Snapping. */
633 if (STREQ(prop_id, "use_snap_project")) {
634 return RNA_boolean_get(op->ptr, "snap");
635 }
636
637 if (STREQ(prop_id, "use_even_offset")) {
638 /* Even offset isn't meaningful for individual faces. */
639 if (op->opm && STREQ(op->opm->idname, "MESH_OT_extrude_faces_move")) {
640 return false;
641 }
642 return true;
643 }
644
645 /* #P_CORRECT_UV. */
646 if (STREQ(prop_id, "correct_uv")) {
647 ScrArea *area = CTX_wm_area(C);
648 return area->spacetype == SPACE_VIEW3D;
649 }
650
651 return true;
652}
653
655{
656 PropertyRNA *prop;
657
658 if (flags & P_ORIENT_AXIS) {
659 prop = RNA_def_property(ot->srna, "orient_axis", PROP_ENUM, PROP_NONE);
660 RNA_def_property_ui_text(prop, "Axis", "");
664 }
665 if (flags & P_ORIENT_AXIS_ORTHO) {
666 prop = RNA_def_property(ot->srna, "orient_axis_ortho", PROP_ENUM, PROP_NONE);
667 RNA_def_property_ui_text(prop, "Axis Ortho", "");
671 }
672
673 if (flags & P_ORIENT_MATRIX) {
674 prop = RNA_def_property(ot->srna, "orient_type", PROP_ENUM, PROP_NONE);
675 RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
677
678 /* Set by 'orient_type' or gizmo which acts on non-standard orientation. */
680 ot->srna, "orient_matrix", 3, 3, nullptr, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f);
682
683 /* Only use 'orient_matrix' when 'orient_matrix_type == orient_type',
684 * this allows us to reuse the orientation set by a gizmo for eg, without disabling the ability
685 * to switch over to other orientations. */
686 prop = RNA_def_property(ot->srna, "orient_matrix_type", PROP_ENUM, PROP_NONE);
687 RNA_def_property_ui_text(prop, "Matrix Orientation", "");
690 }
691
692 if (flags & P_CONSTRAINT) {
693 RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, nullptr, "Constraint Axis", "");
694 }
695
696 if (flags & P_MIRROR) {
697 prop = RNA_def_boolean(ot->srna, "mirror", false, "Mirror Editing", "");
698 if ((flags & P_MIRROR_DUMMY) == P_MIRROR_DUMMY) {
699 /* Only used so macros can disable this option. */
701 }
702 }
703
704 if (flags & P_PROPORTIONAL) {
705 RNA_def_boolean(ot->srna, "use_proportional_edit", false, "Proportional Editing", "");
706 prop = RNA_def_enum(ot->srna,
707 "proportional_edit_falloff",
709 0,
710 "Proportional Falloff",
711 "Falloff type for proportional editing mode");
712 /* Abusing id_curve :/ */
714 RNA_def_float(ot->srna,
715 "proportional_size",
716 1,
719 "Proportional Size",
720 "",
721 0.001f,
722 100.0f);
723
724 RNA_def_boolean(ot->srna, "use_proportional_connected", false, "Connected", "");
725 RNA_def_boolean(ot->srna, "use_proportional_projected", false, "Projected (2D)", "");
726 }
727
728 if (flags & P_SNAP) {
729 prop = RNA_def_boolean(ot->srna, "snap", false, "Use Snapping Options", "");
731
732 if ((flags & P_GEO_SNAP) == P_GEO_SNAP) {
733 prop = RNA_def_enum_flag(ot->srna,
734 "snap_elements",
737 "Snap to Elements",
738 "");
740
741 RNA_def_boolean(ot->srna, "use_snap_project", false, "Project Individual Elements", "");
742
743 /* TODO(@gfxcoder): Rename `snap_target` to `snap_base` to avoid previous ambiguity of
744 * "target" (now, "base" or "source" is geometry to be moved and "target" is geometry to
745 * which moved geometry is snapped). */
746 prop = RNA_def_enum(ot->srna,
747 "snap_target",
749 0,
750 "Snap Base",
751 "Point on source that will snap to target");
753
754 /* Target selection. */
755 prop = RNA_def_boolean(ot->srna, "use_snap_self", true, "Target: Include Active", "");
757 prop = RNA_def_boolean(ot->srna, "use_snap_edit", true, "Target: Include Edit", "");
759 prop = RNA_def_boolean(ot->srna, "use_snap_nonedit", true, "Target: Include Non-Edited", "");
761 prop = RNA_def_boolean(
762 ot->srna, "use_snap_selectable", false, "Target: Exclude Non-Selectable", "");
764
766 ot->srna, "snap_point", 3, nullptr, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
768
769 if ((flags & P_ALIGN_SNAP) == P_ALIGN_SNAP) {
770 prop = RNA_def_boolean(ot->srna, "snap_align", false, "Align with Point Normal", "");
772 prop = RNA_def_float_vector(ot->srna,
773 "snap_normal",
774 3,
775 nullptr,
776 -FLT_MAX,
777 FLT_MAX,
778 "Normal",
779 "",
780 -FLT_MAX,
781 FLT_MAX);
783 }
784 }
785 }
786
787 if (flags & P_GPENCIL_EDIT) {
788 prop = RNA_def_boolean(ot->srna,
789 "gpencil_strokes",
790 false,
791 "Edit Grease Pencil",
792 "Edit selected Grease Pencil strokes");
794 }
795
796 if (flags & P_CURSOR_EDIT) {
797 prop = RNA_def_boolean(ot->srna, "cursor_transform", false, "Transform Cursor", "");
799 }
800
801 if ((flags & P_OPTIONS) && !(flags & P_NO_TEXSPACE)) {
802 prop = RNA_def_boolean(
803 ot->srna, "texture_space", false, "Edit Texture Space", "Edit object data texture space");
805 prop = RNA_def_boolean(
806 ot->srna, "remove_on_cancel", false, "Remove on Cancel", "Remove elements on cancel");
808 prop = RNA_def_boolean(ot->srna,
809 "use_duplicated_keyframes",
810 false,
811 "Duplicated Keyframes",
812 "Transform duplicated keyframes");
814 }
815
816 if (flags & P_CORRECT_UV) {
818 ot->srna, "correct_uv", true, "Correct UVs", "Correct UV coordinates when transforming");
819 }
820
821 if (flags & P_CENTER) {
822 /* For gizmos that define their own center. */
823 prop = RNA_def_property(ot->srna, "center_override", PROP_FLOAT, PROP_XYZ);
824 RNA_def_property_array(prop, 3);
826 RNA_def_property_ui_text(prop, "Center Override", "Force using this center value (when set)");
827 }
828
829 if (flags & P_VIEW2D_EDGE_PAN) {
830 prop = RNA_def_boolean(
831 ot->srna, "view2d_edge_pan", false, "Edge Pan", "Enable edge panning in 2D view");
833 }
834
835 if ((flags & P_NO_DEFAULTS) == 0) {
836 prop = RNA_def_boolean(ot->srna,
837 "release_confirm",
838 false,
839 "Confirm on Release",
840 "Always confirm operation when releasing button");
842
843 prop = RNA_def_boolean(
844 ot->srna, "use_accurate", false, "Accurate", "Use accurate transformation");
846 }
847
848 if (flags & P_POST_TRANSFORM) {
849 prop = RNA_def_boolean(ot->srna,
850 "use_automerge_and_split",
851 false,
852 "Auto Merge & Split",
853 "Forces the use of Auto Merge and Split");
855 }
856
857 if (flags & P_TRANSLATE_ORIGIN) {
858 prop = RNA_def_boolean(ot->srna,
859 "translate_origin",
860 false,
861 "Translate Origin",
862 "Translate origin instead of selection");
864 }
865}
866
868{
869 /* Identifiers. */
870 ot->name = "Move";
871 ot->description = "Move selected items";
872 ot->idname = OP_TRANSLATION;
874
875 /* API callbacks. */
876 ot->invoke = transform_invoke;
877 ot->exec = transform_exec;
878 ot->modal = transform_modal;
879 ot->cancel = transform_cancel;
881 ot->poll_property = transform_poll_property;
882
884 ot->srna, "value", 3, nullptr, -FLT_MAX, FLT_MAX, "Move", "", -FLT_MAX, FLT_MAX);
885
887
892}
893
895{
896 /* Identifiers. */
897 ot->name = "Resize";
898 ot->description = "Scale (resize) selected items";
899 ot->idname = OP_RESIZE;
901
902 /* API callbacks. */
903 ot->invoke = transform_invoke;
904 ot->exec = transform_exec;
905 ot->modal = transform_modal;
906 ot->cancel = transform_cancel;
908 ot->poll_property = transform_poll_property;
909
911 ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Scale", "", -FLT_MAX, FLT_MAX);
912
913 PropertyRNA *prop;
914 prop = RNA_def_float_vector(ot->srna,
915 "mouse_dir_constraint",
916 3,
917 VecZero,
918 -FLT_MAX,
919 FLT_MAX,
920 "Mouse Directional Constraint",
921 "",
922 -FLT_MAX,
923 FLT_MAX);
925
927
931}
932
934{
935 /* Identifiers. */
936 ot->name = "Skin Resize";
937 ot->description = "Scale selected vertices' skin radii";
938 ot->idname = OP_SKIN_RESIZE;
940
941 /* API callbacks. */
942 ot->invoke = transform_invoke;
943 ot->exec = transform_exec;
944 ot->modal = transform_modal;
945 ot->cancel = transform_cancel;
946 ot->poll = ED_operator_editmesh;
947 ot->poll_property = transform_poll_property;
948
950 ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Scale", "", -FLT_MAX, FLT_MAX);
951
953
957}
958
960{
961 /* Identifiers. */
962 ot->name = "Trackball";
963 ot->description = "Trackball style rotation of selected items";
964 ot->idname = OP_TRACKBALL;
966
967 /* API callbacks. */
968 ot->invoke = transform_invoke;
969 ot->exec = transform_exec;
970 ot->modal = transform_modal;
971 ot->cancel = transform_cancel;
973 ot->poll_property = transform_poll_property;
974
975 /* Maybe we could use float_vector_xyz here too? */
977 ot->srna, "value", 2, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -FLT_MAX, FLT_MAX);
978
980
982}
983
985{
986 /* Identifiers. */
987 ot->name = "Rotate";
988 ot->description = "Rotate selected items";
989 ot->idname = OP_ROTATION;
991
992 /* API callbacks. */
993 ot->invoke = transform_invoke;
994 ot->exec = transform_exec;
995 ot->modal = transform_modal;
996 ot->cancel = transform_cancel;
998 ot->poll_property = transform_poll_property;
999
1001 ot->srna, "value", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1002
1004
1008}
1009
1010static bool tilt_poll(bContext *C)
1011{
1012 Object *obedit = CTX_data_edit_object(C);
1013 if (!obedit) {
1014 return false;
1015 }
1016 if (obedit->type == OB_CURVES_LEGACY) {
1017 Curve *cu = (Curve *)obedit->data;
1018 return (cu->flag & CU_3D) && (nullptr != cu->editnurb);
1019 }
1020 if (obedit->type == OB_CURVES) {
1021 return true;
1022 }
1023 return true;
1024}
1025
1027{
1028 /* Identifiers. */
1029 ot->name = "Tilt";
1030 /* Optional -
1031 * "Tilt selected vertices"
1032 * "Specify an extra axis rotation for selected vertices of 3D curve". */
1033 ot->description = "Tilt selected control vertices of 3D curve";
1034 ot->idname = OP_TILT;
1036
1037 /* API callbacks. */
1038 ot->invoke = transform_invoke;
1039 ot->exec = transform_exec;
1040 ot->modal = transform_modal;
1041 ot->cancel = transform_cancel;
1042 ot->poll = tilt_poll;
1043 ot->poll_property = transform_poll_property;
1044
1046 ot->srna, "value", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1047
1049
1051}
1052
1054{
1055 /* Identifiers. */
1056 ot->name = "Bend";
1057 ot->description = "Bend selected items between the 3D cursor and the mouse";
1058 ot->idname = OP_BEND;
1059 /* Depend on cursor location because the cursor location is used to define the region to bend. */
1061
1062 /* API callbacks. */
1063 ot->invoke = transform_invoke;
1064 // ot->exec = transform_exec; /* Unsupported. */
1065 ot->modal = transform_modal;
1066 ot->cancel = transform_cancel;
1068 ot->poll_property = transform_poll_property;
1069
1071 ot->srna, "value", 1, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1072
1074
1076}
1077
1079{
1081 return false;
1082 }
1083
1084 ScrArea *area = CTX_wm_area(C);
1085 return area && !ELEM(area->spacetype, SPACE_ACTION);
1086}
1087
1089{
1090 /* Identifiers. */
1091 ot->name = "Shear";
1092 ot->description = "Shear selected items along the given axis";
1093 ot->idname = OP_SHEAR;
1095
1096 /* API callbacks. */
1097 ot->invoke = transform_invoke;
1098 ot->exec = transform_exec;
1099 ot->modal = transform_modal;
1100 ot->cancel = transform_cancel;
1101 ot->poll = transform_shear_poll;
1102 ot->poll_property = transform_poll_property;
1103
1104 RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
1105
1107
1111}
1112
1114{
1115 /* Identifiers. */
1116 ot->name = "Push/Pull";
1117 ot->description = "Push/Pull selected items";
1118 ot->idname = OP_PUSH_PULL;
1120
1121 /* API callbacks. */
1122 ot->invoke = transform_invoke;
1123 ot->exec = transform_exec;
1124 ot->modal = transform_modal;
1125 ot->cancel = transform_cancel;
1127 ot->poll_property = transform_poll_property;
1128
1129 RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Distance", "", -FLT_MAX, FLT_MAX);
1130
1132
1134}
1135
1137{
1138 /* Identifiers. */
1139 ot->name = "Shrink/Fatten";
1140 ot->description = "Shrink/fatten selected vertices along normals";
1141 ot->idname = OP_SHRINK_FATTEN;
1143
1144 /* API callbacks. */
1145 ot->invoke = transform_invoke;
1146 ot->exec = transform_exec;
1147 ot->modal = transform_modal;
1148 ot->cancel = transform_cancel;
1149 ot->poll = ED_operator_editmesh;
1150 ot->poll_property = transform_poll_property;
1151
1152 RNA_def_float_distance(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
1153
1154 RNA_def_boolean(ot->srna,
1155 "use_even_offset",
1156 false,
1157 "Offset Even",
1158 "Scale the offset to give more even thickness");
1159
1161
1163}
1164
1166{
1167 /* Identifiers. */
1168 ot->name = "To Sphere";
1169 ot->description = "Move selected items outward in a spherical shape around geometric center";
1170 ot->idname = OP_TOSPHERE;
1172
1173 /* API callbacks. */
1174 ot->invoke = transform_invoke;
1175 ot->exec = transform_exec;
1176 ot->modal = transform_modal;
1177 ot->cancel = transform_cancel;
1179 ot->poll_property = transform_poll_property;
1180
1181 RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1);
1182
1184
1186}
1187
1189{
1190 /* Identifiers. */
1191 ot->name = "Mirror";
1192 ot->description = "Mirror selected items around one or more axes";
1193 ot->idname = OP_MIRROR;
1195
1196 /* API callbacks. */
1197 ot->invoke = transform_invoke;
1198 ot->exec = transform_exec;
1199 ot->modal = transform_modal;
1200 ot->cancel = transform_cancel;
1202 ot->poll_property = transform_poll_property;
1203
1205}
1206
1208{
1209 /* Identifiers. */
1210 ot->name = "Scale B-Bone";
1211 ot->description = "Scale selected bendy bones display size";
1212 ot->idname = OP_BONE_SIZE;
1214
1215 /* API callbacks. */
1216 ot->invoke = transform_invoke;
1217 ot->exec = transform_exec;
1218 ot->modal = transform_modal;
1219 ot->cancel = transform_cancel;
1221 ot->poll_property = transform_poll_property;
1222
1224 ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Display Size", "", -FLT_MAX, FLT_MAX);
1225
1227
1229}
1230
1232{
1233 PropertyRNA *prop;
1234
1235 /* Identifiers. */
1236 ot->name = "Edge Slide";
1237 ot->description = "Slide an edge loop along a mesh";
1238 ot->idname = OP_EDGE_SLIDE;
1240
1241 /* API callbacks. */
1242 ot->invoke = transform_invoke;
1243 ot->exec = transform_exec;
1244 ot->modal = transform_modal;
1245 ot->cancel = transform_cancel;
1246 ot->poll = ED_operator_editmesh;
1247 ot->poll_property = transform_poll_property;
1248
1249 RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f);
1250
1251 prop = RNA_def_boolean(ot->srna, "single_side", false, "Single Side", "");
1253 RNA_def_boolean(ot->srna,
1254 "use_even",
1255 false,
1256 "Even",
1257 "Make the edge loop match the shape of the adjacent edge loop");
1258
1260
1261 RNA_def_boolean(ot->srna,
1262 "flipped",
1263 false,
1264 "Flipped",
1265 "When Even mode is active, flips between the two adjacent edge loops");
1266 RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
1267
1269}
1270
1272{
1273 /* Identifiers. */
1274 ot->name = "Vertex Slide";
1275 ot->description = "Slide a vertex along a mesh";
1276 ot->idname = OP_VERT_SLIDE;
1278
1279 /* API callbacks. */
1280 ot->invoke = transform_invoke;
1281 ot->exec = transform_exec;
1282 ot->modal = transform_modal;
1283 ot->cancel = transform_cancel;
1284 ot->poll = ED_operator_editmesh;
1285 ot->poll_property = transform_poll_property;
1286
1287 RNA_def_float_factor(ot->srna, "value", 0, -10.0f, 10.0f, "Factor", "", -1.0f, 1.0f);
1288 RNA_def_boolean(ot->srna,
1289 "use_even",
1290 false,
1291 "Even",
1292 "Make the edge loop match the shape of the adjacent edge loop");
1293
1295
1296 RNA_def_boolean(ot->srna,
1297 "flipped",
1298 false,
1299 "Flipped",
1300 "When Even mode is active, flips between the two adjacent edge loops");
1301 RNA_def_boolean(ot->srna, "use_clamp", true, "Clamp", "Clamp within the edge extents");
1302
1304}
1305
1307{
1308 /* Identifiers. */
1309 ot->name = "Edge Crease";
1310 ot->description = "Change the crease of edges";
1311 ot->idname = OP_EDGE_CREASE;
1313
1314 /* API callbacks. */
1315 ot->invoke = transform_invoke;
1316 ot->exec = transform_exec;
1317 ot->modal = transform_modal;
1318 ot->cancel = transform_cancel;
1319 ot->poll = ED_operator_editmesh;
1320 ot->poll_property = transform_poll_property;
1321
1322 RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
1323
1325
1327}
1328
1330{
1331 /* Identifiers. */
1332 ot->name = "Vertex Crease";
1333 ot->description = "Change the crease of vertices";
1334 ot->idname = OP_VERT_CREASE;
1336
1337 /* API callbacks. */
1338 ot->invoke = transform_invoke;
1339 ot->exec = transform_exec;
1340 ot->modal = transform_modal;
1341 ot->cancel = transform_cancel;
1342 ot->poll = ED_operator_editmesh;
1343 ot->poll_property = transform_poll_property;
1344
1345 RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
1346
1348
1350}
1351
1353{
1354 /* Identifiers. */
1355 ot->name = "Edge Bevel Weight";
1356 ot->description = "Change the bevel weight of edges";
1357 ot->idname = OP_EDGE_BWEIGHT;
1359
1360 /* API callbacks. */
1361 ot->invoke = transform_invoke;
1362 ot->exec = transform_exec;
1363 ot->modal = transform_modal;
1364 ot->cancel = transform_cancel;
1365 ot->poll = ED_operator_editmesh;
1366
1367 RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
1368
1370
1372}
1373
1375{
1376 /* Identifiers. */
1377 ot->name = "Sequence Slide";
1378 ot->description = "Slide a sequence strip in time";
1379 ot->idname = OP_SEQ_SLIDE;
1381
1382 /* API callbacks. */
1383 ot->invoke = transform_invoke;
1384 ot->exec = transform_exec;
1385 ot->modal = transform_modal;
1386 ot->cancel = transform_cancel;
1388
1389 /* Properties. */
1390 PropertyRNA *prop;
1391
1392 prop = RNA_def_float_vector(
1393 ot->srna, "value", 2, nullptr, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
1395
1396 prop = RNA_def_boolean(ot->srna,
1397 "use_restore_handle_selection",
1398 false,
1399 "Restore Handle Selection",
1400 "Restore handle selection after tweaking");
1402
1404
1406}
1407
1409{
1410 /* Identifiers. */
1411 ot->name = "Rotate Normals";
1412 ot->description = "Rotate custom normal of selected items";
1413 ot->idname = OP_NORMAL_ROTATION;
1415
1416 /* API callbacks. */
1417 ot->invoke = transform_invoke;
1418 ot->exec = transform_exec;
1419 ot->modal = transform_modal;
1420 ot->cancel = transform_cancel;
1421 ot->poll = ED_operator_editmesh;
1422 ot->poll_property = transform_poll_property;
1423
1425 ot->srna, "value", 0, nullptr, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI * 2, M_PI * 2);
1426
1428}
1429
1431{
1432 PropertyRNA *prop;
1433
1434 /* Identifiers. */
1435 ot->name = "Transform";
1436 ot->description = "Transform selected items by mode type";
1437 ot->idname = "TRANSFORM_OT_transform";
1439
1440 /* API callbacks. */
1441 ot->invoke = transform_invoke;
1442 ot->exec = transform_exec;
1443 ot->modal = transform_modal;
1444 ot->cancel = transform_cancel;
1446 ot->poll_property = transform_poll_property;
1447
1448 prop = RNA_def_enum(
1449 ot->srna, "mode", rna_enum_transform_mode_type_items, TFM_TRANSLATION, "Mode", "");
1451
1453 ot->srna, "value", 4, nullptr, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);
1454
1456
1460}
1461
1463 wmOperator * /*op*/,
1464 const wmEvent *event)
1465{
1467 if (tref) {
1468 ARegion *region = CTX_wm_region(C);
1469 wmGizmoMap *gzmap = region->runtime->gizmo_map;
1470 wmGizmoGroup *gzgroup = gzmap ? WM_gizmomap_group_find(gzmap, "VIEW3D_GGT_xform_gizmo") :
1471 nullptr;
1472 if (gzgroup != nullptr) {
1473 PointerRNA gzg_ptr;
1475 const int drag_action = RNA_enum_get(&gzg_ptr, "drag_action");
1476 const char *op_id = nullptr;
1477 switch (drag_action) {
1479 op_id = "TRANSFORM_OT_translate";
1480 break;
1482 op_id = "TRANSFORM_OT_rotate";
1483 break;
1485 op_id = "TRANSFORM_OT_resize";
1486 break;
1487 default:
1488 break;
1489 }
1490 if (op_id) {
1491 wmOperatorType *ot = WM_operatortype_find(op_id, true);
1492 PointerRNA op_ptr;
1494 RNA_boolean_set(&op_ptr, "release_confirm", true);
1497 return OPERATOR_FINISHED;
1498 }
1499 }
1500 }
1501 return OPERATOR_PASS_THROUGH;
1502}
1503
1504/* Use with 'TRANSFORM_GGT_gizmo'. */
1506{
1507 /* Identifiers. */
1508 ot->name = "Transform from Gizmo";
1509 ot->description = "Transform selected items by mode type";
1510 ot->idname = "TRANSFORM_OT_from_gizmo";
1511 ot->flag = 0;
1512
1513 /* API callbacks. */
1516}
1517
1534
1536{
1537 wmKeyMap *modalmap = transform_modal_keymap(keyconf);
1538
1539 TransformModeItem *tmode;
1540
1541 for (tmode = transform_modes; tmode->idname; tmode++) {
1542 WM_modalkeymap_assign(modalmap, tmode->idname);
1543 }
1544 WM_modalkeymap_assign(modalmap, "TRANSFORM_OT_transform");
1545}
1546
1547} // 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)
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
void BKE_scene_orientation_slot_set_index(TransformOrientationSlot *orient_slot, int orientation)
Definition scene.cc:2425
#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
#define MAX_NAME
Definition DNA_defs.h:50
Object is a sort of wrapper for general info.
@ OB_CURVES_LEGACY
@ OB_CURVES
@ SCE_ORIENT_DEFAULT
@ SCE_SELECT_FACE
@ SCE_SELECT_VERTEX
@ SCE_SELECT_EDGE
@ SCE_SNAP_TO_INCREMENT
@ SPACE_ACTION
@ SPACE_NLA
@ SPACE_VIEW3D
@ RV3D_NAVIGATING
@ V3D_GIZMO_SHOW_OBJECT_ROTATE
@ V3D_GIZMO_SHOW_OBJECT_SCALE
@ V3D_GIZMO_SHOW_OBJECT_TRANSLATE
@ V3D_ORIENT_CUSTOM
@ 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)
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_active_screen_and_scene(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:164
@ PROP_ENUM
Definition RNA_types.hh:166
@ PROP_SKIP_SAVE
Definition RNA_types.hh:344
@ PROP_HIDDEN
Definition RNA_types.hh:338
@ PROP_XYZ
Definition RNA_types.hh:269
@ PROP_NONE
Definition RNA_types.hh:233
#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)
#define WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgroup, r_ptr)
#define NC_SCENE
Definition WM_types.hh:378
@ 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 ND_TOOLSETTINGS
Definition WM_types.hh:449
#define NA_EDITED
Definition WM_types.hh:584
#define ND_TRANSFORM
Definition WM_types.hh:456
#define ND_SPACE_VIEW3D
Definition WM_types.hh:528
#define NC_OBJECT
Definition WM_types.hh:379
#define NC_SPACE
Definition WM_types.hh:392
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
const char * name
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)
std::string RNA_string_get(PointerRNA *ptr, const char *name)
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_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
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:150
#define FLT_MAX
Definition stdcycles.h:14
void * regiondata
ARegionRuntimeHandle * runtime
EditNurb * editnurb
struct ToolSettings * toolsettings
TransformOrientationSlot orientation_slots[4]
void op_enum(blender::StringRefNull opname, blender::StringRefNull propname, IDProperty *properties, blender::wm::OpCallContext context, eUI_Item_Flag flag, const int active=-1)
wmEventType type
Definition WM_types.hh:757
int mval[2]
Definition WM_types.hh:763
wmGizmoGroupType * type
const char * name
Definition WM_types.hh:1033
const char * idname
Definition WM_types.hh:1035
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:305
wmOperatorStatus WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, blender::wm::OpCallContext context, PointerRNA *properties, const wmEvent *event)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
@ NDOF_MOTION
wmOperatorType * ot
Definition wm_files.cc:4237
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)