Py API (GSoC): Second merging commit
authorJoerg Mueller <nexyon@gmail.com>
Mon, 16 Aug 2010 12:14:09 +0000 (12:14 +0000)
committerJoerg Mueller <nexyon@gmail.com>
Mon, 16 Aug 2010 12:14:09 +0000 (12:14 +0000)
Rough summary of fixes/changes:
- Blender Py API: GameLogic -> bge.logic
- Blender Py API: Implemented missing KX_PYATTRIBUTE_TODOs and -DUMMYs.
- Fix for [#22924] KX_PolygonMaterial.diffuse does not return expected list[r,g,b]
- Py API: Renaming _owner attribute of mathutils classes to owner.
- Fix some minor errors in mathutils and blf.
- Enabling game engine autoplay again based on a patch by Dalai:
  * The biggest 3D view in the open scene is used, if there is none, blender opens the file normally and raises an error.
  * The 3D view are is made fullscreen.
  * Quad view, header, properties and toolbox panel are all hidden to get the maximum view.
  * If the game engine full screen setting is set, the game starts in fullscreen.
- Fix for ipo conversion on file transition in the game engine.

28 files changed:
source/blender/editors/space_logic/logic_window.c
source/blender/makesrna/intern/rna_actuator.c
source/blender/python/generic/blf_api.c
source/blender/python/generic/mathutils_color.c
source/blender/python/generic/mathutils_euler.c
source/blender/python/generic/mathutils_matrix.c
source/blender/python/generic/mathutils_quat.c
source/blender/python/generic/mathutils_vector.c
source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_init_exit.c
source/blender/windowmanager/intern/wm_window.c
source/blender/windowmanager/wm_window.h
source/creator/creator.c
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/GameLogic/SCA_ISensor.cpp
source/gameengine/GameLogic/SCA_ISensor.h
source/gameengine/GameLogic/SCA_JoystickSensor.cpp
source/gameengine/GameLogic/SCA_PythonController.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.cpp
source/gameengine/Ketsji/KX_BlenderMaterial.h
source/gameengine/Ketsji/KX_Camera.cpp
source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
source/gameengine/Ketsji/KX_ConstraintWrapper.h
source/gameengine/Ketsji/KX_PolyProxy.cpp
source/gameengine/Ketsji/KX_PolyProxy.h
source/gameengine/Ketsji/KX_PolygonMaterial.cpp
source/gameengine/Ketsji/KX_VertexProxy.cpp
source/gameengine/Ketsji/KX_VertexProxy.h

index 511ca99ff8249780c4a21e520021a5f3a53d7aa2..d7f8803b3bf912de5197b74457b111b49a1f6d16 100644 (file)
@@ -2529,7 +2529,7 @@ static short draw_actuatorbuttons(Main *bmain, Object *ob, bActuator *act, uiBlo
                        }
 
                        //str = "Scene %t|Load game%x0|Start loaded game%x1|Restart this game%x2|Quit this game %x3";
-                       str = "Scene %t|Start new game%x0|Restart this game%x2|Quit this game %x3|Save GameLogic.globalDict %x4|Load GameLogic.globalDict %x5";
+                       str = "Scene %t|Start new game%x0|Restart this game%x2|Quit this game %x3|Save bge.logic.globalDict %x4|Load bge.logic.globalDict %x5";
                        uiDefButS(block, MENU, B_REDR, str, xco+40, yco-24, (width-80), 19, &gma->type, 0.0, 0.0, 0, 0, ""); 
                        
                        yco -= ysize; 
index f5145d862703538cbbf877195e18843bd5f32ecc..63e09c1b6c240101c2c7e07dcda67965fcaedacb 100644 (file)
@@ -1557,8 +1557,8 @@ static void rna_def_game_actuator(BlenderRNA *brna)
                {ACT_GAME_LOAD, "START", 0, "Start new game", ""},
                {ACT_GAME_RESTART, "RESTART", 0, "Restart this game", ""},
                {ACT_GAME_QUIT, "QUIT", 0, "Quit this game", ""},
-               {ACT_GAME_SAVECFG, "SAVECFG", 0, "Save GameLogic.globalDict", ""},
-               {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load GameLogic.globalDict", ""},
+               {ACT_GAME_SAVECFG, "SAVECFG", 0, "Save bge.logic.globalDict", ""},
+               {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", ""},
                {0, NULL, 0, NULL, NULL}};
        
        srna= RNA_def_struct(brna, "GameActuator", "Actuator");
index 762153b8349ea81bb0243a777123efead4822612..a5f5f8815c7744781ea1938f624f2ac49f5e1458 100644 (file)
@@ -39,7 +39,7 @@ static char py_blf_position_doc[] =
 "   :arg y: Y axis position to draw the text.\n"
 "   :type y: float\n"
 "   :arg z: Z axis position to draw the text.\n"
-"   :type x: float\n";
+"   :type z: float\n";
 
 static PyObject *py_blf_position(PyObject *self, PyObject *args)
 {
@@ -261,7 +261,7 @@ static char py_blf_rotation_doc[] =
 "   :arg fontid: The id of the typeface as returned by :func:`blf.load`, for default font use 0.\n"
 "   :type fontid: int\n"
 "   :arg angle: The angle for text drawing to use.\n"
-"   :type aspect: float\n";
+"   :type angle: float\n";
 
 static PyObject *py_blf_rotation(PyObject *self, PyObject *args)
 {
index d4ab64e13c530221df31280e7c37587439305b5d..57d2838238c55430085232fe26f24407953e87eb 100644 (file)
@@ -445,7 +445,7 @@ static PyGetSetDef Color_getseters[] = {
        {"hsv", (getter)Color_getHSV, (setter)Color_setHSV, "HSV Values in [0, 1].\n\n:type: float triplet", (void *)0},
 
        {"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
-       {"_owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
+       {"owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
        {NULL,NULL,NULL,NULL,NULL}  /* Sentinel */
 };
 
index 63a049189416284bf7dab432702e1e6706b1878f..b36eb7803f1e8b7c6186b79691f8a0d078e9fccc 100644 (file)
@@ -621,7 +621,7 @@ static PyGetSetDef Euler_getseters[] = {
        {"order", (getter)Euler_getOrder, (setter)Euler_setOrder, "Euler rotation order.\n\n:type: string in ['XYZ', 'XZY', 'YXZ', 'YZX', 'ZXY', 'ZYX']", (void *)NULL},
 
        {"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
-       {"_owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
+       {"owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
        {NULL,NULL,NULL,NULL,NULL}  /* Sentinel */
 };
 
index 1ef834b7a3eb80a66090ce75ffa9d5146de04a86..24239e1f54171b596eff8fbe4a12d08a3449ef2b 100644 (file)
@@ -1737,7 +1737,7 @@ static PyGetSetDef Matrix_getseters[] = {
        {"median_scale", (getter)Matrix_getMedianScale, (setter)NULL, "The average scale applied to each axis (readonly).\n\n:type: float", NULL},
        {"is_negative", (getter)Matrix_getIsNegative, (setter)NULL, "True if this matrix results in a negative scale, 3x3 and 4x4 only, (readonly).\n\n:type: bool", NULL},
        {"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
-       {"_owner",(getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
+       {"owner",(getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
        {NULL,NULL,NULL,NULL,NULL}  /* Sentinel */
 };
 
index 8d9fe54fa85ae91a20ae5c6e1f393c5714676f66..553844b6ee5eda40cacff7cdf14b1d72471bdb35 100644 (file)
@@ -109,7 +109,7 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args)
 }
 //----------------------------Quaternion.toMatrix()------------------
 static char Quaternion_ToMatrix_doc[] =
-".. method:: to_matrix(other)\n"
+".. method:: to_matrix()\n"
 "\n"
 "   Return a matrix representation of the quaternion.\n"
 "\n"
@@ -930,7 +930,7 @@ static PyGetSetDef Quaternion_getseters[] = {
        {"angle", (getter)Quaternion_getAngle, (setter)Quaternion_setAngle, "angle of the quaternion.\n\n:type: float", NULL},
        {"axis",(getter)Quaternion_getAxisVec, (setter)Quaternion_setAxisVec, "quaternion axis as a vector.\n\n:type: :class:`Vector`", NULL},
        {"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
-       {"_owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
+       {"owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
        {NULL,NULL,NULL,NULL,NULL}  /* Sentinel */
 };
 
index 9672878ec516479c122ea5660f7e5a86efe9a895..75a695526fc88fa032d3d2c4dc312b2f5ec75b82 100644 (file)
@@ -508,7 +508,8 @@ static char Vector_angle_doc[] =
 "   :arg other: another vector to compare the angle with\n"
 "   :type other: :class:`Vector`\n"
 "   :arg fallback: return this value when the angle cant be calculated (zero length vector)\n"
-"   :return angle: angle in radians or fallback when given\n"
+"   :type fallback: any\n"
+"   :return: angle in radians or fallback when given\n"
 "   :rtype: float\n"
 "\n"
 "   .. note:: Zero length vectors raise an :exc:`AttributeError`.\n";
@@ -607,8 +608,9 @@ static char Vector_Project_doc[] =
 "\n"
 "   Return the projection of this vector onto the *other*.\n"
 "\n"
+"   :arg other: second vector.\n"
 "   :type other: :class:`Vector`\n"
-"   :return projection: the parallel projection vector\n"
+"   :return: the parallel projection vector\n"
 "   :rtype: :class:`Vector`\n";
 
 static PyObject *Vector_Project(VectorObject *self, VectorObject *value)
@@ -1601,7 +1603,7 @@ static PyGetSetDef Vector_getseters[] = {
        {"length", (getter)Vector_getLength, (setter)Vector_setLength, "Vector Length.\n\n:type: float", NULL},
        {"magnitude", (getter)Vector_getLength, (setter)Vector_setLength, "Vector Length.\n\n:type: float", NULL},
        {"is_wrapped", (getter)BaseMathObject_getWrapped, (setter)NULL, BaseMathObject_Wrapped_doc, NULL},
-       {"_owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
+       {"owner", (getter)BaseMathObject_getOwner, (setter)NULL, BaseMathObject_Owner_doc, NULL},
        
        /* autogenerated swizzle attrs, see python script below */
        {"xx",   (getter)Vector_getSwizzle, (setter)NULL, NULL, SET_INT_IN_POINTER(((0|SWIZZLE_VALID_AXIS) | ((0|SWIZZLE_VALID_AXIS)<<SWIZZLE_BITS_PER_AXIS)))}, // 36
index c562d7a0aebdf7cf7086b1300e1be2b9b219f847..9fe09c0836c36d208277350b87f74a13ee62d3c4 100644 (file)
@@ -57,7 +57,7 @@ void          WM_init                         (struct bContext *C, int argc, char **argv);
 void           WM_exit                         (struct bContext *C);
 void           WM_main                         (struct bContext *C);
 
-void           WM_init_game            (struct bContext *C);
+int            WM_init_game            (struct bContext *C);
 void           WM_init_splash          (struct bContext *C);
 
 
index 558d20021ce6ea0a3ac692443eb81f3abab93dac..45c851a55984a36b42c2b66b33595fb71fa49404 100644 (file)
@@ -49,6 +49,7 @@
 #include "BKE_font.h"
 #include "BKE_global.h"
 #include "BKE_library.h"
+#include "BKE_main.h"
 #include "BKE_mball.h"
 #include "BKE_report.h"
 #include "BKE_utildefines.h"
@@ -94,6 +95,7 @@
 
 #include "BKE_depsgraph.h"
 #include "BKE_sound.h"
+#include "GHOST_C-api.h"
 
 static void wm_init_reports(bContext *C)
 {
@@ -186,18 +188,113 @@ void WM_init_splash(bContext *C)
        }
 }
 
-void WM_init_game(bContext *C)
+static ScrArea *biggest_view3d(bContext *C)
+{
+       bScreen *sc= CTX_wm_screen(C);
+       ScrArea *sa, *big= NULL;
+       int size, maxsize= 0;
+
+       for(sa= sc->areabase.first; sa; sa= sa->next) {
+               if(sa->spacetype==SPACE_VIEW3D) {
+                       size= sa->winx * sa->winy;
+                       if(size > maxsize) {
+                               maxsize= size;
+                               big= sa;
+                       }
+               }
+       }
+       return big;
+}
+
+int WM_init_game(bContext *C)
 {
-       //XXX copied from WM_init_splash we may not even need those "window" related code
-       //XXX not working yet, it fails at the game_start_operator pool (it needs an area)
        wmWindowManager *wm= CTX_wm_manager(C);
-       wmWindow *prevwin= CTX_wm_window(C);
-       
-       if(wm->windows.first) {
-               CTX_wm_window_set(C, wm->windows.first);
+       wmWindow* win;
+
+       ScrArea *sa;
+       ARegion *ar;
+
+       Main *main = CTX_data_main(C);
+       Scene *scene= CTX_data_scene(C);
+
+       if (!scene)
+               scene= main->scene.first;
+
+       win = wm->windows.first;
+
+       //first to get a valid window
+       if(win)
+               CTX_wm_window_set(C, win);
+
+       sa = biggest_view3d(C);
+
+       if(sa)
+       {
+               for(ar=sa->regionbase.first; ar; ar=ar->next) {
+                       if(ar->regiontype == RGN_TYPE_WINDOW) {
+                               break;
+                       }
+               }
+       }
+
+       // if we have a valid 3D view
+       if (sa && ar) {
+               ARegion *arhide;
+
+               CTX_wm_area_set(C, sa);
+               CTX_wm_region_set(C, ar);
+
+               /* disable quad view */
+               if(ar->alignment == RGN_ALIGN_QSPLIT)
+                       WM_operator_name_call(C, "SCREEN_OT_region_quadview", WM_OP_EXEC_DEFAULT, NULL);
+
+               /* toolbox, properties panel and header are hidden */
+               for(arhide=sa->regionbase.first; arhide; arhide=arhide->next) {
+                       if(arhide->regiontype != RGN_TYPE_WINDOW) {
+                               if(!(arhide->flag & RGN_FLAG_HIDDEN)) {
+                                       ED_region_toggle_hidden(C, arhide);
+                               }
+                       }
+               }
+
+               /* full screen the area */
+               if(!sa->full) {
+                       ED_screen_full_toggle(C, wm->windows.first, sa);
+               }
+
+               /* Fullscreen */
+               if(scene->gm.fullscreen) {
+                       WM_operator_name_call(C, "WM_OT_window_fullscreen_toggle", WM_OP_EXEC_DEFAULT, NULL);
+                       wm_get_screensize(&ar->winrct.xmax, &ar->winrct.ymax);
+               }
+               else
+               {
+                       GHOST_RectangleHandle rect = GHOST_GetClientBounds(win->ghostwin);
+                       ar->winrct.ymax = GHOST_GetHeightRectangle(rect);
+                       ar->winrct.xmax = GHOST_GetWidthRectangle(rect);
+                       GHOST_DisposeRectangle(rect);
+               }
+
                WM_operator_name_call(C, "VIEW3D_OT_game_start", WM_OP_EXEC_DEFAULT, NULL);
-               CTX_wm_window_set(C, prevwin);
+
+               return 1;
+       }
+       else
+       {
+               ReportTimerInfo *rti;
+
+               BKE_report(&wm->reports, RPT_ERROR, "No valid 3D View found. Game auto start is not possible.");
+
+               /* After adding the report to the global list, reset the report timer. */
+               WM_event_remove_timer(wm, NULL, wm->reports.reporttimer);
+
+               /* Records time since last report was added */
+               wm->reports.reporttimer = WM_event_add_timer(wm, CTX_wm_window(C), TIMER, 0.02);
+
+               rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo");
+               wm->reports.reporttimer->customdata = rti;
        }
+       return 0;
 }
 
 /* free strings of open recent files */
index e4bb5b797d34ea72dac7390fea1847aade76b891..45234464ef046957a737bc831ebdc396514baff9 100644 (file)
@@ -73,7 +73,7 @@ static int prefsizx= 0, prefsizy= 0, prefstax= 0, prefstay= 0;
 
 /* XXX this one should correctly check for apple top header...
  done for Cocoa : returns window contents (and not frame) max size*/
-static void wm_get_screensize(int *width_r, int *height_r) 
+void wm_get_screensize(int *width_r, int *height_r)
 {
        unsigned int uiwidth;
        unsigned int uiheight;
index fa244036645123529ac9b6bcf24861847e704d5c..d57fd0e75d825d0ca3fd68fc89f7115280964c29 100644 (file)
@@ -36,6 +36,8 @@ struct wmOperator;
 void           wm_ghost_init                   (bContext *C);
 void           wm_ghost_exit(void);
 
+void wm_get_screensize(int *width_r, int *height_r);
+
 wmWindow       *wm_window_new                  (bContext *C);
 void           wm_window_free                  (bContext *C, wmWindowManager *wm, wmWindow *win);
 void           wm_window_close                 (bContext *C, wmWindowManager *wm, wmWindow *win);
index 05359b0611210bddabd0f723322aa1cdadfaf009..e99935f64a38abd8b8ae2d0f1241acab4bb1d12e 100644 (file)
@@ -1144,8 +1144,10 @@ int main(int argc, char **argv)
 
        else {
                if((G.fileflags & G_FILE_AUTOPLAY) && (G.f & G_SCRIPT_AUTOEXEC))
-                       WM_init_game(C);
-
+               {
+                       if(WM_init_game(C))
+                               return 0;
+               }
                else if(!G.file_loaded)
                        WM_init_splash(C);
        }
index 7afa85c8c31612e1d0f26c58a7e673c94e2369fa..625549a272e2d94a9192a153237103700d06bb01 100644 (file)
@@ -319,9 +319,6 @@ typedef struct KX_PYATTRIBUTE_DEF {
        } m_typeCheck;
 } PyAttributeDef;
 
-#define KX_PYATTRIBUTE_DUMMY(name) \
-       { name, KX_PYATTRIBUTE_TYPE_DUMMY, KX_PYATTRIBUTE_RO, 0, 0, 0.f, 0.f, false, false, 0, 0, 1, NULL, NULL, NULL, {NULL, NULL, NULL, NULL, NULL, NULL, NULL} }
-
 #define KX_PYATTRIBUTE_BOOL_RW(name,object,field) \
        { name, KX_PYATTRIBUTE_TYPE_BOOL, KX_PYATTRIBUTE_RW, 0, 1, 0.f, 0.f, false, false, offsetof(object,field), 0, 1, NULL, NULL, NULL, {&((object *)0)->field, NULL, NULL, NULL, NULL, NULL, NULL} }
 #define KX_PYATTRIBUTE_BOOL_RW_CHECK(name,object,field,function) \
index bff02326c9c3e79b1ce246af2619f9ae7ca42858..fada69848b2f486b858c486ef3abbfeb0402f5f9 100644 (file)
@@ -357,9 +357,8 @@ PyAttributeDef SCA_ISensor::Attributes[] = {
        KX_PYATTRIBUTE_RO_FUNCTION("triggered", SCA_ISensor, pyattr_get_triggered),
        KX_PYATTRIBUTE_RO_FUNCTION("positive", SCA_ISensor, pyattr_get_positive),
        KX_PYATTRIBUTE_RO_FUNCTION("status", SCA_ISensor, pyattr_get_status),
-       //KX_PYATTRIBUTE_TODO("links"),
-       //KX_PYATTRIBUTE_TODO("posTicks"),
-       //KX_PYATTRIBUTE_TODO("negTicks"),
+       KX_PYATTRIBUTE_RO_FUNCTION("pos_ticks", SCA_ISensor, pyattr_get_posTicks),
+       KX_PYATTRIBUTE_RO_FUNCTION("neg_ticks", SCA_ISensor, pyattr_get_negTicks),
        { NULL }        //Sentinel
 };
 
@@ -401,6 +400,18 @@ PyObject* SCA_ISensor::pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF
        return PyLong_FromSsize_t(status);
 }
 
+PyObject* SCA_ISensor::pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
+       return PyLong_FromLong(self->GetPosTicks());
+}
+
+PyObject* SCA_ISensor::pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
+       return PyLong_FromLong(self->GetNegTicks());
+}
+
 int SCA_ISensor::pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
        SCA_ISensor* self= static_cast<SCA_ISensor*>(self_v);
index 42d06d856b6ef40a7f9fbee1e205bfff3454a4e0..2d3a3ef08a036a5cdbdeca7bcf45601bacf406c1 100644 (file)
@@ -167,6 +167,18 @@ public:
                return m_prev_state;
        }
 
+       /** get the number of ticks since the last positive pulse */
+       int GetPosTicks()
+       {
+               return m_pos_ticks;
+       }
+
+       /** get the number of ticks since the last negative pulse */
+       int GetNegTicks()
+       {
+               return m_neg_ticks;
+       }
+
        /** Resume sensing. */
        void Resume();
 
@@ -185,6 +197,9 @@ public:
        static PyObject*        pyattr_get_triggered(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static PyObject*        pyattr_get_positive(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static PyObject*        pyattr_get_status(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject*        pyattr_get_posTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject*        pyattr_get_negTicks(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+
        static int          pyattr_check_level(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        static int          pyattr_check_tap(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
        
index 5ab42ae7608858c7694a17f285af462e3de9b4a9..29a6a73b865019a7736c2ec58d72e7cfb1f49c8b 100644 (file)
@@ -290,7 +290,6 @@ PyAttributeDef SCA_JoystickSensor::Attributes[] = {
        KX_PYATTRIBUTE_RO_FUNCTION("numButtons",        SCA_JoystickSensor, pyattr_get_num_buttons),
        KX_PYATTRIBUTE_RO_FUNCTION("numHats",           SCA_JoystickSensor, pyattr_get_num_hats),
        KX_PYATTRIBUTE_RO_FUNCTION("connected",         SCA_JoystickSensor, pyattr_get_connected),
-       //KX_PYATTRIBUTE_TODO("events"),
        { NULL }        //Sentinel
 };
 
index 48fdcb3eb44af0dd8af368f95cbb55e89bc6c8fb..1f05846abe47b8cf408b326821f8484d4a5db7f1 100644 (file)
@@ -178,7 +178,7 @@ PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self)
 {
        if(m_sCurrentController==NULL)
        {
-               PyErr_SetString(PyExc_SystemError, "GameLogic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
+               PyErr_SetString(PyExc_SystemError, "bge.logic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
                return NULL;
        }
        return m_sCurrentController->GetProxy();
index 2ef7e55429f62cd770f86cd8ab7c734d7db9ea9a..d88997e212812adf03f820427065b9f4628114c8 100644 (file)
@@ -794,9 +794,9 @@ PyMethodDef KX_BlenderMaterial::Methods[] =
 };
 
 PyAttributeDef KX_BlenderMaterial::Attributes[] = {
-       //KX_PYATTRIBUTE_TODO("shader"),
-       //KX_PYATTRIBUTE_TODO("materialIndex"),
-       //KX_PYATTRIBUTE_TODO("blending"),
+       KX_PYATTRIBUTE_RO_FUNCTION("shader", KX_BlenderMaterial, pyattr_get_shader),
+       KX_PYATTRIBUTE_RO_FUNCTION("material_index", KX_BlenderMaterial, pyattr_get_materialIndex),
+       KX_PYATTRIBUTE_RW_FUNCTION("blending", KX_BlenderMaterial, pyattr_get_blending, pyattr_set_blending),
        { NULL }        //Sentinel
 };
 
@@ -822,6 +822,37 @@ PyTypeObject KX_BlenderMaterial::Type = {
        py_base_new
 };
 
+PyObject* KX_BlenderMaterial::pyattr_get_shader(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+       return self->PygetShader(NULL, NULL);
+}
+
+PyObject* KX_BlenderMaterial::pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+       return PyLong_FromSsize_t(self->GetMaterialIndex());
+}
+
+PyObject* KX_BlenderMaterial::pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+       unsigned int* bfunc = self->getBlendFunc();
+       return Py_BuildValue("(ll)", (long int)bfunc[0], (long int)bfunc[1]);
+}
+
+int KX_BlenderMaterial::pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_BlenderMaterial* self= static_cast<KX_BlenderMaterial*>(self_v);
+       PyObject* obj = self->PysetBlending(value, NULL);
+       if(obj)
+       {
+               Py_DECREF(obj);
+               return 0;
+       }
+       return -1;
+}
+
 KX_PYMETHODDEF_DOC( KX_BlenderMaterial, getShader , "getShader()")
 {
        if( !GLEW_ARB_fragment_shader) {
@@ -908,7 +939,7 @@ static unsigned int GL_array[11] = {
        GL_SRC_ALPHA_SATURATE
 };
 
-KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( GameLogic.src, GameLogic.dest)")
+KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( bge.logic.src, bge.logic.dest)")
 {
        unsigned int b[2];
        if(PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1]))
index 5bf62ff6b7c8d6842f2947b95a0f865387fb8a48..239e334f68a31846eb143aebb68b163b1a25796d 100644 (file)
@@ -79,6 +79,9 @@ public:
        Image * getImage (unsigned int idx) { 
                return (idx < MAXTEX && mMaterial) ? mMaterial->img[idx] : NULL; 
        }
+       unsigned int* getBlendFunc() {
+               return mBlendFunc;
+       }
        // for ipos
        void UpdateIPO(
                MT_Vector4 rgba, MT_Vector3 specrgb,
@@ -99,6 +102,11 @@ public:
        // --------------------------------
        virtual PyObject* py_repr(void) { return PyUnicode_FromString(mMaterial->matname.ReadPtr()); }
 
+       static PyObject* pyattr_get_shader(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_materialIndex(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static int       pyattr_set_blending(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+
        KX_PYMETHOD_DOC( KX_BlenderMaterial, getShader );
        KX_PYMETHOD_DOC( KX_BlenderMaterial, getMaterialIndex );
        KX_PYMETHOD_DOC( KX_BlenderMaterial, getTexture );
index 36b90411e1fb949a5073691493d875ca57df16e9..2402baf92ac881343328fc1c64d71a8157c1aa51 100644 (file)
@@ -553,8 +553,8 @@ KX_PYMETHODDEF_DOC_VARARGS(KX_Camera, sphereInsideFrustum,
 "\tcenter = the center of the sphere (in world coordinates.)\n"
 "\tradius = the radius of the sphere\n\n"
 "\tExample:\n"
-"\timport GameLogic\n\n"
-"\tco = GameLogic.getCurrentController()\n"
+"\timport bge.logic\n\n"
+"\tco = bge.logic.getCurrentController()\n"
 "\tcam = co.GetOwner()\n\n"
 "\t# A sphere of radius 4.0 located at [x, y, z] = [1.0, 1.0, 1.0]\n"
 "\tif (cam.sphereInsideFrustum([1.0, 1.0, 1.0], 4) != cam.OUTSIDE):\n"
@@ -586,8 +586,8 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, boxInsideFrustum,
 "\tinside/outside/intersects this camera's viewing frustum.\n\n"
 "\tbox = a list of the eight (8) corners of the box (in world coordinates.)\n\n"
 "\tExample:\n"
-"\timport GameLogic\n\n"
-"\tco = GameLogic.getCurrentController()\n"
+"\timport bge.logic\n\n"
+"\tco = bge.logic.getCurrentController()\n"
 "\tcam = co.GetOwner()\n\n"
 "\tbox = []\n"
 "\tbox.append([-1.0, -1.0, -1.0])\n"
@@ -630,8 +630,8 @@ KX_PYMETHODDEF_DOC_O(KX_Camera, pointInsideFrustum,
 "\treturns 1 if the given point is inside this camera's viewing frustum.\n\n"
 "\tpoint = The point to test (in world coordinates.)\n\n"
 "\tExample:\n"
-"\timport GameLogic\n\n"
-"\tco = GameLogic.getCurrentController()\n"
+"\timport bge.logic\n\n"
+"\tco = bge.logic.getCurrentController()\n"
 "\tcam = co.GetOwner()\n\n"
 "\t# Test point [0.0, 0.0, 0.0]"
 "\tif (cam.pointInsideFrustum([0.0, 0.0, 0.0])):\n"
index 8af6e63f343475b36fff34ac026dc6195e6c3586..b1baa5fe9e199b229efde30f86366ab6b242dc78 100644 (file)
@@ -110,8 +110,14 @@ PyMethodDef KX_ConstraintWrapper::Methods[] = {
 };
 
 PyAttributeDef KX_ConstraintWrapper::Attributes[] = {
-       //KX_PYATTRIBUTE_TODO("constraintId"),
+       KX_PYATTRIBUTE_RO_FUNCTION("constraint_id", KX_ConstraintWrapper, pyattr_get_constraintId),
        { NULL }        //Sentinel
 };
 
+PyObject* KX_ConstraintWrapper::pyattr_get_constraintId(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_ConstraintWrapper* self= static_cast<KX_ConstraintWrapper*>(self_v);
+       return self->PyGetConstraintId();
+}
+
 #endif // DISABLE_PYTHON
index 530ecf16fed293437def2b7e3a4262616f2dcc60..db9543c23ae9efb20fab6d0b2e5d47dbe9e5c5b1 100644 (file)
@@ -44,6 +44,8 @@ public:
        KX_PYMETHOD_NOARGS(KX_ConstraintWrapper,GetConstraintId);
        KX_PYMETHOD(KX_ConstraintWrapper,SetParam);
        KX_PYMETHOD(KX_ConstraintWrapper,GetParam);
+
+       static PyObject* pyattr_get_constraintId(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 #endif
 
 private:
index 837c79c77b3bf5bff61c46af09429b154098f206..9395e57e68b53fdb39c65cb9bc8266df6743f817 100644 (file)
@@ -72,90 +72,19 @@ PyMethodDef KX_PolyProxy::Methods[] = {
 };
 
 PyAttributeDef KX_PolyProxy::Attributes[] = {
-       /* All dummy's so they come up in a dir() */
-       //KX_PYATTRIBUTE_TODO("DummyProps"),
-       KX_PYATTRIBUTE_DUMMY("matname"),
-       KX_PYATTRIBUTE_DUMMY("texture"),
-       KX_PYATTRIBUTE_DUMMY("material"),
-       KX_PYATTRIBUTE_DUMMY("matid"),
-       KX_PYATTRIBUTE_DUMMY("v1"),
-       KX_PYATTRIBUTE_DUMMY("v2"),
-       KX_PYATTRIBUTE_DUMMY("v3"),
-       KX_PYATTRIBUTE_DUMMY("v4"),
-       KX_PYATTRIBUTE_DUMMY("visible"),
-       KX_PYATTRIBUTE_DUMMY("collide"),
+       KX_PYATTRIBUTE_RO_FUNCTION("material_name", KX_PolyProxy, pyattr_get_material_name),
+       KX_PYATTRIBUTE_RO_FUNCTION("texture_name", KX_PolyProxy, pyattr_get_texture_name),
+       KX_PYATTRIBUTE_RO_FUNCTION("material", KX_PolyProxy, pyattr_get_material),
+       KX_PYATTRIBUTE_RO_FUNCTION("material_id", KX_PolyProxy, pyattr_get_material_id),
+       KX_PYATTRIBUTE_RO_FUNCTION("v1", KX_PolyProxy, pyattr_get_v1),
+       KX_PYATTRIBUTE_RO_FUNCTION("v2", KX_PolyProxy, pyattr_get_v2),
+       KX_PYATTRIBUTE_RO_FUNCTION("v3", KX_PolyProxy, pyattr_get_v3),
+       KX_PYATTRIBUTE_RO_FUNCTION("v4", KX_PolyProxy, pyattr_get_v4),
+       KX_PYATTRIBUTE_RO_FUNCTION("visible", KX_PolyProxy, pyattr_get_visible),
+       KX_PYATTRIBUTE_RO_FUNCTION("collide", KX_PolyProxy, pyattr_get_collide),
        { NULL }        //Sentinel
 };
 
-#if 0
-PyObject* KX_PolyProxy::py_getattro(PyObject *attr)
-{
-       char *attr_str= _PyUnicode_AsString(attr);
-       if (!strcmp(attr_str, "matname"))
-       {
-               return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetMaterialName());
-       }
-       if (!strcmp(attr_str, "texture"))
-       {
-               return PyUnicode_FromString(m_polygon->GetMaterial()->GetPolyMaterial()->GetTextureName());
-       }
-       if (!strcmp(attr_str, "material"))
-       {
-               RAS_IPolyMaterial *polymat = m_polygon->GetMaterial()->GetPolyMaterial();
-               if(polymat->GetFlag() & RAS_BLENDERMAT)
-               {
-                       KX_BlenderMaterial* mat = static_cast<KX_BlenderMaterial*>(polymat);
-                       return mat->GetProxy();
-               }
-               else
-               {
-                       KX_PolygonMaterial* mat = static_cast<KX_PolygonMaterial*>(polymat);
-                       return mat->GetProxy();
-               }
-       }
-       if (!strcmp(attr_str, "matid"))
-       {
-               // we'll have to scan through the material bucket of the mes and compare with 
-               // the one of the polygon
-               RAS_MaterialBucket* polyBucket = m_polygon->GetMaterial();
-               unsigned int matid;
-               for (matid=0; matid<(unsigned int)m_mesh->NumMaterials(); matid++)
-               {
-                       RAS_MeshMaterial* meshMat = m_mesh->GetMeshMaterial(matid);
-                       if (meshMat->m_bucket == polyBucket)
-                               // found it
-                               break;
-               }
-               return PyLong_FromSsize_t(matid);
-       }
-       if (!strcmp(attr_str, "v1"))
-       {
-               return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 0));
-       }
-       if (!strcmp(attr_str, "v2"))
-       {
-               return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 1));
-       }
-       if (!strcmp(attr_str, "v3"))
-       {
-               return PyLong_FromSsize_t(m_polygon->GetVertexOffsetAbs(m_mesh, 2));
-       }
-       if (!strcmp(attr_str, "v4"))
-       {
-               return PyLong_FromSsize_t(((m_polygon->VertexCount()>3)?m_polygon->GetVertexOffsetAbs(m_mesh, 3):0));
-       }
-       if (!strcmp(attr_str, "visible"))
-       {
-               return PyLong_FromSsize_t(m_polygon->IsVisible());
-       }
-       if (!strcmp(attr_str, "collide"))
-       {
-               return PyLong_FromSsize_t(m_polygon->IsCollider());
-       }
-       // py_getattro_up(CValue); // XXX -- todo, make all these attributes
-}
-#endif
-
 KX_PolyProxy::KX_PolyProxy(const RAS_MeshObject*mesh, RAS_Polygon* polygon)
 :      m_polygon(polygon),
        m_mesh((RAS_MeshObject*)mesh)
@@ -179,7 +108,75 @@ CValue*            KX_PolyProxy::GetReplica() { return NULL;}
 
 // stuff for python integration
 
-KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex, 
+PyObject* KX_PolyProxy::pyattr_get_material_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+       return self->PygetMaterialName();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_texture_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+       return self->PygetTextureName();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+       return self->PygetMaterial();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_material_id(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+       return self->PygetMaterialIndex();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+
+       return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 0));
+}
+
+PyObject* KX_PolyProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+
+       return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 1));
+}
+
+PyObject* KX_PolyProxy::pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+
+       return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 2));
+}
+
+PyObject* KX_PolyProxy::pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+
+       if (3 < self->m_polygon->VertexCount())
+       {
+               return PyLong_FromSsize_t(self->m_polygon->GetVertexOffsetAbs(self->m_mesh, 3));
+       }
+       return PyLong_FromSsize_t(0);
+}
+
+PyObject* KX_PolyProxy::pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+       return self->PyisVisible();
+}
+
+PyObject* KX_PolyProxy::pyattr_get_collide(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_PolyProxy* self= static_cast<KX_PolyProxy*>(self_v);
+       return self->PyisCollider();
+}
+
+KX_PYMETHODDEF_DOC_NOARGS(KX_PolyProxy, getMaterialIndex,
 "getMaterialIndex() : return the material index of the polygon in the mesh\n")
 {
        RAS_MaterialBucket* polyBucket = m_polygon->GetMaterial();
index 97d89b37435e801118b1f7eb6bbb72d3be94a385..3e669630e30174b4a838918c9bfc44f7984af2bf 100644 (file)
@@ -54,6 +54,16 @@ public:
 
 
 // stuff for python integration
+       static PyObject* pyattr_get_material_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_texture_name(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_material(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_material_id(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_v1(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_v3(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_v4(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_visible(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_collide(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
 
        KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getMaterialIndex)
        KX_PYMETHOD_DOC_NOARGS(KX_PolyProxy,getNumVertex)
index dacc74f139f6a97796a1a3ce8ad2818a856eeeb0..63204b16e8b5043a93e1850aa0b6c0d81e881269 100644 (file)
@@ -233,7 +233,7 @@ PyAttributeDef KX_PolygonMaterial::Attributes[] = {
        KX_PYATTRIBUTE_FLOAT_RW("shininess", 0.0f, 1000.0f, KX_PolygonMaterial, m_shininess),
        KX_PYATTRIBUTE_FLOAT_RW("specularity", 0.0f, 1000.0f, KX_PolygonMaterial, m_specularity),
        
-       KX_PYATTRIBUTE_RW_FUNCTION("diffuse", KX_PolygonMaterial, pyattr_get_texture, pyattr_set_diffuse),
+       KX_PYATTRIBUTE_RW_FUNCTION("diffuse", KX_PolygonMaterial, pyattr_get_diffuse, pyattr_set_diffuse),
        KX_PYATTRIBUTE_RW_FUNCTION("specular",KX_PolygonMaterial, pyattr_get_specular, pyattr_set_specular),    
        
        KX_PYATTRIBUTE_RO_FUNCTION("tface",     KX_PolygonMaterial, pyattr_get_tface), /* How the heck is this even useful??? - Campbell */
index 652bf5eafedf29649ecb0730e93827a84df1860e..09630ad285193b1e946954cce9682853163f3f24 100644 (file)
@@ -73,247 +73,359 @@ PyMethodDef KX_VertexProxy::Methods[] = {
 };
 
 PyAttributeDef KX_VertexProxy::Attributes[] = {
-       //KX_PYATTRIBUTE_TODO("DummyProps"),
+       KX_PYATTRIBUTE_RW_FUNCTION("x", KX_VertexProxy, pyattr_get_x, pyattr_set_x),
+       KX_PYATTRIBUTE_RW_FUNCTION("y", KX_VertexProxy, pyattr_get_y, pyattr_set_y),
+       KX_PYATTRIBUTE_RW_FUNCTION("z", KX_VertexProxy, pyattr_get_z, pyattr_set_z),
 
-       KX_PYATTRIBUTE_DUMMY("x"),
-       KX_PYATTRIBUTE_DUMMY("y"),
-       KX_PYATTRIBUTE_DUMMY("z"),
+       KX_PYATTRIBUTE_RW_FUNCTION("r", KX_VertexProxy, pyattr_get_r, pyattr_set_r),
+       KX_PYATTRIBUTE_RW_FUNCTION("g", KX_VertexProxy, pyattr_get_g, pyattr_set_g),
+       KX_PYATTRIBUTE_RW_FUNCTION("b", KX_VertexProxy, pyattr_get_b, pyattr_set_b),
+       KX_PYATTRIBUTE_RW_FUNCTION("a", KX_VertexProxy, pyattr_get_a, pyattr_set_a),
 
-       KX_PYATTRIBUTE_DUMMY("r"),
-       KX_PYATTRIBUTE_DUMMY("g"),
-       KX_PYATTRIBUTE_DUMMY("b"),
-       KX_PYATTRIBUTE_DUMMY("a"),
+       KX_PYATTRIBUTE_RW_FUNCTION("u", KX_VertexProxy, pyattr_get_u, pyattr_set_u),
+       KX_PYATTRIBUTE_RW_FUNCTION("v", KX_VertexProxy, pyattr_get_v, pyattr_set_v),
 
-       KX_PYATTRIBUTE_DUMMY("u"),
-       KX_PYATTRIBUTE_DUMMY("v"),
+       KX_PYATTRIBUTE_RW_FUNCTION("u2", KX_VertexProxy, pyattr_get_u2, pyattr_set_u2),
+       KX_PYATTRIBUTE_RW_FUNCTION("v2", KX_VertexProxy, pyattr_get_v2, pyattr_set_v2),
 
-       KX_PYATTRIBUTE_DUMMY("u2"),
-       KX_PYATTRIBUTE_DUMMY("v2"),
+       KX_PYATTRIBUTE_RW_FUNCTION("XYZ", KX_VertexProxy, pyattr_get_XYZ, pyattr_set_XYZ),
+       KX_PYATTRIBUTE_RW_FUNCTION("UV", KX_VertexProxy, pyattr_get_UV, pyattr_set_UV),
 
-       KX_PYATTRIBUTE_DUMMY("XYZ"),
-       KX_PYATTRIBUTE_DUMMY("UV"),
-
-       KX_PYATTRIBUTE_DUMMY("color"),
-       KX_PYATTRIBUTE_DUMMY("colour"),
-
-       KX_PYATTRIBUTE_DUMMY("normal"),
+       KX_PYATTRIBUTE_RW_FUNCTION("color", KX_VertexProxy, pyattr_get_color, pyattr_set_color),
+       KX_PYATTRIBUTE_RW_FUNCTION("normal", KX_VertexProxy, pyattr_get_normal, pyattr_set_normal),
 
        { NULL }        //Sentinel
 };
 
-#if 0
-PyObject*
-KX_VertexProxy::py_getattro(PyObject *attr)
-{
-  char *attr_str= _PyUnicode_AsString(attr);
-  if (attr_str[1]=='\0') { // Group single letters
-    // pos
-    if (attr_str[0]=='x')
-       return PyFloat_FromDouble(m_vertex->getXYZ()[0]);
-    if (attr_str[0]=='y')
-       return PyFloat_FromDouble(m_vertex->getXYZ()[1]);
-    if (attr_str[0]=='z')
-       return PyFloat_FromDouble(m_vertex->getXYZ()[2]);
-
-    // Col
-    if (attr_str[0]=='r')
-       return PyFloat_FromDouble(m_vertex->getRGBA()[0]/255.0);
-    if (attr_str[0]=='g')
-       return PyFloat_FromDouble(m_vertex->getRGBA()[1]/255.0);
-    if (attr_str[0]=='b')
-       return PyFloat_FromDouble(m_vertex->getRGBA()[2]/255.0);
-    if (attr_str[0]=='a')
-       return PyFloat_FromDouble(m_vertex->getRGBA()[3]/255.0);
-
-    // UV
-    if (attr_str[0]=='u')
-       return PyFloat_FromDouble(m_vertex->getUV1()[0]);
-    if (attr_str[0]=='v')
-       return PyFloat_FromDouble(m_vertex->getUV1()[1]);
-  }
-
-
-  if (!strcmp(attr_str, "XYZ"))
-       return PyObjectFrom(MT_Vector3(m_vertex->getXYZ()));
-
-  if (!strcmp(attr_str, "UV"))
-       return PyObjectFrom(MT_Point2(m_vertex->getUV1()));
-
-  if (!strcmp(attr_str, "color") || !strcmp(attr_str, "colour"))
-  {
-       const unsigned char *colp = m_vertex->getRGBA();
-       MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]);
-       color /= 255.0;
-       return PyObjectFrom(color);
-  }
+PyObject* KX_VertexProxy::pyattr_get_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getXYZ()[0]);
+}
 
-  if (!strcmp(attr_str, "normal"))
-  {
-       return PyObjectFrom(MT_Vector3(m_vertex->getNormal()));
-  }
+PyObject* KX_VertexProxy::pyattr_get_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getXYZ()[1]);
+}
 
-  py_getattro_up(CValue);
+PyObject* KX_VertexProxy::pyattr_get_z(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getXYZ()[2]);
 }
-#endif
 
+PyObject* KX_VertexProxy::pyattr_get_r(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getRGBA()[0]/255.0);
+}
 
-#if 0
-int    KX_VertexProxy::py_setattro(PyObject *attr, PyObject *pyvalue)
+PyObject* KX_VertexProxy::pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
 {
-  char *attr_str= _PyUnicode_AsString(attr);
-  if (PySequence_Check(pyvalue))
-  {
-       if (!strcmp(attr_str, "XYZ"))
-       {
-               MT_Point3 vec;
-               if (PyVecTo(pyvalue, vec))
-               {
-                       m_vertex->SetXYZ(vec);
-                       m_mesh->SetMeshModified(true);
-                       return PY_SET_ATTR_SUCCESS;
-               }
-               return PY_SET_ATTR_FAIL;
-       }
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getRGBA()[1]/255.0);
+}
 
-       if (!strcmp(attr_str, "UV"))
-       {
-               MT_Point2 vec;
-               if (PyVecTo(pyvalue, vec))
-               {
-                       m_vertex->SetUV(vec);
-                       m_mesh->SetMeshModified(true);
-                       return PY_SET_ATTR_SUCCESS;
-               }
-               return PY_SET_ATTR_FAIL;
-       }
+PyObject* KX_VertexProxy::pyattr_get_b(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getRGBA()[2]/255.0);
+}
 
-       if (!strcmp(attr_str, "color") || !strcmp(attr_str, "colour"))
-       {
-               MT_Vector4 vec;
-               if (PyVecTo(pyvalue, vec))
-               {
-                       m_vertex->SetRGBA(vec);
-                       m_mesh->SetMeshModified(true);
-                       return PY_SET_ATTR_SUCCESS;
-               }
-               return PY_SET_ATTR_FAIL;
-       }
+PyObject* KX_VertexProxy::pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getRGBA()[3]/255.0);
+}
 
-       if (!strcmp(attr_str, "normal"))
-       {
-               MT_Vector3 vec;
-               if (PyVecTo(pyvalue, vec))
-               {
-                       m_vertex->SetNormal(vec);
-                       m_mesh->SetMeshModified(true);
-                       return PY_SET_ATTR_SUCCESS;
-               }
-               return PY_SET_ATTR_FAIL;
-       }
-  }
-
-  if (PyFloat_Check(pyvalue))
-  {
-       float val = PyFloat_AsDouble(pyvalue);
-       // pos
-       MT_Point3 pos(m_vertex->getXYZ());
-       if (!strcmp(attr_str, "x"))
+PyObject* KX_VertexProxy::pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getUV1()[0]);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getUV1()[1]);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getUV2()[0]);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyFloat_FromDouble(self->m_vertex->getUV2()[1]);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyObjectFrom(MT_Vector3(self->m_vertex->getXYZ()));
+}
+
+PyObject* KX_VertexProxy::pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyObjectFrom(MT_Point2(self->m_vertex->getUV1()));
+}
+
+PyObject* KX_VertexProxy::pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       const unsigned char *colp = self->m_vertex->getRGBA();
+       MT_Vector4 color(colp[0], colp[1], colp[2], colp[3]);
+       color /= 255.0;
+       return PyObjectFrom(color);
+}
+
+PyObject* KX_VertexProxy::pyattr_get_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       return PyObjectFrom(MT_Vector3(self->m_vertex->getNormal()));
+}
+
+int KX_VertexProxy::pyattr_set_x(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               MT_Point3 pos(self->m_vertex->getXYZ());
                pos.x() = val;
-               m_vertex->SetXYZ(pos);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetXYZ(pos);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
+       return PY_SET_ATTR_FAIL;
+}
 
-       if (!strcmp(attr_str, "y"))
+int KX_VertexProxy::pyattr_set_y(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               MT_Point3 pos(self->m_vertex->getXYZ());
                pos.y() = val;
-               m_vertex->SetXYZ(pos);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetXYZ(pos);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
+       return PY_SET_ATTR_FAIL;
+}
 
-       if (!strcmp(attr_str, "z"))
+int KX_VertexProxy::pyattr_set_z(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               MT_Point3 pos(self->m_vertex->getXYZ());
                pos.z() = val;
-               m_vertex->SetXYZ(pos);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetXYZ(pos);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
+       return PY_SET_ATTR_FAIL;
+}
 
-       // uv
-       MT_Point2 uv = m_vertex->getUV1();
-       if (!strcmp(attr_str, "u"))
+int KX_VertexProxy::pyattr_set_u(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               MT_Point2 uv = self->m_vertex->getUV1();
                uv[0] = val;
-               m_vertex->SetUV(uv);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetUV(uv);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
+       return PY_SET_ATTR_FAIL;
+}
 
-       if (!strcmp(attr_str, "v"))
+int KX_VertexProxy::pyattr_set_v(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               MT_Point2 uv = self->m_vertex->getUV1();
                uv[1] = val;
-               m_vertex->SetUV(uv);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetUV(uv);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
+       return PY_SET_ATTR_FAIL;
+}
 
-       // uv
-       MT_Point2 uv2 = m_vertex->getUV2();
-       if (!strcmp(attr_str, "u2"))
+int KX_VertexProxy::pyattr_set_u2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               MT_Point2 uv = self->m_vertex->getUV2();
                uv[0] = val;
-               m_vertex->SetUV2(uv);
-               m_mesh->SetMeshModified(true);
-               return 0;
+               self->m_vertex->SetUV2(uv);
+               self->m_mesh->SetMeshModified(true);
+               return PY_SET_ATTR_SUCCESS;
        }
+       return PY_SET_ATTR_FAIL;
+}
 
-       if (!strcmp(attr_str, "v2"))
+int KX_VertexProxy::pyattr_set_v2(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               MT_Point2 uv = self->m_vertex->getUV2();
                uv[1] = val;
-               m_vertex->SetUV2(uv);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetUV2(uv);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
+       return PY_SET_ATTR_FAIL;
+}
 
-       // col
-       unsigned int icol = *((const unsigned int *)m_vertex->getRGBA());
-       unsigned char *cp = (unsigned char*) &icol;
-       val *= 255.0;
-       if (!strcmp(attr_str, "r"))
+int KX_VertexProxy::pyattr_set_r(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
+               unsigned char *cp = (unsigned char*) &icol;
+               val *= 255.0;
                cp[0] = (unsigned char) val;
-               m_vertex->SetRGBA(icol);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetRGBA(icol);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
-       if (!strcmp(attr_str, "g"))
+       return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_g(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
+               unsigned char *cp = (unsigned char*) &icol;
+               val *= 255.0;
                cp[1] = (unsigned char) val;
-               m_vertex->SetRGBA(icol);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetRGBA(icol);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
-       if (!strcmp(attr_str, "b"))
+       return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_b(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
+               unsigned char *cp = (unsigned char*) &icol;
+               val *= 255.0;
                cp[2] = (unsigned char) val;
-               m_vertex->SetRGBA(icol);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetRGBA(icol);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
-       if (!strcmp(attr_str, "a"))
+       return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_a(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PyFloat_Check(value))
        {
+               float val = PyFloat_AsDouble(value);
+               unsigned int icol = *((const unsigned int *)self->m_vertex->getRGBA());
+               unsigned char *cp = (unsigned char*) &icol;
+               val *= 255.0;
                cp[3] = (unsigned char) val;
-               m_vertex->SetRGBA(icol);
-               m_mesh->SetMeshModified(true);
+               self->m_vertex->SetRGBA(icol);
+               self->m_mesh->SetMeshModified(true);
                return PY_SET_ATTR_SUCCESS;
        }
-  }
+       return PY_SET_ATTR_FAIL;
+}
 
-  return CValue::py_setattro(attr, pyvalue);
+int KX_VertexProxy::pyattr_set_XYZ(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PySequence_Check(value))
+       {
+               MT_Point3 vec;
+               if (PyVecTo(value, vec))
+               {
+                       self->m_vertex->SetXYZ(vec);
+                       self->m_mesh->SetMeshModified(true);
+                       return PY_SET_ATTR_SUCCESS;
+               }
+       }
+       return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_UV(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PySequence_Check(value))
+       {
+               MT_Point2 vec;
+               if (PyVecTo(value, vec))
+               {
+                       self->m_vertex->SetUV(vec);
+                       self->m_mesh->SetMeshModified(true);
+                       return PY_SET_ATTR_SUCCESS;
+               }
+       }
+       return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_color(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PySequence_Check(value))
+       {
+               MT_Vector4 vec;
+               if (PyVecTo(value, vec))
+               {
+                       self->m_vertex->SetRGBA(vec);
+                       self->m_mesh->SetMeshModified(true);
+                       return PY_SET_ATTR_SUCCESS;
+               }
+       }
+       return PY_SET_ATTR_FAIL;
+}
+
+int KX_VertexProxy::pyattr_set_normal(void *self_v, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value)
+{
+       KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
+       if (PySequence_Check(value))
+       {
+               MT_Vector3 vec;
+               if (PyVecTo(value, vec))
+               {
+                       self->m_vertex->SetNormal(vec);
+                       self->m_mesh->SetMeshModified(true);
+                       return PY_SET_ATTR_SUCCESS;
+               }
+       }
+       return PY_SET_ATTR_FAIL;
 }
-#endif
 
 KX_VertexProxy::KX_VertexProxy(KX_MeshProxy*mesh, RAS_TexVert* vertex)
 :      m_vertex(vertex),
index 08fe0e7e2f8037ca7fa3f3e55e3059ba3f0b456f..b39d3ecb7d4e3a0945b49b2de7cc0f8625755ba5 100644 (file)
@@ -56,6 +56,37 @@ public:
 
 // stuff for python integration
 
+       static PyObject* pyattr_get_x(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_y(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_z(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_r(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_b(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_a(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_u(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_v(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_u2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_v2(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_XYZ(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_UV(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_color(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static PyObject* pyattr_get_normal(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef);
+       static int pyattr_set_x(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_y(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_z(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_u(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_v(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_u2(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_v2(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_r(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_g(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_b(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_a(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_XYZ(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_UV(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_color(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+       static int pyattr_set_normal(void *self, const struct KX_PYATTRIBUTE_DEF *attrdef, PyObject *value);
+
        KX_PYMETHOD_NOARGS(KX_VertexProxy,GetXYZ);
        KX_PYMETHOD_O(KX_VertexProxy,SetXYZ);
        KX_PYMETHOD_NOARGS(KX_VertexProxy,GetUV);