=== Mirror Tool ===

Fix calls to new mirror in UV window (it would segfault with invalid arguments).

Reported by Matt in the tracker (#8176)
This commit is contained in:
Martin Poirier 2008-01-29 02:38:26 +00:00
parent 8072d88c75
commit 14d1c736b8
3 changed files with 24 additions and 13 deletions

@ -65,7 +65,6 @@ void aspect_sima(struct SpaceImage *sima, float *x, float *y);
void select_invert_tface_uv(void);
void select_swap_tface_uv(void);
void mirrormenu_tface_uv(void);
void mirror_tface_uv(char mirroraxis);
void hide_tface_uv(int swap);
void reveal_tface_uv(void);
void stitch_limit_uv_tface(void);

@ -240,26 +240,29 @@ void transform_width_height_tface_uv(int *width, int *height)
}
}
void mirror_tface_uv(char mirroraxis)
{
if (mirroraxis == 'x')
Mirror(1); /* global x */
else if (mirroraxis == 'y')
Mirror(2); /* global y */
}
void mirrormenu_tface_uv(void)
{
float mat[3][3];
short mode= 0;
Mat3One(mat);
if( is_uv_tface_editing_allowed()==0 ) return;
mode= pupmenu("Mirror%t|X Axis%x1|Y Axis%x2|");
if(mode==-1) return;
if(mode==1) mirror_tface_uv('x');
else if(mode==2) mirror_tface_uv('y');
if (mode == 1) {
initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM);
BIF_setSingleAxisConstraint(mat[0], " on X axis");
Transform();
}
else {
initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM);
BIF_setSingleAxisConstraint(mat[1], " on Y axis");
Transform();
}
BIF_undo_push("Mirror UV");
}

@ -52,6 +52,7 @@
#include "DNA_userdef_types.h"
#include "DNA_customdata_types.h" /* for UV layer menu */
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
#include "BDR_drawmesh.h"
@ -870,12 +871,20 @@ static uiBlock *image_uvs_transformmenu(void *arg_unused)
static void do_image_uvs_mirrormenu(void *arg, int event)
{
float mat[3][3];
Mat3One(mat);
switch(event) {
case 0: /* X axis */
mirror_tface_uv('x');
initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM);
BIF_setSingleAxisConstraint(mat[0], " on global X axis");
Transform();
break;
case 1: /* Y axis */
mirror_tface_uv('y');
initTransform(TFM_MIRROR, CTX_NO_PET|CTX_AUTOCONFIRM);
BIF_setSingleAxisConstraint(mat[1], " on global Y axis");
Transform();
break;
}