26
24
* ***** END GPL LICENSE BLOCK *****
29
#ifndef ED_UVEDIT_INTERN_H
30
#define ED_UVEDIT_INTERN_H
27
/** \file blender/editors/uvedit/uvedit_intern.h
32
#ifndef __UVEDIT_INTERN_H__
33
#define __UVEDIT_INTERN_H__
38
42
struct wmOperatorType;
40
#define UV_SELECT_ALL 1
41
#define UV_SELECT_PINNED 2
43
49
/* id can be from 0 to 3 */
44
50
#define TF_PIN_MASK(id) (TF_PIN1 << id)
45
51
#define TF_SEL_MASK(id) (TF_SEL1 << id)
47
53
/* visibility and selection */
48
int uvedit_face_visible_nolocal(struct Scene *scene, struct EditFace *efa);
49
int uvedit_face_visible(struct Scene *scene, struct Image *ima, struct EditFace *efa, struct MTFace *tf);
51
int uvedit_face_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf);
52
void uvedit_face_select(struct Scene *scene, struct EditFace *efa, struct MTFace *tf);
53
void uvedit_face_deselect(struct Scene *scene, struct EditFace *efa, struct MTFace *tf);
55
int uvedit_edge_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
56
void uvedit_edge_select(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
57
void uvedit_edge_deselect(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
59
int uvedit_uv_selected(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
60
void uvedit_uv_select(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
61
void uvedit_uv_deselect(struct Scene *scene, struct EditFace *efa, struct MTFace *tf, int i);
54
int uvedit_face_visible_nolocal(struct Scene *scene, struct BMFace *efa);
63
56
/* geometric utilities */
64
58
void uv_center(float uv[][2], float cent[2], int quad);
65
59
float uv_area(float uv[][2], int quad);
66
60
void uv_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy);
62
float poly_uv_area(float uv[][2], int len);
63
void poly_copy_aspect(float uv_orig[][2], float uv[][2], float aspx, float aspy, int len);
64
void poly_uv_center(struct BMEditMesh *em, struct BMFace *f, float cent[2]);
68
typedef struct NearestHit {
71
struct BMLoop *l, *nextl;
72
struct MLoopUV *luv, *nextluv;
73
int lindex; //index of loop within face
74
int vert1, vert2; //index in mesh of edge vertices
77
void uv_find_nearest_vert(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], float penalty[2], struct NearestHit *hit);
78
void uv_find_nearest_edge(struct Scene *scene, struct Image *ima, struct BMEditMesh *em, float co[2], struct NearestHit *hit);
80
/* utility tool functions */
82
struct UvElement *ED_uv_element_get(struct UvElementMap *map, struct BMFace *efa, struct BMLoop *l);
83
void uvedit_live_unwrap_update(struct SpaceImage *sima, struct Scene *scene, struct Object *obedit);
87
/* object that stores display data for previewing before accepting stitching */
88
typedef struct StitchPreviewer {
89
/* here we'll store the preview triangle indices of the mesh */
91
/* uvs per polygon. */
92
unsigned int *uvs_per_polygon;
93
/*number of preview polygons */
94
unsigned int num_polys;
95
/* preview data. These will be either the previewed vertices or edges depending on stitch mode settings */
96
float *preview_stitchable;
97
float *preview_unstitchable;
98
/* here we'll store the number of elements to be drawn */
99
unsigned int num_stitchable;
100
unsigned int num_unstitchable;
101
unsigned int preview_uvs;
102
/* ...and here we'll store the triangles*/
104
unsigned int num_static_tris;
107
StitchPreviewer *uv_get_stitch_previewer(void);
69
111
void UV_OT_average_islands_scale(struct wmOperatorType *ot);
70
112
void UV_OT_cube_project(struct wmOperatorType *ot);
71
113
void UV_OT_cylinder_project(struct wmOperatorType *ot);