diff options
-rw-r--r-- | source/blender/editors/space_logic/logic_window.c | 27 | ||||
-rw-r--r-- | source/blender/editors/space_logic/space_logic.c | 7 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonInit.cpp | 38 | ||||
-rw-r--r-- | source/gameengine/Ketsji/KX_PythonSeq.cpp | 20 |
4 files changed, 64 insertions, 28 deletions
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 118bcaa0cf4..47ba197daa0 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -83,9 +83,6 @@ static int pupmenu() {return 1;} #define B_REDR 1 #define B_IDNAME 2 -#define B_ADD_PROP 2701 -#define B_CHANGE_PROP 2702 - #define B_ADD_SENS 2703 #define B_CHANGE_SENS 2704 #define B_DEL_SENS 2705 @@ -364,7 +361,6 @@ static void sca_move_actuator(bContext *C, void *datav, void *data2_unused) void do_logic_buts(bContext *C, void *arg, int event) { - bProperty *prop; bSensor *sens; bController *cont; bActuator *act; @@ -386,25 +382,7 @@ void do_logic_buts(bContext *C, void *arg, int event) case B_SETMAINACTOR: ob->gameflag &= ~(OB_SECTOR|OB_PROP); break; - - - case B_ADD_PROP: - prop= new_property(PROP_FLOAT); - make_unique_prop_names(C, prop->name); - BLI_addtail(&ob->prop, prop); - ED_undo_push(C, "Add property"); - break; -#if 0 // XXX Now done in python - case B_CHANGE_PROP: - prop= ob->prop.first; - while(prop) { - if(prop->type!=prop->otype) { - init_property(prop); - } - prop= prop->next; - } - break; -#endif + case B_ADD_SENS: for(ob=G.main->object.first; ob; ob=ob->id.next) { if(ob->scaflag & OB_ADDSENS) { @@ -1666,7 +1644,8 @@ char *get_state_name(Object *ob, short bit) static void check_state_mask(bContext *C, void *arg1_but, void *arg2_mask) { - int shift= 0; // XXX + wmWindow *win= CTX_wm_window(C); + int shift= win->eventstate->shift; unsigned int *cont_mask = arg2_mask; uiBut *but = arg1_but; diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index 703b408aae6..3c46522bba2 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -102,6 +102,13 @@ static SpaceLink *logic_new(const bContext *C) slogic= MEM_callocN(sizeof(SpaceLogic), "initlogic"); slogic->spacetype= SPACE_LOGIC; + /* default options */ + slogic->scaflag = (BUTS_SENS_SEL|BUTS_SENS_ACT|BUTS_SENS_LINK) | + (BUTS_CONT_SEL|BUTS_CONT_ACT|BUTS_CONT_LINK) | + (BUTS_ACT_SEL|BUTS_ACT_ACT|BUTS_ACT_LINK) | + (BUTS_SENS_STATE|BUTS_ACT_STATE); + + /* header */ ar= MEM_callocN(sizeof(ARegion), "header for logic"); diff --git a/source/gameengine/Ketsji/KX_PythonInit.cpp b/source/gameengine/Ketsji/KX_PythonInit.cpp index 67ab67814b2..667b4cd5d89 100644 --- a/source/gameengine/Ketsji/KX_PythonInit.cpp +++ b/source/gameengine/Ketsji/KX_PythonInit.cpp @@ -2018,4 +2018,42 @@ void resetGamePythonPath() } +/* Copied from pythons 3's Object.c + * also in blenders bpy_uitl.c, mailed the python-dev + * list about enabling something like this again for py3 */ +PyObject * +Py_CmpToRich(int op, int cmp) +{ + PyObject *res; + int ok; + + if (PyErr_Occurred()) + return NULL; + switch (op) { + case Py_LT: + ok = cmp < 0; + break; + case Py_LE: + ok = cmp <= 0; + break; + case Py_EQ: + ok = cmp == 0; + break; + case Py_NE: + ok = cmp != 0; + break; + case Py_GT: + ok = cmp > 0; + break; + case Py_GE: + ok = cmp >= 0; + break; + default: + PyErr_BadArgument(); + return NULL; + } + res = ok ? Py_True : Py_False; + Py_INCREF(res); + return res; +} diff --git a/source/gameengine/Ketsji/KX_PythonSeq.cpp b/source/gameengine/Ketsji/KX_PythonSeq.cpp index 1098dc03b62..165a85e2c14 100644 --- a/source/gameengine/Ketsji/KX_PythonSeq.cpp +++ b/source/gameengine/Ketsji/KX_PythonSeq.cpp @@ -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; */ |