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
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c13
-rw-r--r--source/blender/editors/space_logic/logic_window.c2
-rw-r--r--source/blender/makesrna/intern/rna_actuator.c4
-rw-r--r--source/blender/python/doc/sphinx_doc_gen.py37
-rw-r--r--source/blender/python/generic/blf_api.c4
-rw-r--r--source/blender/python/generic/mathutils_color.c2
-rw-r--r--source/blender/python/generic/mathutils_euler.c2
-rw-r--r--source/blender/python/generic/mathutils_matrix.c2
-rw-r--r--source/blender/python/generic/mathutils_quat.c4
-rw-r--r--source/blender/python/generic/mathutils_vector.c8
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c113
-rw-r--r--source/blender/windowmanager/intern/wm_window.c2
-rw-r--r--source/blender/windowmanager/wm_window.h2
-rw-r--r--source/creator/creator.c6
-rw-r--r--source/gameengine/Expressions/PyObjectPlus.h3
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.cpp17
-rw-r--r--source/gameengine/GameLogic/SCA_ISensor.h15
-rw-r--r--source/gameengine/GameLogic/SCA_JoystickSensor.cpp1
-rw-r--r--source/gameengine/GameLogic/SCA_PythonController.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.cpp39
-rw-r--r--source/gameengine/Ketsji/KX_BlenderMaterial.h8
-rw-r--r--source/gameengine/Ketsji/KX_Camera.cpp12
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.cpp8
-rw-r--r--source/gameengine/Ketsji/KX_ConstraintWrapper.h2
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.cpp161
-rw-r--r--source/gameengine/Ketsji/KX_PolyProxy.h10
-rw-r--r--source/gameengine/Ketsji/KX_PolygonMaterial.cpp2
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.cpp454
-rw-r--r--source/gameengine/Ketsji/KX_VertexProxy.h31
30 files changed, 311 insertions, 657 deletions
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 6b20a1041b3..799ef580f63 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -479,17 +479,16 @@ static int removedoublesflag_exec(bContext *C, wmOperator *op)
int count = removedoublesflag(em,1,0,RNA_float_get(op->ptr, "limit"));
- if(!count)
- return OPERATOR_CANCELLED;
+ if(count) {
+ recalc_editnormals(em);
- recalc_editnormals(em);
+ DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
+ }
BKE_reportf(op->reports, RPT_INFO, "Removed %d vertices", count);
-
- DAG_id_flush_update(obedit->data, OB_RECALC_DATA);
- WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
-
BKE_mesh_end_editmesh(obedit->data, em);
+
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c
index d7f8803b3bf..511ca99ff82 100644
--- a/source/blender/editors/space_logic/logic_window.c
+++ b/source/blender/editors/space_logic/logic_window.c
@@ -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 bge.logic.globalDict %x4|Load bge.logic.globalDict %x5";
+ str = "Scene %t|Start new game%x0|Restart this game%x2|Quit this game %x3|Save GameLogic.globalDict %x4|Load GameLogic.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;
diff --git a/source/blender/makesrna/intern/rna_actuator.c b/source/blender/makesrna/intern/rna_actuator.c
index 63e09c1b6c2..f5145d86270 100644
--- a/source/blender/makesrna/intern/rna_actuator.c
+++ b/source/blender/makesrna/intern/rna_actuator.c
@@ -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 bge.logic.globalDict", ""},
- {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load bge.logic.globalDict", ""},
+ {ACT_GAME_SAVECFG, "SAVECFG", 0, "Save GameLogic.globalDict", ""},
+ {ACT_GAME_LOADCFG, "LOADCFG", 0, "Load GameLogic.globalDict", ""},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "GameActuator", "Actuator");
diff --git a/source/blender/python/doc/sphinx_doc_gen.py b/source/blender/python/doc/sphinx_doc_gen.py
index 1355d2508a5..940b5fbcce9 100644
--- a/source/blender/python/doc/sphinx_doc_gen.py
+++ b/source/blender/python/doc/sphinx_doc_gen.py
@@ -144,9 +144,7 @@ def pyfunc2sphinx(ident, fw, identifier, py_func, is_class=True):
def py_descr2sphinx(ident, fw, descr, module_name, type_name, identifier):
- if identifier.startswith("_"):
- return
-
+
doc = descr.__doc__
if not doc:
doc = undocumented_message(module_name, type_name, identifier)
@@ -383,7 +381,6 @@ def rna2sphinx(BASEPATH):
fw(" mathutils.rst\n\n")
fw(" blf.rst\n\n")
- fw(" aud.rst\n\n")
# game engine
fw("===================\n")
@@ -466,30 +463,14 @@ def rna2sphinx(BASEPATH):
import blf as module
pymodule2sphinx(BASEPATH, "blf", module, "Font Drawing (blf)")
del module
-
- import aud as module
- pymodule2sphinx(BASEPATH, "aud", module, "Audio System (aud)")
- del module
# game engine
- from bge import types as module
- pymodule2sphinx(BASEPATH, "bge.types", module, "Game Engine bge.types Module")
-
- from bge import logic as module
- pymodule2sphinx(BASEPATH, "bge.logic", module, "Game Engine bge.logic Module")
-
- from bge import render as module
- pymodule2sphinx(BASEPATH, "bge.render", module, "Game Engine bge.render Module")
-
- from bge import events as module
- pymodule2sphinx(BASEPATH, "bge.events", module, "Game Engine bge.events Module")
-
- #import shutil
+ import shutil
# copy2 keeps time/date stamps
- #shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.types.rst"), BASEPATH)
- #shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.logic.rst"), BASEPATH)
- #shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.render.rst"), BASEPATH)
- #shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.events.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.types.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.logic.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.render.rst"), BASEPATH)
+ shutil.copy2(os.path.join(BASEPATH, "../../../../gameengine/PyDoc/bge.events.rst"), BASEPATH)
if 0:
@@ -783,8 +764,7 @@ def rna2sphinx(BASEPATH):
file.close()
-def main():
- import bpy
+if __name__ == '__main__':
if 'bpy' not in dir():
print("\nError, this script must run from inside blender2.5")
print(script_help_msg)
@@ -854,6 +834,3 @@ def main():
import sys
sys.exit()
-
-if __name__ == '__main__':
- main()
diff --git a/source/blender/python/generic/blf_api.c b/source/blender/python/generic/blf_api.c
index a5f5f8815c7..762153b8349 100644
--- a/source/blender/python/generic/blf_api.c
+++ b/source/blender/python/generic/blf_api.c
@@ -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 z: float\n";
+" :type x: 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 angle: float\n";
+" :type aspect: float\n";
static PyObject *py_blf_rotation(PyObject *self, PyObject *args)
{
diff --git a/source/blender/python/generic/mathutils_color.c b/source/blender/python/generic/mathutils_color.c
index 57d2838238c..d4ab64e13c5 100644
--- a/source/blender/python/generic/mathutils_color.c
+++ b/source/blender/python/generic/mathutils_color.c
@@ -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 */
};
diff --git a/source/blender/python/generic/mathutils_euler.c b/source/blender/python/generic/mathutils_euler.c
index b36eb7803f1..63a04918941 100644
--- a/source/blender/python/generic/mathutils_euler.c
+++ b/source/blender/python/generic/mathutils_euler.c
@@ -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 */
};
diff --git a/source/blender/python/generic/mathutils_matrix.c b/source/blender/python/generic/mathutils_matrix.c
index 24239e1f541..1ef834b7a3e 100644
--- a/source/blender/python/generic/mathutils_matrix.c
+++ b/source/blender/python/generic/mathutils_matrix.c
@@ -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 */
};
diff --git a/source/blender/python/generic/mathutils_quat.c b/source/blender/python/generic/mathutils_quat.c
index 553844b6ee5..8d9fe54fa85 100644
--- a/source/blender/python/generic/mathutils_quat.c
+++ b/source/blender/python/generic/mathutils_quat.c
@@ -109,7 +109,7 @@ static PyObject *Quaternion_ToEuler(QuaternionObject * self, PyObject *args)
}
//----------------------------Quaternion.toMatrix()------------------
static char Quaternion_ToMatrix_doc[] =
-".. method:: to_matrix()\n"
+".. method:: to_matrix(other)\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 */
};
diff --git a/source/blender/python/generic/mathutils_vector.c b/source/blender/python/generic/mathutils_vector.c
index 75a695526fc..9672878ec51 100644
--- a/source/blender/python/generic/mathutils_vector.c
+++ b/source/blender/python/generic/mathutils_vector.c
@@ -508,8 +508,7 @@ 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"
-" :type fallback: any\n"
-" :return: angle in radians or fallback when given\n"
+" :return angle: angle in radians or fallback when given\n"
" :rtype: float\n"
"\n"
" .. note:: Zero length vectors raise an :exc:`AttributeError`.\n";
@@ -608,9 +607,8 @@ 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: the parallel projection vector\n"
+" :return projection: the parallel projection vector\n"
" :rtype: :class:`Vector`\n";
static PyObject *Vector_Project(VectorObject *self, VectorObject *value)
@@ -1603,7 +1601,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
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 9fe09c0836c..c562d7a0aeb 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -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);
-int WM_init_game (struct bContext *C);
+void WM_init_game (struct bContext *C);
void WM_init_splash (struct bContext *C);
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 45c851a5598..558d20021ce 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -49,7 +49,6 @@
#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"
@@ -95,7 +94,6 @@
#include "BKE_depsgraph.h"
#include "BKE_sound.h"
-#include "GHOST_C-api.h"
static void wm_init_reports(bContext *C)
{
@@ -188,113 +186,18 @@ void WM_init_splash(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)
+void 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* 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);
- }
-
+ wmWindow *prevwin= CTX_wm_window(C);
+
+ if(wm->windows.first) {
+ CTX_wm_window_set(C, wm->windows.first);
WM_operator_name_call(C, "VIEW3D_OT_game_start", WM_OP_EXEC_DEFAULT, NULL);
-
- 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;
+ CTX_wm_window_set(C, prevwin);
}
- return 0;
}
/* free strings of open recent files */
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 45234464ef0..e4bb5b797d3 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -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*/
-void wm_get_screensize(int *width_r, int *height_r)
+static void wm_get_screensize(int *width_r, int *height_r)
{
unsigned int uiwidth;
unsigned int uiheight;
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index d57fd0e75d8..fa244036645 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -36,8 +36,6 @@ 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);
diff --git a/source/creator/creator.c b/source/creator/creator.c
index e99935f64a3..05359b06112 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1144,10 +1144,8 @@ int main(int argc, char **argv)
else {
if((G.fileflags & G_FILE_AUTOPLAY) && (G.f & G_SCRIPT_AUTOEXEC))
- {
- if(WM_init_game(C))
- return 0;
- }
+ WM_init_game(C);
+
else if(!G.file_loaded)
WM_init_splash(C);
}
diff --git a/source/gameengine/Expressions/PyObjectPlus.h b/source/gameengine/Expressions/PyObjectPlus.h
index 625549a272e..7afa85c8c31 100644
--- a/source/gameengine/Expressions/PyObjectPlus.h
+++ b/source/gameengine/Expressions/PyObjectPlus.h
@@ -319,6 +319,9 @@ 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) \
diff --git a/source/gameengine/GameLogic/SCA_ISensor.cpp b/source/gameengine/GameLogic/SCA_ISensor.cpp
index fada69848b2..bff02326c9c 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.cpp
+++ b/source/gameengine/GameLogic/SCA_ISensor.cpp
@@ -357,8 +357,9 @@ 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_RO_FUNCTION("pos_ticks", SCA_ISensor, pyattr_get_posTicks),
- KX_PYATTRIBUTE_RO_FUNCTION("neg_ticks", SCA_ISensor, pyattr_get_negTicks),
+ //KX_PYATTRIBUTE_TODO("links"),
+ //KX_PYATTRIBUTE_TODO("posTicks"),
+ //KX_PYATTRIBUTE_TODO("negTicks"),
{ NULL } //Sentinel
};
@@ -400,18 +401,6 @@ 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);
diff --git a/source/gameengine/GameLogic/SCA_ISensor.h b/source/gameengine/GameLogic/SCA_ISensor.h
index 2d3a3ef08a0..42d06d856b6 100644
--- a/source/gameengine/GameLogic/SCA_ISensor.h
+++ b/source/gameengine/GameLogic/SCA_ISensor.h
@@ -167,18 +167,6 @@ 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();
@@ -197,9 +185,6 @@ 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);
diff --git a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
index 29a6a73b865..5ab42ae7608 100644
--- a/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
+++ b/source/gameengine/GameLogic/SCA_JoystickSensor.cpp
@@ -290,6 +290,7 @@ 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
};
diff --git a/source/gameengine/GameLogic/SCA_PythonController.cpp b/source/gameengine/GameLogic/SCA_PythonController.cpp
index 1f05846abe4..48fdcb3eb44 100644
--- a/source/gameengine/GameLogic/SCA_PythonController.cpp
+++ b/source/gameengine/GameLogic/SCA_PythonController.cpp
@@ -178,7 +178,7 @@ PyObject* SCA_PythonController::sPyGetCurrentController(PyObject *self)
{
if(m_sCurrentController==NULL)
{
- PyErr_SetString(PyExc_SystemError, "bge.logic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
+ PyErr_SetString(PyExc_SystemError, "GameLogic.getCurrentController(), this function is being run outside the python controllers context, or blenders internal state is corrupt.");
return NULL;
}
return m_sCurrentController->GetProxy();
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
index d88997e2128..2ef7e55429f 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.cpp
@@ -794,9 +794,9 @@ PyMethodDef KX_BlenderMaterial::Methods[] =
};
PyAttributeDef KX_BlenderMaterial::Attributes[] = {
- 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),
+ //KX_PYATTRIBUTE_TODO("shader"),
+ //KX_PYATTRIBUTE_TODO("materialIndex"),
+ //KX_PYATTRIBUTE_TODO("blending"),
{ NULL } //Sentinel
};
@@ -822,37 +822,6 @@ 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) {
@@ -939,7 +908,7 @@ static unsigned int GL_array[11] = {
GL_SRC_ALPHA_SATURATE
};
-KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( bge.logic.src, bge.logic.dest)")
+KX_PYMETHODDEF_DOC( KX_BlenderMaterial, setBlending , "setBlending( GameLogic.src, GameLogic.dest)")
{
unsigned int b[2];
if(PyArg_ParseTuple(args, "ii:setBlending", &b[0], &b[1]))
diff --git a/source/gameengine/Ketsji/KX_BlenderMaterial.h b/source/gameengine/Ketsji/KX_BlenderMaterial.h
index 239e334f68a..5bf62ff6b7c 100644
--- a/source/gameengine/Ketsji/KX_BlenderMaterial.h
+++ b/source/gameengine/Ketsji/KX_BlenderMaterial.h
@@ -79,9 +79,6 @@ 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,
@@ -102,11 +99,6 @@ 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 );
diff --git a/source/gameengine/Ketsji/KX_Camera.cpp b/source/gameengine/Ketsji/KX_Camera.cpp
index 2402baf92ac..36b90411e1f 100644
--- a/source/gameengine/Ketsji/KX_Camera.cpp
+++ b/source/gameengine/Ketsji/KX_Camera.cpp
@@ -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 bge.logic\n\n"
-"\tco = bge.logic.getCurrentController()\n"
+"\timport GameLogic\n\n"
+"\tco = GameLogic.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 bge.logic\n\n"
-"\tco = bge.logic.getCurrentController()\n"
+"\timport GameLogic\n\n"
+"\tco = GameLogic.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 bge.logic\n\n"
-"\tco = bge.logic.getCurrentController()\n"
+"\timport GameLogic\n\n"
+"\tco = GameLogic.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"
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
index b1baa5fe9e1..8af6e63f343 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.cpp
@@ -110,14 +110,8 @@ PyMethodDef KX_ConstraintWrapper::Methods[] = {
};
PyAttributeDef KX_ConstraintWrapper::Attributes[] = {
- KX_PYATTRIBUTE_RO_FUNCTION("constraint_id", KX_ConstraintWrapper, pyattr_get_constraintId),
+ //KX_PYATTRIBUTE_TODO("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
diff --git a/source/gameengine/Ketsji/KX_ConstraintWrapper.h b/source/gameengine/Ketsji/KX_ConstraintWrapper.h
index db9543c23ae..530ecf16fed 100644
--- a/source/gameengine/Ketsji/KX_ConstraintWrapper.h
+++ b/source/gameengine/Ketsji/KX_ConstraintWrapper.h
@@ -44,8 +44,6 @@ 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:
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.cpp b/source/gameengine/Ketsji/KX_PolyProxy.cpp
index 9395e57e68b..837c79c77b3 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.cpp
+++ b/source/gameengine/Ketsji/KX_PolyProxy.cpp
@@ -72,19 +72,90 @@ PyMethodDef KX_PolyProxy::Methods[] = {
};
PyAttributeDef KX_PolyProxy::Attributes[] = {
- 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),
+ /* 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"),
{ 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)
@@ -108,75 +179,7 @@ CValue* KX_PolyProxy::GetReplica() { return NULL;}
// stuff for python integration
-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,
+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();
diff --git a/source/gameengine/Ketsji/KX_PolyProxy.h b/source/gameengine/Ketsji/KX_PolyProxy.h
index 3e669630e30..97d89b37435 100644
--- a/source/gameengine/Ketsji/KX_PolyProxy.h
+++ b/source/gameengine/Ketsji/KX_PolyProxy.h
@@ -54,16 +54,6 @@ 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)
diff --git a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
index 63204b16e8b..dacc74f139f 100644
--- a/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
+++ b/source/gameengine/Ketsji/KX_PolygonMaterial.cpp
@@ -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_diffuse, pyattr_set_diffuse),
+ KX_PYATTRIBUTE_RW_FUNCTION("diffuse", KX_PolygonMaterial, pyattr_get_texture, 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 */
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.cpp b/source/gameengine/Ketsji/KX_VertexProxy.cpp
index 09630ad2851..652bf5eafed 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.cpp
+++ b/source/gameengine/Ketsji/KX_VertexProxy.cpp
@@ -73,359 +73,247 @@ PyMethodDef KX_VertexProxy::Methods[] = {
};
PyAttributeDef KX_VertexProxy::Attributes[] = {
- 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_TODO("DummyProps"),
- 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("x"),
+ KX_PYATTRIBUTE_DUMMY("y"),
+ KX_PYATTRIBUTE_DUMMY("z"),
- 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("r"),
+ KX_PYATTRIBUTE_DUMMY("g"),
+ KX_PYATTRIBUTE_DUMMY("b"),
+ KX_PYATTRIBUTE_DUMMY("a"),
- 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("u"),
+ KX_PYATTRIBUTE_DUMMY("v"),
- 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("u2"),
+ KX_PYATTRIBUTE_DUMMY("v2"),
- 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),
+ KX_PYATTRIBUTE_DUMMY("XYZ"),
+ KX_PYATTRIBUTE_DUMMY("UV"),
- { NULL } //Sentinel
-};
-
-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]);
-}
+ KX_PYATTRIBUTE_DUMMY("color"),
+ KX_PYATTRIBUTE_DUMMY("colour"),
-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]);
-}
-
-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]);
-}
-
-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);
-}
-
-PyObject* KX_VertexProxy::pyattr_get_g(void *self_v, const KX_PYATTRIBUTE_DEF *attrdef)
-{
- KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
- return PyFloat_FromDouble(self->m_vertex->getRGBA()[1]/255.0);
-}
-
-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);
-}
+ KX_PYATTRIBUTE_DUMMY("normal"),
-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);
-}
-
-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]);
-}
+ { NULL } //Sentinel
+};
-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]);
-}
+#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_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]);
-}
+ if (!strcmp(attr_str, "normal"))
+ {
+ return PyObjectFrom(MT_Vector3(m_vertex->getNormal()));
+ }
-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]);
+ py_getattro_up(CValue);
}
+#endif
-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)
+#if 0
+int KX_VertexProxy::py_setattro(PyObject *attr, PyObject *pyvalue)
{
- KX_VertexProxy* self= static_cast<KX_VertexProxy*>(self_v);
- return PyObjectFrom(MT_Point2(self->m_vertex->getUV1()));
-}
+ 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;
+ }
-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);
-}
+ 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_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()));
-}
+ 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;
+ }
-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))
+ 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"))
{
- float val = PyFloat_AsDouble(value);
- MT_Point3 pos(self->m_vertex->getXYZ());
pos.x() = val;
- self->m_vertex->SetXYZ(pos);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetXYZ(pos);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- return PY_SET_ATTR_FAIL;
-}
-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))
+ if (!strcmp(attr_str, "y"))
{
- float val = PyFloat_AsDouble(value);
- MT_Point3 pos(self->m_vertex->getXYZ());
pos.y() = val;
- self->m_vertex->SetXYZ(pos);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetXYZ(pos);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- return PY_SET_ATTR_FAIL;
-}
-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))
+ if (!strcmp(attr_str, "z"))
{
- float val = PyFloat_AsDouble(value);
- MT_Point3 pos(self->m_vertex->getXYZ());
pos.z() = val;
- self->m_vertex->SetXYZ(pos);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetXYZ(pos);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- return PY_SET_ATTR_FAIL;
-}
-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))
+ // uv
+ MT_Point2 uv = m_vertex->getUV1();
+ if (!strcmp(attr_str, "u"))
{
- float val = PyFloat_AsDouble(value);
- MT_Point2 uv = self->m_vertex->getUV1();
uv[0] = val;
- self->m_vertex->SetUV(uv);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetUV(uv);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- return PY_SET_ATTR_FAIL;
-}
-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))
+ if (!strcmp(attr_str, "v"))
{
- float val = PyFloat_AsDouble(value);
- MT_Point2 uv = self->m_vertex->getUV1();
uv[1] = val;
- self->m_vertex->SetUV(uv);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetUV(uv);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- return PY_SET_ATTR_FAIL;
-}
-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))
+ // uv
+ MT_Point2 uv2 = m_vertex->getUV2();
+ if (!strcmp(attr_str, "u2"))
{
- float val = PyFloat_AsDouble(value);
- MT_Point2 uv = self->m_vertex->getUV2();
uv[0] = val;
- self->m_vertex->SetUV2(uv);
- self->m_mesh->SetMeshModified(true);
- return PY_SET_ATTR_SUCCESS;
+ m_vertex->SetUV2(uv);
+ m_mesh->SetMeshModified(true);
+ return 0;
}
- return PY_SET_ATTR_FAIL;
-}
-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))
+ if (!strcmp(attr_str, "v2"))
{
- float val = PyFloat_AsDouble(value);
- MT_Point2 uv = self->m_vertex->getUV2();
uv[1] = val;
- self->m_vertex->SetUV2(uv);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetUV2(uv);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- return PY_SET_ATTR_FAIL;
-}
-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))
+ // col
+ unsigned int icol = *((const unsigned int *)m_vertex->getRGBA());
+ unsigned char *cp = (unsigned char*) &icol;
+ val *= 255.0;
+ if (!strcmp(attr_str, "r"))
{
- 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;
- self->m_vertex->SetRGBA(icol);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetRGBA(icol);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- 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))
+ if (!strcmp(attr_str, "g"))
{
- 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;
- self->m_vertex->SetRGBA(icol);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetRGBA(icol);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- 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))
+ if (!strcmp(attr_str, "b"))
{
- 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;
- self->m_vertex->SetRGBA(icol);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetRGBA(icol);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- 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))
+ if (!strcmp(attr_str, "a"))
{
- 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;
- self->m_vertex->SetRGBA(icol);
- self->m_mesh->SetMeshModified(true);
+ m_vertex->SetRGBA(icol);
+ m_mesh->SetMeshModified(true);
return PY_SET_ATTR_SUCCESS;
}
- return PY_SET_ATTR_FAIL;
-}
+ }
-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;
+ return CValue::py_setattro(attr, pyvalue);
}
+#endif
KX_VertexProxy::KX_VertexProxy(KX_MeshProxy*mesh, RAS_TexVert* vertex)
: m_vertex(vertex),
diff --git a/source/gameengine/Ketsji/KX_VertexProxy.h b/source/gameengine/Ketsji/KX_VertexProxy.h
index b39d3ecb7d4..08fe0e7e2f8 100644
--- a/source/gameengine/Ketsji/KX_VertexProxy.h
+++ b/source/gameengine/Ketsji/KX_VertexProxy.h
@@ -56,37 +56,6 @@ 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);