Blender V5.0
editmesh_inset.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_object_types.h"
12
13#include "BLI_math_matrix.h"
14#include "BLI_math_vector.h"
15#include "BLI_string_utf8.h"
16
17#include "BLT_translation.hh"
18
19#include "BKE_context.hh"
20#include "BKE_editmesh.hh"
21#include "BKE_global.hh"
22#include "BKE_layer.hh"
23#include "BKE_screen.hh"
24#include "BKE_unit.hh"
25
26#include "RNA_access.hh"
27#include "RNA_define.hh"
28
29#include "WM_api.hh"
30#include "WM_types.hh"
31
32#include "UI_interface.hh"
33
34#include "ED_mesh.hh"
35#include "ED_numinput.hh"
36#include "ED_screen.hh"
37#include "ED_space_api.hh"
38#include "ED_transform.hh"
39#include "ED_util.hh"
40#include "ED_view3d.hh"
41
42#include "mesh_intern.hh" /* own include */
43
44using blender::Vector;
45
51
52struct InsetData {
54 float old_depth;
57 float pixel_size; /* use when mouse input is interpreted as spatial distance */
59 bool shift;
63
66
67 /* modal only */
69 float mcenter[2];
71};
72
74{
75 InsetData *opdata = static_cast<InsetData *>(op->customdata);
76 ScrArea *area = CTX_wm_area(C);
77 Scene *sce = CTX_data_scene(C);
78
79 if (area) {
80 char msg[UI_MAX_DRAW_STR];
81 char flts_str[NUM_STR_REP_LEN * 2];
82 if (hasNumInput(&opdata->num_input)) {
83 outputNumInput(&opdata->num_input, flts_str, sce->unit);
84 }
85 else {
88 RNA_float_get(op->ptr, "thickness"),
89 -4,
91 sce->unit,
92 true);
95 RNA_float_get(op->ptr, "depth"),
96 -4,
98 sce->unit,
99 true);
100 }
101 SNPRINTF_UTF8(msg, IFACE_("Thickness: %s, Depth: %s"), flts_str, flts_str + NUM_STR_REP_LEN);
102 ED_area_status_text(area, msg);
103 }
104
106 status.item(IFACE_("Confirm"), ICON_EVENT_RETURN, ICON_MOUSE_LMB);
107 status.item(IFACE_("Cancel"), ICON_EVENT_ESC, ICON_MOUSE_RMB);
108 status.item_bool(IFACE_("Depth"), opdata->modify_depth, ICON_EVENT_CTRL);
109 status.item_bool(IFACE_("Outset"), RNA_boolean_get(op->ptr, "use_outset"), ICON_EVENT_O);
110 status.item_bool(IFACE_("Boundary"), RNA_boolean_get(op->ptr, "use_boundary"), ICON_EVENT_B);
111 status.item_bool(IFACE_("Individual"), RNA_boolean_get(op->ptr, "use_individual"), ICON_EVENT_I);
112}
113
114static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
115{
116 InsetData *opdata;
117 Scene *scene = CTX_data_scene(C);
118 ViewLayer *view_layer = CTX_data_view_layer(C);
119
120 if (is_modal) {
121 RNA_float_set(op->ptr, "thickness", 0.0f);
122 RNA_float_set(op->ptr, "depth", 0.0f);
123 }
124
125 op->customdata = opdata = MEM_mallocN<InsetData>("inset_operator_data");
126
127 uint objects_used_len = 0;
128
129 opdata->max_obj_scale = FLT_MIN;
130
131 {
133 scene, view_layer, CTX_wm_view3d(C));
134 opdata->ob_store = static_cast<InsetObjectStore *>(
135 MEM_malloc_arrayN(objects.size(), sizeof(*opdata->ob_store), __func__));
136 for (uint ob_index = 0; ob_index < objects.size(); ob_index++) {
137 Object *obedit = objects[ob_index];
138 float scale = mat4_to_scale(obedit->object_to_world().ptr());
139 opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale);
141 if (em->bm->totvertsel > 0) {
142 opdata->ob_store[objects_used_len].ob = obedit;
143 objects_used_len++;
144 }
145 }
146 opdata->ob_store_len = objects_used_len;
147 }
148
149 opdata->old_thickness = 0.0;
150 opdata->old_depth = 0.0;
151 opdata->modify_depth = false;
152 opdata->shift = false;
153 opdata->shift_amount = 0.0f;
154 opdata->is_modal = is_modal;
155
156 initNumInput(&opdata->num_input);
157 opdata->num_input.idx_max = 1; /* Two elements. */
158 opdata->num_input.unit_sys = scene->unit.system;
159 opdata->num_input.unit_type[0] = B_UNIT_LENGTH;
160 opdata->num_input.unit_type[1] = B_UNIT_LENGTH;
161
162 if (is_modal) {
163 ARegion *region = CTX_wm_region(C);
164
165 for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
166 Object *obedit = opdata->ob_store[ob_index].ob;
168 opdata->ob_store[ob_index].mesh_backup = EDBM_redo_state_store(em);
169 }
170
173 opdata->mcenter,
175 G.moving = G_TRANSFORM_EDIT;
176 }
177
178 return true;
179}
180
182{
183 InsetData *opdata;
184 ScrArea *area = CTX_wm_area(C);
185
186 opdata = static_cast<InsetData *>(op->customdata);
187
188 if (opdata->is_modal) {
189 ARegion *region = CTX_wm_region(C);
190 for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
191 EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup);
192 }
193 ED_region_draw_cb_exit(region->runtime->type, opdata->draw_handle_pixel);
194 G.moving = 0;
195 }
196
197 if (area) {
198 ED_area_status_text(area, nullptr);
199 }
200 ED_workspace_status_text(C, nullptr);
201
202 MEM_SAFE_FREE(opdata->ob_store);
203 MEM_freeN(opdata);
204 op->customdata = nullptr;
205}
206
208{
209 InsetData *opdata = static_cast<InsetData *>(op->customdata);
210 if (opdata->is_modal) {
211 for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
212 Object *obedit = opdata->ob_store[ob_index].ob;
214 EDBM_redo_state_restore_and_free(&opdata->ob_store[ob_index].mesh_backup, em, true);
216 params.calc_looptris = false;
217 params.calc_normals = false;
218 params.is_destructive = true;
219 EDBM_update(static_cast<Mesh *>(obedit->data), &params);
220 }
221 }
222
223 edbm_inset_exit(C, op);
224
225 /* need to force redisplay or we may still view the modified result */
227}
228
230{
231 InsetData *opdata;
232 BMOperator bmop;
233 bool changed = false;
234
235 const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
236 const bool use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
237 const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
238 const bool use_edge_rail = RNA_boolean_get(op->ptr, "use_edge_rail");
239 const float thickness = RNA_float_get(op->ptr, "thickness");
240 const float depth = RNA_float_get(op->ptr, "depth");
241 const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
242 /* not passed onto the BMO */
243 const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset");
244 const bool use_individual = RNA_boolean_get(op->ptr, "use_individual");
245 const bool use_interpolate = RNA_boolean_get(op->ptr, "use_interpolate");
246
247 opdata = static_cast<InsetData *>(op->customdata);
248
249 for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
250 Object *obedit = opdata->ob_store[ob_index].ob;
252
253 if (opdata->is_modal) {
254 EDBM_redo_state_restore(&opdata->ob_store[ob_index].mesh_backup, em, false);
255 }
256
257 if (use_individual) {
258 EDBM_op_init(em,
259 &bmop,
260 op,
261 "inset_individual faces=%hf use_even_offset=%b use_relative_offset=%b "
262 "use_interpolate=%b thickness=%f depth=%f",
264 use_even_offset,
265 use_relative_offset,
266 use_interpolate,
267 thickness,
268 depth);
269 }
270 else {
272 em,
273 &bmop,
274 op,
275 "inset_region faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b "
276 "use_interpolate=%b thickness=%f depth=%f use_outset=%b use_edge_rail=%b",
278 use_boundary,
279 use_even_offset,
280 use_relative_offset,
281 use_interpolate,
282 thickness,
283 depth,
284 use_outset,
285 use_edge_rail);
286
287 if (use_outset) {
289 em->bm, &bmop, bmop.slots_in, "faces_exclude", BM_FACE, BM_ELEM_HIDDEN);
290 }
291 }
292 BMO_op_exec(em->bm, &bmop);
293
294 if (use_select_inset) {
295 /* deselect original faces/verts */
298 em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
299 }
300 else {
303 }
304
305 if (!EDBM_op_finish(em, &bmop, op, true)) {
306 continue;
307 }
308
310 params.calc_looptris = true;
311 params.calc_normals = false;
312 params.is_destructive = true;
313 EDBM_update(static_cast<Mesh *>(obedit->data), &params);
314 changed = true;
315 }
316 return changed;
317}
318
320{
321 if (!edbm_inset_init(C, op, false)) {
322 return OPERATOR_CANCELLED;
323 }
324
325 if (!edbm_inset_calc(op)) {
326 edbm_inset_exit(C, op);
327 return OPERATOR_CANCELLED;
328 }
329
330 edbm_inset_exit(C, op);
331 return OPERATOR_FINISHED;
332}
333
335{
337 InsetData *opdata;
338 float mlen[2];
339 float center_3d[3];
340
341 if (!edbm_inset_init(C, op, true)) {
342 return OPERATOR_CANCELLED;
343 }
344
345 opdata = static_cast<InsetData *>(op->customdata);
346
348
349 /* initialize mouse values */
351 C, V3D_AROUND_CENTER_MEDIAN, center_3d, opdata->mcenter))
352 {
353 /* in this case the tool will likely do nothing,
354 * ideally this will never happen and should be checked for above */
355 opdata->mcenter[0] = opdata->mcenter[1] = 0;
356 }
357 mlen[0] = opdata->mcenter[0] - event->mval[0];
358 mlen[1] = opdata->mcenter[1] - event->mval[1];
359 opdata->initial_length = len_v2(mlen);
360 opdata->pixel_size = rv3d ? ED_view3d_pixel_size(rv3d, center_3d) : 1.0f;
361
362 edbm_inset_calc(op);
363
365
368}
369
371{
372 InsetData *opdata = static_cast<InsetData *>(op->customdata);
373 const bool has_numinput = hasNumInput(&opdata->num_input);
374
375 /* Modal numinput active, try to handle numeric inputs first... */
376 if (event->val == KM_PRESS && has_numinput && handleNumInput(C, &opdata->num_input, event)) {
377 float amounts[2] = {RNA_float_get(op->ptr, "thickness"), RNA_float_get(op->ptr, "depth")};
378 applyNumInput(&opdata->num_input, amounts);
379 amounts[0] = max_ff(amounts[0], 0.0f);
380 RNA_float_set(op->ptr, "thickness", amounts[0]);
381 RNA_float_set(op->ptr, "depth", amounts[1]);
382
383 if (edbm_inset_calc(op)) {
386 }
387 edbm_inset_cancel(C, op);
388 return OPERATOR_CANCELLED;
389 }
390 if ((event->type == opdata->launch_event) && (event->val == KM_RELEASE) &&
391 RNA_boolean_get(op->ptr, "release_confirm"))
392 {
393 edbm_inset_calc(op);
394 edbm_inset_exit(C, op);
395 return OPERATOR_FINISHED;
396 }
397
398 bool handled = false;
399 switch (event->type) {
400 case EVT_ESCKEY:
401 case RIGHTMOUSE:
402 edbm_inset_cancel(C, op);
403 return OPERATOR_CANCELLED;
404
405 case MOUSEMOVE:
406 if (!has_numinput) {
407 float mdiff[2];
408 float amount;
409
410 mdiff[0] = opdata->mcenter[0] - event->mval[0];
411 mdiff[1] = opdata->mcenter[1] - event->mval[1];
412
413 if (opdata->modify_depth) {
414 amount = opdata->old_depth +
415 ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) /
416 opdata->max_obj_scale;
417 }
418 else {
419 amount = opdata->old_thickness -
420 ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) /
421 opdata->max_obj_scale;
422 }
423
424 /* Fake shift-transform... */
425 if (opdata->shift) {
426 amount = (amount - opdata->shift_amount) * 0.1f + opdata->shift_amount;
427 }
428
429 if (opdata->modify_depth) {
430 RNA_float_set(op->ptr, "depth", amount);
431 }
432 else {
433 amount = max_ff(amount, 0.0f);
434 RNA_float_set(op->ptr, "thickness", amount);
435 }
436
437 if (edbm_inset_calc(op)) {
439 }
440 else {
441 edbm_inset_cancel(C, op);
442 return OPERATOR_CANCELLED;
443 }
444 handled = true;
445 }
446 break;
447
448 case LEFTMOUSE:
449 case EVT_PADENTER:
450 case EVT_RETKEY:
451 if ((event->val == KM_PRESS) ||
452 ((event->val == KM_RELEASE) && RNA_boolean_get(op->ptr, "release_confirm")))
453 {
454 edbm_inset_calc(op);
455 edbm_inset_exit(C, op);
456 return OPERATOR_FINISHED;
457 }
458 break;
459 case EVT_LEFTSHIFTKEY:
461 if (event->val == KM_PRESS) {
462 if (opdata->modify_depth) {
463 opdata->shift_amount = RNA_float_get(op->ptr, "depth");
464 }
465 else {
466 opdata->shift_amount = RNA_float_get(op->ptr, "thickness");
467 }
468 opdata->shift = true;
469 handled = true;
470 }
471 else {
472 opdata->shift_amount = 0.0f;
473 opdata->shift = false;
474 handled = true;
475 }
476 break;
477
478 case EVT_LEFTCTRLKEY:
479 case EVT_RIGHTCTRLKEY: {
480 float mlen[2];
481
482 mlen[0] = opdata->mcenter[0] - event->mval[0];
483 mlen[1] = opdata->mcenter[1] - event->mval[1];
484
485 if (event->val == KM_PRESS) {
486 opdata->old_thickness = RNA_float_get(op->ptr, "thickness");
487 if (opdata->shift) {
488 opdata->shift_amount = opdata->old_thickness;
489 }
490 opdata->modify_depth = true;
491 }
492 else {
493 opdata->old_depth = RNA_float_get(op->ptr, "depth");
494 if (opdata->shift) {
495 opdata->shift_amount = opdata->old_depth;
496 }
497 opdata->modify_depth = false;
498 }
499 opdata->initial_length = len_v2(mlen);
500
502 handled = true;
503 break;
504 }
505
506 case EVT_OKEY:
507 if (event->val == KM_PRESS) {
508 const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
509 RNA_boolean_set(op->ptr, "use_outset", !use_outset);
510 if (edbm_inset_calc(op)) {
512 }
513 else {
514 edbm_inset_cancel(C, op);
515 return OPERATOR_CANCELLED;
516 }
517 handled = true;
518 }
519 break;
520 case EVT_BKEY:
521 if (event->val == KM_PRESS) {
522 const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
523 RNA_boolean_set(op->ptr, "use_boundary", !use_boundary);
524 if (edbm_inset_calc(op)) {
526 }
527 else {
528 edbm_inset_cancel(C, op);
529 return OPERATOR_CANCELLED;
530 }
531 handled = true;
532 }
533 break;
534 case EVT_IKEY:
535 if (event->val == KM_PRESS) {
536 const bool use_individual = RNA_boolean_get(op->ptr, "use_individual");
537 RNA_boolean_set(op->ptr, "use_individual", !use_individual);
538 if (edbm_inset_calc(op)) {
540 }
541 else {
542 edbm_inset_cancel(C, op);
543 return OPERATOR_CANCELLED;
544 }
545 handled = true;
546 }
547 break;
548 default: {
549 break;
550 }
551 }
552
553 /* Modal numinput inactive, try to handle numeric inputs last... */
554 if (!handled && event->val == KM_PRESS && handleNumInput(C, &opdata->num_input, event)) {
555 float amounts[2] = {RNA_float_get(op->ptr, "thickness"), RNA_float_get(op->ptr, "depth")};
556 applyNumInput(&opdata->num_input, amounts);
557 amounts[0] = max_ff(amounts[0], 0.0f);
558 RNA_float_set(op->ptr, "thickness", amounts[0]);
559 RNA_float_set(op->ptr, "depth", amounts[1]);
560
561 if (edbm_inset_calc(op)) {
564 }
565 edbm_inset_cancel(C, op);
566 return OPERATOR_CANCELLED;
567 }
568
570}
571
573{
574 PropertyRNA *prop;
575
576 /* identifiers */
577 ot->name = "Inset Faces";
578 ot->idname = "MESH_OT_inset";
579 ot->description = "Inset new faces into selected faces";
580
581 /* API callbacks. */
582 ot->invoke = edbm_inset_invoke;
583 ot->modal = edbm_inset_modal;
584 ot->exec = edbm_inset_exec;
585 ot->cancel = edbm_inset_cancel;
586 ot->poll = ED_operator_editmesh;
587
588 /* flags */
590
591 /* properties */
592 RNA_def_boolean(ot->srna, "use_boundary", true, "Boundary", "Inset face boundaries");
593 RNA_def_boolean(ot->srna,
594 "use_even_offset",
595 true,
596 "Offset Even",
597 "Scale the offset to give more even thickness");
598 RNA_def_boolean(ot->srna,
599 "use_relative_offset",
600 false,
601 "Offset Relative",
602 "Scale the offset by surrounding geometry");
604 ot->srna, "use_edge_rail", false, "Edge Rail", "Inset the region along existing edges");
605
607 ot->srna, "thickness", 0.0f, 0.0f, 1e12f, "Thickness", "", 0.0f, 10.0f);
608 /* use 1 rather than 10 for max else dragging the button moves too far */
609 RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
610
612 ot->srna, "depth", 0.0f, -1e12f, 1e12f, "Depth", "", -10.0f, 10.0f);
613 RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.01, 4);
614
615 RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset");
617 ot->srna, "use_select_inset", false, "Select Outer", "Select the new inset faces");
618 RNA_def_boolean(ot->srna, "use_individual", false, "Individual", "Individual face inset");
620 ot->srna, "use_interpolate", true, "Interpolate", "Blend face data across the inset");
621
622 prop = RNA_def_boolean(ot->srna, "release_confirm", false, "Confirm on Release", "");
624}
ScrArea * CTX_wm_area(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
BMEditMesh * BKE_editmesh_from_object(Object *ob)
Return the BMEditMesh for a given object.
Definition editmesh.cc:61
@ G_TRANSFORM_EDIT
blender::Vector< Object * > BKE_view_layer_array_from_objects_in_edit_mode_unique_data(const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
@ B_UNIT_LENGTH
Definition BKE_unit.hh:137
size_t BKE_unit_value_as_string(char *str, int str_maxncpy, double value, int prec, int type, const UnitSettings &settings, bool pad)
Definition unit.cc:1882
MINLINE float max_ff(float a, float b)
float mat4_to_scale(const float mat[4][4])
MINLINE float len_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
#define SNPRINTF_UTF8(dst, format,...)
unsigned int uint
#define IFACE_(msgid)
Object is a sort of wrapper for general info.
@ V3D_AROUND_CENTER_MEDIAN
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
void EDBM_flag_disable_all(BMEditMesh *em, char hflag)
void void EDBM_redo_state_restore_and_free(BMBackup *backup, BMEditMesh *em, bool recalc_looptris) ATTR_NONNULL(1
void EDBM_update(Mesh *mesh, const EDBMUpdate_Params *params)
void void void EDBM_redo_state_free(BMBackup *backup) ATTR_NONNULL(1)
BMBackup EDBM_redo_state_store(BMEditMesh *em)
void EDBM_redo_state_restore(BMBackup *backup, BMEditMesh *em, bool recalc_looptris) ATTR_NONNULL(1
void initNumInput(NumInput *n)
Definition numinput.cc:70
#define NUM_STR_REP_LEN
bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
Definition numinput.cc:312
bool applyNumInput(NumInput *n, float *vec)
Definition numinput.cc:190
void outputNumInput(NumInput *n, char *str, const UnitSettings &unit_settings)
Definition numinput.cc:88
bool hasNumInput(const NumInput *n)
Definition numinput.cc:171
void ED_area_status_text(ScrArea *area, const char *str)
Definition area.cc:851
void ED_workspace_status_text(bContext *C, const char *str)
Definition area.cc:1024
bool ED_operator_editmesh(bContext *C)
void ED_region_tag_redraw(ARegion *region)
Definition area.cc:618
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
#define REGION_DRAW_POST_PIXEL
void ED_region_draw_mouse_line_cb(const bContext *C, ARegion *region, void *arg_info)
Definition ed_draw.cc:662
float ED_view3d_pixel_size(const RegionView3D *rv3d, const float co[3])
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
@ PROP_SKIP_SAVE
Definition RNA_types.hh:344
@ PROP_HIDDEN
Definition RNA_types.hh:338
#define C
Definition RandGen.cpp:29
#define UI_MAX_DRAW_STR
@ KM_PRESS
Definition WM_types.hh:311
@ KM_RELEASE
Definition WM_types.hh:312
@ OPTYPE_BLOCKING
Definition WM_types.hh:184
@ OPTYPE_UNDO
Definition WM_types.hh:182
@ OPTYPE_GRAB_CURSOR_XY
Definition WM_types.hh:188
@ OPTYPE_REGISTER
Definition WM_types.hh:180
@ BM_ELEM_HIDDEN
@ BM_ELEM_SELECT
#define BM_FACE
void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, char hflag, bool do_flush)
BMO_FLAG_BUFFER.
void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, char htype, char hflag)
void BMO_op_exec(BMesh *bm, BMOperator *op)
BMESH OPSTACK EXEC OP.
int64_t size() const
static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
static wmOperatorStatus edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void edbm_inset_cancel(bContext *C, wmOperator *op)
static void edbm_inset_exit(bContext *C, wmOperator *op)
static wmOperatorStatus edbm_inset_exec(bContext *C, wmOperator *op)
void MESH_OT_inset(wmOperatorType *ot)
static void edbm_inset_update_header(wmOperator *op, bContext *C)
static wmOperatorStatus edbm_inset_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool edbm_inset_calc(wmOperator *op)
bool EDBM_op_init(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const char *fmt,...)
bool EDBM_op_finish(BMEditMesh *em, BMOperator *bmop, wmOperator *op, const bool do_report)
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void * MEM_mallocN(size_t len, const char *str)
Definition mallocn.cc:128
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
Definition mallocn.cc:133
void MEM_freeN(void *vmemh)
Definition mallocn.cc:113
#define G(x, y, z)
bool calculateTransformCenter(bContext *C, int centerMode, float cent3d[3], float cent2d[2])
const int status
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
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_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
ARegionRuntimeHandle * runtime
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
int totvertsel
float initial_length
float shift_amount
float mcenter[2]
float old_thickness
NumInput num_input
float max_obj_scale
InsetObjectStore * ob_store
void * draw_handle_pixel
short idx_max
int unit_type[NUM_MAX_ELEMENTS]
struct UnitSettings unit
wmEventType type
Definition WM_types.hh:757
short val
Definition WM_types.hh:759
struct PointerRNA * ptr
int WM_userdef_event_type_from_keymap_type(int kmitype)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
@ RIGHTMOUSE
@ EVT_OKEY
@ EVT_RIGHTCTRLKEY
@ EVT_IKEY
@ EVT_LEFTCTRLKEY
@ EVT_PADENTER
@ MOUSEMOVE
@ LEFTMOUSE
@ EVT_ESCKEY
@ EVT_RIGHTSHIFTKEY
@ EVT_LEFTSHIFTKEY
@ EVT_BKEY
@ EVT_RETKEY
wmOperatorType * ot
Definition wm_files.cc:4237