59 this->win_half = {region->winx / 2.0f, region->winy / 2.0f};
65 for (
int i = 0; i < 4; i++) {
66 this->proj_mat[i][0] *= this->win_half[0];
67 this->proj_mat[i][1] *= this->win_half[1];
73 this->proj_mat.
location()[0] -= this->win_half[0];
74 this->proj_mat.
location()[1] -= this->win_half[1];
106 if (tc->custom.mode.data) {
110 BLI_assert_msg(0,
"Should never happen, at least one EdgeSlideData should be valid");
134 float p[3],
const float v1[3],
const float v2[3],
const float v3[3],
float t)
136 float t_mid, t_delta;
142 if (t_delta < 0.0f) {
152 t_mid = 1.0f - t_mid;
168 mval_dir[1] = 100.0f;
171 float mval_start[2], mval_end[2];
218 const bool use_calc_direction)
223 bool use_occlude_geometry =
false;
253 if (use_occlude_geometry) {
259 t->
depsgraph, em, scene_eval, obedit_eval, bmbvh_coord_storage);
263 vert_positions.
is_empty() ?
nullptr :
264 vert_positions.
data(),
274 float2 *loop_dir =
nullptr;
275 float *loop_maxdist =
nullptr;
277 if (use_calc_direction) {
279 loop_maxdist =
static_cast<float *
>(
MEM_mallocN(
sizeof(
float) * loop_nr,
"sv loop_maxdist"));
288 if (!is_visible && !use_calc_direction) {
296 sld->
project(sv, sco_a, sco_b);
302 dist_best_sq = dist_sq;
303 mval_dir = sco_b - sco_a;
308 if (use_calc_direction) {
311 if (dist_sq < loop_maxdist[l_nr]) {
312 loop_maxdist[l_nr] = dist_sq;
313 loop_dir[l_nr] = sco_b - sco_a;
318 if (use_calc_direction) {
321 int l_nr = sv.loop_nr;
322 if (
math::dot(loop_dir[l_nr], mval_dir) < 0.0f) {
340 const bool use_double_side)
356 if (!use_double_side) {
369 array_len[sv.loop_nr].count++;
372 for (TMP &accum : array_len) {
373 accum.accum /= accum.count;
377 if (array_len[sv.loop_nr].accum[1] > array_len[sv.loop_nr].accum[0]) {
378 sv.dir_side[0] = sv.dir_side[1];
380 sv.dir_side[1] =
float3(0);
399 if (sld ==
nullptr) {
405 custom_data->
data =
nullptr;
413 switch (event->
type) {
449 if (sld ==
nullptr) {
476 float co_a[3], co_b[3], co_mark[3];
477 const float fac = (slp->
perc + 1.0f) / 2.0f;
479 const float guide_size = ctrl_size - 0.5f;
480 const int alpha_shade = -30;
499 float *co_test =
nullptr;
511 if (co_test !=
nullptr) {
527 else if (is_clamp ==
false) {
529 const int alpha_shade = -160;
549 const float3 &sv_co_orig = sv.v_co_orig();
560 const int alpha_shade = -160;
589 float3 co_orig, co_dest[2], dvec, snap_point;
591 co_dest[0] = co_orig + sv->
dir_side[0];
592 co_dest[1] = co_orig + sv->
dir_side[1];
610 side_index = perc < 0.0f;
625 side_index = t_snap >= t_mid;
649 perc = (1.0f - perc) * t_mid;
652 perc = perc * (1.0f - t_mid) + t_mid;
659 perc = (2 * perc) - 1.0f;
671 const float curr_length_fac,
672 const int curr_side_unclamp,
673 const bool use_clamp,
680 if (use_even ==
false) {
682 const int side_index = (fac < 0.0f);
683 const float fac_final =
fabsf(fac);
687 int side_index = curr_side_unclamp;
689 side_index =
int(!side_index);
691 const float fac_final = (side_index == (fac < 0.0f) ?
fabsf(fac) : -
fabsf(fac));
707 float co_a[3], co_b[3];
731 const bool use_even = slp->
use_even;
732 const bool use_flip = slp->
flipped;
735 float curr_length_fac = 0.0f;
738 curr_length_fac = sv_active->
edge_len * (((use_flip ? perc : -perc) + 1.0f) / 2.0f);
740 else if (use_clamp) {
747 if (sld ==
nullptr) {
753 sv, perc, curr_length_fac, curr_side_unclamp, use_clamp, use_even, use_flip, sv.td->loc);
767 const bool is_constrained = !(is_clamp ==
false ||
hasNumInput(&t->
num));
780 if (is_constrained) {
781 CLAMP(
final, -1.0f, 1.0f);
822 status.
item_bool(
IFACE_(
"Clamp"), is_clamp, ICON_EVENT_C, ICON_EVENT_ALT);
831 float delta[3], orig_co[3], final_co[3];
841 float curr_length_fac = 0.0f;
843 curr_length_fac = sv_active.
edge_len * (((slp->
flipped ? fac : -fac) + 1.0f) / 2.0f);
866 bool use_double_side,
882 if (use_double_side ==
false) {
898 tc->custom.mode.data = sld;
925 bool use_double_side =
true;
926 bool use_even =
false;
927 bool flipped =
false;
928 bool use_clamp =
true;
961 sld->
project(curr_sv, sco_a, sco_b);
962 float2 mval_dir = sco_b - sco_a;
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.
BMBVHTree * BKE_bmbvh_new_from_editmesh(struct BMEditMesh *em, int flag, const blender::float3 *cos_cage, bool cos_cage_free)
void BKE_bmbvh_free(BMBVHTree *tree)
#define BLI_assert_msg(a, msg)
MINLINE float min_ff(float a, float b)
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
void mul_m4_v3(const float M[4][4], float r[3])
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float len_squared_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v2_fl(float r[2], float f)
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
void copy_vn_fl(float *array_tar, int size, float val)
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v2(float r[2])
MINLINE void swap_v3_v3(float a[3], float b[3])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
size_t BLI_snprintf_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char char size_t BLI_strncpy_rlen(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
ID * DEG_get_evaluated_id(const Depsgraph *depsgraph, ID *id)
Object * DEG_get_evaluated_object(const Depsgraph *depsgraph, Object *object)
bool BMBVH_EdgeVisible(const BMBVHTree *tree, const BMEdge *e, const Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const Object *obedit)
void ED_area_status_text(ScrArea *area, const char *str)
#define XRAY_ENABLED(v3d)
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
#define GPU_matrix_mul(x)
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_blend(eGPUBlend blend)
void GPU_line_width(float width)
void GPU_point_size(float size)
void GPU_depth_test(eGPUDepthTest test)
float UI_GetThemeValuef(int colorid)
void UI_view2d_view_to_region_m4(const View2D *v2d, float matrix[4][4]) ATTR_NONNULL()
#define BM_elem_flag_test(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
void item_bool(std::string text, bool inverted, int icon1, int icon2=0)
void opmodal(std::string text, const wmOperatorType *ot, int propvalue, bool inverted=false)
IndexRange index_range() const
constexpr const T * data() const
constexpr bool is_empty() const
local_group_size(16, 16) .push_constant(Type b
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
T length(const VecBase< T, Size > &a)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
VectorT project_point(const MatT &mat, const VectorT &point)
VecBase< float, 2 > float2
VecBase< float, 3 > float3
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
void project(const TransDataEdgeSlideVert *svert, float2 &r_sco_a, float2 &r_sco_b) const
Array< TransDataEdgeSlideVert > sv
void update_proj_mat(TransInfo *t, const TransDataContainer *tc)
TransCustomDataContainer custom
const float * v_co_orig() const
blender::float3 dir_side[2]
float values_modal_offset[4]
TransCustomDataContainer custom
TransConvertTypeInfo * data_type
const c_style_mat & ptr() const
VecBase< T, 2 > xy() const
struct wmOperatorType * type