* KX_PythonSeq - comparisons work again. eg. act1.sensors == act2.sensors, had to copy Py_CmpToRich inline grr!, mailed python-dev about this.

* Shift-Click on states in the logic UI works again.
* New Logic Space has all the view options pressed.
This commit is contained in:
Campbell Barton
2009-09-02 20:46:28 +00:00
parent 21af438ef8
commit e80b37cd75
4 changed files with 64 additions and 28 deletions

View File

@@ -345,6 +345,19 @@ static int KX_PythonSeq_compare( KX_PythonSeq * a, KX_PythonSeq * b ) /* TODO -
return ( a->type == b->type && a->base == b->base) ? 0 : -1;
}
extern PyObject *Py_CmpToRich(int op, int cmp);
static PyObject *KX_PythonSeq_richcmp(PyObject *a, PyObject *b, int op)
{
int cmp_result= -1; /* assume false */
if(BPy_KX_PythonSeq_Check(a) && BPy_KX_PythonSeq_Check(b)) {
cmp_result= KX_PythonSeq_compare((KX_PythonSeq *)a, (KX_PythonSeq *)b);
}
return Py_CmpToRich(op, cmp_result);
}
/*
* repr function
* convert to a list and get its string value
@@ -374,8 +387,7 @@ PyTypeObject KX_PythonSeq_Type = {
NULL, /* printfunc tp_print; */
NULL, /* getattrfunc tp_getattr; */
NULL, /* setattrfunc tp_setattr; */
/* TODO, richcmp */
NULL, /* ( cmpfunc ) KX_PythonSeq_compare, // cmpfunc tp_compare; */
NULL, /* cmpfunc tp_compare; */
( reprfunc ) KX_PythonSeq_repr, /* reprfunc tp_repr; */
/* Method suites for standard classes */
@@ -401,14 +413,14 @@ PyTypeObject KX_PythonSeq_Type = {
NULL, /* char *tp_doc; Documentation string */
/*** Assigned meaning in release 2.0 ***/
/* call function for all accessible objects */
NULL, /* traverseproc tp_traverse; */
NULL, /* traverseproc tp_traverse; */
/* delete references to contained objects */
NULL, /* inquiry tp_clear; */
/*** Assigned meaning in release 2.1 ***/
/*** rich comparisons ***/
NULL, /* richcmpfunc tp_richcompare; */
(richcmpfunc)KX_PythonSeq_richcmp, /* richcmpfunc tp_richcompare; */
/*** weak reference enabler ***/
0, /* long tp_weaklistoffset; */