77 const float *co_ref = rv3d->
ofs;
78 float co_a_ss[2] = {x_start, y_start}, co_b_ss[2] = {x_end, y_end}, co_delta_ss[2];
79 float co_a[3], co_b[3];
103 int valid_objects = 0;
112 uint objects_len = 0;
115 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
116 Object *obedit = objects[ob_index];
124 if (valid_objects == 0) {
135 if ((clear_inner != clear_outer) || use_fill) {
153 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
154 Object *obedit = objects[ob_index];
177 for (
int ob_index = 0; ob_index < opdata->
backup_len; ob_index++) {
264 plane_no[0] = plane_no[1] = 0.0f;
285 uint objects_len = 0;
289 for (
uint ob_index = 0; ob_index < objects_len; ob_index++) {
290 Object *obedit = objects[ob_index];
294 if (opdata !=
NULL) {
305 if (opdata !=
NULL) {
311 float plane_co_local[3];
312 float plane_no_local[3];
325 "bisect_plane geom=%hvef plane_co=%v plane_no=%v dist=%f clear_inner=%b clear_outer=%b",
337 float normal_fill[3];
349 "triangle_fill edges=%S normal=%v use_dissolve=%b",
360 "face_attribute_fill faces=%S use_normals=%b use_data=%b",
380 .calc_looptri = true,
381 .calc_normals = false,
382 .is_destructive = true,
402 ot->
description =
"Cut geometry along a plane (click-drag to define plane)";
422 "A point on the plane",
433 "The direction the plane points",
440 ot->
srna,
"clear_inner",
false,
"Clear Inner",
"Remove geometry behind the plane");
442 ot->
srna,
"clear_outer",
false,
"Clear Outer",
"Remove geometry in front of the plane");
450 "Preserves the existing geometry along the cut plane",
506 float plane_co[3], plane_no[3];
531 float plane_no_cross[3];
547 float *value = value_p;
552 float plane_co[3], plane_no[3];
565 const float *value = value_p;
570 float plane_co[3], plane[4];
619 float *value = value_p;
628 float plane_no_proj[3];
647 const float *value = value_p;
656 float plane_no_proj[3];
663 if (angle_delta != 0.0f) {
724 .value_get_fn = gizmo_bisect_prop_depth_get,
725 .value_set_fn = gizmo_bisect_prop_depth_set,
726 .range_get_fn = NULL,
733 .value_get_fn = gizmo_bisect_prop_translate_get,
734 .value_set_fn = gizmo_bisect_prop_translate_set,
735 .range_get_fn = NULL,
742 .value_get_fn = gizmo_bisect_prop_angle_get,
743 .value_set_fn = gizmo_bisect_prop_angle_set,
744 .range_get_fn = NULL,
761 gzgt->
name =
"Mesh Bisect";
762 gzgt->
idname =
"MESH_GGT_bisect";
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 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)
void BKE_report(ReportList *reports, eReportType type, const char *message)
void closest_to_plane_normalized_v3(float r_close[3], const float plane[4], const float pt[3])
void mul_m3_v3(const float M[3][3], float r[3])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void mul_transposed_mat3_m4_v3(const float M[4][4], float r[3])
float angle_compat_rad(float angle, float angle_compat)
void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], float angle)
MINLINE float normalize_v3(float r[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
void project_plane_normalized_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v3(float r[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
#define UNUSED_VARS_NDEBUG(...)
Object is a sort of wrapper for general info.
@ ED_GIZMO_MOVE_STYLE_RING_2D
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_MIRROR
@ ED_GIZMO_DIAL_DRAW_FLAG_ANGLE_START_Y
@ ED_GIZMO_ARROW_STYLE_NORMAL
bool ED_gizmo_poll_or_unlink_delayed_from_operator(const struct bContext *C, struct wmGizmoGroupType *gzgt, const char *idname)
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)
bool ED_operator_editmesh(struct bContext *C)
void ED_workspace_status_text(struct bContext *C, const char *str)
int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op)
void ED_view3d_win_to_delta(const struct ARegion *region, const float xy_delta[2], float zfac, float r_out[3])
void ED_view3d_win_to_vector(const struct ARegion *region, const float mval[2], float r_out[3])
float ED_view3d_calc_zfac(const struct RegionView3D *rv3d, const float co[3])
void ED_view3d_win_to_3d(const struct View3D *v3d, const struct ARegion *region, const float depth_pt[3], const float mval[2], float r_out[3])
struct RegionView3D * ED_view3d_context_rv3d(struct bContext *C)
Read Guarded memory(de)allocation.
void UI_GetThemeColor3fv(int colorid, float col[3])
@ WM_GIZMOGROUPTYPE_DRAW_MODAL_EXCLUDE
ATTR_WARN_UNUSED_RESULT BMesh * bm
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.
bool BMO_op_initf(BMesh *bm, BMOperator *op, int flag, const char *fmt,...)
void BMO_op_finish(BMesh *bm, BMOperator *op)
BMESH OPSTACK FINISH OP.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
void MESH_OT_bisect(struct wmOperatorType *ot)
static void gizmo_mesh_bisect_draw_prepare(const bContext *UNUSED(C), wmGizmoGroup *gzgroup)
static void mesh_bisect_interactive_calc(bContext *C, wmOperator *op, float plane_co[3], float plane_no[3])
static int mesh_bisect_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void gizmo_mesh_bisect_setup(const bContext *C, wmGizmoGroup *gzgroup)
static void gizmo_bisect_prop_depth_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
static void edbm_bisect_exit(BisectData *opdata)
static void gizmo_bisect_exec(GizmoGroup *ggd)
static void gizmo_bisect_prop_translate_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
struct GizmoGroup GizmoGroup
static int mesh_bisect_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void gizmo_mesh_bisect_update_from_op(GizmoGroup *ggd)
static void MESH_GGT_bisect(struct wmGizmoGroupType *gzgt)
static void gizmo_bisect_prop_translate_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
static bool gizmo_mesh_bisect_poll(const bContext *C, wmGizmoGroupType *gzgt)
static void gizmo_bisect_prop_angle_set(const wmGizmo *gz, wmGizmoProperty *gz_prop, const void *value_p)
static void gizmo_bisect_prop_depth_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
static void gizmo_bisect_prop_angle_get(const wmGizmo *gz, wmGizmoProperty *gz_prop, void *value_p)
static int mesh_bisect_exec(bContext *C, wmOperator *op)
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)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
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)
PropertyRNA * RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_, const char *identifier, int len, const float *default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
struct BMOpSlot slots_out[BMO_OP_MAX_SLOTS]
struct BisectData::@450 * backup
struct wmGizmo * translate_z
PropertyRNA * prop_plane_no
struct wmGizmo * rotate_c
struct wmGizmo * translate_c
struct GizmoGroup::@451 data
PropertyRNA * prop_plane_co
wmGenericUserData user_data
eWM_GizmoFlagGroupTypeFlag flag
struct wmGizmoMapType_Params gzmap_params
wmGizmoGroupFnDrawPrepare draw_prepare
const struct wmGizmoPropertyType * type
struct wmGizmoGroup * parent_gzgroup
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
struct wmOperatorType * type
int WM_gesture_straightline_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_gesture_straightline_cancel(bContext *C, wmOperator *op)
int WM_gesture_straightline_modal(bContext *C, wmOperator *op, const wmEvent *event)
int WM_gesture_straightline_active_side_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void WM_gizmo_set_matrix_offset_rotation_from_yz_axis(wmGizmo *gz, const float y_axis[3], const float z_axis[3])
wmGizmo * WM_gizmo_new_ptr(const wmGizmoType *gzt, wmGizmoGroup *gzgroup, PointerRNA *properties)
void WM_gizmo_set_scale(wmGizmo *gz, const float scale)
void WM_gizmo_set_matrix_location(wmGizmo *gz, const float origin[3])
void WM_gizmo_set_flag(wmGizmo *gz, const int flag, const bool enable)
void WM_gizmo_set_matrix_rotation_from_z_axis(wmGizmo *gz, const float z_axis[3])
bool WM_gizmo_group_type_ensure(const char *idname)
wmGizmoGroupType * WM_gizmogrouptype_append(void(*wtfunc)(struct wmGizmoGroupType *))
void WM_gizmo_target_property_def_func(wmGizmo *gz, const char *idname, const wmGizmoPropertyFnParams *params)
const wmGizmoType * WM_gizmotype_find(const char *idname, bool quiet)
void WM_operator_properties_gesture_straightline(wmOperatorType *ot, int cursor)
wmOperator * WM_operator_last_redo(const bContext *C)