Blender  V2.93
Classes | Macros
transform_mode_edge_slide.c File Reference
#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)
 

Transform (Edge Slide)

typedef struct TransDataEdgeSlideVert TransDataEdgeSlideVert
 
typedef struct EdgeSlideData EdgeSlideData
 
typedef struct EdgeSlideParams EdgeSlideParams
 
static TransDataContaineredge_slide_container_first_ok (TransInfo *t)
 
static EdgeSlideDataedgeSlideFirstGet (TransInfo *t)
 
static void calcEdgeSlideCustomPoints (struct TransInfo *t)
 
static BMEdgeget_other_edge (BMVert *v, BMEdge *e)
 
static void interp_line_v3_v3v3v3 (float p[3], const float v1[3], const float v2[3], const float v3[3], float t)
 
static bool bm_loop_calc_opposite_co (BMLoop *l_tmp, const float plane_no[3], float r_co[3])
 
static BMLoopget_next_loop (BMVert *v, BMLoop *l, BMEdge *e_prev, BMEdge *e_next, float r_slide_vec[3])
 
static void calcEdgeSlide_mval_range (TransInfo *t, TransDataContainer *tc, EdgeSlideData *sld, const int *sv_table, const int loop_nr, const float mval[2], const bool use_occlude_geometry, const bool use_calc_direction)
 
static void calcEdgeSlide_even (TransInfo *t, TransDataContainer *tc, EdgeSlideData *sld, const float mval[2])
 
static EdgeSlideDatacreateEdgeSlideVerts_double_side (TransInfo *t, TransDataContainer *tc)
 
static EdgeSlideDatacreateEdgeSlideVerts_single_side (TransInfo *t, TransDataContainer *tc)
 
static void freeEdgeSlideVerts (TransInfo *UNUSED(t), TransDataContainer *UNUSED(tc), TransCustomData *custom_data)
 
static eRedrawFlag handleEventEdgeSlide (struct TransInfo *t, const struct wmEvent *event)
 
void drawEdgeSlide (TransInfo *t)
 
static void edge_slide_snap_apply (TransInfo *t, float *value)
 
static void doEdgeSlide (TransInfo *t, float perc)
 
static void applyEdgeSlide (TransInfo *t, const int UNUSED(mval[2]))
 
void initEdgeSlide_ex (TransInfo *t, bool use_double_side, bool use_even, bool flipped, bool use_clamp)
 
void initEdgeSlide (TransInfo *t)
 

Macro Definition Documentation

◆ EDGESLIDE_VERT_IS_INNER

#define EDGESLIDE_VERT_IS_INNER (   v,
  e_dir 
)     ((BM_edge_is_boundary(e_dir) == false) && (BM_vert_edge_count_nonwire(v) == 2))

◆ INDEX_INVALID

#define INDEX_INVALID   -2

◆ INDEX_UNSET

#define INDEX_UNSET   -1

◆ SV_FROM_VERT

#define SV_FROM_VERT (   v)
Value:
((sv_table[BM_elem_index_get(v)] == INDEX_UNSET) ? \
((void)(sv_table[BM_elem_index_get(v)] = STACK_SIZE(sv_array)), \
STACK_PUSH_RET_PTR(sv_array)) : \
(&sv_array[sv_table[BM_elem_index_get(v)]]))
#define STACK_SIZE(stack)
#define STACK_PUSH_RET_PTR(stack)
#define BM_elem_index_get(ele)
Definition: bmesh_inline.h:124
ATTR_WARN_UNUSED_RESULT const BMVert * v
#define INDEX_UNSET

Typedef Documentation

◆ EdgeSlideData

typedef struct EdgeSlideData EdgeSlideData

◆ EdgeSlideParams

◆ TransDataEdgeSlideVert

Function Documentation

◆ applyEdgeSlide()

static void applyEdgeSlide ( TransInfo t,
const int   UNUSEDmval[2] 
)
static

◆ bm_loop_calc_opposite_co()

static bool bm_loop_calc_opposite_co ( BMLoop l_tmp,
const float  plane_no[3],
float  r_co[3] 
)
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().

◆ calcEdgeSlide_even()

static void calcEdgeSlide_even ( TransInfo t,
TransDataContainer tc,
EdgeSlideData sld,
const float  mval[2] 
)
static

◆ calcEdgeSlide_mval_range()

static void calcEdgeSlide_mval_range ( TransInfo t,
TransDataContainer tc,
EdgeSlideData sld,
const int *  sv_table,
const int  loop_nr,
const float  mval[2],
const bool  use_occlude_geometry,
const bool  use_calc_direction 
)
static

◆ calcEdgeSlideCustomPoints()

static void calcEdgeSlideCustomPoints ( struct TransInfo t)
static

◆ createEdgeSlideVerts_double_side()

static EdgeSlideData* createEdgeSlideVerts_double_side ( TransInfo t,
TransDataContainer tc 
)
static

◆ createEdgeSlideVerts_single_side()

static EdgeSlideData* createEdgeSlideVerts_single_side ( TransInfo t,
TransDataContainer tc 
)
static

◆ doEdgeSlide()

static void doEdgeSlide ( TransInfo t,
float  perc 
)
static

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

Note
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().

◆ drawEdgeSlide()

void drawEdgeSlide ( TransInfo t)

◆ edge_slide_container_first_ok()

static TransDataContainer* edge_slide_container_first_ok ( TransInfo t)
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().

◆ edge_slide_snap_apply()

static void edge_slide_snap_apply ( TransInfo t,
float value 
)
static

◆ edgeSlideFirstGet()

static EdgeSlideData* edgeSlideFirstGet ( TransInfo t)
static

◆ freeEdgeSlideVerts()

static void freeEdgeSlideVerts ( TransInfo UNUSEDt,
TransDataContainer UNUSEDtc,
TransCustomData custom_data 
)
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().

◆ get_next_loop()

static BMLoop* get_next_loop ( BMVert v,
BMLoop l,
BMEdge e_prev,
BMEdge e_next,
float  r_slide_vec[3] 
)
static

◆ get_other_edge()

static BMEdge* get_other_edge ( BMVert v,
BMEdge e 
)
static

◆ handleEventEdgeSlide()

static eRedrawFlag handleEventEdgeSlide ( struct TransInfo t,
const struct wmEvent event 
)
static

◆ initEdgeSlide()

void initEdgeSlide ( TransInfo t)

Definition at line 1566 of file transform_mode_edge_slide.c.

References initEdgeSlide_ex(), and t.

◆ initEdgeSlide_ex()

void initEdgeSlide_ex ( TransInfo t,
bool  use_double_side,
bool  use_even,
bool  flipped,
bool  use_clamp 
)

◆ interp_line_v3_v3v3v3()

static void interp_line_v3_v3v3v3 ( float  p[3],
const float  v1[3],
const float  v2[3],
const float  v3[3],
float  t 
)
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().