added no-xtile and no-ytile to the images realtime properties and python api.

This commit is contained in:
Campbell Barton 2007-03-12 01:43:11 +00:00
parent ffd91ac726
commit 268fdb7425
5 changed files with 44 additions and 1 deletions

@ -117,6 +117,8 @@ typedef struct Image {
#define IMA_TWINANIM 2
#define IMA_COLCYCLE 4 /* Depreciated */
#define IMA_MIPMAP_COMPLETE 8 /* all mipmap levels in OpenGL texture set? */
#define IMA_NOREPEAT_U 16
#define IMA_NOREPEAT_V 32
/* ima->type and ima->source moved to BKE_image.h, for API */

@ -1131,6 +1131,15 @@ static PyObject *Image_getFlag(BPy_Image *self, void *flag)
}
static PyObject *Image_getFlagTpage(BPy_Image *self, void *flag)
{
if (self->image->tpageflag & (int)flag)
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
}
static int Image_setSource( BPy_Image *self, PyObject *args)
{
PyObject* integer = PyNumber_Int( args );
@ -1160,6 +1169,14 @@ static int Image_setFlag(BPy_Image *self, PyObject *value, void *flag)
return 0;
}
static int Image_setFlagTpage(BPy_Image *self, PyObject *value, void *flag)
{
if ( PyObject_IsTrue(value) )
self->image->tpageflag |= (int)flag;
else
self->image->tpageflag &= ~(int)flag;
return 0;
}
/*
* get integer attributes
@ -1295,7 +1312,10 @@ static PyGetSetDef BPy_Image_getseters[] = {
"image antialiasing toggle", (void *)IMA_ANTIALI },
{"reflect", (getter)Image_getFlag, (setter)Image_setFlag,
"image reflect toggle", (void *)IMA_REFLECT },
{"noXTile", (getter)Image_getFlagTpage, (setter)Image_setFlagTpage,
"image reflect toggle", (void *)IMA_REFLECT },
{"noYTile", (getter)Image_getFlagTpage, (setter)Image_setFlagTpage,
"image reflect toggle", (void *)IMA_REFLECT },
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
};

@ -111,6 +111,10 @@ class Image:
@type bindcode: int
@ivar source: Image source type. See L{the Sources dictionary<Sources>} .
@type source: int
@ivar noXTile: When true the image will not tile horizontally.
@type noXTile: bool
@ivar noYTile: When true the image will not tile vertically.
@type noYTile: bool
"""
def getName():

@ -948,6 +948,11 @@ static void image_panel_game_properties(short cntrl) // IMAGE_HANDLER_GAME_PROPE
uiDefButS(block, NUM, B_SIMAGEDRAW, "X:", 160,130,70,19, &G.sima->image->xrep, 1.0, 16.0, 0, 0, "Sets the degree of repetition in the X direction");
uiDefButS(block, NUM, B_SIMAGEDRAW, "Y:", 230,130,70,19, &G.sima->image->yrep, 1.0, 16.0, 0, 0, "Sets the degree of repetition in the Y direction");
uiBlockBeginAlign(block);
uiBlockBeginAlign(block);
uiDefButBitS(block, TOG, IMA_NOREPEAT_U, B_SIMAGEDRAW, "No XRep", 160,100,70,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Disable texture repeating horizontaly");
uiDefButBitS(block, TOG, IMA_NOREPEAT_V, B_SIMAGEDRAW, "No YRep", 230,100,70,19, &G.sima->image->tpageflag, 0, 0, 0, 0, "Disable texture repeating vertically");
uiBlockEndAlign(block);
}
}

@ -417,6 +417,18 @@ int set_tpage(MTFace *tface)
}
else glBindTexture( GL_TEXTURE_2D, *bind);
/* dont tile x/y as set the the game properties */
if (ima->tpageflag & IMA_NOREPEAT_U)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
else
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
if (ima->tpageflag & IMA_NOREPEAT_V)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
else
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
/* tag_image_time(ima);*/ /* Did this get lost in the image recode? */
glEnable(GL_TEXTURE_2D);
fCurpage= ima;