- remove debug printf
authorCampbell Barton <ideasman42@gmail.com>
Mon, 6 Apr 2009 12:47:15 +0000 (12:47 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 6 Apr 2009 12:47:15 +0000 (12:47 +0000)
- remove test for importing the module rather then creating a new one (didnt mean to commit)
- added constants for the mouse sensor to use.

source/blender/python/api2_2x/bpy_internal_import.c
source/gameengine/Ketsji/KX_PythonInit.cpp

index 1423ffe522b316c87ee4751b13a2c918ba85bbb8..d8280d4d609d7d621d8df74df7c78e5e887bb5e9 100644 (file)
@@ -70,7 +70,6 @@ PyObject *importText( char *name )
        memcpy( &txtname[namelen], ".py", 4 );
 
        for(text = maggie->text.first; text; text = text->id.next) {
-               fprintf(stderr, "%s | %s\n", txtname, text->id.name+2);
                if( !strcmp( txtname, text->id.name+2 ) )
                        break;
        }
index 73342d891d852058332bca63b3982642048fbff5..9929e66c3a4cf89677a2f38743357caa222fdecd 100644 (file)
@@ -924,22 +924,10 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
        gUseVisibilityTemp=false;
 
        // Create the module and add the functions
-       
-       
-       m = PyImport_ImportModule("GameLogic");
-       
-       if(m==NULL) {
-               printf("Import for the first time!\n");
-               PyErr_Clear();
-               m = Py_InitModule4("GameLogic", game_methods,
+       m = Py_InitModule4("GameLogic", game_methods,
                                           GameLogic_module_documentation,
                                           (PyObject*)NULL,PYTHON_API_VERSION);
-       }
-       else {
-               Py_DECREF(m); /**/
-               printf("Alredy imported!\n");
-               return(m);
-       }
+
        // Add some symbolic constants to the module
        d = PyModule_GetDict(m);
        
@@ -1105,6 +1093,16 @@ PyObject* initGameLogic(KX_KetsjiEngine *engine, KX_Scene* scene) // quick hack
        KX_MACRO_addTypesToDict(d, KX_DYN_DISABLE_RIGID_BODY, KX_SCA_DynamicActuator::KX_DYN_DISABLE_RIGID_BODY);
        KX_MACRO_addTypesToDict(d, KX_DYN_SET_MASS, KX_SCA_DynamicActuator::KX_DYN_SET_MASS);
 
+       /* Input & Mouse Sensor */
+       KX_MACRO_addTypesToDict(d, KX_INPUT_NONE, SCA_InputEvent::KX_NO_INPUTSTATUS);
+       KX_MACRO_addTypesToDict(d, KX_INPUT_JUST_ACTIVATED, SCA_InputEvent::KX_JUSTACTIVATED);
+       KX_MACRO_addTypesToDict(d, KX_INPUT_ACTIVE, SCA_InputEvent::KX_ACTIVE);
+       KX_MACRO_addTypesToDict(d, KX_INPUT_JUST_RELEASED, SCA_InputEvent::KX_JUSTRELEASED);
+       
+       KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_LEFT, SCA_InputEvent::KX_LEFTMOUSE);
+       KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_MIDDLE, SCA_InputEvent::KX_MIDDLEMOUSE);
+       KX_MACRO_addTypesToDict(d, KX_MOUSE_BUT_RIGHT, SCA_InputEvent::KX_RIGHTMOUSE);
+
        // Check for errors
        if (PyErr_Occurred())
     {