Blender  V3.3
ED_uvedit.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2008 Blender Foundation. All rights reserved. */
3 
8 #pragma once
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 struct ARegion;
15 struct ARegionType;
16 struct BMEditMesh;
17 struct BMFace;
18 struct BMLoop;
19 struct BMesh;
20 struct Image;
21 struct ImageUser;
22 struct Main;
23 struct Object;
24 struct Scene;
25 struct SpaceImage;
26 struct ToolSettings;
27 struct View2D;
28 struct ViewLayer;
29 struct bContext;
30 struct bNode;
31 struct bNodeTree;
32 struct wmKeyConfig;
33 
34 /* uvedit_ops.c */
35 
36 void ED_operatortypes_uvedit(void);
37 void ED_operatormacros_uvedit(void);
38 void ED_keymap_uvedit(struct wmKeyConfig *keyconf);
39 
40 bool ED_uvedit_minmax(const struct Scene *scene,
41  struct Object *obedit,
42  float min[2],
43  float max[2]);
47 void ED_uvedit_select_all(struct BMesh *bm);
48 
49 bool ED_uvedit_minmax_multi(const struct Scene *scene,
50  struct Object **objects_edit,
51  uint objects_len,
52  float r_min[2],
53  float r_max[2]);
54 bool ED_uvedit_center_multi(const struct Scene *scene,
55  struct Object **objects_edit,
56  uint objects_len,
57  float r_cent[2],
58  char mode);
59 
61  struct Scene *scene,
62  struct ViewLayer *view_layer,
63  float r_center[2],
64  char mode,
65  bool *r_has_select);
66 bool ED_uvedit_center_from_pivot(struct SpaceImage *sima,
67  struct Scene *scene,
68  struct ViewLayer *view_layer,
69  float r_center[2],
70  char mode);
71 
72 bool ED_object_get_active_image(struct Object *ob,
73  int mat_nr,
74  struct Image **r_ima,
75  struct ImageUser **r_iuser,
76  struct bNode **r_node,
77  struct bNodeTree **r_ntree);
78 void ED_object_assign_active_image(struct Main *bmain,
79  struct Object *ob,
80  int mat_nr,
81  struct Image *ima);
82 
83 bool ED_uvedit_test(struct Object *obedit);
84 
85 /* Visibility and selection tests. */
86 
87 bool uvedit_face_visible_test_ex(const struct ToolSettings *ts, struct BMFace *efa);
89  struct BMFace *efa,
90  int cd_loop_uv_offset);
92  struct BMLoop *l,
93  int cd_loop_uv_offset);
94 bool uvedit_uv_select_test_ex(const struct ToolSettings *ts,
95  struct BMLoop *l,
96  int cd_loop_uv_offset);
97 bool uvedit_face_visible_test(const struct Scene *scene, struct BMFace *efa);
98 bool uvedit_face_select_test(const struct Scene *scene, struct BMFace *efa, int cd_loop_uv_offset);
99 bool uvedit_edge_select_test(const struct Scene *scene, struct BMLoop *l, int cd_loop_uv_offset);
100 bool uvedit_uv_select_test(const struct Scene *scene, struct BMLoop *l, int cd_loop_uv_offset);
101 
102 /* Individual UV element selection functions. */
103 
109 void uvedit_face_select_set(const struct Scene *scene,
110  struct BMEditMesh *em,
111  struct BMFace *efa,
112  bool select,
113  bool do_history,
114  int cd_loop_uv_offset);
120 void uvedit_edge_select_set(const struct Scene *scene,
121  struct BMEditMesh *em,
122  struct BMLoop *l,
123  bool select,
124  bool do_history,
125  int cd_loop_uv_offset);
131 void uvedit_uv_select_set(const struct Scene *scene,
132  struct BMEditMesh *em,
133  struct BMLoop *l,
134  bool select,
135  bool do_history,
136  int cd_loop_uv_offset);
137 
138 /* Low level functions for (de)selecting individual UV elements. Ensure UV face visibility before
139  * use. */
140 
142  struct BMEditMesh *em,
143  struct BMFace *efa,
144  bool do_history,
145  int cd_loop_uv_offset);
147  struct BMEditMesh *em,
148  struct BMFace *efa,
149  int cd_loop_uv_offset);
151  struct BMEditMesh *em,
152  struct BMLoop *l,
153  bool do_history,
154  int cd_loop_uv_offset);
156  struct BMEditMesh *em,
157  struct BMLoop *l,
158  int cd_loop_uv_offset);
160  struct BMEditMesh *em,
161  struct BMLoop *l,
162  bool do_history,
163  int cd_loop_uv_offset);
165  struct BMEditMesh *em,
166  struct BMLoop *l,
167  int cd_loop_uv_offset);
168 
169 /* Sticky mode UV element selection functions. */
170 
172  struct BMEditMesh *em,
173  struct BMFace *efa,
174  bool select,
175  bool do_history,
176  int cd_loop_uv_offset);
178  struct BMEditMesh *em,
179  struct BMLoop *l,
180  bool select,
181  bool do_history,
182  uint cd_loop_uv_offset);
184  struct BMEditMesh *em,
185  struct BMLoop *l,
186  bool select,
187  bool do_history,
188  uint cd_loop_uv_offset);
189 
190 /* Low level functions for sticky element selection (sticky mode independent). Type of sticky
191  * selection is specified explicitly (using sticky_flag, except for face selection). */
192 
194  struct BMEditMesh *em,
195  struct BMFace *efa,
196  const bool select,
197  const bool do_history,
198  const int cd_loop_uv_offset);
200  struct BMEditMesh *em,
201  struct BMLoop *l,
202  const bool select,
203  const int sticky_flag,
204  const bool do_history,
205  const int cd_loop_uv_offset);
207  struct BMEditMesh *em,
208  struct BMLoop *l,
209  const bool select,
210  const int sticky_flag,
211  const bool do_history,
212  const int cd_loop_uv_offset);
213 
214 /* Sets required UV edge flags as specified by the sticky_flag. */
216  struct BMLoop *l,
217  const bool select,
218  const int sticky_flag,
219  const int cd_loop_uv_offset);
220 
227 void ED_uvedit_selectmode_clean(const struct Scene *scene, struct Object *obedit);
229 
235 void ED_uvedit_selectmode_flush(const struct Scene *scene, struct BMEditMesh *em);
236 
240 void uvedit_deselect_flush(const struct Scene *scene, struct BMEditMesh *em);
244 void uvedit_select_flush(const struct Scene *scene, struct BMEditMesh *em);
245 
246 bool ED_uvedit_nearest_uv_multi(const struct View2D *v2d,
247  const struct Scene *scene,
248  struct Object **objects,
249  uint objects_len,
250  const int mval[2],
251  const bool ignore_selected,
252  float *dist_sq,
253  float r_uv[2]);
254 
256  struct BMesh *bm,
257  int len_max,
258  int *r_faces_len);
260  struct BMesh *bm,
261  int len_max,
262  int *r_edges_len);
264  struct BMesh *bm,
265  int len_max,
266  int *r_verts_len);
267 
268 void ED_uvedit_get_aspect(struct Object *obedit, float *r_aspx, float *r_aspy);
270  const int material_index,
271  float *r_aspx,
272  float *r_aspy);
273 
274 void ED_uvedit_active_vert_loop_set(struct BMesh *bm, struct BMLoop *l);
276 
277 void ED_uvedit_active_edge_loop_set(struct BMesh *bm, struct BMLoop *l);
279 
286  struct BMEditMesh *em,
287  bool select);
288 
289 /* uvedit_unwrap_ops.c */
290 
291 void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit);
293 void ED_uvedit_live_unwrap_end(short cancel);
294 
295 void ED_uvedit_live_unwrap(const struct Scene *scene, struct Object **objects, int objects_len);
296 void ED_uvedit_add_simple_uvs(struct Main *bmain, const struct Scene *scene, struct Object *ob);
297 
298 /* uvedit_draw.c */
299 
300 void ED_image_draw_cursor(struct ARegion *region, const float cursor[2]);
301 
302 /* uvedit_buttons.c */
303 
304 void ED_uvedit_buttons_register(struct ARegionType *art);
305 
306 /* uvedit_islands.c */
307 
309  const struct Image *image;
311  int grid_shape[2];
314 };
316  bool use_active,
317  struct UVMapUDIM_Params *udim_params);
318 
327 };
328 
332 bool uv_coords_isect_udim(const struct Image *image,
333  const int udim_grid[2],
334  const float coords[2]);
336  Object **objects,
337  uint objects_len,
338  const struct UVMapUDIM_Params *udim_params,
339  const struct UVPackIsland_Params *params);
340 
341 #ifdef __cplusplus
342 }
343 #endif
unsigned int uint
Definition: BLI_sys_types.h:67
void ED_uvedit_buttons_register(struct ARegionType *art)
void ED_uvedit_select_sync_flush(const struct ToolSettings *ts, struct BMEditMesh *em, bool select)
bool uvedit_face_select_test(const struct Scene *scene, struct BMFace *efa, int cd_loop_uv_offset)
void ED_uvedit_selectmode_clean_multi(struct bContext *C)
bool ED_uvedit_center_multi(const struct Scene *scene, struct Object **objects_edit, uint objects_len, float r_cent[2], char mode)
void ED_uvedit_live_unwrap_begin(struct Scene *scene, struct Object *obedit)
void ED_uvedit_selectmode_clean(const struct Scene *scene, struct Object *obedit)
UV Select Mode set.
void ED_operatormacros_uvedit(void)
Definition: uvedit_ops.c:2108
void uvedit_uv_select_disable(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, int cd_loop_uv_offset)
bool ED_object_get_active_image(struct Object *ob, int mat_nr, struct Image **r_ima, struct ImageUser **r_iuser, struct bNode **r_node, struct bNodeTree **r_ntree)
Definition: uvedit_ops.c:109
void uvedit_face_select_shared_vert(const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, const bool select, const bool do_history, const int cd_loop_uv_offset)
struct BMLoop * ED_uvedit_active_edge_loop_get(struct BMesh *bm)
void uvedit_edge_select_shared_vert(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, const bool select, const int sticky_flag, const bool do_history, const int cd_loop_uv_offset)
void ED_uvedit_get_aspect_from_material(Object *ob, const int material_index, float *r_aspx, float *r_aspy)
void ED_uvedit_select_all(struct BMesh *bm)
Definition: uvedit_ops.c:240
void uvedit_face_select_set(const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, bool select, bool do_history, int cd_loop_uv_offset)
Select UV Face.
bool uvedit_uv_select_test(const struct Scene *scene, struct BMLoop *l, int cd_loop_uv_offset)
bool ED_uvedit_minmax_multi(const struct Scene *scene, struct Object **objects_edit, uint objects_len, float r_min[2], float r_max[2])
void ED_object_assign_active_image(struct Main *bmain, struct Object *ob, int mat_nr, struct Image *ima)
Definition: uvedit_ops.c:160
bool ED_uvedit_center_from_pivot_ex(struct SpaceImage *sima, struct Scene *scene, struct ViewLayer *view_layer, float r_center[2], char mode, bool *r_has_select)
Definition: uvedit_ops.c:317
bool uvedit_edge_select_test_ex(const struct ToolSettings *ts, struct BMLoop *l, int cd_loop_uv_offset)
void ED_keymap_uvedit(struct wmKeyConfig *keyconf)
Definition: uvedit_ops.c:2123
bool ED_uvedit_center_from_pivot(struct SpaceImage *sima, struct Scene *scene, struct ViewLayer *view_layer, float r_center[2], char mode)
Definition: uvedit_ops.c:353
bool ED_uvedit_test(struct Object *obedit)
Definition: uvedit_ops.c:64
void uvedit_edge_select_disable(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, int cd_loop_uv_offset)
void ED_uvedit_live_unwrap(const struct Scene *scene, struct Object **objects, int objects_len)
void uvedit_deselect_flush(const struct Scene *scene, struct BMEditMesh *em)
bool uv_coords_isect_udim(const struct Image *image, const int udim_grid[2], const float coords[2])
void ED_uvedit_get_aspect(struct Object *obedit, float *r_aspx, float *r_aspy)
void uvedit_uv_select_set_with_sticky(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, bool select, bool do_history, uint cd_loop_uv_offset)
void uvedit_face_select_set_with_sticky(const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, bool select, bool do_history, int cd_loop_uv_offset)
void uvedit_face_select_enable(const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, bool do_history, int cd_loop_uv_offset)
void ED_uvedit_active_vert_loop_set(struct BMesh *bm, struct BMLoop *l)
Definition: uvedit_select.c:98
struct BMLoop ** ED_uvedit_selected_verts(const struct Scene *scene, struct BMesh *bm, int len_max, int *r_verts_len)
void uvedit_uv_select_shared_vert(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, const bool select, const int sticky_flag, const bool do_history, const int cd_loop_uv_offset)
void ED_uvedit_live_unwrap_re_solve(void)
void uvedit_edge_select_set(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, bool select, bool do_history, int cd_loop_uv_offset)
Select UV Edge.
bool uvedit_uv_select_test_ex(const struct ToolSettings *ts, struct BMLoop *l, int cd_loop_uv_offset)
void uvedit_edge_select_set_with_sticky(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, bool select, bool do_history, uint cd_loop_uv_offset)
void uvedit_edge_select_set_noflush(const struct Scene *scene, struct BMLoop *l, const bool select, const int sticky_flag, const int cd_loop_uv_offset)
void ED_operatortypes_uvedit(void)
Definition: uvedit_ops.c:2055
void uvedit_uv_select_enable(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, bool do_history, int cd_loop_uv_offset)
bool uvedit_face_visible_test_ex(const struct ToolSettings *ts, struct BMFace *efa)
char ED_uvedit_select_mode_get(const struct Scene *scene)
void uvedit_select_flush(const struct Scene *scene, struct BMEditMesh *em)
void ED_uvedit_add_simple_uvs(struct Main *bmain, const struct Scene *scene, struct Object *ob)
struct BMLoop * ED_uvedit_active_vert_loop_get(struct BMesh *bm)
void uvedit_face_select_disable(const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, int cd_loop_uv_offset)
void uvedit_edge_select_enable(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, bool do_history, int cd_loop_uv_offset)
bool uvedit_edge_select_test(const struct Scene *scene, struct BMLoop *l, int cd_loop_uv_offset)
void ED_uvedit_active_edge_loop_set(struct BMesh *bm, struct BMLoop *l)
struct BMFace ** ED_uvedit_selected_faces(const struct Scene *scene, struct BMesh *bm, int len_max, int *r_faces_len)
bool uvedit_face_select_test_ex(const struct ToolSettings *ts, struct BMFace *efa, int cd_loop_uv_offset)
bool uvedit_face_visible_test(const struct Scene *scene, struct BMFace *efa)
void ED_uvedit_selectmode_flush(const struct Scene *scene, struct BMEditMesh *em)
UV Select Mode Flush.
void ED_image_draw_cursor(struct ARegion *region, const float cursor[2])
Definition: uvedit_draw.c:25
bool ED_uvedit_minmax(const struct Scene *scene, struct Object *obedit, float min[2], float max[2])
void ED_uvedit_live_unwrap_end(short cancel)
void uvedit_uv_select_set(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, bool select, bool do_history, int cd_loop_uv_offset)
Select UV Vertex.
bool ED_uvedit_udim_params_from_image_space(const struct SpaceImage *sima, bool use_active, struct UVMapUDIM_Params *udim_params)
bool ED_uvedit_nearest_uv_multi(const struct View2D *v2d, const struct Scene *scene, struct Object **objects, uint objects_len, const int mval[2], const bool ignore_selected, float *dist_sq, float r_uv[2])
void ED_uvedit_pack_islands_multi(const struct Scene *scene, Object **objects, uint objects_len, const struct UVMapUDIM_Params *udim_params, const struct UVPackIsland_Params *params)
struct BMLoop ** ED_uvedit_selected_edges(const struct Scene *scene, struct BMesh *bm, int len_max, int *r_edges_len)
#define C
Definition: RandGen.cpp:25
__forceinline const avxb select(const avxb &m, const avxb &t, const avxb &f)
Definition: avxb.h:154
ATTR_WARN_UNUSED_RESULT BMesh * bm
ATTR_WARN_UNUSED_RESULT const BMLoop * l
Scene scene
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
#define min(a, b)
Definition: sort.c:35
Definition: BKE_main.h:121
const struct Image * image
Definition: ED_uvedit.h:309
bool use_target_udim
Definition: ED_uvedit.h:312
int grid_shape[2]
Definition: ED_uvedit.h:311
float max
static bool do_history(const char *name, ReportList *reports)
Definition: writefile.c:1269