|
Blender
V2.93
|
#include <stdlib.h>#include "MEM_guardedalloc.h"#include "BLI_math.h"#include "BLI_string.h"#include "BLI_utildefines_stack.h"#include "BKE_context.h"#include "BKE_editmesh.h"#include "BKE_editmesh_bvh.h"#include "BKE_unit.h"#include "GPU_immediate.h"#include "GPU_matrix.h"#include "GPU_state.h"#include "ED_mesh.h"#include "ED_screen.h"#include "WM_api.h"#include "WM_types.h"#include "UI_interface.h"#include "UI_resources.h"#include "BLT_translation.h"#include "transform.h"#include "transform_constraints.h"#include "transform_convert.h"#include "transform_mode.h"#include "transform_snap.h"Go to the source code of this file.
Classes | |
| struct | TransDataEdgeSlideVert |
| struct | EdgeSlideData |
| struct | EdgeSlideParams |
Macros | |
| #define | INDEX_UNSET -1 |
| #define | INDEX_INVALID -2 |
| #define | EDGESLIDE_VERT_IS_INNER(v, e_dir) ((BM_edge_is_boundary(e_dir) == false) && (BM_vert_edge_count_nonwire(v) == 2)) |
| #define | SV_FROM_VERT(v) |
| #define EDGESLIDE_VERT_IS_INNER | ( | v, | |
| e_dir | |||
| ) | ((BM_edge_is_boundary(e_dir) == false) && (BM_vert_edge_count_nonwire(v) == 2)) |
| #define INDEX_INVALID -2 |
| #define INDEX_UNSET -1 |
| #define SV_FROM_VERT | ( | v | ) |
| typedef struct EdgeSlideData EdgeSlideData |
| typedef struct EdgeSlideParams EdgeSlideParams |
| typedef struct TransDataEdgeSlideVert TransDataEdgeSlideVert |
|
static |
Definition at line 1450 of file transform_mode_edge_slide.c.
References applyNumInput(), applySnapping(), BLI_snprintf(), BLI_strncpy_rlen(), Freestyle::c, CLAMP, doEdgeSlide(), ED_area_status_text(), EdgeSlideParams::flipped, hasNumInput(), NUM_STR_REP_LEN, outputNumInput(), recalcData(), str, t, T_ALT_TRANSFORM, TIP_, transform_snap_increment(), UI_MAX_DRAW_STR, EdgeSlideParams::use_even, validSnap(), and WM_bool_as_string().
Referenced by initEdgeSlide_ex().
|
static |
Find the closest point on the ngon on the opposite side. used to set the edge slide distance for ngons.
Definition at line 181 of file transform_mode_edge_slide.c.
References BMVert::co, copy_v3_v3(), isect_line_plane_v3(), len_v3v3(), line_point_factor_v3(), BMLoop::next, BMLoop::prev, and BMLoop::v.
Referenced by get_next_loop().
|
static |
Definition at line 476 of file transform_mode_edge_slide.c.
References BMVert::co, EdgeSlideData::curr_sv_index, TransDataEdgeSlideVert::dir_side, ED_view3d_ob_project_mat_get(), ED_view3d_project_float_v2_m4(), TransDataEdgeSlideVert::edge_len, len_squared_v2v2(), len_v3v3(), NULL, TransDataContainer::obedit, SPACE_VIEW3D, EdgeSlideData::sv, t, EdgeSlideData::totsv, unit_m4(), and TransDataEdgeSlideVert::v.
Referenced by createEdgeSlideVerts_double_side(), and createEdgeSlideVerts_single_side().
|
static |
Calculate screenspace mval_start / mval_end, optionally slide direction.
Definition at line 314 of file transform_mode_edge_slide.c.
References add_v3_v3v3(), BKE_bmbvh_free(), BKE_bmbvh_new_from_editmesh(), BKE_editmesh_from_object(), BLI_assert, BM_EDGES_OF_VERT, BM_elem_flag_test, BM_elem_index_get, BM_ELEM_SELECT, BM_ITER_ELEM, BMBVH_EdgeVisible(), BMBVH_RESPECT_HIDDEN, BMVert::co, copy_v2_v2(), copy_vn_fl(), TransDataEdgeSlideVert::dir_side, dist_squared_to_line_segment_v2(), dot_v3v3(), e, ED_view3d_ob_project_mat_get(), ED_view3d_project_float_v3_m4(), float(), len_squared_v2(), len_squared_v2v2(), TransDataEdgeSlideVert::loop_nr, MEM_callocN, MEM_freeN, MEM_mallocN, mul_v2_fl(), EdgeSlideData::mval_end, EdgeSlideData::mval_start, NULL, TransDataContainer::obedit, SPACE_VIEW3D, sub_v3_v3v3(), EdgeSlideData::sv, SWAP, swap_v3_v3(), t, EdgeSlideData::totsv, unit_m4(), UNLIKELY, UNUSED_VARS_NDEBUG, v, TransDataEdgeSlideVert::v, TransDataEdgeSlideVert::v_side, zero_v2(), and zero_v3().
Referenced by createEdgeSlideVerts_double_side(), and createEdgeSlideVerts_single_side().
|
static |
Definition at line 120 of file transform_mode_edge_slide.c.
References applyMouseInput(), edgeSlideFirstGet(), EdgeSlideData::mval_end, EdgeSlideData::mval_start, setCustomPoints(), and t.
Referenced by handleEventEdgeSlide(), and initEdgeSlide_ex().
|
static |
Definition at line 524 of file transform_mode_edge_slide.c.
References BKE_editmesh_from_object(), BLI_assert, BMEditMesh::bm, bm, BM_edge_is_boundary(), BM_edge_is_manifold(), BM_edge_other_vert(), BM_EDGES_OF_MESH, BM_EDGES_OF_VERT, BM_elem_flag_disable, BM_elem_flag_enable, BM_elem_flag_test, BM_elem_index_get, BM_elem_index_set, BM_ELEM_SELECT, BM_ELEM_TAG, BM_ITER_ELEM, BM_ITER_MESH, BM_ITER_MESH_INDEX, BM_loop_other_edge_loop(), BM_VERT, BM_VERTS_OF_MESH, calcEdgeSlide_even(), calcEdgeSlide_mval_range(), BMVert::co, copy_v3_v3(), EdgeSlideData::curr_sv_index, TransDataEdgeSlideVert::dir_side, BMVert::e, BMLoop::e, e, EDGESLIDE_VERT_IS_INNER, BMesh::elem_index_dirty, float(), get_next_loop(), get_other_edge(), INDEX_INVALID, INDEX_UNSET, l_b, TransDataEdgeSlideVert::loop_nr, MEM_callocN, MEM_freeN, MEM_mallocN, NULL, OB_WIRE, TransDataContainer::obedit, BMLoop::radial_next, SPACE_VIEW3D, STACK_DECLARE, STACK_INIT, STACK_SIZE, sub_v3_v3v3(), EdgeSlideData::sv, SV_FROM_VERT, t, EdgeSlideData::totsv, BMesh::totvert, TRANS_DATA_CONTAINER_FIRST_OK, v, TransDataEdgeSlideVert::v, TransDataEdgeSlideVert::v_co_orig, TransDataEdgeSlideVert::v_side, XRAY_ENABLED, and zero_v3().
Referenced by initEdgeSlide_ex().
|
static |
A simple version of createEdgeSlideVerts_double_side Which assumes the longest unselected.
Definition at line 885 of file transform_mode_edge_slide.c.
References BKE_editmesh_from_object(), BLI_assert, BMEditMesh::bm, bm, BM_DISK_EDGE_NEXT, BM_edge_calc_length_squared(), BM_edge_other_vert(), BM_EDGES_OF_VERT, BM_elem_flag_test, BM_elem_index_get, BM_elem_index_set, BM_ELEM_SELECT, BM_ITER_ELEM, BM_ITER_MESH_INDEX, BM_VERT, BM_vert_is_edge_pair(), BM_VERTS_OF_MESH, calcEdgeSlide_even(), calcEdgeSlide_mval_range(), BMVert::co, copy_v3_v3(), EdgeSlideData::curr_sv_index, TransDataEdgeSlideVert::dir_side, BMVert::e, e, BMesh::elem_index_dirty, float(), interp_v3_v3v3(), line_point_factor_v3(), TransDataEdgeSlideVert::loop_nr, MEM_callocN, MEM_freeN, MEM_mallocN, NULL, OB_WIRE, TransDataContainer::obedit, SPACE_VIEW3D, sub_v3_v3v3(), EdgeSlideData::sv, t, EdgeSlideData::totsv, BMesh::totvert, BMesh::totvertsel, TRANS_DATA_CONTAINER_FIRST_OK, v, TransDataEdgeSlideVert::v, TransDataEdgeSlideVert::v_co_orig, TransDataEdgeSlideVert::v_side, and XRAY_ENABLED.
Referenced by initEdgeSlide_ex().
Implementation note, even mode ignores the starting positions and uses only the a/b verts, this could be changed/improved so the distance is still met but the verts are moved along their original path (which may not be straight), however how it works now is OK and matches 2.4x - Campbell
len_v3v3(curr_sv->dir_side[0], curr_sv->dir_side[1]) is the same as the distance between the original vert locations, same goes for the lines below.Definition at line 1352 of file transform_mode_edge_slide.c.
References add_v3_v3v3(), BMVert::co, copy_v3_v3(), EdgeSlideData::curr_side_unclamp, EdgeSlideData::curr_sv_index, TransDataEdgeSlideVert::dir_side, TransDataEdgeSlideVert::edge_len, edgeSlideFirstGet(), fabsf, EdgeSlideParams::flipped, FOREACH_TRANS_DATA_CONTAINER, interp_line_v3_v3v3v3(), is_zero_v3(), madd_v3_v3v3fl(), min_ff(), NULL, EdgeSlideParams::perc, EdgeSlideData::sv, t, T_ALT_TRANSFORM, EdgeSlideData::totsv, EdgeSlideParams::use_even, TransDataEdgeSlideVert::v, and TransDataEdgeSlideVert::v_co_orig.
Referenced by applyEdgeSlide().
| void drawEdgeSlide | ( | TransInfo * | t | ) |
Definition at line 1132 of file transform_mode_edge_slide.c.
References Freestyle::a, add_v3_v3(), add_v3_v3v3(), BMVert::co, copy_v3_v3(), EdgeSlideData::curr_side_unclamp, EdgeSlideData::curr_sv_index, TransDataEdgeSlideVert::dir_side, edgeSlideFirstGet(), EdgeSlideParams::flipped, GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_DEPTH_LESS_EQUAL, GPU_DEPTH_NONE, GPU_depth_test(), GPU_FETCH_FLOAT, GPU_line_width(), GPU_matrix_mul, GPU_matrix_pop(), GPU_matrix_push(), GPU_point_size(), GPU_PRIM_LINES, GPU_PRIM_POINTS, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), immBegin(), immBeginAtMost(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniformThemeColorShadeAlpha(), immVertex3fv(), immVertexFormat(), interp_line_v3_v3v3v3(), is_zero_v3(), mul_v3_fl(), negate_v3_v3(), NULL, EdgeSlideParams::perc, pos, EdgeSlideData::sv, t, T_ALT_TRANSFORM, TFM_EDGE_SLIDE, TH_EDGE_SELECT, TH_FACEDOT_SIZE, TH_OUTLINE_WIDTH, TH_SELECT, EdgeSlideData::totsv, TRANS_DATA_CONTAINER_FIRST_OK, UI_GetThemeValuef(), EdgeSlideParams::use_even, TransDataEdgeSlideVert::v_co_orig, and TransDataEdgeSlideVert::v_side.
Referenced by drawTransformView().
|
static |
Get the first valid TransDataContainer *.
Note we cannot trust TRANS_DATA_CONTAINER_FIRST_OK because of multi-object that may leave items with invalid custom data in the transform data container.
Definition at line 103 of file transform_mode_edge_slide.c.
References BLI_assert, FOREACH_TRANS_DATA_CONTAINER, NULL, and t.
Referenced by edge_slide_snap_apply(), and edgeSlideFirstGet().
Definition at line 1270 of file transform_mode_edge_slide.c.
References add_v3_v3v3(), copy_v3_v3(), EdgeSlideData::curr_side_unclamp, EdgeSlideData::curr_sv_index, TransDataContainer::custom, TransCustomData::data, TransDataEdgeSlideVert::dir_side, edge_slide_container_first_ok(), EdgeSlideParams::flipped, getSnapPoint(), line_point_factor_v3(), TransDataContainer::mat, TransCustomDataContainer::mode, mul_m4_v3(), normalize_v3(), SCE_SNAP_MODE_EDGE, SCE_SNAP_MODE_FACE, sub_v3_v3(), sub_v3_v3v3(), EdgeSlideData::sv, t, T_ALT_TRANSFORM, transform_constraint_snap_axis_to_edge(), transform_constraint_snap_axis_to_face(), EdgeSlideParams::use_even, TransDataContainer::use_local_mat, and TransDataEdgeSlideVert::v_co_orig.
Referenced by initEdgeSlide_ex().
|
static |
Definition at line 114 of file transform_mode_edge_slide.c.
References TransDataContainer::custom, TransCustomData::data, edge_slide_container_first_ok(), TransCustomDataContainer::mode, and t.
Referenced by calcEdgeSlideCustomPoints(), doEdgeSlide(), and drawEdgeSlide().
|
static |
Definition at line 1064 of file transform_mode_edge_slide.c.
References TransCustomData::data, MEM_freeN, NULL, and EdgeSlideData::sv.
Referenced by initEdgeSlide_ex().
|
static |
Given 2 edges and a loop, step over the loops and calculate a direction to slide along.
| r_slide_vec | the direction to slide, the length of the vector defines the slide distance. |
Definition at line 220 of file transform_mode_edge_slide.c.
References add_v3_v3(), BLI_assert, BM_edge_calc_length(), BM_edge_other_vert(), BM_edge_share_vert(), BM_face_vert_share_loop(), BM_loop_calc_face_direction(), bm_loop_calc_opposite_co(), BM_loop_other_edge_loop(), BM_vert_in_edge(), BMVert::co, copy_v3_v3(), cross_v3_v3v3(), BMLoop::e, e, ELEM, BMLoop::f, l, BMFace::len, len_v3v3(), BMLoop::next, BMFace::no, normalize_v3(), normalize_v3_length(), NULL, BMLoop::prev, BMLoop::radial_next, sub_v3_v3v3(), BMLoop::v, and v.
Referenced by createEdgeSlideVerts_double_side().
Definition at line 132 of file transform_mode_edge_slide.c.
References BM_EDGES_OF_VERT, BM_elem_flag_test, BM_ELEM_SELECT, BM_ITER_ELEM, e, NULL, and v.
Referenced by createEdgeSlideVerts_double_side().
|
static |
Definition at line 1080 of file transform_mode_edge_slide.c.
References calcEdgeSlideCustomPoints(), EVT_CKEY, EVT_EKEY, EVT_FKEY, EVT_MODAL_MAP, EdgeSlideParams::flipped, KM_PRESS, MOUSEMOVE, t, T_ALT_TRANSFORM, TFM_EDGE_SLIDE, TFM_MODAL_EDGESLIDE_DOWN, TFM_MODAL_EDGESLIDE_UP, TREDRAW_HARD, TREDRAW_NOTHING, wmEvent::type, EdgeSlideParams::use_even, and wmEvent::val.
Referenced by initEdgeSlide_ex().
| void initEdgeSlide | ( | TransInfo * | t | ) |
Definition at line 1566 of file transform_mode_edge_slide.c.
References initEdgeSlide_ex(), and t.
| void initEdgeSlide_ex | ( | TransInfo * | t, |
| bool | use_double_side, | ||
| bool | use_even, | ||
| bool | flipped, | ||
| bool | use_clamp | ||
| ) |
Definition at line 1505 of file transform_mode_edge_slide.c.
References applyEdgeSlide(), B_UNIT_NONE, calcEdgeSlideCustomPoints(), copy_v3_fl(), createEdgeSlideVerts_double_side(), createEdgeSlideVerts_single_side(), edge_slide_snap_apply(), EdgeSlideParams::flipped, FOREACH_TRANS_DATA_CONTAINER, freeEdgeSlideVerts(), handleEventEdgeSlide(), initMouseInputMode(), INPUT_CUSTOM_RATIO_FLIP, MEM_callocN, EdgeSlideParams::perc, t, T_ALT_TRANSFORM, T_NO_CONSTRAINT, T_NO_PROJECT, TFM_EDGE_SLIDE, TRANS_CANCEL, transform_snap_distance_len_squared_fn(), and EdgeSlideParams::use_even.
Referenced by initEdgeSlide(), and transform_mode_init().
|
static |
Definition at line 147 of file transform_mode_edge_slide.c.
References copy_v3_v3(), fabsf, interp_v3_v3v3(), line_point_factor_v3(), t, UNLIKELY, v1, and v2.
Referenced by doEdgeSlide(), and drawEdgeSlide().