46 #define SUBD_SMOOTH_MAX 4.0f
47 #define SUBD_CUTS_MAX 500
101 for (
uint base_index = 0; base_index < lcd->
bases_len; base_index++) {
133 if (gcache->
is_init ==
false) {
156 #ifdef BMW_EDGERING_NGON
157 const bool use_only_quads =
false;
159 const bool use_only_quads =
false;
169 const bool is_macro = (op->
opm !=
NULL);
199 .calc_looptri = true,
200 .calc_normals = false,
201 .is_destructive = true,
321 const int previewlines)
330 else if (
e ==
NULL) {
355 best.base_index = base_index;
368 const bool is_interactive = (
event !=
NULL);
385 if (is_interactive) {
386 for (
uint base_index = 0; base_index < bases_len; base_index++) {
391 op->
reports,
RPT_WARNING,
"Loop cut does not work well on deformed edit mesh display");
401 if (is_interactive ==
false) {
402 if (exec_data.base_index >= bases_len) {
408 if (exec_data.e_index >= em->
bm->
totedge) {
420 if (is_interactive) {
431 if (is_interactive) {
446 #ifdef USE_LOOPSLIDE_HACK
451 const bool mesh_select_mode[3] = {
461 if (is_interactive) {
464 TIP_(
"Select a ring to be cut, use mouse-wheel or page-up/down for number of cuts, "
465 "hold Alt for smooth"));
481 "VIEW3D_GGT_mesh_preselect_edgering") :
488 if (object_index != -1 && edge_index != -1) {
536 float cuts = lcd->
cuts;
538 bool show_cuts =
false;
549 float values[2] = {cuts, smoothness};
552 smoothness = values[1];
555 bool handled =
false;
556 switch (event->
type) {
588 cuts += 0.02f * (
event->xy[1] -
event->prev_xy[1]);
589 if (cuts < 1 && lcd->cuts >= 1) {
594 smoothness += 0.002f * (
event->xy[1] -
event->prev_xy[1]);
619 cuts =
max_ff(cuts - 1, 1);
637 lcd->
vc.
mval[0] =
event->mval[0];
638 lcd->
vc.
mval[1] =
event->mval[1];
650 float values[2] = {cuts, smoothness};
653 smoothness = values[1];
657 if (cuts != lcd->
cuts) {
687 TIP_(
"Number of Cuts: %s, Smooth: %s (Alt)"),
703 ot->
name =
"Edge Ring Select";
704 ot->
idname =
"MESH_OT_edgering_select";
739 prop =
RNA_def_int(
ot->
srna,
"number_cuts", 1, 1, 1000000,
"Number of Cuts",
"", 1, 100);
765 prop =
RNA_def_int(
ot->
srna,
"object_index", -1, -1, INT_MAX,
"Object Index",
"", 0, INT_MAX);
767 prop =
RNA_def_int(
ot->
srna,
"edge_index", -1, -1, INT_MAX,
"Edge Index",
"", 0, INT_MAX);
770 #ifdef USE_LOOPSLIDE_HACK
typedef float(TangentPoint)[2]
struct Scene * CTX_data_scene(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
const float(* BKE_editmesh_vert_coords_when_deformed(struct Depsgraph *depsgraph, struct BMEditMesh *em, struct Scene *scene, struct Object *obedit, int *r_vert_len, bool *r_is_alloc))[3]
BMEditMesh * BKE_editmesh_from_object(struct Object *ob)
Return the BMEditMesh for a given object.
#define BKE_view_layer_array_from_bases_in_edit_mode(view_layer, v3d, r_len)
struct Object * BKE_modifiers_is_deformed_by_armature(struct Object *ob)
struct Object * BKE_modifiers_is_deformed_by_lattice(struct Object *ob)
void BKE_report(ReportList *reports, eReportType type, const char *message)
MINLINE float max_ff(float a, float b)
MINLINE float clamp_f(float value, float min, float max)
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
struct ID * DEG_get_evaluated_id(const struct Depsgraph *depsgraph, struct ID *id)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
Object is a sort of wrapper for general info.
#define SCE_SELECT_VERTEX
@ OP_IS_MODAL_CURSOR_REGION
bool EDBM_selectmode_disable_multi(struct bContext *C, short selectmode_disable, short selectmode_fallback)
void EDBM_preselect_edgering_destroy(struct EditMesh_PreSelEdgeRing *psel)
void EDBM_update(struct Mesh *me, const struct EDBMUpdate_Params *params)
void EDBM_preselect_edgering_clear(struct EditMesh_PreSelEdgeRing *psel)
void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc)
struct BMEdge * EDBM_edge_find_nearest_ex(struct ViewContext *vc, float *dist_px_manhattan, float *r_dist_center, bool use_select_bias, bool use_cycle, struct BMEdge **r_eed_zbuf, struct Base **bases, uint bases_len, uint *r_base_index)
struct EditMesh_PreSelEdgeRing * EDBM_preselect_edgering_create(void)
void EDBM_flag_disable_all(struct BMEditMesh *em, char hflag)
void EDBM_preselect_edgering_draw(struct EditMesh_PreSelEdgeRing *psel, const float matrix[4][4])
void EDBM_selectmode_flush_ex(struct BMEditMesh *em, short selectmode)
void EDBM_preselect_edgering_update_from_edge(struct EditMesh_PreSelEdgeRing *psel, struct BMesh *bm, struct BMEdge *eed_start, int previewlines, const float(*coords)[3])
void EDBM_selectmode_flush(struct BMEditMesh *em)
bool ED_operator_editmesh_region_view3d(struct bContext *C)
void ED_region_tag_redraw(struct ARegion *region)
void ED_workspace_status_text(struct bContext *C, const char *str)
#define REGION_DRAW_POST_VIEW
void * ED_region_draw_cb_activate(struct ARegionType *art, void(*draw)(const struct bContext *, struct ARegion *, void *), void *customdata, int type)
bool ED_region_draw_cb_exit(struct ARegionType *art, void *handle)
void ED_view3d_viewcontext_init_object(struct ViewContext *vc, struct Object *obact)
void view3d_operator_needs_opengl(const struct bContext *C)
float ED_view3d_select_dist_px(void)
Read Guarded memory(de)allocation.
#define BM_elem_index_get(ele)
void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select)
Select Vert.
void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
Select Edge.
#define BM_select_history_store(bm, ele)
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
void BM_mesh_esubdivide(BMesh *bm, char edge_hflag, float smooth, short smooth_falloff, bool use_smooth_even, float fractal, float along_normal, int numcuts, int seltype, int cornertype, short use_single_edge, short use_grid_fill, short use_only_quads, int seed)
bool BM_edge_is_any_face_len_test(const BMEdge *e, const int len)
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
void BMW_init(BMWalker *walker, BMesh *bm, int type, short mask_vert, short mask_edge, short mask_face, BMWFlag flag, int layer)
Init Walker.
void BMW_end(BMWalker *walker)
End Walker.
void * BMW_begin(BMWalker *walker, void *start)
void * BMW_step(BMWalker *walker)
Step Walker.
static void loopcut_update_edge(RingSelOpData *lcd, uint base_index, BMEdge *e, const int previewlines)
static int ringsel_init(bContext *C, wmOperator *op, bool do_cut)
static void ringsel_find_edge(RingSelOpData *lcd, const int previewlines)
struct RingSelOpData RingSelOpData
static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
static void ringcut_cancel(bContext *C, wmOperator *op)
static void ringsel_exit(bContext *UNUSED(C), wmOperator *op)
static void ringsel_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void *arg)
static int loopcut_exec(bContext *C, wmOperator *op)
static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
void MESH_OT_loopcut(wmOperatorType *ot)
static void ringsel_finish(bContext *C, wmOperator *op)
static int loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op)
static void edgering_select(RingSelOpData *lcd)
static void loopcut_mouse_move(RingSelOpData *lcd, const int previewlines)
static int ringcut_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void MESH_OT_edgering_select(wmOperatorType *ot)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
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)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
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_enum_default(PropertyRNA *prop, int value)
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
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)
PropertyRNA * RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value, const char *ui_name, const char *ui_description)
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]
struct wmGizmoMap * gizmo_map
struct ARegionType * type
struct EditMesh_PreSelEdgeRing * presel_edgering
struct MeshCoordsCache * geom_cache
struct ToolSettings * toolsettings
struct Depsgraph * depsgraph
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 *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmGizmoGroup * WM_gizmomap_group_find(struct wmGizmoMap *gzmap, const char *idname)
void WM_operatortype_props_advanced_begin(wmOperatorType *ot)