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:
authorCampbell Barton <ideasman42@gmail.com>2007-09-21 02:38:04 +0400
committerCampbell Barton <ideasman42@gmail.com>2007-09-21 02:38:04 +0400
commit9dcf337e93e02300e66739bb647031c94551a10d (patch)
tree9394007b5355c3f26c4c259ef9cc3a014013104d /source/blender/src/editsima.c
parentd3a8bcc435f9bfb1ff0d12d0e3f588a1fa8d19e0 (diff)
image display option for viewing non square pixels (x/y aspect for each image) - useful when editing UV coords with textures that have been resized to values that run fast in openGL (256/512/1024) but have lost their original aspect ratio, especially useful when rotating UV's.
Bumped the subversion to 2, so the default aspect is set to 1:1. Made "Repeat Image" option time image drawing and bail out early if its taking too long. (quater of a sec max) this could be avoided if the texture was drawn on a quad, but that wouldnt support other image draw options. This is a good short term solution because it was possibly to lock up blender if you zoomed out a long way then enabled "Repeat Image".
Diffstat (limited to 'source/blender/src/editsima.c')
-rw-r--r--source/blender/src/editsima.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c
index 8d17599dd86..d0e8f11b1c2 100644
--- a/source/blender/src/editsima.c
+++ b/source/blender/src/editsima.c
@@ -216,10 +216,13 @@ void be_square_tface_uv(EditMesh *em)
void transform_aspect_ratio_tface_uv(float *aspx, float *aspy)
{
int w, h;
-
+ float xuser_asp, yuser_asp;
+
+ aspect_sima(G.sima, &xuser_asp, &yuser_asp);
+
transform_width_height_tface_uv(&w, &h);
- *aspx= (float)w/256.0f;
- *aspy= (float)h/256.0f;
+ *aspx= (float)w/256.0f * xuser_asp;
+ *aspy= (float)h/256.0f * yuser_asp;
}
void transform_width_height_tface_uv(int *width, int *height)
@@ -1990,3 +1993,19 @@ void BIF_image_update_frame(void)
}
}
+void aspect_sima(SpaceImage *sima, float *x, float *y)
+{
+ *x = *y = 1.0;
+
+ if( (sima->image == 0) ||
+ (sima->image->type == IMA_TYPE_R_RESULT) ||
+ (sima->image->type == IMA_TYPE_COMPOSITE) ||
+ (sima->image->tpageflag & IMA_TILES) ||
+ (sima->image->aspx==0.0 || sima->image->aspy==0.0)
+ ) {
+ return;
+ }
+
+ /* x is always 1 */
+ *y = sima->image->aspy / sima->image->aspx;
+}