27 #include "RNA_prototypes.h"
45 #define MVAL_PIXEL_MARGIN 5.0f
47 #define PROFILE_HARD_MIN 0.0f
49 #define SEGMENTS_HARD_MAX 1000
52 #define OFFSET_VALUE 0
53 #define OFFSET_VALUE_PERCENT 1
54 #define PROFILE_VALUE 2
55 #define SEGMENTS_VALUE 3
56 #define NUM_VALUE_KINDS 4
59 "offset",
"offset_pct",
"profile",
"segments"};
126 int available_len =
sizeof(buf);
129 #define WM_MODALKEY(_id) \
130 WM_modalkeymap_operator_items_to_string_buf( \
131 op->type, (_id), true, UI_MAX_SHORTCUT_STR, &available_len, &p)
149 const char *mode_str, *omiter_str, *imiter_str, *vmesh_str, *profile_type_str, *affect_str;
175 "%s: Segments (%d), "
176 "%s: Profile (%.3f), "
177 "%s: Clamp Overlap (%s), "
179 "%s: Outer Miter (%s), "
180 "%s: Inner Miter (%s), "
181 "%s: Harden Normals (%s), "
182 "%s: Mark Seam (%s), "
183 "%s: Mark Sharp (%s), "
184 "%s: Profile Type (%s), "
185 "%s: Intersection (%s)"),
234 uint objects_used_len = 0;
241 uint ob_store_len = 0;
243 view_layer, v3d, &ob_store_len);
245 for (
uint ob_index = 0; ob_index < ob_store_len; ob_index++) {
246 Object *obedit = objects[ob_index];
251 opdata->
ob_store[objects_used_len].
ob = obedit;
263 float pixels_per_inch =
U.dpi *
U.pixelsize;
305 bool changed =
false;
319 const int face_strength_mode =
RNA_enum_get(op->
ptr,
"face_strength_mode");
346 "bevel geom=%hev offset=%f segments=%i affect=%i offset_type=%i "
347 "profile_type=%i profile=%f clamp_overlap=%b material=%i loop_slide=%b "
348 "mark_seam=%b mark_sharp=%b harden_normals=%b face_strength_mode=%i "
349 "miter_outer=%i miter_inner=%i spread=%f smoothresh=%f custom_profile=%p "
389 .calc_looptri = true,
390 .calc_normals = true,
391 .is_destructive = true,
439 .calc_looptri = false,
440 .calc_normals = true,
441 .is_destructive = true,
472 const float mlen[2] = {
473 opdata->
mcenter[0] -
event->mval[0],
474 opdata->
mcenter[1] -
event->mval[1],
484 float sc = opdata->
scale[vmode];
539 const float mdiff[2] = {
540 opdata->
mcenter[0] -
event->mval[0],
541 opdata->
mcenter[1] -
event->mval[1],
602 "OFFSET_MODE_CHANGE",
604 "Change Offset Mode",
605 "Cycle through offset modes"},
607 "CLAMP_OVERLAP_TOGGLE",
609 "Toggle Clamp Overlap",
610 "Toggle clamp overlap flag"},
614 "Change Affect Type",
615 "Change which geometry type the operation affects, edges or vertices"},
617 "HARDEN_NORMALS_TOGGLE",
619 "Toggle Harden Normals",
620 "Toggle harden normals flag"},
625 "Toggle mark seam flag"},
630 "Toggle mark sharp flag"},
632 "OUTER_MITER_CHANGE",
634 "Change Outer Miter",
635 "Cycle through outer miter kinds"},
637 "INNER_MITER_CHANGE",
639 "Change Inner Miter",
640 "Cycle through inner miter kinds"},
643 "VERTEX_MESH_CHANGE",
645 "Change Intersection Method",
646 "Cycle through intersection methods"},
668 bool handled =
false;
669 short etype =
event->type;
670 short eval =
event->val;
695 float delta = 0.02f * (
event->xy[1] -
event->prev_xy[1]);
959 uiItemR(layout, op->
ptr,
"face_strength_mode", 0,
IFACE_(
"Face Strength"), ICON_NONE);
978 {
BEVEL_AMT_OFFSET,
"OFFSET", 0,
"Offset",
"Amount is offset of new edges from original"},
984 "Amount is perpendicular distance from original edge to bevel face"},
985 {
BEVEL_AMT_PERCENT,
"PERCENT", 0,
"Percent",
"Amount is percent of adjacent edge length"},
990 "Amount is absolute distance along adjacent edge"},
999 "The profile can be a concave or convex curve"},
1004 "The profile can be any arbitrary path between its endpoints"},
1015 "Set face strength on new and modified faces only"},
1022 {
BEVEL_MITER_PATCH,
"PATCH", 0,
"Patch",
"Outside of miter is squared-off patch"},
1039 "A cutoff at each profile's end before the intersection"},
1051 ot->
description =
"Cut into selected items at an angle to create bevel or chamfer";
1071 "The method for determining the size of the bevel");
1079 prop_profile_type_items,
1082 "The type of shape used to rebuild a beveled section");
1094 "Segments for curved edge",
1104 "Controls profile shape (0.5 = round)",
1113 "Affect edges or vertices");
1119 "Do not allow beveled edges/vertices to overlap each other");
1122 ot->
srna,
"loop_slide",
true,
"Loop Slide",
"Prefer sliding along edges to even widths");
1134 "Material for bevel faces (-1 means use adjacent faces)",
1142 "Match normals of new faces to adjacent faces");
1145 "face_strength_mode",
1146 face_strength_mode_items,
1148 "Face Strength Mode",
1149 "Whether to set face strength, and which faces to set face strength on");
1156 "Pattern to use for outside of miters");
1163 "Pattern to use for inside of miters");
1171 "Amount to spread arcs for arc inner miters",
1179 "Vertex Mesh Method",
1180 "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 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 void EDBM_redo_state_restore_and_free(struct BMBackup *backup, struct BMEditMesh *em, bool recalc_looptri) ATTR_NONNULL(1
void EDBM_update(struct Mesh *me, const struct EDBMUpdate_Params *params)
void EDBM_redo_state_restore(struct BMBackup *backup, struct BMEditMesh *em, bool recalc_looptri) ATTR_NONNULL(1
struct BMBackup EDBM_redo_state_store(struct BMEditMesh *em)
void EDBM_flag_disable_all(struct BMEditMesh *em, char hflag)
void void void EDBM_redo_state_free(struct BMBackup *backup) ATTR_NONNULL(1)
void EDBM_selectmode_flush(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
bool ED_region_draw_cb_exit(struct ARegionType *art, void *handle)
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 Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
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, char htype, char hflag, 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)
@ 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
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)
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)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
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])
static const pxr::TfToken st("st", pxr::TfToken::Immortal)
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
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)