Blender  V2.93
editmesh_inset.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  */
16 
21 #include "MEM_guardedalloc.h"
22 
23 #include "DNA_object_types.h"
24 
25 #include "BLI_math.h"
26 #include "BLI_string.h"
27 
28 #include "BLT_translation.h"
29 
30 #include "BKE_context.h"
31 #include "BKE_editmesh.h"
32 #include "BKE_global.h"
33 #include "BKE_layer.h"
34 #include "BKE_unit.h"
35 
36 #include "RNA_access.h"
37 #include "RNA_define.h"
38 
39 #include "WM_api.h"
40 #include "WM_types.h"
41 
42 #include "UI_interface.h"
43 
44 #include "ED_mesh.h"
45 #include "ED_numinput.h"
46 #include "ED_screen.h"
47 #include "ED_space_api.h"
48 #include "ED_transform.h"
49 #include "ED_util.h"
50 #include "ED_view3d.h"
51 
52 #include "mesh_intern.h" /* own include */
53 
54 typedef struct {
59 
60 typedef struct {
62  float old_depth;
65  float pixel_size; /* use when mouse input is interpreted as spatial distance */
66  bool is_modal;
67  bool shift;
68  float shift_amount;
71 
74 
75  /* modal only */
77  float mcenter[2];
79  short gizmo_flag;
80 } InsetData;
81 
83 {
84  InsetData *opdata = op->customdata;
85 
86  const char *str = TIP_(
87  "Confirm: Enter/LClick, Cancel: (Esc/RClick), Thickness: %s, "
88  "Depth (Ctrl to tweak): %s (%s), Outset (O): (%s), Boundary (B): (%s), Individual (I): "
89  "(%s)");
90 
91  char msg[UI_MAX_DRAW_STR];
93  Scene *sce = CTX_data_scene(C);
94 
95  if (area) {
96  char flts_str[NUM_STR_REP_LEN * 2];
97  if (hasNumInput(&opdata->num_input)) {
98  outputNumInput(&opdata->num_input, flts_str, &sce->unit);
99  }
100  else {
101  BKE_unit_value_as_string(flts_str,
103  RNA_float_get(op->ptr, "thickness"),
104  4,
106  &sce->unit,
107  true);
110  RNA_float_get(op->ptr, "depth"),
111  4,
113  &sce->unit,
114  true);
115  }
116  BLI_snprintf(msg,
117  sizeof(msg),
118  str,
119  flts_str,
120  flts_str + NUM_STR_REP_LEN,
122  WM_bool_as_string(RNA_boolean_get(op->ptr, "use_outset")),
123  WM_bool_as_string(RNA_boolean_get(op->ptr, "use_boundary")),
124  WM_bool_as_string(RNA_boolean_get(op->ptr, "use_individual")));
125 
127  }
128 }
129 
130 static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
131 {
132  InsetData *opdata;
134  ViewLayer *view_layer = CTX_data_view_layer(C);
135 
136  if (is_modal) {
137  RNA_float_set(op->ptr, "thickness", 0.0f);
138  RNA_float_set(op->ptr, "depth", 0.0f);
139  }
140 
141  op->customdata = opdata = MEM_mallocN(sizeof(InsetData), "inset_operator_data");
142 
143  uint objects_used_len = 0;
144 
145  opdata->max_obj_scale = FLT_MIN;
146 
147  {
148  uint ob_store_len = 0;
150  view_layer, CTX_wm_view3d(C), &ob_store_len);
151  opdata->ob_store = MEM_malloc_arrayN(ob_store_len, sizeof(*opdata->ob_store), __func__);
152  for (uint ob_index = 0; ob_index < ob_store_len; ob_index++) {
153  Object *obedit = objects[ob_index];
154  float scale = mat4_to_scale(obedit->obmat);
155  opdata->max_obj_scale = max_ff(opdata->max_obj_scale, scale);
156  BMEditMesh *em = BKE_editmesh_from_object(obedit);
157  if (em->bm->totvertsel > 0) {
158  opdata->ob_store[objects_used_len].ob = obedit;
159  objects_used_len++;
160  }
161  }
162  MEM_freeN(objects);
163  opdata->ob_store_len = objects_used_len;
164  }
165 
166  opdata->old_thickness = 0.0;
167  opdata->old_depth = 0.0;
168  opdata->modify_depth = false;
169  opdata->shift = false;
170  opdata->shift_amount = 0.0f;
171  opdata->is_modal = is_modal;
172 
173  initNumInput(&opdata->num_input);
174  opdata->num_input.idx_max = 1; /* Two elements. */
175  opdata->num_input.unit_sys = scene->unit.system;
176  opdata->num_input.unit_type[0] = B_UNIT_LENGTH;
177  opdata->num_input.unit_type[1] = B_UNIT_LENGTH;
178 
179  if (is_modal) {
180  View3D *v3d = CTX_wm_view3d(C);
181  ARegion *region = CTX_wm_region(C);
182 
183  for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
184  Object *obedit = opdata->ob_store[ob_index].ob;
185  BMEditMesh *em = BKE_editmesh_from_object(obedit);
186  opdata->ob_store[ob_index].mesh_backup = EDBM_redo_state_store(em);
187  }
188 
191  G.moving = G_TRANSFORM_EDIT;
192  if (v3d) {
193  opdata->gizmo_flag = v3d->gizmo_flag;
194  v3d->gizmo_flag = V3D_GIZMO_HIDE;
195  }
196  }
197 
198  return true;
199 }
200 
202 {
203  InsetData *opdata;
205 
206  opdata = op->customdata;
207 
208  if (opdata->is_modal) {
209  View3D *v3d = CTX_wm_view3d(C);
210  ARegion *region = CTX_wm_region(C);
211  for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
212  EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup, NULL, false);
213  }
215  if (v3d) {
216  v3d->gizmo_flag = opdata->gizmo_flag;
217  }
218  G.moving = 0;
219  }
220 
221  if (area) {
223  }
224 
225  MEM_SAFE_FREE(opdata->ob_store);
227 }
228 
230 {
231  InsetData *opdata;
232 
233  opdata = op->customdata;
234  if (opdata->is_modal) {
235  for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
236  Object *obedit = opdata->ob_store[ob_index].ob;
237  BMEditMesh *em = BKE_editmesh_from_object(obedit);
238  EDBM_redo_state_free(&opdata->ob_store[ob_index].mesh_backup, em, true);
239  EDBM_update_generic(obedit->data, false, true);
240  }
241  }
242 
243  edbm_inset_exit(C, op);
244 
245  /* need to force redisplay or we may still view the modified result */
247 }
248 
249 static bool edbm_inset_calc(wmOperator *op)
250 {
251  InsetData *opdata;
252  BMOperator bmop;
253  bool changed = false;
254 
255  const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
256  const bool use_even_offset = RNA_boolean_get(op->ptr, "use_even_offset");
257  const bool use_relative_offset = RNA_boolean_get(op->ptr, "use_relative_offset");
258  const bool use_edge_rail = RNA_boolean_get(op->ptr, "use_edge_rail");
259  const float thickness = RNA_float_get(op->ptr, "thickness");
260  const float depth = RNA_float_get(op->ptr, "depth");
261  const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
262  /* not passed onto the BMO */
263  const bool use_select_inset = RNA_boolean_get(op->ptr, "use_select_inset");
264  const bool use_individual = RNA_boolean_get(op->ptr, "use_individual");
265  const bool use_interpolate = RNA_boolean_get(op->ptr, "use_interpolate");
266 
267  opdata = op->customdata;
268 
269  for (uint ob_index = 0; ob_index < opdata->ob_store_len; ob_index++) {
270  Object *obedit = opdata->ob_store[ob_index].ob;
271  BMEditMesh *em = BKE_editmesh_from_object(obedit);
272 
273  if (opdata->is_modal) {
274  EDBM_redo_state_restore(opdata->ob_store[ob_index].mesh_backup, em, false);
275  }
276 
277  if (use_individual) {
278  EDBM_op_init(em,
279  &bmop,
280  op,
281  "inset_individual faces=%hf use_even_offset=%b use_relative_offset=%b "
282  "use_interpolate=%b thickness=%f depth=%f",
284  use_even_offset,
285  use_relative_offset,
286  use_interpolate,
287  thickness,
288  depth);
289  }
290  else {
291  EDBM_op_init(
292  em,
293  &bmop,
294  op,
295  "inset_region faces=%hf use_boundary=%b use_even_offset=%b use_relative_offset=%b "
296  "use_interpolate=%b thickness=%f depth=%f use_outset=%b use_edge_rail=%b",
298  use_boundary,
299  use_even_offset,
300  use_relative_offset,
301  use_interpolate,
302  thickness,
303  depth,
304  use_outset,
305  use_edge_rail);
306 
307  if (use_outset) {
309  em->bm, &bmop, bmop.slots_in, "faces_exclude", BM_FACE, BM_ELEM_HIDDEN);
310  }
311  }
312  BMO_op_exec(em->bm, &bmop);
313 
314  if (use_select_inset) {
315  /* deselect original faces/verts */
318  em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_SELECT, true);
319  }
320  else {
322  BMO_slot_buffer_hflag_enable(em->bm, bmop.slots_in, "faces", BM_FACE, BM_ELEM_SELECT, true);
323  }
324 
325  if (!EDBM_op_finish(em, &bmop, op, true)) {
326  continue;
327  }
328 
329  EDBM_update_generic(obedit->data, true, true);
330  changed = true;
331  }
332  return changed;
333 }
334 
336 {
337  if (!edbm_inset_init(C, op, false)) {
338  return OPERATOR_CANCELLED;
339  }
340 
341  if (!edbm_inset_calc(op)) {
342  edbm_inset_exit(C, op);
343  return OPERATOR_CANCELLED;
344  }
345 
346  edbm_inset_exit(C, op);
347  return OPERATOR_FINISHED;
348 }
349 
350 static int edbm_inset_invoke(bContext *C, wmOperator *op, const wmEvent *event)
351 {
353  InsetData *opdata;
354  float mlen[2];
355  float center_3d[3];
356 
357  if (!edbm_inset_init(C, op, true)) {
358  return OPERATOR_CANCELLED;
359  }
360 
361  opdata = op->customdata;
362 
364 
365  /* initialize mouse values */
366  if (!calculateTransformCenter(C, V3D_AROUND_CENTER_MEDIAN, center_3d, opdata->mcenter)) {
367  /* in this case the tool will likely do nothing,
368  * ideally this will never happen and should be checked for above */
369  opdata->mcenter[0] = opdata->mcenter[1] = 0;
370  }
371  mlen[0] = opdata->mcenter[0] - event->mval[0];
372  mlen[1] = opdata->mcenter[1] - event->mval[1];
373  opdata->initial_length = len_v2(mlen);
374  opdata->pixel_size = rv3d ? ED_view3d_pixel_size(rv3d, center_3d) : 1.0f;
375 
376  edbm_inset_calc(op);
377 
379 
381  return OPERATOR_RUNNING_MODAL;
382 }
383 
384 static int edbm_inset_modal(bContext *C, wmOperator *op, const wmEvent *event)
385 {
386  InsetData *opdata = op->customdata;
387  const bool has_numinput = hasNumInput(&opdata->num_input);
388 
389  /* Modal numinput active, try to handle numeric inputs first... */
390  if (event->val == KM_PRESS && has_numinput && handleNumInput(C, &opdata->num_input, event)) {
391  float amounts[2] = {RNA_float_get(op->ptr, "thickness"), RNA_float_get(op->ptr, "depth")};
392  applyNumInput(&opdata->num_input, amounts);
393  amounts[0] = max_ff(amounts[0], 0.0f);
394  RNA_float_set(op->ptr, "thickness", amounts[0]);
395  RNA_float_set(op->ptr, "depth", amounts[1]);
396 
397  if (edbm_inset_calc(op)) {
399  return OPERATOR_RUNNING_MODAL;
400  }
401  edbm_inset_cancel(C, op);
402  return OPERATOR_CANCELLED;
403  }
404  if ((event->type == opdata->launch_event) && (event->val == KM_RELEASE) &&
405  RNA_boolean_get(op->ptr, "release_confirm")) {
406  edbm_inset_calc(op);
407  edbm_inset_exit(C, op);
408  return OPERATOR_FINISHED;
409  }
410 
411  bool handled = false;
412  switch (event->type) {
413  case EVT_ESCKEY:
414  case RIGHTMOUSE:
415  edbm_inset_cancel(C, op);
416  return OPERATOR_CANCELLED;
417 
418  case MOUSEMOVE:
419  if (!has_numinput) {
420  float mdiff[2];
421  float amount;
422 
423  mdiff[0] = opdata->mcenter[0] - event->mval[0];
424  mdiff[1] = opdata->mcenter[1] - event->mval[1];
425 
426  if (opdata->modify_depth) {
427  amount = opdata->old_depth +
428  ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) /
429  opdata->max_obj_scale;
430  }
431  else {
432  amount = opdata->old_thickness -
433  ((len_v2(mdiff) - opdata->initial_length) * opdata->pixel_size) /
434  opdata->max_obj_scale;
435  }
436 
437  /* Fake shift-transform... */
438  if (opdata->shift) {
439  amount = (amount - opdata->shift_amount) * 0.1f + opdata->shift_amount;
440  }
441 
442  if (opdata->modify_depth) {
443  RNA_float_set(op->ptr, "depth", amount);
444  }
445  else {
446  amount = max_ff(amount, 0.0f);
447  RNA_float_set(op->ptr, "thickness", amount);
448  }
449 
450  if (edbm_inset_calc(op)) {
452  }
453  else {
454  edbm_inset_cancel(C, op);
455  return OPERATOR_CANCELLED;
456  }
457  handled = true;
458  }
459  break;
460 
461  case LEFTMOUSE:
462  case EVT_PADENTER:
463  case EVT_RETKEY:
464  if ((event->val == KM_PRESS) ||
465  ((event->val == KM_RELEASE) && RNA_boolean_get(op->ptr, "release_confirm"))) {
466  edbm_inset_calc(op);
467  edbm_inset_exit(C, op);
468  return OPERATOR_FINISHED;
469  }
470  break;
471  case EVT_LEFTSHIFTKEY:
472  case EVT_RIGHTSHIFTKEY:
473  if (event->val == KM_PRESS) {
474  if (opdata->modify_depth) {
475  opdata->shift_amount = RNA_float_get(op->ptr, "depth");
476  }
477  else {
478  opdata->shift_amount = RNA_float_get(op->ptr, "thickness");
479  }
480  opdata->shift = true;
481  handled = true;
482  }
483  else {
484  opdata->shift_amount = 0.0f;
485  opdata->shift = false;
486  handled = true;
487  }
488  break;
489 
490  case EVT_LEFTCTRLKEY:
491  case EVT_RIGHTCTRLKEY: {
492  float mlen[2];
493 
494  mlen[0] = opdata->mcenter[0] - event->mval[0];
495  mlen[1] = opdata->mcenter[1] - event->mval[1];
496 
497  if (event->val == KM_PRESS) {
498  opdata->old_thickness = RNA_float_get(op->ptr, "thickness");
499  if (opdata->shift) {
500  opdata->shift_amount = opdata->old_thickness;
501  }
502  opdata->modify_depth = true;
503  }
504  else {
505  opdata->old_depth = RNA_float_get(op->ptr, "depth");
506  if (opdata->shift) {
507  opdata->shift_amount = opdata->old_depth;
508  }
509  opdata->modify_depth = false;
510  }
511  opdata->initial_length = len_v2(mlen);
512 
514  handled = true;
515  break;
516  }
517 
518  case EVT_OKEY:
519  if (event->val == KM_PRESS) {
520  const bool use_outset = RNA_boolean_get(op->ptr, "use_outset");
521  RNA_boolean_set(op->ptr, "use_outset", !use_outset);
522  if (edbm_inset_calc(op)) {
524  }
525  else {
526  edbm_inset_cancel(C, op);
527  return OPERATOR_CANCELLED;
528  }
529  handled = true;
530  }
531  break;
532  case EVT_BKEY:
533  if (event->val == KM_PRESS) {
534  const bool use_boundary = RNA_boolean_get(op->ptr, "use_boundary");
535  RNA_boolean_set(op->ptr, "use_boundary", !use_boundary);
536  if (edbm_inset_calc(op)) {
538  }
539  else {
540  edbm_inset_cancel(C, op);
541  return OPERATOR_CANCELLED;
542  }
543  handled = true;
544  }
545  break;
546  case EVT_IKEY:
547  if (event->val == KM_PRESS) {
548  const bool use_individual = RNA_boolean_get(op->ptr, "use_individual");
549  RNA_boolean_set(op->ptr, "use_individual", !use_individual);
550  if (edbm_inset_calc(op)) {
552  }
553  else {
554  edbm_inset_cancel(C, op);
555  return OPERATOR_CANCELLED;
556  }
557  handled = true;
558  }
559  break;
560  }
561 
562  /* Modal numinput inactive, try to handle numeric inputs last... */
563  if (!handled && event->val == KM_PRESS && handleNumInput(C, &opdata->num_input, event)) {
564  float amounts[2] = {RNA_float_get(op->ptr, "thickness"), RNA_float_get(op->ptr, "depth")};
565  applyNumInput(&opdata->num_input, amounts);
566  amounts[0] = max_ff(amounts[0], 0.0f);
567  RNA_float_set(op->ptr, "thickness", amounts[0]);
568  RNA_float_set(op->ptr, "depth", amounts[1]);
569 
570  if (edbm_inset_calc(op)) {
572  return OPERATOR_RUNNING_MODAL;
573  }
574  edbm_inset_cancel(C, op);
575  return OPERATOR_CANCELLED;
576  }
577 
578  return OPERATOR_RUNNING_MODAL;
579 }
580 
582 {
583  PropertyRNA *prop;
584 
585  /* identifiers */
586  ot->name = "Inset Faces";
587  ot->idname = "MESH_OT_inset";
588  ot->description = "Inset new faces into selected faces";
589 
590  /* api callbacks */
596 
597  /* flags */
599 
600  /* properties */
601  RNA_def_boolean(ot->srna, "use_boundary", true, "Boundary", "Inset face boundaries");
603  "use_even_offset",
604  true,
605  "Offset Even",
606  "Scale the offset to give more even thickness");
608  "use_relative_offset",
609  false,
610  "Offset Relative",
611  "Scale the offset by surrounding geometry");
613  ot->srna, "use_edge_rail", false, "Edge Rail", "Inset the region along existing edges");
614 
615  prop = RNA_def_float_distance(
616  ot->srna, "thickness", 0.0f, 0.0f, 1e12f, "Thickness", "", 0.0f, 10.0f);
617  /* use 1 rather than 10 for max else dragging the button moves too far */
618  RNA_def_property_ui_range(prop, 0.0, 1.0, 0.01, 4);
619 
620  prop = RNA_def_float_distance(
621  ot->srna, "depth", 0.0f, -1e12f, 1e12f, "Depth", "", -10.0f, 10.0f);
622  RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.01, 4);
623 
624  RNA_def_boolean(ot->srna, "use_outset", false, "Outset", "Outset rather than inset");
626  ot->srna, "use_select_inset", false, "Select Outer", "Select the new inset faces");
627  RNA_def_boolean(ot->srna, "use_individual", false, "Individual", "Individual face inset");
629  ot->srna, "use_interpolate", true, "Interpolate", "Blend face data across the inset");
630 
631  prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "");
633 }
struct ScrArea * CTX_wm_area(const bContext *C)
Definition: context.c:714
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
struct ViewLayer * CTX_data_view_layer(const bContext *C)
Definition: context.c:1044
struct View3D * CTX_wm_view3d(const bContext *C)
Definition: context.c:760
struct ARegion * CTX_wm_region(const bContext *C)
Definition: context.c:725
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
Definition: context.c:769
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
Definition: editmesh.c:85
@ G_TRANSFORM_EDIT
Definition: BKE_global.h:219
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, r_len)
Definition: BKE_layer.h:426
@ B_UNIT_LENGTH
Definition: BKE_unit.h:79
size_t BKE_unit_value_as_string(char *str, int len_max, double value, int prec, int type, const struct UnitSettings *settings, bool pad)
MINLINE float max_ff(float a, float b)
float mat4_to_scale(const float M[4][4])
Definition: math_matrix.c:2196
MINLINE float len_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
unsigned int uint
Definition: BLI_sys_types.h:83
#define TIP_(msgid)
Object is a sort of wrapper for general info.
@ V3D_AROUND_CENTER_MEDIAN
@ V3D_GIZMO_HIDE
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
void EDBM_redo_state_free(struct BMBackup *, struct BMEditMesh *em, int recalctess)
struct BMBackup EDBM_redo_state_store(struct BMEditMesh *em)
void EDBM_update_generic(struct Mesh *me, const bool do_tessellation, const bool is_destructive)
void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag)
void EDBM_redo_state_restore(struct BMBackup, struct BMEditMesh *em, int recalctess)
void outputNumInput(NumInput *n, char *str, struct UnitSettings *unit_settings)
Definition: numinput.c:102
void initNumInput(NumInput *n)
Definition: numinput.c:83
#define NUM_STR_REP_LEN
Definition: ED_numinput.h:27
bool applyNumInput(NumInput *n, float *vec)
Definition: numinput.c:207
bool hasNumInput(const NumInput *n)
Definition: numinput.c:185
bool handleNumInput(struct bContext *C, NumInput *n, const struct wmEvent *event)
void ED_area_status_text(ScrArea *area, const char *str)
Definition: area.c:815
void ED_region_tag_redraw(struct ARegion *region)
Definition: area.c:667
bool ED_operator_editmesh(struct bContext *C)
Definition: screen_ops.c:404
void * ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *customdata, int type)
Definition: spacetypes.c:238
#define REGION_DRAW_POST_PIXEL
Definition: ED_space_api.h:67
void ED_region_draw_cb_exit(struct ARegionType *, void *)
Definition: spacetypes.c:253
bool calculateTransformCenter(struct bContext *C, int centerMode, float cent3d[3], float cent2d[2])
Definition: transform.c:1259
void ED_region_draw_mouse_line_cb(const struct bContext *C, struct ARegion *region, void *arg_info)
float ED_view3d_pixel_size(const struct RegionView3D *rv3d, const float co[3])
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
@ PROP_SKIP_SAVE
Definition: RNA_types.h:204
@ PROP_HIDDEN
Definition: RNA_types.h:202
#define C
Definition: RandGen.cpp:39
#define UI_MAX_DRAW_STR
Definition: UI_interface.h:90
@ OPTYPE_BLOCKING
Definition: WM_types.h:157
@ OPTYPE_UNDO
Definition: WM_types.h:155
@ OPTYPE_GRAB_CURSOR_XY
Definition: WM_types.h:161
@ OPTYPE_REGISTER
Definition: WM_types.h:153
#define KM_PRESS
Definition: WM_types.h:242
#define KM_RELEASE
Definition: WM_types.h:243
@ BM_FACE
Definition: bmesh_class.h:386
@ BM_ELEM_HIDDEN
Definition: bmesh_class.h:472
@ BM_ELEM_SELECT
Definition: bmesh_class.h:471
void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const char htype, const char hflag, const 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, const char htype, const char hflag)
void BMO_op_exec(BMesh *bm, BMOperator *op)
BMESH OPSTACK EXEC OP.
Scene scene
static int edbm_inset_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bool edbm_inset_init(bContext *C, wmOperator *op, const bool is_modal)
static int edbm_inset_exec(bContext *C, wmOperator *op)
static void edbm_inset_cancel(bContext *C, wmOperator *op)
static void edbm_inset_exit(bContext *C, wmOperator *op)
void MESH_OT_inset(wmOperatorType *ot)
static void edbm_inset_update_header(wmOperator *op, bContext *C)
static int edbm_inset_modal(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)
#define str(s)
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
Definition: mallocn.c:48
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:41
void *(* MEM_mallocN)(size_t len, const char *str)
Definition: mallocn.c:47
static void area(int d1, int d2, int e1, int e2, float weights[2])
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
Definition: rna_access.c:6272
float RNA_float_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6355
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
Definition: rna_access.c:6366
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
Definition: rna_access.c:6261
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
Definition: rna_define.c:3481
PropertyRNA * RNA_def_float_distance(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
Definition: rna_define.c:4041
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
Definition: rna_define.c:1512
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
Definition: rna_define.c:1706
struct ARegionType * type
struct BMesh * bm
Definition: BKE_editmesh.h:52
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BMOpSlot slots_in[BMO_OP_MAX_SLOTS]
int totvertsel
Definition: bmesh_class.h:298
float initial_length
float shift_amount
int launch_event
float mcenter[2]
uint ob_store_len
float old_thickness
float pixel_size
short gizmo_flag
NumInput num_input
float max_obj_scale
bool modify_depth
InsetObjectStore * ob_store
float old_depth
void * draw_handle_pixel
BMBackup mesh_backup
short idx_max
Definition: ED_numinput.h:34
int unit_sys
Definition: ED_numinput.h:35
int unit_type[NUM_MAX_ELEMENTS]
Definition: ED_numinput.h:37
float obmat[4][4]
void * data
struct UnitSettings unit
char gizmo_flag
short val
Definition: WM_types.h:579
short type
Definition: WM_types.h:577
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:752
const char * name
Definition: WM_types.h:721
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:768
const char * idname
Definition: WM_types.h:723
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:776
void(* cancel)(struct bContext *, struct wmOperator *)
Definition: WM_types.h:760
struct StructRNA * srna
Definition: WM_types.h:802
const char * description
Definition: WM_types.h:726
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
Definition: WM_types.h:736
struct PointerRNA * ptr
#define G(x, y, z)
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.c:3156
const char * WM_bool_as_string(bool test)
Definition: wm_keymap.c:2003