diff options
-rw-r--r-- | source/blender/python/api2_2x/Texture.c | 64 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Texture.py | 15 |
2 files changed, 60 insertions, 19 deletions
diff --git a/source/blender/python/api2_2x/Texture.c b/source/blender/python/api2_2x/Texture.c index ffa61d3794f..843c0dbb24d 100644 --- a/source/blender/python/api2_2x/Texture.c +++ b/source/blender/python/api2_2x/Texture.c @@ -74,10 +74,10 @@ #define EXPP_TEX_ANIMMONSTART_MAX ((int)MAXFRAMEF) #define EXPP_TEX_ANIMMONDUR_MIN 0 #define EXPP_TEX_ANIMMONDUR_MAX 250 -#define EXPP_TEX_ANIMOFFSET_MIN -((int)(MAXFRAMEF)/2) -#define EXPP_TEX_ANIMOFFSET_MAX ((int)(MAXFRAMEF)/2) -#define EXPP_TEX_ANIMSTART_MIN 0 -#define EXPP_TEX_ANIMSTART_MAX ((int)(MAXFRAMEF)/2) +#define EXPP_TEX_ANIMOFFSET_MIN -((int)MAXFRAMEF) +#define EXPP_TEX_ANIMOFFSET_MAX ((int)MAXFRAMEF) +#define EXPP_TEX_ANIMSTART_MIN 1 +#define EXPP_TEX_ANIMSTART_MAX ((int)MAXFRAMEF) #define EXPP_TEX_FIEIMA_MIN 1 #define EXPP_TEX_FIEIMA_MAX 200 #define EXPP_TEX_NOISEDEPTH_MIN 0 @@ -485,9 +485,14 @@ SETFUNC( setWeight3 ); SETFUNC( setWeight4 ); static PyObject *Texture_getImageFlags( BPy_Texture *self, void *type ); +static PyObject *Texture_getIUserFlags( BPy_Texture *self, void *type ); +static PyObject *Texture_getIUserCyclic( BPy_Texture *self ); static PyObject *Texture_getNoiseBasis2( BPy_Texture *self, void *type ); static int Texture_setImageFlags( BPy_Texture *self, PyObject *args, void *type ); +static int Texture_setIUserFlags( BPy_Texture *self, PyObject *args, + void *type ); +static int Texture_setIUserCyclic( BPy_Texture *self, PyObject *args ); static int Texture_setNoiseBasis2( BPy_Texture *self, PyObject *args, void *type ); @@ -730,16 +735,20 @@ static PyGetSetDef BPy_Texture_getseters[] = { (getter)Texture_getImageFlags, (setter)Texture_setImageFlags, "X/Y flip for rendering enabled ('ImageFlags')", (void *)TEX_IMAROT}, + {"autoRefresh", + (getter)Texture_getIUserFlags, (setter)Texture_setIUserFlags, + "Refresh image on frame changes enabled", + (void *)IMA_ANIM_ALWAYS}, + {"cyclic", + (getter)Texture_getIUserCyclic, (setter)Texture_setIUserCyclic, + "Cycling of animated frames enabled", + NULL}, #if 0 /* disabled, moved to image */ {"fields", (getter)Texture_getImageFlags, (setter)Texture_setImageFlags, "Use of image's fields enabled ('ImageFlags')", (void *)TEX_FIELDS}, - {"cyclic", - (getter)Texture_getImageFlags, (setter)Texture_setImageFlags, - "Looping of animated frames enabled ('ImageFlags')", - (void *)TEX_ANIMCYCLIC}, {"movie", (getter)Texture_getImageFlags, (setter)Texture_setImageFlags, "Movie frames as images enabled ('ImageFlags')", @@ -1412,6 +1421,15 @@ static int Texture_setAnimFrames( BPy_Texture * self, PyObject * value ) EXPP_TEX_ANIMFRAME_MAX, 'h' ); } +static int Texture_setIUserCyclic( BPy_Texture * self, PyObject * value ) +{ + if( PyObject_IsTrue( value ) ) + self->texture->iuser.cycl = 1; + else + self->texture->iuser.cycl = 0; + return 0; +} + #if 0 /* this was stupid to begin with! (ton) */ static int Texture_setAnimLength( BPy_Texture * self, PyObject * value ) @@ -1507,7 +1525,7 @@ static int Texture_setIntExtend( BPy_Texture * self, PyObject * value ) static int Texture_setFieldsPerImage( BPy_Texture * self, PyObject * value ) { - return EXPP_setIValueClamped ( value, &self->texture->fie_ima, + return EXPP_setIValueClamped ( value, &self->texture->iuser.fie_ima, EXPP_TEX_FIEIMA_MIN, EXPP_TEX_FIEIMA_MAX, 'h' ); @@ -1619,6 +1637,16 @@ static int Texture_setImageFlags( BPy_Texture * self, PyObject * value, return 0; } +static int Texture_setIUserFlags( BPy_Texture * self, PyObject * value, + void *flag ) +{ + if( PyObject_IsTrue(value) ) + self->texture->iuser.flag |= (int)flag; + else + self->texture->iuser.flag &= ~(int)flag; + return 0; +} + static int Texture_setNoiseDepth( BPy_Texture * self, PyObject * value ) { short max = EXPP_TEX_NOISEDEPTH_MAX; @@ -1970,7 +1998,7 @@ static int Texture_setIpo( BPy_Texture * self, PyObject * value ) static PyObject *Texture_getAnimFrames( BPy_Texture *self ) { - PyObject *attr = PyInt_FromLong( self->texture->frames ); + PyObject *attr = PyInt_FromLong( self->texture->iuser.frames ); if( !attr ) return EXPP_ReturnPyObjError( PyExc_RuntimeError, @@ -1979,6 +2007,14 @@ static PyObject *Texture_getAnimFrames( BPy_Texture *self ) return attr; } +static PyObject *Texture_getIUserCyclic( BPy_Texture *self ) +{ + if( self->texture->iuser.cycl ) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + #if 0 /* disabled. this option was too stupid! (ton) */ static PyObject *Texture_getAnimLength( BPy_Texture *self ) @@ -2183,6 +2219,14 @@ static PyObject *Texture_getImageFlags( BPy_Texture *self, void *type ) return attr; } +static PyObject *Texture_getIUserFlags( BPy_Texture *self, void *flag ) +{ + if( self->texture->iuser.flag & (int)flag ) + Py_RETURN_TRUE; + else + Py_RETURN_FALSE; +} + static PyObject *Texture_getIScale( BPy_Texture *self ) { PyObject *attr = PyFloat_FromDouble( self->texture->ns_outscale ); diff --git a/source/blender/python/api2_2x/doc/Texture.py b/source/blender/python/api2_2x/doc/Texture.py index 01a0d5c8908..9b1c3e0d7d3 100644 --- a/source/blender/python/api2_2x/doc/Texture.py +++ b/source/blender/python/api2_2x/doc/Texture.py @@ -254,18 +254,13 @@ class Texture: specific texture types. @ivar animFrames: Number of frames of a movie to use. - Value is clamped to the range [0,30000]. + Value is clamped to the range [0,300000]. @type animFrames: int - @ivar animLength: Number of frames of a movie to use (0 for all). - Value is clamped to the range [0,9000]. - @type animLength: int - @ivar animMontage: Montage mode, start frames and durations. Example: C{( (fra1,dur1), (fra2,dur2), (fra3,dur3), (fra4,dur4) )}. - @type animMontage: tuple of 4 (int,int) @ivar animOffset: Offsets the number of the first movie frame to use. - Value is clamped to the range [-9000,9000]. + Value is clamped to the range [-300000,300000]. @type animOffset: int @ivar animStart: Starting frame of the movie to use. - Value is clamped to the range [1,9000]. + Value is clamped to the range [1,300000]. @type animStart: int @ivar anti: Image anti-aliasing enabled. Also see L{ImageFlags}. @type anti: int @@ -280,7 +275,7 @@ class Texture: @ivar crop: Sets the cropping extents (for image textures). @type crop: tuple of 4 ints @ivar cyclic: Looping of animated frames enabled. Also see L{ImageFlags}. - @type cyclic: int + @type cyclic: boolean @ivar distAmnt: Amount of distortion (for distorted noise textures). Value is clamped to the range [0.0,10.0]. @type distAmnt: float @@ -385,6 +380,8 @@ class Texture: each color a list of 5 floats [0 - 1], [r,g,b,a,pos]. The colorband can have between 1 and 31 colors. @type colorband: list + @ivar autoRefresh: Refresh image on frame changes enabled. + @type autoRefresh: boolean """ def getExtend(): |