55 this->win_half = {1.0f, 1.0f};
60 this->win_half = {region->winx / 2.0f, region->winy / 2.0f};
66 for (
int i = 0; i < 4; i++) {
67 this->proj_mat[i][0] *= this->win_half[0];
68 this->proj_mat[i][1] *= this->win_half[1];
74 this->proj_mat.
location()[0] -= this->win_half[0];
75 this->proj_mat.
location()[1] -= this->win_half[1];
93 if (sv.co_link_orig_3d.
size() <= 1) {
97 const float3 &v_co_orig =
sv.co_orig_3d();
101 int co_link_curr_best = -1;
104 const float3 &loc_dst =
sv.co_link_orig_3d[j];
109 if (dir_dot > dir_dot_best) {
110 dir_dot_best = dir_dot;
111 co_link_curr_best = j;
115 if (co_link_curr_best != -1) {
116 sv.co_link_curr = co_link_curr_best;
133 if (dist_sq < dist_min_sq) {
134 dist_min_sq = dist_sq;
135 this->curr_sv_index = i;
158 int mval_ofs[2], mval_start[2], mval_end[2];
164 ARRAY_SET_ITEMS(mval_start, co_orig_2d[0] + mval_ofs[0], co_orig_2d[1] + mval_ofs[1]);
165 ARRAY_SET_ITEMS(mval_end, co_curr_2d[0] + mval_ofs[0], co_curr_2d[1] + mval_ofs[1]);
216 custom_data->
data =
nullptr;
224 switch (event->
type) {
284 const int alpha_shade = -160;
315 const float3 &co_orig_3d = sv.co_orig_3d();
316 const float3 &co_dest_3d = sv.co_dest_3d();
348 float3 co_orig_3d_cpy = co_orig_3d_act;
350 co_orig_3d_cpy[0] /= t->
aspect[0];
351 co_orig_3d_cpy[1] /= t->
aspect[1];
364 float viewport_size[4];
366 immUniform2f(
"viewport_size", viewport_size[2], viewport_size[3]);
395 if (use_even ==
false) {
402 if (edge_len > FLT_EPSILON) {
422 const bool use_even = slp->
use_even;
426 if (sld ==
nullptr) {
434 tperc *= edge_len_curr;
451 float snap_point[3], dvec[3];
481 const bool flipped = slp->
flipped;
482 const bool use_even = slp->
use_even;
484 const bool is_constrained = !(is_clamp ==
false ||
hasNumInput(&t->
num));
494 if (is_constrained) {
495 CLAMP(
final, 0.0f, 1.0f);
543 const float edge_len_curr =
len_v3v3(orig_co, loc_dst_act);
544 tperc *= edge_len_curr;
585 tc->custom.mode.data = sld;
612 bool use_even =
false;
613 bool flipped =
false;
614 bool use_clamp =
true;
float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3])
void mul_m4_v3(const float M[4][4], float r[3])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
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_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 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 compare_v2v2(const float v1[2], const float v2[2], float limit) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[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
#define ARRAY_SET_ITEMS(...)
void ED_area_status_text(ScrArea *area, const char *str)
blender::float4x4 ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob)
void GPU_matrix_identity_set()
void GPU_matrix_scale_2f(float x, float y)
void GPU_matrix_push_projection()
#define GPU_matrix_mul(x)
void GPU_matrix_pop_projection()
@ GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR
@ 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)
void GPU_viewport_size_get_f(float coords[4])
float UI_GetThemeValuef(int colorid)
void UI_view2d_view_to_region_m4(const View2D *v2d, float matrix[4][4]) ATTR_NONNULL()
IndexRange index_range() const
local_group_size(16, 16) .push_constant(Type b
void *(* MEM_callocN)(size_t len, const char *str)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
VectorT project_point(const MatT &mat, const VectorT &point)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< float, 2 > float2
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
TransCustomDataContainer custom
const blender::float3 & co_dest_3d() const
const float * co_orig_3d() const
float values_modal_offset[4]
TransCustomDataContainer custom
TransConvertTypeInfo * data_type
void update_active_vert(TransInfo *, const float2 &mval_fl)
Vector< float3 > targets_buffer
void update_active_edges(TransInfo *t, const float2 &mval_fl)
void update_proj_mat(TransInfo *t, const TransDataContainer *tc)
Array< TransDataVertSlideVert > sv
float2 project(const float3 &co)
const c_style_mat & ptr() const
static MatBase identity()
VecBase< T, 2 > xy() const
const char * WM_bool_as_string(bool test)
void wmOrtho2_region_pixelspace(const ARegion *region)