[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15431] trunk/blender/source: Made some python game engine funcs use NOARGS, getAxisVec was using wrong multiplication order.

Campbell Barton ideasman42 at gmail.com
Fri Jul 4 21:01:59 CEST 2008


Revision: 15431
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15431
Author:   campbellbarton
Date:     2008-07-04 21:00:56 +0200 (Fri, 04 Jul 2008)

Log Message:
-----------
Made some python  game engine funcs use NOARGS, getAxisVec was using wrong multiplication order.
Use BUT_TOGDUAL for controllers init states so you can see what the init state is for any controller without using the button to check.

Modified Paths:
--------------
    trunk/blender/source/blender/src/buttons_logic.c
    trunk/blender/source/blender/src/interface_draw.c
    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
    trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp

Modified: trunk/blender/source/blender/src/buttons_logic.c
===================================================================
--- trunk/blender/source/blender/src/buttons_logic.c	2008-07-04 17:59:16 UTC (rev 15430)
+++ trunk/blender/source/blender/src/buttons_logic.c	2008-07-04 19:00:56 UTC (rev 15431)
@@ -3164,11 +3164,11 @@
 			for (offset=0; offset<15; offset+=5) {
 				uiBlockBeginAlign(block);
 				for (stbit=0; stbit<5; stbit++) {
-					but = uiDefButBitI(block, 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)));
+					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)));
 					uiButSetFunc(but, check_object_state, but, &(ob->state));
 				}
 				for (stbit=0; stbit<5; stbit++) {
-					but = uiDefButBitI(block, 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)));
+					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)));
 					uiButSetFunc(but, check_object_state, but, &(ob->state));
 				}
 			}

Modified: trunk/blender/source/blender/src/interface_draw.c
===================================================================
--- trunk/blender/source/blender/src/interface_draw.c	2008-07-04 17:59:16 UTC (rev 15430)
+++ trunk/blender/source/blender/src/interface_draw.c	2008-07-04 19:00:56 UTC (rev 15431)
@@ -180,8 +180,12 @@
 		height= ICON_HEIGHT;
 	
 	if(but->flag & UI_ICON_LEFT) {
-		if (but->type==BUT_TOGDUAL && but->drawstr[0]) {
-			xs= but->x1-1.0;
+		if (but->type==BUT_TOGDUAL) {
+			if (but->drawstr[0]) {
+				xs= but->x1-1.0;
+			} else {
+				xs= (but->x1+but->x2- height)/2.0;
+			}
 		}
 		else if (but->type==BUTM ) {
 			xs= but->x1+1.0;

Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2008-07-04 17:59:16 UTC (rev 15430)
+++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp	2008-07-04 19:00:56 UTC (rev 15431)
@@ -1413,7 +1413,7 @@
 	MT_Vector3 vect;
 	if (PyVecTo(value, vect))
 	{
-		return PyObjectFrom(vect * NodeGetWorldOrientation());
+		return PyObjectFrom(NodeGetWorldOrientation() * vect);
 	}
 	return NULL;
 }

Modified: trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp
===================================================================
--- trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2008-07-04 17:59:16 UTC (rev 15430)
+++ trunk/blender/source/gameengine/Ketsji/KX_PythonInit.cpp	2008-07-04 19:00:56 UTC (rev 15431)
@@ -103,9 +103,7 @@
 static PyObject* ErrorObject;
 STR_String gPyGetRandomFloat_doc="getRandomFloat returns a random floating point value in the range [0..1)";
 
-static PyObject* gPyGetRandomFloat(PyObject*,
-					PyObject*, 
-					PyObject*)
+static PyObject* gPyGetRandomFloat(PyObject*)
 {
 	return PyFloat_FromDouble(MT_random());
 }
@@ -156,9 +154,7 @@
 static bool usedsp = false;
 
 // this gets a pointer to an array filled with floats
-static PyObject* gPyGetSpectrum(PyObject*,
-								PyObject* args, 
-								PyObject*)
+static PyObject* gPyGetSpectrum(PyObject*)
 {
 	SND_IAudioDevice* audiodevice = SND_DeviceManager::Instance();
 
@@ -237,7 +233,7 @@
 	return NULL;
 }
 
-static PyObject* gPyGetLogicTicRate(PyObject*, PyObject*, PyObject*)
+static PyObject* gPyGetLogicTicRate(PyObject*)
 {
 	return PyFloat_FromDouble(KX_KetsjiEngine::GetTicRate());
 }
@@ -273,7 +269,7 @@
 
 
 
-static PyObject* gPyGetPhysicsTicRate(PyObject*, PyObject*, PyObject*)
+static PyObject* gPyGetPhysicsTicRate(PyObject*)
 {
 	return PyFloat_FromDouble(PHY_GetActiveEnvironment()->getFixedTimeStep());
 }
@@ -281,9 +277,7 @@
 static STR_String gPyGetCurrentScene_doc =  
 "getCurrentScene()\n"
 "Gets a reference to the current scene.\n";
-static PyObject* gPyGetCurrentScene(PyObject* self,
-					   PyObject* args, 
-					   PyObject* kwds)
+static PyObject* gPyGetCurrentScene(PyObject* self)
 {
 	Py_INCREF(gp_KetsjiScene);
 	return (PyObject*) gp_KetsjiScene;
@@ -366,19 +360,19 @@
 	{"expandPath", (PyCFunction)gPyExpandPath, METH_VARARGS, gPyExpandPath_doc},
 	{"getCurrentController",
 	(PyCFunction) SCA_PythonController::sPyGetCurrentController,
-	METH_VARARGS, SCA_PythonController::sPyGetCurrentController__doc__},
+	METH_NOARGS, SCA_PythonController::sPyGetCurrentController__doc__},
 	{"getCurrentScene", (PyCFunction) gPyGetCurrentScene,
-	METH_VARARGS, gPyGetCurrentScene_doc.Ptr()},
+	METH_NOARGS, gPyGetCurrentScene_doc.Ptr()},
 	{"addActiveActuator",(PyCFunction) SCA_PythonController::sPyAddActiveActuator,
 	METH_VARARGS, SCA_PythonController::sPyAddActiveActuator__doc__},
 	{"getRandomFloat",(PyCFunction) gPyGetRandomFloat,
-	METH_VARARGS,gPyGetRandomFloat_doc.Ptr()},
+	METH_NOARGS,gPyGetRandomFloat_doc.Ptr()},
 	{"setGravity",(PyCFunction) gPySetGravity, METH_VARARGS,"set Gravitation"},
-	{"getSpectrum",(PyCFunction) gPyGetSpectrum, METH_VARARGS,"get audio spectrum"},
+	{"getSpectrum",(PyCFunction) gPyGetSpectrum, METH_NOARGS,"get audio spectrum"},
 	{"stopDSP",(PyCFunction) gPyStopDSP, METH_VARARGS,"stop using the audio dsp (for performance reasons)"},
-	{"getLogicTicRate", (PyCFunction) gPyGetLogicTicRate, METH_VARARGS, "Gets the logic tic rate"},
+	{"getLogicTicRate", (PyCFunction) gPyGetLogicTicRate, METH_NOARGS, "Gets the logic tic rate"},
 	{"setLogicTicRate", (PyCFunction) gPySetLogicTicRate, METH_VARARGS, "Sets the logic tic rate"},
-	{"getPhysicsTicRate", (PyCFunction) gPyGetPhysicsTicRate, METH_VARARGS, "Gets the physics tic rate"},
+	{"getPhysicsTicRate", (PyCFunction) gPyGetPhysicsTicRate, METH_NOARGS, "Gets the physics tic rate"},
 	{"setPhysicsTicRate", (PyCFunction) gPySetPhysicsTicRate, METH_VARARGS, "Sets the physics tic rate"},
 	{"PrintGLInfo", (PyCFunction)pyPrintExt, METH_NOARGS, "Prints GL Extension Info"},
 	{NULL, (PyCFunction) NULL, 0, NULL }





More information about the Bf-blender-cvs mailing list