driverExpression - strcpy on wrong type (my bad) fixed.

added .sel bool for Ipo curves.
This commit is contained in:
2007-01-13 04:53:41 +00:00
parent c6a57fb4b0
commit 156ac69aad
2 changed files with 34 additions and 2 deletions

View File

@@ -89,6 +89,9 @@ static int IpoCurve_setDriverObject( C_IpoCurve * self, PyObject * args );
static PyObject *IpoCurve_getDriverChannel( C_IpoCurve * self);
static int IpoCurve_setDriverChannel( C_IpoCurve * self, PyObject * args );
static PyObject *IpoCurve_getDriverExpression( C_IpoCurve * self);
static PyObject *IpoCurve_getFlag( C_IpoCurve * self, void *type);
static int IpoCurve_setFlag( C_IpoCurve * self, PyObject *value, void *type);
static int IpoCurve_setDriverExpression( C_IpoCurve * self, PyObject * args );
static PyObject *IpoCurve_getCurval( C_IpoCurve * self, PyObject * args );
static int IpoCurve_setCurval( C_IpoCurve * self, PyObject * key,
@@ -143,7 +146,7 @@ static PyGetSetDef C_IpoCurve_getseters[] = {
NULL},
{"driver",
(getter)IpoCurve_getDriver, (setter)IpoCurve_setDriver,
"The status of the driver 1-on, 0-off",
"The status of the driver 1-object, 2-py expression, 0-off",
NULL},
{"driverObject",
(getter)IpoCurve_getDriverObject, (setter)IpoCurve_setDriverObject,
@@ -165,6 +168,12 @@ static PyGetSetDef C_IpoCurve_getseters[] = {
(getter)IpoCurve_newgetExtend, (setter)IpoCurve_newsetExtend,
"The extend mode of the curve",
NULL},
{"sel",
(getter)IpoCurve_getFlag, (setter)IpoCurve_setFlag,
"the selection state of the curve",
(void *)IPO_SELECT},
{NULL,NULL,NULL,NULL,NULL}
};
@@ -942,7 +951,7 @@ static int IpoCurve_setDriverExpression( C_IpoCurve * self, PyObject * arg )
return EXPP_ReturnIntError( PyExc_ValueError,
"string is too long, use 127 characters or less" );
strcpy(&ipo->driver->name, exp);
strcpy(ipo->driver->name, exp);
return 0;
}
@@ -1046,6 +1055,27 @@ static int IpoCurve_newsetExtend( C_IpoCurve * self, PyObject * value )
IPO_HORIZ, IPO_CYCLX, 'h' );
}
static PyObject *IpoCurve_getFlag( C_IpoCurve * self, void *type )
{
if (self->ipocurve->flag & (int)type)
Py_RETURN_TRUE;
else
Py_RETURN_FALSE;
}
static int IpoCurve_setFlag( C_IpoCurve * self, PyObject *value, void *type )
{
int param = PyObject_IsTrue( value );
if (param)
self->ipocurve->flag |= (int)type;
else
self->ipocurve->flag &= ~(int)type;
return 0;
}
/* #####DEPRECATED###### */
static PyObject *IpoCurve_addBezier( C_IpoCurve * self, PyObject * args )

View File

@@ -54,6 +54,8 @@ class IpoCurve:
@type driverObject: Blender Object or None
@ivar driverExpression: Python expression used to drive the Ipo curve. [0 - 127 chars]
@type driverExpression: string
@ivar sel: The selection state of this curve.
@type sel: bool
@ivar driverChannel: Object channel used to drive the Ipo curve.
Use module constants: IpoCurve.LOC_X, IpoCurve.LOC_Y, IpoCurve.LOC_Z,
IpoCurve.ROT_X, IpoCurve.ROT_Y, IpoCurve.ROT_Z, IpoCurve.SIZE_X,