Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/src/buttons_logic.c7
-rw-r--r--source/gameengine/Ketsji/KX_GameObject.cpp12
2 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/src/buttons_logic.c b/source/blender/src/buttons_logic.c
index cb09f947f3c..1a9e1030688 100644
--- a/source/blender/src/buttons_logic.c
+++ b/source/blender/src/buttons_logic.c
@@ -3126,6 +3126,8 @@ void logic_buts(void)
ob= OBACT;
for(a=0; a<count; a++) {
+ unsigned int controller_state_mask = 0; /* store a bitmask for states that are used */
+
ob= (Object *)idar[a];
uiClearButLock();
uiSetButLock(object_is_libdata(ob), ERROR_LIBDATA_MESSAGE);
@@ -3150,6 +3152,7 @@ void logic_buts(void)
act = cont->links[iact];
act->flag |= ACT_LINKED;
}
+ controller_state_mask |= cont->state_mask;
cont = cont->next;
}
@@ -3164,11 +3167,11 @@ void logic_buts(void)
for (offset=0; offset<15; offset+=5) {
uiBlockBeginAlign(block);
for (stbit=0; stbit<5; stbit++) {
- but = uiDefButBitI(block, BUT_TOGDUAL, 1<<(stbit+offset), stbit+offset, "", (short)(xco+35+12*stbit+13*offset), yco, 12, 12, (int *)&(ob->state), 0, 0, 0, 0, get_state_name(ob, (short)(stbit+offset)));
+ but = uiDefButBitI(block, controller_state_mask&(1<<(stbit+offset)) ? BUT_TOGDUAL:TOG, 1<<(stbit+offset), stbit+offset, "", (short)(xco+35+12*stbit+13*offset), yco, 12, 12, (int *)&(ob->state), 0, 0, 0, 0, get_state_name(ob, (short)(stbit+offset)));
uiButSetFunc(but, check_object_state, but, &(ob->state));
}
for (stbit=0; stbit<5; stbit++) {
- but = uiDefButBitI(block, BUT_TOGDUAL, 1<<(stbit+offset+15), stbit+offset+15, "", (short)(xco+35+12*stbit+13*offset), yco-12, 12, 12, (int *)&(ob->state), 0, 0, 0, 0, get_state_name(ob, (short)(stbit+offset+15)));
+ but = uiDefButBitI(block, controller_state_mask&(1<<(stbit+offset)) ? BUT_TOGDUAL:TOG, 1<<(stbit+offset+15), stbit+offset+15, "", (short)(xco+35+12*stbit+13*offset), yco-12, 12, 12, (int *)&(ob->state), 0, 0, 0, 0, get_state_name(ob, (short)(stbit+offset+15)));
uiButSetFunc(but, check_object_state, but, &(ob->state));
}
}
diff --git a/source/gameengine/Ketsji/KX_GameObject.cpp b/source/gameengine/Ketsji/KX_GameObject.cpp
index 507cedcd5d3..bde5e2cd0a2 100644
--- a/source/gameengine/Ketsji/KX_GameObject.cpp
+++ b/source/gameengine/Ketsji/KX_GameObject.cpp
@@ -1506,8 +1506,10 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCastTo,
{
KX_GameObject *other;
PyErr_Clear();
- if (!PyType_IsSubtype(pyarg->ob_type, &KX_GameObject::Type))
+ if (!PyType_IsSubtype(pyarg->ob_type, &KX_GameObject::Type)) {
+ PyErr_SetString(PyExc_TypeError, "the first argument to rayCastTo must be a vector or a KX_GameObject");
return NULL;
+ }
other = static_cast<KX_GameObject*>(pyarg);
toPoint = other->NodeGetWorldPosition();
}
@@ -1567,8 +1569,10 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
if (!PyVecTo(pyto, toPoint))
{
PyErr_Clear();
- if (!PyType_IsSubtype(pyto->ob_type, &KX_GameObject::Type))
+ if (!PyType_IsSubtype(pyto->ob_type, &KX_GameObject::Type)) {
+ PyErr_SetString(PyExc_TypeError, "the first argument to rayCast must be a vector or a KX_GameObject");
return NULL;
+ }
other = static_cast<KX_GameObject*>(pyto);
toPoint = other->NodeGetWorldPosition();
}
@@ -1579,8 +1583,10 @@ KX_PYMETHODDEF_DOC(KX_GameObject, rayCast,
else if (!PyVecTo(pyfrom, fromPoint))
{
PyErr_Clear();
- if (!PyType_IsSubtype(pyfrom->ob_type, &KX_GameObject::Type))
+ if (!PyType_IsSubtype(pyfrom->ob_type, &KX_GameObject::Type)) {
+ PyErr_SetString(PyExc_TypeError, "the second optional argument to rayCast must be a vector or a KX_GameObject");
return NULL;
+ }
other = static_cast<KX_GameObject*>(pyfrom);
fromPoint = other->NodeGetWorldPosition();
}