51#define SUBD_SMOOTH_MAX 4.0f
52#define SUBD_CUTS_MAX 500
96 if (lcd->
ob !=
nullptr) {
142 if (gcache->
is_init ==
false) {
165#ifdef BMW_EDGERING_NGON
166 const bool use_only_quads =
false;
168 const bool use_only_quads =
false;
178 const bool is_macro = (op->
opm !=
nullptr);
207 params.calc_looptris =
true;
208 params.calc_normals =
false;
209 params.is_destructive =
true;
326 const int previewlines)
335 else if (
e ==
nullptr) {
354 &lcd->
vc, &best.dist,
nullptr,
false,
false,
nullptr, lcd->
bases, &base_index);
357 best.ob = lcd->
bases[base_index]->object;
359 best.base_index = base_index;
376 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;
418 if (exec_data.e_index >= em->
bm->
totedge) {
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;
454#ifdef USE_LOOPSLIDE_HACK
458 const bool mesh_select_mode[3] = {
468 if (is_interactive) {
485 status.item(
"", ICON_MOUSE_MMB);
486 status.item(
IFACE_(
"Number of Cuts"), ICON_EVENT_PAGEUP, ICON_EVENT_PAGEDOWN);
487 status.item(
IFACE_(
"Smoothness"), ICON_EVENT_ALT, ICON_MOUSE_MMB);
503 "VIEW3D_GGT_mesh_preselect_edgering") :
505 if ((gzgroup !=
nullptr) && gzgroup->
gizmos.
first) {
510 if (object_index != -1 && edge_index != -1) {
559 float cuts = lcd->
cuts;
561 bool show_cuts =
false;
572 float values[2] = {cuts, smoothness};
575 smoothness = values[1];
578 bool handled =
false;
579 switch (event->
type) {
613 cuts += 0.02f * (
event->xy[1] -
event->prev_xy[1]);
614 if (cuts < 1 && lcd->cuts >= 1) {
619 smoothness += 0.002f * (
event->xy[1] -
event->prev_xy[1]);
644 cuts =
max_ff(cuts - 1, 1);
662 lcd->
vc.
mval[0] =
event->mval[0];
663 lcd->
vc.
mval[1] =
event->mval[1];
678 float values[2] = {cuts, smoothness};
681 smoothness = values[1];
685 if (cuts != lcd->
cuts) {
727 ot->name =
"Edge Ring Select";
728 ot->idname =
"MESH_OT_edgering_select";
729 ot->description =
"Select an edge ring";
732 ot->invoke = ringsel_invoke;
748 ot->name =
"Loop Cut";
749 ot->idname =
"MESH_OT_loopcut";
750 ot->description =
"Add a new loop between existing loops";
764 prop =
RNA_def_int(
ot->srna,
"number_cuts", 1, 1, 1000000,
"Number of Cuts",
"", 1, 100);
790 prop =
RNA_def_int(
ot->srna,
"object_index", -1, -1, INT_MAX,
"Object Index",
"", 0, INT_MAX);
793 prop =
RNA_def_int(
ot->srna,
"edge_index", -1, -1, INT_MAX,
"Edge Index",
"", 0, INT_MAX);
796#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])
size_t size_t size_t BLI_snprintf_utf8(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define SNPRINTF_UTF8(dst, format,...)
#define BLT_I18NCONTEXT_ID_CURVE_LEGACY
#define BLT_I18NCONTEXT_ID_MESH
void DEG_id_tag_update(ID *id, unsigned int flags)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
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)
bool EDBM_uvselect_clear(BMEditMesh *em)
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_gpu(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)
Initialize Walker.
void BMW_end(BMWalker *walker)
End Walker.
void * BMW_step(BMWalker *walker)
Step Walker.
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 wmOperatorStatus loopcut_init(bContext *C, wmOperator *op, const wmEvent *event)
static int ringsel_init(bContext *C, wmOperator *op, bool do_cut)
static void ringsel_find_edge(RingSelOpData *lcd, const int previewlines)
static wmOperatorStatus loopcut_exec(bContext *C, wmOperator *op)
static wmOperatorStatus loopcut_finish(RingSelOpData *lcd, bContext *C, wmOperator *op)
static void ringcut_cancel(bContext *C, wmOperator *op)
static wmOperatorStatus ringcut_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event)
void MESH_OT_loopcut(wmOperatorType *ot)
static void ringsel_finish(bContext *C, wmOperator *op)
static void edgering_select(RingSelOpData *lcd)
static void loopcut_mouse_move(RingSelOpData *lcd, const int previewlines)
void MESH_OT_edgering_select(wmOperatorType *ot)
VecBase< float, 3 > float3
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[]
ARegionRuntimeHandle * runtime
Array< float3 > allocated_vert_positions
Span< float3 > vert_positions
Array< MeshCoordsCache > geom_cache
EditMesh_PreSelEdgeRing * presel_edgering
struct ToolSettings * toolsettings
wmEventModifierFlag modifier
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)