Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/transform/transform_snap_object.c
| Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | |||||
| #include "ED_transform.h" | #include "ED_transform.h" | ||||
| #include "ED_transform_snap_object_context.h" | #include "ED_transform_snap_object_context.h" | ||||
| #include "ED_view3d.h" | #include "ED_view3d.h" | ||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "transform.h" | #include "transform.h" | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** Internal Data Types | /** \name Internal Data Types | ||||
| * \{ */ | * \{ */ | ||||
| #define MAX_CLIPPLANE_LEN 3 | #define MAX_CLIPPLANE_LEN 3 | ||||
| enum eViewProj { | enum eViewProj { | ||||
| VIEW_PROJ_NONE = -1, | VIEW_PROJ_NONE = -1, | ||||
| VIEW_PROJ_ORTHO = 0, | VIEW_PROJ_ORTHO = 0, | ||||
| VIEW_PROJ_PERSP = -1, | VIEW_PROJ_PERSP = -1, | ||||
| ▲ Show 20 Lines • Show All 65 Lines • ▼ Show 20 Lines | struct { | ||||
| void *user_data; | void *user_data; | ||||
| } edit_mesh; | } edit_mesh; | ||||
| } callbacks; | } callbacks; | ||||
| }; | }; | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** Common Utilities | /** \name Common Utilities | ||||
| * \{ */ | * \{ */ | ||||
| /** | /** | ||||
| * Calculate the minimum and maximum coordinates of the box that encompasses this mesh. | * Calculate the minimum and maximum coordinates of the box that encompasses this mesh. | ||||
| */ | */ | ||||
| static void bm_mesh_minmax(BMesh *bm, float r_min[3], float r_max[3]) | static void bm_mesh_minmax(BMesh *bm, float r_min[3], float r_max[3]) | ||||
| { | { | ||||
| INIT_MINMAX(r_min, r_max); | INIT_MINMAX(r_min, r_max); | ||||
| ▲ Show 20 Lines • Show All 839 Lines • ▼ Show 20 Lines | static bool raycastObjects(SnapObjectContext *sctx, | ||||
| iter_snap_objects(sctx, params, raycast_obj_cb, &data); | iter_snap_objects(sctx, params, raycast_obj_cb, &data); | ||||
| return data.ret; | return data.ret; | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** Snap Nearest utilities | /** \name Snap Nearest utilities | ||||
| * \{ */ | * \{ */ | ||||
| /* Test BoundBox */ | /* Test BoundBox */ | ||||
| static bool snap_bound_box_check_dist(float min[3], | static bool snap_bound_box_check_dist(float min[3], | ||||
| const float max[3], | const float max[3], | ||||
| const float lpmat[4][4], | const float lpmat[4][4], | ||||
| const float win_size[2], | const float win_size[2], | ||||
| const float mval[2], | const float mval[2], | ||||
| ▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | static bool test_projected_edge_dist(const struct DistProjectedAABBPrecalc *precalc, | ||||
| return test_projected_vert_dist( | return test_projected_vert_dist( | ||||
| precalc, clip_plane, clip_plane_len, is_persp, near_co, dist_px_sq, r_co); | precalc, clip_plane, clip_plane_len, is_persp, near_co, dist_px_sq, r_co); | ||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** Walk DFS | /** \name Walk DFS | ||||
| * \{ */ | * \{ */ | ||||
| typedef void (*Nearest2DGetVertCoCallback)(const int index, const float **co, void *data); | typedef void (*Nearest2DGetVertCoCallback)(const int index, const float **co, void *data); | ||||
| typedef void (*Nearest2DGetEdgeVertsCallback)(const int index, int v_index[2], void *data); | typedef void (*Nearest2DGetEdgeVertsCallback)(const int index, int v_index[2], void *data); | ||||
| typedef void (*Nearest2DGetTriVertsCallback)(const int index, int v_index[3], void *data); | typedef void (*Nearest2DGetTriVertsCallback)(const int index, int v_index[3], void *data); | ||||
| /* Equal the previous one */ | /* Equal the previous one */ | ||||
| typedef void (*Nearest2DGetTriEdgesCallback)(const int index, int e_index[3], void *data); | typedef void (*Nearest2DGetTriEdgesCallback)(const int index, int e_index[3], void *data); | ||||
| typedef void (*Nearest2DCopyVertNoCallback)(const int index, float r_no[3], void *data); | typedef void (*Nearest2DCopyVertNoCallback)(const int index, float r_no[3], void *data); | ||||
| ▲ Show 20 Lines • Show All 1,976 Lines • Show Last 20 Lines | |||||