Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_intern.h')
-rw-r--r--source/blender/editors/uvedit/uvedit_intern.h26
1 files changed, 23 insertions, 3 deletions
diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h
index 28567234fab..6fef7ebcf22 100644
--- a/source/blender/editors/uvedit/uvedit_intern.h
+++ b/source/blender/editors/uvedit/uvedit_intern.h
@@ -41,13 +41,34 @@ typedef struct UvNearestHit {
/** Always set if we have a hit. */
struct BMFace *efa;
struct BMLoop *l;
- /** Needs to be set before calling nearest functions. */
+ /**
+ * Needs to be set before calling nearest functions.
+ *
+ * \note When #UV_NEAREST_HIT_INIT_DIST_PX or #UV_NEAREST_HIT_INIT_MAX are used,
+ * this value is pixels squared.
+ */
float dist_sq;
+
+ /** Scale the UV's to account for aspect ratio from the image view. */
+ float scale[2];
} UvNearestHit;
-#define UV_NEAREST_HIT_INIT \
+#define UV_NEAREST_HIT_INIT_DIST_PX(v2d, dist_px) \
+ { \
+ .dist_sq = square_f(U.pixelsize * dist_px), \
+ .scale = { \
+ UI_view2d_scale_get_x(v2d), \
+ UI_view2d_scale_get_y(v2d), \
+ }, \
+ }
+
+#define UV_NEAREST_HIT_INIT_MAX(v2d) \
{ \
.dist_sq = FLT_MAX, \
+ .scale = { \
+ UI_view2d_scale_get_x(v2d), \
+ UI_view2d_scale_get_y(v2d), \
+ }, \
}
bool uv_find_nearest_vert(struct Scene *scene,
@@ -96,7 +117,6 @@ BMLoop *uv_find_nearest_loop_from_edge(struct Scene *scene,
void uvedit_live_unwrap_update(struct SpaceImage *sima,
struct Scene *scene,
struct Object *obedit);
-void uvedit_pixel_to_float(struct SpaceImage *sima, float pixeldist, float r_dist[2]);
/* operators */