49#define SUBD_SMOOTH_MAX 4.0f
50#define SUBD_CUTS_MAX 500
94 if (lcd->
ob !=
nullptr) {
141 if (gcache->
is_init ==
false) {
163#ifdef BMW_EDGERING_NGON
164 const bool use_only_quads =
false;
166 const bool use_only_quads =
false;
177 const bool is_macro = (op->
opm !=
nullptr);
325 const int previewlines)
334 else if (
e ==
nullptr) {
353 &lcd->
vc, &best.dist,
nullptr,
false,
false,
nullptr, lcd->
bases, &base_index);
356 best.ob = lcd->
bases[base_index]->object;
358 best.base_index = base_index;
375 const bool is_interactive = (rv3d !=
nullptr) && (event !=
nullptr);
392 if (is_interactive) {
393 for (
Base *base : bases) {
394 Object *ob_iter = base->object;
399 op->
reports,
RPT_WARNING,
"Loop cut does not work well on deformed edit mesh display");
405 if (is_interactive) {
411 if (is_interactive ==
false) {
412 if (exec_data.base_index >= bases.
size()) {
416 Object *ob_iter = bases[exec_data.base_index]->object;
429 if (is_interactive) {
436 lcd->
bases = std::move(bases);
439 if (is_interactive) {
445 Object *ob_iter = lcd->
bases[exec_data.base_index]->object;
456#ifdef USE_LOOPSLIDE_HACK
460 const bool mesh_select_mode[3] = {
470 if (is_interactive) {
484 status.
item(
IFACE_(
"Confirm"), ICON_MOUSE_LMB);
485 status.
item(
IFACE_(
"Cancel"), ICON_MOUSE_RMB);
486 status.
item(
IFACE_(
"Select Ring"), ICON_MOUSE_MOVE);
487 status.
item(
"", ICON_MOUSE_MMB);
488 status.
item(
IFACE_(
"Number of Cuts"), ICON_EVENT_PAGEUP, ICON_EVENT_PAGEDOWN);
489 status.
item(
IFACE_(
"Smoothness"), ICON_EVENT_ALT, ICON_MOUSE_MMB);
505 "VIEW3D_GGT_mesh_preselect_edgering") :
507 if ((gzgroup !=
nullptr) && gzgroup->
gizmos.first_) {
512 if (object_index != -1 && edge_index != -1) {
562 float cuts = lcd->
cuts;
564 bool show_cuts =
false;
575 float values[2] = {cuts, smoothness};
578 smoothness = values[1];
581 bool handled =
false;
582 switch (event->
type) {
616 cuts += 0.02f * (
event->xy[1] -
event->prev_xy[1]);
617 if (cuts < 1 && lcd->cuts >= 1) {
622 smoothness += 0.002f * (
event->xy[1] -
event->prev_xy[1]);
647 cuts =
max_ff(cuts - 1, 1);
665 lcd->
vc.
mval[0] =
event->mval[0];
666 lcd->
vc.
mval[1] =
event->mval[1];
681 float values[2] = {cuts, smoothness};
684 smoothness = values[1];
688 if (cuts != lcd->
cuts) {
729 ot->
name =
"Loop Cut";
730 ot->
idname =
"MESH_OT_loopcut";
731 ot->
description =
"Add a new loop between existing loops";
745 prop =
RNA_def_int(ot->
srna,
"number_cuts", 1, 1, 1000000,
"Number of Cuts",
"", 1, 100);
777#ifdef USE_LOOPSLIDE_HACK
#define SNPRINTF_UTF8(dst, format,...)
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define BLT_I18NCONTEXT_ID_MESH
Object is a sort of wrapper for general info.
#define REGION_DRAW_POST_VIEW
Read Blender memory allocation and freeing.
#define BM_elem_index_get(ele)
#define BM_select_history_store(bm, ele)
void item(std::string text, int icon1, int icon2=0)
void WM_main_add_notifier(uint type, void *reference)
void EDBM_flag_disable_all(BMesh *bm, char hflag)
static int ringsel_init(bContext *C, wmOperator *op, bool do_cut)
size_t size_t size_t BLI_snprintf_utf8(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
void BM_mesh_elem_index_ensure(BMesh *bm, const char htype)
ScrArea * CTX_wm_area(const bContext *C)
EditMesh_PreSelEdgeRing * EDBM_preselect_edgering_create()
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
BLI_INLINE bool BM_edge_is_wire(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
MINLINE void copy_v2_v2_int(int r[2], const int a[2])
static void ringcut_cancel(bContext *C, wmOperator *op)
int RNA_enum_get(PointerRNA *ptr, const char *name)
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
bool BM_edge_is_any_face_len_test(const BMEdge *e, const int len)
void EDBM_selectmode_flush(BMesh *bm, short selectmode)
static wmOperatorStatus loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op)
BMesh * BKE_editmesh_bmesh_get_for_write(Mesh *mesh)
Span< float3 > BKE_editmesh_vert_coords_when_deformed(Depsgraph *depsgraph, Scene *scene, Object *obedit, Array< float3 > &r_alloc)
static wmOperatorStatus ringcut_invoke(bContext *C, wmOperator *op, const wmEvent *event)
bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
BLI_INLINE BMEdge * BM_edge_at_index(BMesh *bm, const int index)
void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
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, BMWDelimitFlag delimit)
Initialize Walker.
void EDBM_update(Mesh *mesh, const EDBMUpdate_Params *params)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
static void ringsel_finish(bContext *C, wmOperator *op)
@ OP_IS_MODAL_CURSOR_REGION
Object * BKE_modifiers_is_deformed_by_armature(Object *ob)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool hasNumInput(const NumInput *n)
void view3d_operator_needs_gpu(const bContext *C)
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 MESH_OT_loopcut(wmOperatorType *ot)
void ED_region_tag_redraw(ARegion *region)
void EDBM_preselect_edgering_update_from_edge(EditMesh_PreSelEdgeRing *psel, BMesh *bm, BMEdge *eed_start, int previewlines, Span< float3 > vert_positions)
ViewLayer * CTX_data_view_layer(const bContext *C)
static void loopcut_update_edge(RingSelOpData *lcd, uint base_index, BMEdge *e, const int previewlines)
void ED_view3d_viewcontext_init_object(ViewContext *vc, Object *obact)
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)
PropertyRNA * RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier_c_str, int type, int subtype)
bool EDBM_selectmode_disable_multi(bContext *C, short selectmode_disable, short selectmode_fallback)
bool ED_operator_editmesh(bContext *C)
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
void EDBM_preselect_edgering_clear(EditMesh_PreSelEdgeRing *psel)
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
static void edgering_select(RingSelOpData *lcd)
static wmOperatorStatus loopcut_exec(bContext *C, wmOperator *op)
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
void BMW_end(BMWalker *walker)
End Walker.
void DEG_id_tag_update(ID *id, unsigned int flags)
void BKE_report(ReportList *reports, eReportType type, const char *message)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
void initNumInput(NumInput *n)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C, bool rna_write_check=false)
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[]
void ED_area_status_text(ScrArea *area, const char *str)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select)
Select Vert.
bool applyNumInput(NumInput *n, float *vec)
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values)
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
static void loopcut_mouse_move(RingSelOpData *lcd, const int previewlines)
static void ringsel_find_edge(RingSelOpData *lcd, const int previewlines)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
ViewContext em_setup_viewcontext(bContext *C)
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)
void EDBM_selectmode_flush_ex(BMesh *bm, short selectmode)
Main * CTX_data_main(const bContext *C)
MINLINE float max_ff(float a, float b)
void EDBM_preselect_edgering_destroy(EditMesh_PreSelEdgeRing *psel)
void outputNumInput(NumInput *n, char *str, const UnitSettings &unit_settings)
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, Span< Base * > bases, uint *r_base_index)
void WM_operatortype_props_advanced_begin(wmOperatorType *ot)
void * BMW_step(BMWalker *walker)
Step Walker.
wmGizmoGroup * WM_gizmomap_group_find(wmGizmoMap *gzmap, const char *idname)
static void ringsel_exit(bContext *, wmOperator *op)
bool EDBM_uvselect_clear(BMesh *bm)
Scene * CTX_data_scene(const bContext *C)
static void ringsel_draw(const bContext *, ARegion *, void *arg)
void EDBM_preselect_edgering_draw(EditMesh_PreSelEdgeRing *psel, const float matrix[4][4])
static wmOperatorStatus loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
float ED_view3d_select_dist_px()
Vector< Base * > BKE_view_layer_array_from_bases_in_edit_mode(const Main &bmain, const Scene *scene, ViewLayer *view_layer, const View3D *v3d)
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)
ARegion * CTX_wm_region(const bContext *C)
void ED_workspace_status_text(bContext *C, const char *str)
float RNA_float_get(PointerRNA *ptr, const char *name)
View3D * CTX_wm_view3d(const bContext *C)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
@ BMW_DELIMIT_EDGE_RING_NGONS
MINLINE float clamp_f(float value, float min, float max)
Object * BKE_modifiers_is_deformed_by_lattice(Object *ob)
static wmOperatorStatus loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select)
Select Edge.
bke::ARegionRuntime * runtime
Array< float3 > allocated_vert_positions
Span< float3 > vert_positions
Array< MeshCoordsCache > geom_cache
EditMesh_PreSelEdgeRing * presel_edgering
struct ToolSettings * toolsettings
struct ARegionType * type
wmEventModifierFlag modifier
ListBaseT< wmGizmo > gizmos
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(*) cancel(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports