58 #define MVAL_PIXEL_MARGIN 5.0f
60 #define PROFILE_HARD_MIN 0.0f
62 #define SEGMENTS_HARD_MAX 1000
65 #define OFFSET_VALUE 0
66 #define OFFSET_VALUE_PERCENT 1
67 #define PROFILE_VALUE 2
68 #define SEGMENTS_VALUE 3
69 #define NUM_VALUE_KINDS 4
72 "offset",
"offset_pct",
"profile",
"segments"};
140 int available_len =
sizeof(buf);
143 #define WM_MODALKEY(_id) \
144 WM_modalkeymap_operator_items_to_string_buf( \
145 op->type, (_id), true, UI_MAX_SHORTCUT_STR, &available_len, &p)
163 const char *mode_str, *omiter_str, *imiter_str, *vmesh_str, *profile_type_str, *affect_str;
189 "%s: Segments (%d), "
190 "%s: Profile (%.3f), "
191 "%s: Clamp Overlap (%s), "
193 "%s: Outer Miter (%s), "
194 "%s: Inner Miter (%s), "
195 "%s: Harden Normals (%s), "
196 "%s: Mark Seam (%s), "
197 "%s: Mark Sharp (%s), "
198 "%s: Profile Type (%s), "
199 "%s: Intersection (%s)"),
248 uint objects_used_len = 0;
255 uint ob_store_len = 0;
257 view_layer, v3d, &ob_store_len);
259 for (
uint ob_index = 0; ob_index < ob_store_len; ob_index++) {
260 Object *obedit = objects[ob_index];
265 opdata->
ob_store[objects_used_len].
ob = obedit;
277 float pixels_per_inch =
U.dpi *
U.pixelsize;
324 bool changed =
false;
338 const int face_strength_mode =
RNA_enum_get(op->
ptr,
"face_strength_mode");
365 "bevel geom=%hev offset=%f segments=%i affect=%i offset_type=%i "
366 "profile_type=%i profile=%f clamp_overlap=%b material=%i loop_slide=%b "
367 "mark_seam=%b mark_sharp=%b harden_normals=%b face_strength_mode=%i "
368 "miter_outer=%i miter_inner=%i spread=%f smoothresh=%f custom_profile=%p "
393 if (offset != 0.0f) {
487 const float mlen[2] = {
488 opdata->
mcenter[0] -
event->mval[0],
489 opdata->
mcenter[1] -
event->mval[1],
499 float sc = opdata->
scale[vmode];
554 const float mdiff[2] = {
555 opdata->
mcenter[0] -
event->mval[0],
556 opdata->
mcenter[1] -
event->mval[1],
617 "OFFSET_MODE_CHANGE",
619 "Change Offset Mode",
620 "Cycle through offset modes"},
622 "CLAMP_OVERLAP_TOGGLE",
624 "Toggle Clamp Overlap",
625 "Toggle clamp overlap flag"},
629 "Change Affect Type",
630 "Change which geometry type the operation affects, edges or vertices"},
632 "HARDEN_NORMALS_TOGGLE",
634 "Toggle Harden Normals",
635 "Toggle harden normals flag"},
640 "Toggle mark seam flag"},
645 "Toggle mark sharp flag"},
647 "OUTER_MITER_CHANGE",
649 "Change Outer Miter",
650 "Cycle through outer miter kinds"},
652 "INNER_MITER_CHANGE",
654 "Change Inner Miter",
655 "Cycle through inner miter kinds"},
658 "VERTEX_MESH_CHANGE",
660 "Change Intersection Method",
661 "Cycle through intersection methods"},
683 bool handled =
false;
684 short etype =
event->type;
685 short eval =
event->val;
710 float delta = 0.02f * (
event->y -
event->prevy);
978 uiItemR(layout, &
ptr,
"face_strength_mode", 0,
IFACE_(
"Face Strength"), ICON_NONE);
997 {
BEVEL_AMT_OFFSET,
"OFFSET", 0,
"Offset",
"Amount is offset of new edges from original"},
1003 "Amount is perpendicular distance from original edge to bevel face"},
1004 {
BEVEL_AMT_PERCENT,
"PERCENT", 0,
"Percent",
"Amount is percent of adjacent edge length"},
1009 "Amount is absolute distance along adjacent edge"},
1018 "The profile can be a concave or convex curve"},
1023 "The profile can be any arbitrary path between its endpoints"},
1034 "Set face strength on new and modified faces only"},
1041 {
BEVEL_MITER_PATCH,
"PATCH", 0,
"Patch",
"Outside of miter is squared-off patch"},
1058 "A cutoff at each profile's end before the intersection"},
1070 ot->
description =
"Cut into selected items at an angle to create bevel or chamfer";
1090 "The method for determining the size of the bevel");
1098 prop_profile_type_items,
1101 "The type of shape used to rebuild a beveled section");
1113 "Segments for curved edge",
1123 "Controls profile shape (0.5 = round)",
1132 "Affect edges or vertices");
1138 "Do not allow beveled edges/vertices to overlap each other");
1141 ot->
srna,
"loop_slide",
true,
"Loop Slide",
"Prefer sliding along edges to even widths");
1153 "Material for bevel faces (-1 means use adjacent faces)",
1161 "Match normals of new faces to adjacent faces");
1164 "face_strength_mode",
1165 face_strength_mode_items,
1167 "Face Strength Mode",
1168 "Whether to set face strength, and which faces to set face strength on");
1175 "Pattern to use for outside of miters");
1182 "Pattern to use for inside of miters");
1190 "Amount to spread arcs for arc inner miters",
1198 "Vertex Mesh Method",
1199 "The method to use to create meshes at intersections");
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct ToolSettings * CTX_data_tool_settings(const bContext *C)
struct RegionView3D * CTX_wm_region_view3d(const bContext *C)
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
#define BKE_view_layer_array_from_objects_in_edit_mode_unique_data(view_layer, v3d, r_len)
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])
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
typedef double(DMatrix)[4][4]
Object is a sort of wrapper for general info.
@ V3D_AROUND_CENTER_MEDIAN
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 EDBM_selectmode_flush(struct BMEditMesh *em)
void EDBM_mesh_normals_update(struct BMEditMesh *em)
void ED_area_status_text(ScrArea *area, const char *str)
void ED_region_tag_redraw(struct ARegion *region)
bool ED_operator_editmesh(struct bContext *C)
void ED_workspace_status_text(struct bContext *C, const char *str)
void * ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *customdata, int type)
#define REGION_DRAW_POST_PIXEL
void ED_region_draw_cb_exit(struct ARegionType *, void *)
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])
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
Group RGB to Bright Vector Camera CLAMP
StructRNA RNA_ToolSettings
void uiLayoutSetActive(uiLayout *layout, bool active)
uiLayout * uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiTemplateCurveProfile(uiLayout *layout, struct PointerRNA *ptr, const char *propname)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
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_op_exec(BMesh *bm, BMOperator *op)
BMESH OPSTACK EXEC OP.
@ BEVEL_PROFILE_SUPERELLIPSE
@ BEVEL_FACE_STRENGTH_NONE
@ BEVEL_FACE_STRENGTH_AFFECTED
@ BEVEL_FACE_STRENGTH_NEW
@ BEVEL_FACE_STRENGTH_ALL
static const float value_clamp_max[NUM_VALUE_KINDS]
static void edbm_bevel_cancel(bContext *C, wmOperator *op)
static void edbm_bevel_mouse_set_value(wmOperator *op, const wmEvent *event)
static void edbm_bevel_ui(bContext *C, wmOperator *op)
static void edbm_bevel_exit(bContext *C, wmOperator *op)
static void edbm_bevel_update_status_text(bContext *C, wmOperator *op)
static const float value_start[NUM_VALUE_KINDS]
wmKeyMap * bevel_modal_keymap(wmKeyConfig *keyconf)
static int edbm_bevel_exec(bContext *C, wmOperator *op)
static bool edbm_bevel_init(bContext *C, wmOperator *op, const bool is_modal)
static const float value_clamp_min[NUM_VALUE_KINDS]
#define OFFSET_VALUE_PERCENT
static float get_bevel_offset(wmOperator *op)
static int edbm_bevel_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void edbm_bevel_numinput_set_value(wmOperator *op)
void MESH_OT_bevel(wmOperatorType *ot)
static const char * value_rna_name[NUM_VALUE_KINDS]
#define SEGMENTS_HARD_MAX
static void edbm_bevel_calc_initial_length(wmOperator *op, const wmEvent *event, bool mode_changed)
static int edbm_bevel_invoke(bContext *C, wmOperator *op, const wmEvent *event)
#define MVAL_PIXEL_MARGIN
static bool edbm_bevel_calc(wmOperator *op)
@ BEV_MODAL_PROFILE_TYPE_CHANGE
@ BEV_MODAL_MARK_SHARP_TOGGLE
@ BEV_MODAL_AFFECT_CHANGE
@ BEV_MODAL_HARDEN_NORMALS_TOGGLE
@ BEV_MODAL_VERTEX_MESH_CHANGE
@ BEV_MODAL_OFFSET_MODE_CHANGE
@ BEV_MODAL_SEGMENTS_DOWN
@ BEV_MODAL_INNER_MITER_CHANGE
@ BEV_MODAL_MARK_SEAM_TOGGLE
@ BEV_MODAL_VALUE_SEGMENTS
@ BEV_MODAL_OUTER_MITER_CHANGE
@ BEV_MODAL_CLAMP_OVERLAP_TOGGLE
@ BEV_MODAL_VALUE_PROFILE
static const float value_scale_per_inch[NUM_VALUE_KINDS]
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)
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_enum_name_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
struct ARegionType * type
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
float shift_value[NUM_VALUE_KINDS]
BevelObjectStore * ob_store
NumInput num_input[NUM_VALUE_KINDS]
CurveProfile * custom_profile
float scale[NUM_VALUE_KINDS]
float initial_length[NUM_VALUE_KINDS]
struct ToolSettings * toolsettings
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* cancel)(struct bContext *, struct wmOperator *)
void(* ui)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct wmOperatorType * type
int WM_userdef_event_type_from_keymap_type(int kmitype)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
const char * WM_bool_as_string(bool test)
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)