Blender  V3.3
ED_transform_snap_object_context.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 
7 #pragma once
8 
9 #include "DNA_scene_types.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 struct BMEdge;
16 struct BMFace;
17 struct BMVert;
18 
19 struct ARegion;
20 struct Depsgraph;
21 struct ListBase;
22 struct Object;
23 struct Scene;
24 struct View3D;
25 
26 /* transform_snap_object.cc */
27 
28 /* ED_transform_snap_object_*** API */
29 
30 typedef enum eSnapEditType {
33  SNAP_GEOM_EDIT = 2, /* Bmesh for mesh-type. */
35 
39 
40  float depth;
41  float co[3];
42  float no[3];
43  int index;
44 
45  struct Object *ob_eval;
46  float obmat[4][4];
47 
48  /* needed to tell which ray-cast this was part of,
49  * the same object may be part of many ray-casts when dupli's are used. */
50  unsigned int ob_uuid;
51 };
52 
55  /* Special context sensitive handling for the active or selected object. */
57  /* Geometry for snapping in edit mode. */
59  /* snap to the closest element, use when using more than one snap type */
60  bool use_occlusion_test : true;
61  /* exclude back facing geometry from snapping */
62  bool use_backface_culling : true;
63  /* Break nearest face snapping into steps to improve transformations across U-shaped targets. */
65  /* Enable to force nearest face snapping to snap to target the source was initially near. */
67 };
68 
72 
73 /* callbacks to filter how snap works */
75  SnapObjectContext *sctx,
76  bool (*test_vert_fn)(struct BMVert *, void *user_data),
77  bool (*test_edge_fn)(struct BMEdge *, void *user_data),
78  bool (*test_face_fn)(struct BMFace *, void *user_data),
79  void *user_data);
80 
82  struct Depsgraph *depsgraph,
83  const View3D *v3d,
84  const struct SnapObjectParams *params,
85  const float ray_start[3],
86  const float ray_normal[3],
87  float *ray_depth,
88  /* return args */
89  float r_loc[3],
90  float r_no[3],
91  int *r_index,
92  struct Object **r_ob,
93  float r_obmat[4][4]);
95  struct Depsgraph *depsgraph,
96  const View3D *v3d,
97  const struct SnapObjectParams *params,
98  const float ray_origin[3],
99  const float ray_direction[3],
100  float *ray_depth,
101  float r_co[3],
102  float r_no[3]);
103 
112  struct Depsgraph *depsgraph,
113  const View3D *v3d,
114  const struct SnapObjectParams *params,
115  const float ray_start[3],
116  const float ray_normal[3],
117  float ray_depth,
118  bool sort,
119  struct ListBase *r_hit_list);
120 
142  struct Depsgraph *depsgraph,
143  const ARegion *region,
144  const View3D *v3d,
145  const eSnapMode snap_to,
146  const struct SnapObjectParams *params,
147  const float init_co[3],
148  const float mval[2],
149  const float prev_co[3],
150  float *dist_px,
151  float r_loc[3],
152  float r_no[3],
153  int *r_index,
154  struct Object **r_ob,
155  float r_obmat[4][4],
156  float r_face_nor[3]);
174  struct Depsgraph *depsgraph,
175  const ARegion *region,
176  const View3D *v3d,
177  const eSnapMode snap_to,
178  const struct SnapObjectParams *params,
179  const float init_co[3],
180  const float mval[2],
181  const float prev_co[3],
182  float *dist_px,
183  /* return args */
184  float r_loc[3],
185  float r_no[3]);
186 
191  struct Depsgraph *depsgraph,
192  const ARegion *region,
193  const View3D *v3d,
194  const struct SnapObjectParams *params,
195  const float mval[2],
196  float ray_depth,
197  bool sort,
198  ListBase *r_hit_list);
199 
200 #ifdef __cplusplus
201 }
202 #endif
struct Depsgraph Depsgraph
Definition: DEG_depsgraph.h:35
eSnapTargetSelect
eSnapMode
eSnapMode ED_transform_snap_object_project_view3d(struct SnapObjectContext *sctx, struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const eSnapMode snap_to, const struct SnapObjectParams *params, const float init_co[3], const float mval[2], const float prev_co[3], float *dist_px, float r_loc[3], float r_no[3])
bool ED_transform_snap_object_project_all_view3d_ex(SnapObjectContext *sctx, struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const struct SnapObjectParams *params, const float mval[2], float ray_depth, bool sort, ListBase *r_hit_list)
bool ED_transform_snap_object_project_ray_all(SnapObjectContext *sctx, struct Depsgraph *depsgraph, const View3D *v3d, const struct SnapObjectParams *params, const float ray_start[3], const float ray_normal[3], float ray_depth, bool sort, struct ListBase *r_hit_list)
void ED_transform_snap_object_context_set_editmesh_callbacks(SnapObjectContext *sctx, bool(*test_vert_fn)(struct BMVert *, void *user_data), bool(*test_edge_fn)(struct BMEdge *, void *user_data), bool(*test_face_fn)(struct BMFace *, void *user_data), void *user_data)
bool ED_transform_snap_object_project_ray(SnapObjectContext *sctx, struct Depsgraph *depsgraph, const View3D *v3d, const struct SnapObjectParams *params, const float ray_origin[3], const float ray_direction[3], float *ray_depth, float r_co[3], float r_no[3])
SnapObjectContext * ED_transform_snap_object_context_create(struct Scene *scene, int flag)
void ED_transform_snap_object_context_destroy(SnapObjectContext *sctx)
bool ED_transform_snap_object_project_ray_ex(struct SnapObjectContext *sctx, struct Depsgraph *depsgraph, const View3D *v3d, const struct SnapObjectParams *params, const float ray_start[3], const float ray_normal[3], float *ray_depth, float r_loc[3], float r_no[3], int *r_index, struct Object **r_ob, float r_obmat[4][4])
eSnapMode ED_transform_snap_object_project_view3d_ex(struct SnapObjectContext *sctx, struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, const eSnapMode snap_to, const struct SnapObjectParams *params, const float init_co[3], const float mval[2], const float prev_co[3], float *dist_px, float r_loc[3], float r_no[3], int *r_index, struct Object **r_ob, float r_obmat[4][4], float r_face_nor[3])
void sort(btMatrix3x3 &U, btVector3 &sigma, btMatrix3x3 &V, int t)
Helper function of 3X3 SVD for sorting singular values.
Scene scene
const Depsgraph * depsgraph
void * user_data
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
bool(* test_face_fn)(BMFace *, void *user_data)
bool(* test_edge_fn)(BMEdge *, void *user_data)
bool(* test_vert_fn)(BMVert *, void *user_data)
struct SnapObjectHitDepth * next
struct SnapObjectHitDepth * prev