50#define SUBD_SMOOTH_MAX 4.0f
51#define SUBD_CUTS_MAX 500
95 if (lcd->
ob !=
nullptr) {
108 Object *ob_iter = base->object;
141 if (gcache->
is_init ==
false) {
164#ifdef BMW_EDGERING_NGON
165 const bool use_only_quads =
false;
167 const bool use_only_quads =
false;
177 const bool is_macro = (op->
opm !=
nullptr);
206 params.calc_looptris =
true;
207 params.calc_normals =
false;
208 params.is_destructive =
true;
316 const int previewlines)
325 else if (
e ==
nullptr) {
344 &lcd->
vc, &best.dist,
nullptr,
false,
false,
nullptr, lcd->
bases, &base_index);
347 best.ob = lcd->
bases[base_index]->object;
349 best.base_index = base_index;
366 const bool is_interactive = (rv3d !=
nullptr) && (event !=
nullptr);
382 if (is_interactive) {
383 for (
Base *base : bases) {
384 Object *ob_iter = base->object;
389 op->
reports,
RPT_WARNING,
"Loop cut does not work well on deformed edit mesh display");
395 if (is_interactive) {
401 if (is_interactive ==
false) {
402 if (exec_data.base_index >= bases.
size()) {
406 Object *ob_iter = bases[exec_data.base_index]->object;
408 if (exec_data.e_index >= em->
bm->
totedge) {
419 if (is_interactive) {
426 lcd->
bases = std::move(bases);
429 if (is_interactive) {
435 Object *ob_iter = lcd->
bases[exec_data.base_index]->object;
444#ifdef USE_LOOPSLIDE_HACK
448 const bool mesh_select_mode[3] = {
458 if (is_interactive) {
472 status.
item(
IFACE_(
"Confirm"), ICON_MOUSE_LMB);
473 status.
item(
IFACE_(
"Cancel"), ICON_MOUSE_RMB);
474 status.
item(
IFACE_(
"Select Ring"), ICON_MOUSE_MOVE);
475 status.
item(
"", ICON_MOUSE_MMB);
476 status.
item(
IFACE_(
"Number of Cuts"), ICON_EVENT_PAGEUP, ICON_EVENT_PAGEDOWN);
477 status.
item(
IFACE_(
"Smoothness"), ICON_EVENT_ALT, ICON_MOUSE_MMB);
493 "VIEW3D_GGT_mesh_preselect_edgering") :
495 if ((gzgroup !=
nullptr) && gzgroup->
gizmos.
first) {
500 if (object_index != -1 && edge_index != -1) {
549 float cuts = lcd->
cuts;
551 bool show_cuts =
false;
562 float values[2] = {cuts, smoothness};
565 smoothness = values[1];
568 bool handled =
false;
569 switch (event->
type) {
603 cuts += 0.02f * (
event->xy[1] -
event->prev_xy[1]);
604 if (cuts < 1 && lcd->cuts >= 1) {
609 smoothness += 0.002f * (
event->xy[1] -
event->prev_xy[1]);
634 cuts =
max_ff(cuts - 1, 1);
652 lcd->
vc.
mval[0] =
event->mval[0];
653 lcd->
vc.
mval[1] =
event->mval[1];
665 float values[2] = {cuts, smoothness};
668 smoothness = values[1];
672 if (cuts != lcd->
cuts) {
714 ot->
name =
"Edge Ring Select";
715 ot->
idname =
"MESH_OT_edgering_select";
751 prop =
RNA_def_int(
ot->
srna,
"number_cuts", 1, 1, 1000000,
"Number of Cuts",
"", 1, 100);
777 prop =
RNA_def_int(
ot->
srna,
"object_index", -1, -1, INT_MAX,
"Object Index",
"", 0, INT_MAX);
780 prop =
RNA_def_int(
ot->
srna,
"edge_index", -1, -1, INT_MAX,
"Edge Index",
"", 0, INT_MAX);
783#ifdef USE_LOOPSLIDE_HACK
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
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)
blender::Span< blender::float3 > BKE_editmesh_vert_coords_when_deformed(Depsgraph *depsgraph, BMEditMesh *em, Scene *scene, Object *obedit, blender::Array< blender::float3 > &r_alloc)
BMEditMesh * BKE_editmesh_from_object(Object *ob)
Return the BMEditMesh for a given object.
blender::Vector< Base * > BKE_view_layer_array_from_bases_in_edit_mode(const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
Object * BKE_modifiers_is_deformed_by_lattice(Object *ob)
Object * BKE_modifiers_is_deformed_by_armature(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])
#define SNPRINTF(dst, format,...)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define BLT_I18NCONTEXT_ID_MESH
void DEG_id_tag_update(ID *id, unsigned int flags)
ID * DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
Object is a sort of wrapper for general info.
@ OP_IS_MODAL_CURSOR_REGION
void EDBM_flag_disable_all(BMEditMesh *em, char hflag)
void EDBM_update(Mesh *mesh, const EDBMUpdate_Params *params)
void EDBM_preselect_edgering_destroy(EditMesh_PreSelEdgeRing *psel)
void EDBM_preselect_edgering_clear(EditMesh_PreSelEdgeRing *psel)
BMEdge * EDBM_edge_find_nearest_ex(ViewContext *vc, float *dist_px_manhattan, float *r_dist_center, bool use_select_bias, bool use_cycle, BMEdge **r_eed_zbuf, blender::Span< Base * > bases, uint *r_base_index)
ViewContext em_setup_viewcontext(bContext *C)
void EDBM_selectmode_flush(BMEditMesh *em)
void EDBM_preselect_edgering_draw(EditMesh_PreSelEdgeRing *psel, const float matrix[4][4])
void EDBM_selectmode_flush_ex(BMEditMesh *em, short selectmode)
bool EDBM_selectmode_disable_multi(bContext *C, short selectmode_disable, short selectmode_fallback)
EditMesh_PreSelEdgeRing * EDBM_preselect_edgering_create()
void EDBM_preselect_edgering_update_from_edge(EditMesh_PreSelEdgeRing *psel, BMesh *bm, BMEdge *eed_start, int previewlines, blender::Span< blender::float3 > vert_positions)
void ED_area_status_text(ScrArea *area, const char *str)
bool ED_operator_editmesh_region_view3d(bContext *C)
void ED_workspace_status_text(bContext *C, const char *str)
bool ED_operator_editmesh(bContext *C)
void ED_region_tag_redraw(ARegion *region)
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
#define REGION_DRAW_POST_VIEW
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
float ED_view3d_select_dist_px()
void view3d_operator_needs_opengl(const bContext *C)
void ED_view3d_viewcontext_init_object(ViewContext *vc, Object *obact)
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_begin(BMWalker *walker, void *start)
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_step(BMWalker *walker)
Step Walker.
void item(std::string text, int icon1, int icon2=0)
static void loopcut_update_edge(RingSelOpData *lcd, uint base_index, BMEdge *e, const int previewlines)
static void ringsel_draw(const bContext *, ARegion *, void *arg)
static void ringsel_exit(bContext *, wmOperator *op)
static int ringsel_init(bContext *C, wmOperator *op, bool do_cut)
static void ringsel_find_edge(RingSelOpData *lcd, const int previewlines)
static int loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
static void ringcut_cancel(bContext *C, wmOperator *op)
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 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_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const 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)
PropertyRNA * RNA_def_float(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)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
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_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, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]
struct ARegionType * type
Array< float3 > allocated_vert_positions
Span< float3 > vert_positions
Array< MeshCoordsCache > geom_cache
EditMesh_PreSelEdgeRing * presel_edgering
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
int(* modal)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(* cancel)(bContext *C, wmOperator *op)
struct ReportList * reports
void WM_main_add_notifier(uint type, void *reference)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
void WM_operatortype_props_advanced_begin(wmOperatorType *ot)