Merging r38390 through r38418 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Fri, 15 Jul 2011 20:22:01 +0000 (20:22 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Fri, 15 Jul 2011 20:22:01 +0000 (20:22 +0000)
32 files changed:
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/physics/physics_fluid.c
source/blender/makesdna/DNA_particle_types.h
source/blender/python/CMakeLists.txt
source/blender/python/SConscript
source/blender/python/generic/CMakeLists.txt
source/blender/python/intern/bpy.c
source/blender/python/intern/bpy_interface.c
source/blender/python/intern/bpy_rna.c
source/blender/python/mathutils/CMakeLists.txt [new file with mode: 0644]
source/blender/python/mathutils/mathutils.c [moved from source/blender/python/generic/mathutils.c with 98% similarity]
source/blender/python/mathutils/mathutils.h [moved from source/blender/python/generic/mathutils.h with 99% similarity]
source/blender/python/mathutils/mathutils_Color.c [moved from source/blender/python/generic/mathutils_Color.c with 100% similarity]
source/blender/python/mathutils/mathutils_Color.h [moved from source/blender/python/generic/mathutils_Color.h with 100% similarity]
source/blender/python/mathutils/mathutils_Euler.c [moved from source/blender/python/generic/mathutils_Euler.c with 99% similarity]
source/blender/python/mathutils/mathutils_Euler.h [moved from source/blender/python/generic/mathutils_Euler.h with 100% similarity]
source/blender/python/mathutils/mathutils_Matrix.c [moved from source/blender/python/generic/mathutils_Matrix.c with 99% similarity]
source/blender/python/mathutils/mathutils_Matrix.h [moved from source/blender/python/generic/mathutils_Matrix.h with 100% similarity]
source/blender/python/mathutils/mathutils_Quaternion.c [moved from source/blender/python/generic/mathutils_Quaternion.c with 100% similarity]
source/blender/python/mathutils/mathutils_Quaternion.h [moved from source/blender/python/generic/mathutils_Quaternion.h with 100% similarity]
source/blender/python/mathutils/mathutils_Vector.c [moved from source/blender/python/generic/mathutils_Vector.c with 99% similarity]
source/blender/python/mathutils/mathutils_Vector.h [moved from source/blender/python/generic/mathutils_Vector.h with 100% similarity]
source/blender/python/mathutils/mathutils_geometry.c [moved from source/blender/python/generic/mathutils_geometry.c with 98% similarity]
source/blender/python/mathutils/mathutils_geometry.h [moved from source/blender/python/generic/mathutils_geometry.h with 96% similarity]
source/blenderplayer/CMakeLists.txt
source/creator/CMakeLists.txt
source/gameengine/Expressions/PyObjectPlus.h
source/gameengine/Ketsji/CMakeLists.txt
source/gameengine/Ketsji/KX_PyMath.h
source/gameengine/Ketsji/KX_PythonInit.cpp
source/gameengine/Ketsji/SConscript

index a26ef101c1cbbfbfe93d46f83155b1f3f584cf0a..496b8e9ab070b4b615e5d95e26250d930d37371e 100644 (file)
@@ -75,6 +75,7 @@
 #include "DNA_node_types.h"
 #include "DNA_object_fluidsim.h" // NT
 #include "DNA_packedFile_types.h"
+#include "DNA_particle_types.h"
 #include "DNA_property_types.h"
 #include "DNA_text_types.h"
 #include "DNA_view3d_types.h"
@@ -3203,9 +3204,37 @@ static void lib_link_particlesettings(FileData *fd, Main *main)
                        if(part->effector_weights)
                                part->effector_weights->group = newlibadr(fd, part->id.lib, part->effector_weights->group);
 
-                       dw = part->dupliweights.first;
-                       for(; dw; dw=dw->next)
-                               dw->ob = newlibadr(fd, part->id.lib, dw->ob);
+                       if(part->dupliweights.first) {
+                               int index_ok = 0;
+                               /* check for old files without indices (all indexes 0) */
+                               dw = part->dupliweights.first;
+                               if(part->dupliweights.first == part->dupliweights.last) {
+                                       /* special case for only one object in the group */
+                                       index_ok = 1;
+                               }
+                               else { 
+                                       for(; dw; dw=dw->next) {
+                                               if(dw->index > 0) {
+                                                       index_ok = 1;
+                                                       break;
+                                               }
+                                       }
+                               }
+
+                               if(index_ok) {
+                                       /* if we have indexes, let's use them */
+                                       dw = part->dupliweights.first;
+                                       for(; dw; dw=dw->next) {
+                                               GroupObject *go = (GroupObject *)BLI_findlink(&part->dup_group->gobject, dw->index);
+                                               dw->ob = go ? go->ob : NULL;
+                                       }
+                               }
+                               else {
+                                       /* otherwise try to get objects from own library (won't work on library linked groups) */
+                                       for(; dw; dw=dw->next)
+                                               dw->ob = newlibadr(fd, part->id.lib, dw->ob);
+                               }
+                       }
 
                        if(part->boids) {
                                BoidState *state = part->boids->states.first;
index 0ba4082686a95c09f5f544bfe670874860dfe8a7..771f83221addc9adff18ed65f4cc6241692d11ac 100644 (file)
@@ -838,6 +838,7 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
 {
        ParticleSettings *part;
        ParticleDupliWeight *dw;
+       GroupObject *go;
        int a;
 
        part= idbase->first;
@@ -852,8 +853,16 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
                        writestruct(wd, DATA, "EffectorWeights", 1, part->effector_weights);
 
                        dw = part->dupliweights.first;
-                       for(; dw; dw=dw->next)
+                       for(; dw; dw=dw->next) {
+                               /* update indices */
+                               dw->index = 0;
+                               go = part->dup_group->gobject.first;
+                               while(go && go->ob != dw->ob) {
+                                       go=go->next;
+                                       dw->index++;
+                               }
                                writestruct(wd, DATA, "ParticleDupliWeight", 1, dw);
+                       }
 
                        if(part->boids && part->phystype == PART_PHYS_BOIDS) {
                                BoidState *state = part->boids->states.first;
index b573c77c7f338fba563b52fd7f8ebe61302bd144..37309f1e07c7f5ec659dd7c81dd09081484bc659 100644 (file)
@@ -722,15 +722,17 @@ typedef struct FluidBakeJob {
 
 static void fluidbake_free(void *customdata)
 {
-       FluidBakeJob *fb= customdata;
+       FluidBakeJob *fb= (FluidBakeJob *)customdata;
        MEM_freeN(fb);
 }
 
 /* called by fluidbake, only to check job 'stop' value */
-static int fluidbake_breakjob(void *UNUSED(customdata))
+static int fluidbake_breakjob(void *customdata)
 {
-       //FluidBakeJob *fb= (FluidBakeJob *)customdata;
-       //return *(fb->stop);
+       FluidBakeJob *fb= (FluidBakeJob *)customdata;
+
+       if(fb->stop && *(fb->stop))
+               return 1;
        
        /* this is not nice yet, need to make the jobs list template better 
         * for identifying/acting upon various different jobs */
@@ -741,7 +743,7 @@ static int fluidbake_breakjob(void *UNUSED(customdata))
 /* called by fluidbake, wmJob sends notifier */
 static void fluidbake_updatejob(void *customdata, float progress)
 {
-       FluidBakeJob *fb= customdata;
+       FluidBakeJob *fb= (FluidBakeJob *)customdata;
        
        *(fb->do_update)= 1;
        *(fb->progress)= progress;
@@ -749,7 +751,7 @@ static void fluidbake_updatejob(void *customdata, float progress)
 
 static void fluidbake_startjob(void *customdata, short *stop, short *do_update, float *progress)
 {
-       FluidBakeJob *fb= customdata;
+       FluidBakeJob *fb= (FluidBakeJob *)customdata;
        
        fb->stop= stop;
        fb->do_update = do_update;
@@ -764,7 +766,7 @@ static void fluidbake_startjob(void *customdata, short *stop, short *do_update,
 
 static void fluidbake_endjob(void *customdata)
 {
-       FluidBakeJob *fb= customdata;
+       FluidBakeJob *fb= (FluidBakeJob *)customdata;
        
        if (fb->settings) {
                MEM_freeN(fb->settings);
index aace8156e9d16bc00d2d3fd17524a21569c3e5ef..69ee530c0b65c27dcac5137140069c50c7a74606 100644 (file)
@@ -89,7 +89,8 @@ typedef struct ParticleDupliWeight {
        struct ParticleDupliWeight *next, *prev;
        struct Object *ob;
        short count;
-       short flag, rt[2];
+       short flag;
+       short index, rt; /* only updated on file save and used on file load */
 } ParticleDupliWeight;
 
 typedef struct ParticleData {
index fe9e030770337934ec103b00479136f5ad44c5de..8071edb378fbd6871b933e3897e3e9bbab2d8ab4 100644 (file)
@@ -18,3 +18,4 @@
 
 add_subdirectory(intern)
 add_subdirectory(generic)
+add_subdirectory(mathutils)
index de6b859d259c7013c15f370518ed8eb6abbec8dd..dec0de4a6ab27e12841c05dbb7b220d63e5c4b87 100644 (file)
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-# TODO, split into 2 files.
+# TODO, split into 3 files.
 
 Import ('env')
 
@@ -18,7 +18,14 @@ if is_debug:
     defs.append('_DEBUG')
 
 sources = env.Glob('generic/*.c')
-env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165]) # ketsji is 360
+env.BlenderLib( libname = 'bf_python_ext', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [363,165]) # ketsji is 360
+
+
+# mathutils
+defs = []
+
+sources = env.Glob('mathutils/*.c')
+env.BlenderLib( libname = 'bf_python_mathutils', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core','player'], priority = [362,165])
 
 
 # bpy
index 0889c77f9ad31ccd3e3e2a5db963d1162b4ac11d..794b31b4ed3937f33ca91f036a8c7f6ae2d2fcb2 100644 (file)
@@ -37,13 +37,6 @@ set(SRC
        bgl.c
        blf_py_api.c
        bpy_internal_import.c
-       mathutils.c
-       mathutils_Color.c
-       mathutils_Euler.c
-       mathutils_Matrix.c
-       mathutils_Quaternion.c
-       mathutils_Vector.c
-       mathutils_geometry.c
        noise_py_api.c
        py_capi_utils.c
 
@@ -51,13 +44,6 @@ set(SRC
        bgl.h
        blf_py_api.h
        bpy_internal_import.h
-       mathutils.h
-       mathutils_Color.h
-       mathutils_Euler.h
-       mathutils_Matrix.h
-       mathutils_Quaternion.h
-       mathutils_Vector.h
-       mathutils_geometry.h
        noise_py_api.h
        py_capi_utils.h
 )
index fb4c285a45866afd7a70705c37de72d7f9e9c709..3f637feadf742b1e99d7021a498dd993570e7255 100644 (file)
 #include "MEM_guardedalloc.h"
 
  /* external util modules */
-#include "../generic/mathutils.h"
+#include "../generic/IDProp.h"
 #include "../generic/bgl.h"
 #include "../generic/blf_py_api.h"
-#include "../generic/IDProp.h"
+#include "../mathutils/mathutils.h"
 
 PyObject *bpy_package_py= NULL;
 
index f091a511e933948648c1268810e2c2b466b4c3c3..8bd6e6c611c14dd2821204838d43ba56e2f36b1e 100644 (file)
 #include "../generic/py_capi_utils.h"
 
 /* inittab initialization functions */
-#include "../generic/noise_py_api.h"
-#include "../generic/mathutils.h"
 #include "../generic/bgl.h"
 #include "../generic/blf_py_api.h"
+#include "../generic/noise_py_api.h"
+#include "../mathutils/mathutils.h"
 
 /* for internal use, when starting and ending python scripts */
 
@@ -175,8 +175,8 @@ extern PyObject *AUD_initPython(void);
 
 static struct _inittab bpy_internal_modules[]= {
        {(char *)"noise", BPyInit_noise},
-       {(char *)"mathutils", BPyInit_mathutils},
-//     {(char *)"mathutils.geometry", BPyInit_mathutils_geometry},
+       {(char *)"mathutils", PyInit_mathutils},
+//     {(char *)"mathutils.geometry", PyInit_mathutils_geometry},
        {(char *)"bgl", BPyInit_bgl},
        {(char *)"blf", BPyInit_blf},
 #ifdef WITH_AUDASPACE
index 4f6edb02a7cd0ee571867c5eae30c2c8161e512e..61fc2e483b1e910145b926e37b874719f0c0254c 100644 (file)
@@ -346,7 +346,7 @@ static int pyrna_py_to_prop(PointerRNA *ptr, PropertyRNA *prop, void *data, PyOb
 static int deferred_register_prop(StructRNA *srna, PyObject *key, PyObject *item);
 
 #ifdef USE_MATHUTILS
-#include "../generic/mathutils.h" /* so we can have mathutils callbacks */
+#include "../mathutils/mathutils.h" /* so we can have mathutils callbacks */
 
 static PyObject *pyrna_prop_array_subscript_slice(BPy_PropertyArrayRNA *self, PointerRNA *ptr, PropertyRNA *prop, Py_ssize_t start, Py_ssize_t stop, Py_ssize_t length);
 static short pyrna_rotation_euler_order_get(PointerRNA *ptr, PropertyRNA **prop_eul_order, short order_fallback);
diff --git a/source/blender/python/mathutils/CMakeLists.txt b/source/blender/python/mathutils/CMakeLists.txt
new file mode 100644 (file)
index 0000000..b28496d
--- /dev/null
@@ -0,0 +1,52 @@
+# ***** BEGIN GPL LICENSE BLOCK *****
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# Contributor(s): Campbell Barton
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC 
+       .
+       ../../blenlib
+       ../../blenkernel
+       ../../makesdna
+       ../../../../intern/guardedalloc
+)
+
+set(INC_SYS
+       ${PYTHON_INCLUDE_DIRS}
+)
+
+set(SRC
+       mathutils.c
+       mathutils_Color.c
+       mathutils_Euler.c
+       mathutils_Matrix.c
+       mathutils_Quaternion.c
+       mathutils_Vector.c
+       mathutils_geometry.c
+
+       mathutils.h
+       mathutils_Color.h
+       mathutils_Euler.h
+       mathutils_Matrix.h
+       mathutils_Quaternion.h
+       mathutils_Vector.h
+       mathutils_geometry.h
+)
+
+
+blender_add_lib(bf_python_mathutils "${SRC}" "${INC}" "${INC_SYS}")
similarity index 98%
rename from source/blender/python/generic/mathutils.c
rename to source/blender/python/mathutils/mathutils.c
index 1ff33d5a6bb6b73ed462b677d3b5602bf81698d3..50b75b09cb2c2c7b172c823e39f8ad1a68e3a4a8 100644 (file)
@@ -345,7 +345,7 @@ static struct PyModuleDef M_Mathutils_module_def = {
        NULL,  /* m_free */
 };
 
-PyMODINIT_FUNC BPyInit_mathutils(void)
+PyMODINIT_FUNC PyInit_mathutils(void)
 {
        PyObject *submodule;
        PyObject *item;
@@ -371,7 +371,7 @@ PyMODINIT_FUNC BPyInit_mathutils(void)
        PyModule_AddObject(submodule, "Color",          (PyObject *)&color_Type);
        
        /* submodule */
-       PyModule_AddObject(submodule, "geometry",               (item=BPyInit_mathutils_geometry()));
+       PyModule_AddObject(submodule, "geometry",               (item=PyInit_mathutils_geometry()));
        /* XXX, python doesnt do imports with this usefully yet
         * 'from mathutils.geometry import PolyFill'
         * ...fails without this. */
similarity index 99%
rename from source/blender/python/generic/mathutils.h
rename to source/blender/python/mathutils/mathutils.h
index 449708d1ac1e7fffef8536be85d25fef216959d3..7454cfe78b3de481e0df632f7a5e04d1c9b0d67a 100644 (file)
@@ -67,7 +67,7 @@ int BaseMathObject_traverse(BaseMathObject *self, visitproc visit, void *arg);
 int BaseMathObject_clear(BaseMathObject *self);
 void BaseMathObject_dealloc(BaseMathObject * self);
 
-PyMODINIT_FUNC BPyInit_mathutils(void);
+PyMODINIT_FUNC PyInit_mathutils(void);
 
 int EXPP_FloatsAreEqual(float A, float B, int floatSteps);
 int EXPP_VectorsAreEqual(float *vecA, float *vecB, int size, int floatSteps);
similarity index 99%
rename from source/blender/python/generic/mathutils_Euler.c
rename to source/blender/python/mathutils/mathutils_Euler.c
index a7d6d921d166f04ac2b59aa08852df536bab0458..5c609d8961fea5d51682aaafab5f37a442567fb9 100644 (file)
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
-#ifndef int32_t
-#include "BLO_sys_types.h"
-#endif
-
 #define EULER_SIZE 3
 
 //----------------------------------mathutils.Euler() -------------------
@@ -89,7 +85,7 @@ static const char *euler_order_str(EulerObject *self)
 short euler_order_from_string(const char *str, const char *error_prefix)
 {
        if((str[0] && str[1] && str[2] && str[3]=='\0')) {
-               switch(*((int32_t *)str)) {
+               switch(*((PY_INT32_T *)str)) {
                        case 'X'|'Y'<<8|'Z'<<16:        return EULER_ORDER_XYZ;
                        case 'X'|'Z'<<8|'Y'<<16:        return EULER_ORDER_XZY;
                        case 'Y'|'X'<<8|'Z'<<16:        return EULER_ORDER_YXZ;
similarity index 99%
rename from source/blender/python/generic/mathutils_Matrix.c
rename to source/blender/python/mathutils/mathutils_Matrix.c
index c5ed1e32ee8174fde195b9b98591d8409f97f9bb..b0187c1ef2558c6f24c47fa93e54b713df1932d6 100644 (file)
@@ -35,7 +35,6 @@
 #include "mathutils.h"
 
 #include "BLI_math.h"
-#include "BLI_blenlib.h"
 #include "BLI_utildefines.h"
 
 static PyObject *Matrix_copy(MatrixObject *self);
similarity index 99%
rename from source/blender/python/generic/mathutils_Vector.c
rename to source/blender/python/mathutils/mathutils_Vector.c
index a834e8f2ba4b1d33dae73d606afc235f3ff5a195..e2c958adaa5a348b709988a58f95f01696a10165 100644 (file)
@@ -34,7 +34,6 @@
 
 #include "mathutils.h"
 
-#include "BLI_blenlib.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
 
similarity index 98%
rename from source/blender/python/generic/mathutils_geometry.c
rename to source/blender/python/mathutils/mathutils_geometry.c
index d2724f6603e76e6390ec71eda17b61d7f8736387..bcdfe020e1ab10e3d6585dc6bd8e6324ca177dfd 100644 (file)
 #include "mathutils_geometry.h"
 
 /* Used for PolyFill */
-#include "MEM_guardedalloc.h"
+#ifndef MATH_STANDALONE /* define when building outside blender */
+#  include "MEM_guardedalloc.h"
+#  include "BLI_blenlib.h"
+#  include "BLI_boxpack2d.h"
+#  include "BKE_displist.h"
+#  include "BKE_curve.h"
+#endif
 
-#include "BLI_blenlib.h"
-#include "BLI_boxpack2d.h"
 #include "BLI_math.h"
 #include "BLI_utildefines.h"
-#include "BKE_displist.h"
-
-#include "BKE_curve.h"
 
 #define SWAP_FLOAT(a, b, tmp) tmp=a; a=b; b=tmp
 #define eps 0.000001
@@ -346,132 +346,6 @@ static PyObject *M_Geometry_area_tri(PyObject *UNUSED(self), PyObject* args)
        }
 }
 
-/*----------------------------------geometry.PolyFill() -------------------*/
-PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc,
-".. function:: tesselate_polygon(veclist_list)\n"
-"\n"
-"   Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n"
-"\n"
-"   :arg veclist_list: list of polylines\n"
-"   :rtype: list\n"
-);
-/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */
-static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq)
-{
-       PyObject *tri_list; /*return this list of tri's */
-       PyObject *polyLine, *polyVec;
-       int i, len_polylines, len_polypoints, ls_error= 0;
-
-       /* display listbase */
-       ListBase dispbase={NULL, NULL};
-       DispList *dl;
-       float *fp; /*pointer to the array of malloced dl->verts to set the points from the vectors */
-       int index, *dl_face, totpoints=0;
-
-       if(!PySequence_Check(polyLineSeq)) {
-               PyErr_SetString(PyExc_TypeError,
-                               "expected a sequence of poly lines");
-               return NULL;
-       }
-       
-       len_polylines= PySequence_Size(polyLineSeq);
-       
-       for(i= 0; i < len_polylines; ++i) {
-               polyLine= PySequence_GetItem(polyLineSeq, i);
-               if (!PySequence_Check(polyLine)) {
-                       freedisplist(&dispbase);
-                       Py_XDECREF(polyLine); /* may be null so use Py_XDECREF*/
-                       PyErr_SetString(PyExc_TypeError,
-                                       "One or more of the polylines is not a sequence of mathutils.Vector's");
-                       return NULL;
-               }
-               
-               len_polypoints= PySequence_Size(polyLine);
-               if (len_polypoints>0) { /* dont bother adding edges as polylines */
-#if 0
-                       if (EXPP_check_sequence_consistency(polyLine, &vector_Type) != 1) {
-                               freedisplist(&dispbase);
-                               Py_DECREF(polyLine);
-                               PyErr_SetString(PyExc_TypeError,
-                                               "A point in one of the polylines is not a mathutils.Vector type");
-                               return NULL;
-                       }
-#endif
-                       dl= MEM_callocN(sizeof(DispList), "poly disp");
-                       BLI_addtail(&dispbase, dl);
-                       dl->type= DL_INDEX3;
-                       dl->nr= len_polypoints;
-                       dl->type= DL_POLY;
-                       dl->parts= 1; /* no faces, 1 edge loop */
-                       dl->col= 0; /* no material */
-                       dl->verts= fp= MEM_callocN(sizeof(float)*3*len_polypoints, "dl verts");
-                       dl->index= MEM_callocN(sizeof(int)*3*len_polypoints, "dl index");
-                       
-                       for(index= 0; index<len_polypoints; ++index, fp+=3) {
-                               polyVec= PySequence_GetItem(polyLine, index);
-                               if(VectorObject_Check(polyVec)) {
-                                       
-                                       if(BaseMath_ReadCallback((VectorObject *)polyVec) == -1)
-                                               ls_error= 1;
-                                       
-                                       fp[0]= ((VectorObject *)polyVec)->vec[0];
-                                       fp[1]= ((VectorObject *)polyVec)->vec[1];
-                                       if(((VectorObject *)polyVec)->size > 2)
-                                               fp[2]= ((VectorObject *)polyVec)->vec[2];
-                                       else
-                                               fp[2]= 0.0f; /* if its a 2d vector then set the z to be zero */
-                               }
-                               else {
-                                       ls_error= 1;
-                               }
-                               
-                               totpoints++;
-                               Py_DECREF(polyVec);
-                       }
-               }
-               Py_DECREF(polyLine);
-       }
-       
-       if(ls_error) {
-               freedisplist(&dispbase); /* possible some dl was allocated */
-               PyErr_SetString(PyExc_TypeError,
-                               "A point in one of the polylines "
-                               "is not a mathutils.Vector type");
-               return NULL;
-       }
-       else if (totpoints) {
-               /* now make the list to return */
-               filldisplist(&dispbase, &dispbase, 0);
-               
-               /* The faces are stored in a new DisplayList
-               thats added to the head of the listbase */
-               dl= dispbase.first; 
-               
-               tri_list= PyList_New(dl->parts);
-               if(!tri_list) {
-                       freedisplist(&dispbase);
-                       PyErr_SetString(PyExc_RuntimeError,
-                                       "failed to make a new list");
-                       return NULL;
-               }
-               
-               index= 0;
-               dl_face= dl->index;
-               while(index < dl->parts) {
-                       PyList_SET_ITEM(tri_list, index, Py_BuildValue("iii", dl_face[0], dl_face[1], dl_face[2]));
-                       dl_face+= 3;
-                       index++;
-               }
-               freedisplist(&dispbase);
-       }
-       else {
-               /* no points, do this so scripts dont barf */
-               freedisplist(&dispbase); /* possible some dl was allocated */
-               tri_list= PyList_New(0);
-       }
-       
-       return tri_list;
-}
 
 PyDoc_STRVAR(M_Geometry_intersect_line_line_2d_doc,
 ".. function:: intersect_line_line_2d(lineA_p1, lineA_p2, lineB_p1, lineB_p2)\n"
@@ -844,135 +718,88 @@ static PyObject *M_Geometry_intersect_point_quad_2d(PyObject *UNUSED(self), PyOb
        return PyLong_FromLong(isect_point_quad_v2(pt_vec->vec, quad_p1->vec, quad_p2->vec, quad_p3->vec, quad_p4->vec));
 }
 
-static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
+PyDoc_STRVAR(M_Geometry_barycentric_transform_doc,
+".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n"
+"\n"
+"   Return a transformed point, the transformation is defined by 2 triangles.\n"
+"\n"
+"   :arg point: The point to transform.\n"
+"   :type point: :class:`mathutils.Vector`\n"
+"   :arg tri_a1: source triangle vertex.\n"
+"   :type tri_a1: :class:`mathutils.Vector`\n"
+"   :arg tri_a2: source triangle vertex.\n"
+"   :type tri_a2: :class:`mathutils.Vector`\n"
+"   :arg tri_a3: source triangle vertex.\n"
+"   :type tri_a3: :class:`mathutils.Vector`\n"
+"   :arg tri_a1: target triangle vertex.\n"
+"   :type tri_a1: :class:`mathutils.Vector`\n"
+"   :arg tri_a2: target triangle vertex.\n"
+"   :type tri_a2: :class:`mathutils.Vector`\n"
+"   :arg tri_a3: target triangle vertex.\n"
+"   :type tri_a3: :class:`mathutils.Vector`\n"
+"   :return: The transformed point\n"
+"   :rtype: :class:`mathutils.Vector`'s\n"
+);
+static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObject *args)
 {
-       int len, i;
-       PyObject *list_item, *item_1, *item_2;
-       boxPack *box;
-       
-       
-       /* Error checking must already be done */
-       if(!PyList_Check(value)) {
-               PyErr_SetString(PyExc_TypeError,
-                               "can only back a list of [x, y, w, h]");
-               return -1;
-       }
-       
-       len= PyList_Size(value);
-       
-       (*boxarray)= MEM_mallocN(len*sizeof(boxPack), "boxPack box");
-       
-       
-       for(i= 0; i < len; i++) {
-               list_item= PyList_GET_ITEM(value, i);
-               if(!PyList_Check(list_item) || PyList_Size(list_item) < 4) {
-                       MEM_freeN(*boxarray);
-                       PyErr_SetString(PyExc_TypeError,
-                                       "can only pack a list of [x, y, w, h]");
-                       return -1;
-               }
-               
-               box= (*boxarray)+i;
-               
-               item_1= PyList_GET_ITEM(list_item, 2);
-               item_2= PyList_GET_ITEM(list_item, 3);
-               
-               box->w=  (float)PyFloat_AsDouble(item_1);
-               box->h=  (float)PyFloat_AsDouble(item_2);
-               box->index= i;
-
-               /* accounts for error case too and overwrites with own error */
-               if (box->w < 0.0f || box->h < 0.0f) {
-                       MEM_freeN(*boxarray);
-                       PyErr_SetString(PyExc_TypeError,
-                                       "error parsing width and height values from list: "
-                                       "[x, y, w, h], not numbers or below zero");
-                       return -1;
-               }
+       VectorObject *vec_pt;
+       VectorObject *vec_t1_tar, *vec_t2_tar, *vec_t3_tar;
+       VectorObject *vec_t1_src, *vec_t2_src, *vec_t3_src;
+       float vec[3];
 
-               /* verts will be added later */
+       if(!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform",
+                 &vector_Type, &vec_pt,
+                 &vector_Type, &vec_t1_src,
+                 &vector_Type, &vec_t2_src,
+                 &vector_Type, &vec_t3_src,
+                 &vector_Type, &vec_t1_tar,
+                 &vector_Type, &vec_t2_tar,
+                 &vector_Type, &vec_t3_tar)
+       ) {
+               return NULL;
        }
-       return 0;
-}
 
-static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray)
-{
-       int len, i;
-       PyObject *list_item;
-       boxPack *box;
-       
-       len= PyList_Size(value);
-       
-       for(i= 0; i < len; i++) {
-               box= (*boxarray)+i;
-               list_item= PyList_GET_ITEM(value, box->index);
-               PyList_SET_ITEM(list_item, 0, PyFloat_FromDouble(box->x));
-               PyList_SET_ITEM(list_item, 1, PyFloat_FromDouble(box->y));
+       if(     vec_pt->size != 3 ||
+               vec_t1_src->size != 3 ||
+               vec_t2_src->size != 3 ||
+               vec_t3_src->size != 3 ||
+               vec_t1_tar->size != 3 ||
+               vec_t2_tar->size != 3 ||
+               vec_t3_tar->size != 3)
+       {
+               PyErr_SetString(PyExc_ValueError,
+                               "One of more of the vector arguments wasn't a 3D vector");
+               return NULL;
        }
-       MEM_freeN(*boxarray);
+
+       barycentric_transform(vec, vec_pt->vec,
+                       vec_t1_tar->vec, vec_t2_tar->vec, vec_t3_tar->vec,
+                       vec_t1_src->vec, vec_t2_src->vec, vec_t3_src->vec);
+
+       return newVectorObject(vec, 3, Py_NEW, NULL);
 }
 
-PyDoc_STRVAR(M_Geometry_box_pack_2d_doc,
-".. function:: box_pack_2d(boxes)\n"
+#ifndef MATH_STANDALONE
+
+PyDoc_STRVAR(M_Geometry_interpolate_bezier_doc,
+".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n"
 "\n"
-"   Returns the normal of the 3D tri or quad.\n"
+"   Interpolate a bezier spline segment.\n"
 "\n"
-"   :arg boxes: list of boxes, each box is a list where the first 4 items are [x, y, width, height, ...] other items are ignored.\n"
-"   :type boxes: list\n"
-"   :return: the width and height of the packed bounding box\n"
-"   :rtype: tuple, pair of floats\n"
+"   :arg knot1: First bezier spline point.\n"
+"   :type knot1: :class:`mathutils.Vector`\n"
+"   :arg handle1: First bezier spline handle.\n"
+"   :type handle1: :class:`mathutils.Vector`\n"
+"   :arg handle2: Second bezier spline handle.\n"
+"   :type handle2: :class:`mathutils.Vector`\n"
+"   :arg knot2: Second bezier spline point.\n"
+"   :type knot2: :class:`mathutils.Vector`\n"
+"   :arg resolution: Number of points to return.\n"
+"   :type resolution: int\n"
+"   :return: The interpolated points\n"
+"   :rtype: list of :class:`mathutils.Vector`'s\n"
 );
-static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlist)
-{
-       float tot_width= 0.0f, tot_height= 0.0f;
-       int len;
-
-       PyObject *ret;
-       
-       if(!PyList_Check(boxlist)) {
-               PyErr_SetString(PyExc_TypeError,
-                               "expected a list of boxes [[x, y, w, h], ... ]");
-               return NULL;
-       }
-
-       len= PyList_GET_SIZE(boxlist);
-       if (len) {
-               boxPack *boxarray= NULL;
-               if(boxPack_FromPyObject(boxlist, &boxarray) == -1) {
-                       return NULL; /* exception set */
-               }
-
-               /* Non Python function */
-               boxPack2D(boxarray, len, &tot_width, &tot_height);
-
-               boxPack_ToPyObject(boxlist, &boxarray);
-       }
-
-       ret= PyTuple_New(2);
-       PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(tot_width));
-       PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(tot_width));
-       return ret;
-}
-
-PyDoc_STRVAR(M_Geometry_interpolate_bezier_doc,
-".. function:: interpolate_bezier(knot1, handle1, handle2, knot2, resolution)\n"
-"\n"
-"   Interpolate a bezier spline segment.\n"
-"\n"
-"   :arg knot1: First bezier spline point.\n"
-"   :type knot1: :class:`mathutils.Vector`\n"
-"   :arg handle1: First bezier spline handle.\n"
-"   :type handle1: :class:`mathutils.Vector`\n"
-"   :arg handle2: Second bezier spline handle.\n"
-"   :type handle2: :class:`mathutils.Vector`\n"
-"   :arg knot2: Second bezier spline point.\n"
-"   :type knot2: :class:`mathutils.Vector`\n"
-"   :arg resolution: Number of points to return.\n"
-"   :type resolution: int\n"
-"   :return: The interpolated points\n"
-"   :rtype: list of :class:`mathutils.Vector`'s\n"
-);
-static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* args)
+static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject* args)
 {
        VectorObject *vec_k1, *vec_h1, *vec_k2, *vec_h2;
        int resolu;
@@ -980,13 +807,13 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject*
        int i;
        float *coord_array, *fp;
        PyObject *list;
-       
+
        float k1[4]= {0.0, 0.0, 0.0, 0.0};
        float h1[4]= {0.0, 0.0, 0.0, 0.0};
        float k2[4]= {0.0, 0.0, 0.0, 0.0};
        float h2[4]= {0.0, 0.0, 0.0, 0.0};
-       
-       
+
+
        if(!PyArg_ParseTuple(args, "O!O!O!O!i:interpolate_bezier",
          &vector_Type, &vec_k1,
          &vector_Type, &vec_h1,
@@ -1006,17 +833,17 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject*
                return NULL;
 
        dims= MAX4(vec_k1->size, vec_h1->size, vec_h2->size, vec_k2->size);
-       
+
        for(i=0; i < vec_k1->size; i++) k1[i]= vec_k1->vec[i];
        for(i=0; i < vec_h1->size; i++) h1[i]= vec_h1->vec[i];
        for(i=0; i < vec_k2->size; i++) k2[i]= vec_k2->vec[i];
        for(i=0; i < vec_h2->size; i++) h2[i]= vec_h2->vec[i];
-       
+
        coord_array= MEM_callocN(dims * (resolu) * sizeof(float), "interpolate_bezier");
        for(i=0; i<dims; i++) {
                forward_diff_bezier(k1[i], h1[i], h2[i], k2[i], coord_array+i, resolu-1, sizeof(float)*dims);
        }
-       
+
        list= PyList_New(resolu);
        fp= coord_array;
        for(i=0; i<resolu; i++, fp= fp+dims) {
@@ -1026,67 +853,247 @@ static PyObject *M_Geometry_interpolate_bezier(PyObject *UNUSED(self), PyObject*
        return list;
 }
 
-PyDoc_STRVAR(M_Geometry_barycentric_transform_doc,
-".. function:: barycentric_transform(point, tri_a1, tri_a2, tri_a3, tri_b1, tri_b2, tri_b3)\n"
+
+PyDoc_STRVAR(M_Geometry_tesselate_polygon_doc,
+".. function:: tesselate_polygon(veclist_list)\n"
 "\n"
-"   Return a transformed point, the transformation is defined by 2 triangles.\n"
+"   Takes a list of polylines (each point a vector) and returns the point indices for a polyline filled with triangles.\n"
 "\n"
-"   :arg point: The point to transform.\n"
-"   :type point: :class:`mathutils.Vector`\n"
-"   :arg tri_a1: source triangle vertex.\n"
-"   :type tri_a1: :class:`mathutils.Vector`\n"
-"   :arg tri_a2: source triangle vertex.\n"
-"   :type tri_a2: :class:`mathutils.Vector`\n"
-"   :arg tri_a3: source triangle vertex.\n"
-"   :type tri_a3: :class:`mathutils.Vector`\n"
-"   :arg tri_a1: target triangle vertex.\n"
-"   :type tri_a1: :class:`mathutils.Vector`\n"
-"   :arg tri_a2: target triangle vertex.\n"
-"   :type tri_a2: :class:`mathutils.Vector`\n"
-"   :arg tri_a3: target triangle vertex.\n"
-"   :type tri_a3: :class:`mathutils.Vector`\n"
-"   :return: The transformed point\n"
-"   :rtype: :class:`mathutils.Vector`'s\n"
+"   :arg veclist_list: list of polylines\n"
+"   :rtype: list\n"
 );
-static PyObject *M_Geometry_barycentric_transform(PyObject *UNUSED(self), PyObject *args)
+/* PolyFill function, uses Blenders scanfill to fill multiple poly lines */
+static PyObject *M_Geometry_tesselate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq)
 {
-       VectorObject *vec_pt;
-       VectorObject *vec_t1_tar, *vec_t2_tar, *vec_t3_tar;
-       VectorObject *vec_t1_src, *vec_t2_src, *vec_t3_src;
-       float vec[3];
+       PyObject *tri_list; /*return this list of tri's */
+       PyObject *polyLine, *polyVec;
+       int i, len_polylines, len_polypoints, ls_error= 0;
 
-       if(!PyArg_ParseTuple(args, "O!O!O!O!O!O!O!:barycentric_transform",
-                 &vector_Type, &vec_pt,
-                 &vector_Type, &vec_t1_src,
-                 &vector_Type, &vec_t2_src,
-                 &vector_Type, &vec_t3_src,
-                 &vector_Type, &vec_t1_tar,
-                 &vector_Type, &vec_t2_tar,
-                 &vector_Type, &vec_t3_tar)
-       ) {
+       /* display listbase */
+       ListBase dispbase={NULL, NULL};
+       DispList *dl;
+       float *fp; /*pointer to the array of malloced dl->verts to set the points from the vectors */
+       int index, *dl_face, totpoints=0;
+
+       if(!PySequence_Check(polyLineSeq)) {
+               PyErr_SetString(PyExc_TypeError,
+                               "expected a sequence of poly lines");
                return NULL;
        }
 
-       if(     vec_pt->size != 3 ||
-               vec_t1_src->size != 3 ||
-               vec_t2_src->size != 3 ||
-               vec_t3_src->size != 3 ||
-               vec_t1_tar->size != 3 ||
-               vec_t2_tar->size != 3 ||
-               vec_t3_tar->size != 3)
-       {
-               PyErr_SetString(PyExc_ValueError,
-                               "One of more of the vector arguments wasn't a 3D vector");
+       len_polylines= PySequence_Size(polyLineSeq);
+
+       for(i= 0; i < len_polylines; ++i) {
+               polyLine= PySequence_GetItem(polyLineSeq, i);
+               if (!PySequence_Check(polyLine)) {
+                       freedisplist(&dispbase);
+                       Py_XDECREF(polyLine); /* may be null so use Py_XDECREF*/
+                       PyErr_SetString(PyExc_TypeError,
+                                       "One or more of the polylines is not a sequence of mathutils.Vector's");
+                       return NULL;
+               }
+
+               len_polypoints= PySequence_Size(polyLine);
+               if (len_polypoints>0) { /* dont bother adding edges as polylines */
+#if 0
+                       if (EXPP_check_sequence_consistency(polyLine, &vector_Type) != 1) {
+                               freedisplist(&dispbase);
+                               Py_DECREF(polyLine);
+                               PyErr_SetString(PyExc_TypeError,
+                                               "A point in one of the polylines is not a mathutils.Vector type");
+                               return NULL;
+                       }
+#endif
+                       dl= MEM_callocN(sizeof(DispList), "poly disp");
+                       BLI_addtail(&dispbase, dl);
+                       dl->type= DL_INDEX3;
+                       dl->nr= len_polypoints;
+                       dl->type= DL_POLY;
+                       dl->parts= 1; /* no faces, 1 edge loop */
+                       dl->col= 0; /* no material */
+                       dl->verts= fp= MEM_callocN(sizeof(float)*3*len_polypoints, "dl verts");
+                       dl->index= MEM_callocN(sizeof(int)*3*len_polypoints, "dl index");
+
+                       for(index= 0; index<len_polypoints; ++index, fp+=3) {
+                               polyVec= PySequence_GetItem(polyLine, index);
+                               if(VectorObject_Check(polyVec)) {
+
+                                       if(BaseMath_ReadCallback((VectorObject *)polyVec) == -1)
+                                               ls_error= 1;
+
+                                       fp[0]= ((VectorObject *)polyVec)->vec[0];
+                                       fp[1]= ((VectorObject *)polyVec)->vec[1];
+                                       if(((VectorObject *)polyVec)->size > 2)
+                                               fp[2]= ((VectorObject *)polyVec)->vec[2];
+                                       else
+                                               fp[2]= 0.0f; /* if its a 2d vector then set the z to be zero */
+                               }
+                               else {
+                                       ls_error= 1;
+                               }
+
+                               totpoints++;
+                               Py_DECREF(polyVec);
+                       }
+               }
+               Py_DECREF(polyLine);
+       }
+
+       if(ls_error) {
+               freedisplist(&dispbase); /* possible some dl was allocated */
+               PyErr_SetString(PyExc_TypeError,
+                               "A point in one of the polylines "
+                               "is not a mathutils.Vector type");
                return NULL;
        }
+       else if (totpoints) {
+               /* now make the list to return */
+               filldisplist(&dispbase, &dispbase, 0);
 
-       barycentric_transform(vec, vec_pt->vec,
-                       vec_t1_tar->vec, vec_t2_tar->vec, vec_t3_tar->vec,
-                       vec_t1_src->vec, vec_t2_src->vec, vec_t3_src->vec);
+               /* The faces are stored in a new DisplayList
+               thats added to the head of the listbase */
+               dl= dispbase.first;
 
-       return newVectorObject(vec, 3, Py_NEW, NULL);
+               tri_list= PyList_New(dl->parts);
+               if(!tri_list) {
+                       freedisplist(&dispbase);
+                       PyErr_SetString(PyExc_RuntimeError,
+                                       "failed to make a new list");
+                       return NULL;
+               }
+
+               index= 0;
+               dl_face= dl->index;
+               while(index < dl->parts) {
+                       PyList_SET_ITEM(tri_list, index, Py_BuildValue("iii", dl_face[0], dl_face[1], dl_face[2]));
+                       dl_face+= 3;
+                       index++;
+               }
+               freedisplist(&dispbase);
+       }
+       else {
+               /* no points, do this so scripts dont barf */
+               freedisplist(&dispbase); /* possible some dl was allocated */
+               tri_list= PyList_New(0);
+       }
+
+       return tri_list;
 }
 
+
+static int boxPack_FromPyObject(PyObject *value, boxPack **boxarray)
+{
+       int len, i;
+       PyObject *list_item, *item_1, *item_2;
+       boxPack *box;
+
+
+       /* Error checking must already be done */
+       if(!PyList_Check(value)) {
+               PyErr_SetString(PyExc_TypeError,
+                               "can only back a list of [x, y, w, h]");
+               return -1;
+       }
+
+       len= PyList_Size(value);
+
+       (*boxarray)= MEM_mallocN(len*sizeof(boxPack), "boxPack box");
+
+
+       for(i= 0; i < len; i++) {
+               list_item= PyList_GET_ITEM(value, i);
+               if(!PyList_Check(list_item) || PyList_Size(list_item) < 4) {
+                       MEM_freeN(*boxarray);
+                       PyErr_SetString(PyExc_TypeError,
+                                       "can only pack a list of [x, y, w, h]");
+                       return -1;
+               }
+
+               box= (*boxarray)+i;
+
+               item_1= PyList_GET_ITEM(list_item, 2);
+               item_2= PyList_GET_ITEM(list_item, 3);
+
+               box->w=  (float)PyFloat_AsDouble(item_1);
+               box->h=  (float)PyFloat_AsDouble(item_2);
+               box->index= i;
+
+               /* accounts for error case too and overwrites with own error */
+               if (box->w < 0.0f || box->h < 0.0f) {
+                       MEM_freeN(*boxarray);
+                       PyErr_SetString(PyExc_TypeError,
+                                       "error parsing width and height values from list: "
+                                       "[x, y, w, h], not numbers or below zero");
+                       return -1;
+               }
+
+               /* verts will be added later */
+       }
+       return 0;
+}
+
+static void boxPack_ToPyObject(PyObject *value, boxPack **boxarray)
+{
+       int len, i;
+       PyObject *list_item;
+       boxPack *box;
+
+       len= PyList_Size(value);
+
+       for(i= 0; i < len; i++) {
+               box= (*boxarray)+i;
+               list_item= PyList_GET_ITEM(value, box->index);
+               PyList_SET_ITEM(list_item, 0, PyFloat_FromDouble(box->x));
+               PyList_SET_ITEM(list_item, 1, PyFloat_FromDouble(box->y));
+       }
+       MEM_freeN(*boxarray);
+}
+
+PyDoc_STRVAR(M_Geometry_box_pack_2d_doc,
+".. function:: box_pack_2d(boxes)\n"
+"\n"
+"   Returns the normal of the 3D tri or quad.\n"
+"\n"
+"   :arg boxes: list of boxes, each box is a list where the first 4 items are [x, y, width, height, ...] other items are ignored.\n"
+"   :type boxes: list\n"
+"   :return: the width and height of the packed bounding box\n"
+"   :rtype: tuple, pair of floats\n"
+);
+static PyObject *M_Geometry_box_pack_2d(PyObject *UNUSED(self), PyObject *boxlist)
+{
+       float tot_width= 0.0f, tot_height= 0.0f;
+       int len;
+
+       PyObject *ret;
+
+       if(!PyList_Check(boxlist)) {
+               PyErr_SetString(PyExc_TypeError,
+                               "expected a list of boxes [[x, y, w, h], ... ]");
+               return NULL;
+       }
+
+       len= PyList_GET_SIZE(boxlist);
+       if (len) {
+               boxPack *boxarray= NULL;
+               if(boxPack_FromPyObject(boxlist, &boxarray) == -1) {
+                       return NULL; /* exception set */
+               }
+
+               /* Non Python function */
+               boxPack2D(boxarray, len, &tot_width, &tot_height);
+
+               boxPack_ToPyObject(boxlist, &boxarray);
+       }
+
+       ret= PyTuple_New(2);
+       PyTuple_SET_ITEM(ret, 0, PyFloat_FromDouble(tot_width));
+       PyTuple_SET_ITEM(ret, 1, PyFloat_FromDouble(tot_width));
+       return ret;
+}
+
+#endif /* MATH_STANDALONE */
+
+
 static PyMethodDef M_Geometry_methods[]= {
        {"intersect_ray_tri", (PyCFunction) M_Geometry_intersect_ray_tri, METH_VARARGS, M_Geometry_intersect_ray_tri_doc},
        {"intersect_point_line", (PyCFunction) M_Geometry_intersect_point_line, METH_VARARGS, M_Geometry_intersect_point_line_doc},
@@ -1097,12 +1104,14 @@ static PyMethodDef M_Geometry_methods[]= {
        {"intersect_line_plane", (PyCFunction) M_Geometry_intersect_line_plane, METH_VARARGS, M_Geometry_intersect_line_plane_doc},
        {"intersect_line_sphere", (PyCFunction) M_Geometry_intersect_line_sphere, METH_VARARGS, M_Geometry_intersect_line_sphere_doc},
        {"intersect_line_sphere_2d", (PyCFunction) M_Geometry_intersect_line_sphere_2d, METH_VARARGS, M_Geometry_intersect_line_sphere_2d_doc},
-       {"interpolate_bezier", (PyCFunction) M_Geometry_interpolate_bezier, METH_VARARGS, M_Geometry_interpolate_bezier_doc},
        {"area_tri", (PyCFunction) M_Geometry_area_tri, METH_VARARGS, M_Geometry_area_tri_doc},
        {"normal", (PyCFunction) M_Geometry_normal, METH_VARARGS, M_Geometry_normal_doc},
+       {"barycentric_transform", (PyCFunction) M_Geometry_barycentric_transform, METH_VARARGS, M_Geometry_barycentric_transform_doc},
+#ifndef MATH_STANDALONE
+       {"interpolate_bezier", (PyCFunction) M_Geometry_interpolate_bezier, METH_VARARGS, M_Geometry_interpolate_bezier_doc},
        {"tesselate_polygon", (PyCFunction) M_Geometry_tesselate_polygon, METH_O, M_Geometry_tesselate_polygon_doc},
        {"box_pack_2d", (PyCFunction) M_Geometry_box_pack_2d, METH_O, M_Geometry_box_pack_2d_doc},
-       {"barycentric_transform", (PyCFunction) M_Geometry_barycentric_transform, METH_VARARGS, M_Geometry_barycentric_transform_doc},
+#endif
        {NULL, NULL, 0, NULL}
 };
 
@@ -1119,7 +1128,7 @@ static struct PyModuleDef M_Geometry_module_def= {
 };
 
 /*----------------------------MODULE INIT-------------------------*/
-PyMODINIT_FUNC BPyInit_mathutils_geometry(void)
+PyMODINIT_FUNC PyInit_mathutils_geometry(void)
 {
        PyObject *submodule= PyModule_Create(&M_Geometry_module_def);
        return submodule;
similarity index 96%
rename from source/blender/python/generic/mathutils_geometry.h
rename to source/blender/python/mathutils/mathutils_geometry.h
index 929b8cc8d75d7710a2c665259903b433b44eb00f..c963a63ce7fc75a8ac66e812e42c8956d43923b1 100644 (file)
@@ -38,6 +38,6 @@
 
 #include "mathutils.h"
 
-PyMODINIT_FUNC BPyInit_mathutils_geometry(void);
+PyMODINIT_FUNC PyInit_mathutils_geometry(void);
 
 #endif /* MATHUTILS_GEOMETRY_H */
index b501631ee2d5bab5009a122f7c02c325639fd53f..39f93846e912c860b905b94464af5d5d6282ea6c 100644 (file)
@@ -121,6 +121,7 @@ endif()
                bf_intern_guardedalloc 
                bf_intern_memutil 
                bf_python_ext
+               bf_python_mathutils
                bf_blenlib 
                bf_imbuf_cineon
                bf_imbuf_openexr 
index 66dd6b53feb1ee51c20ccd08a820a8d5c023852a..c1f0560bc1cb9cb5f993b265c9cc5812a042fec7 100644 (file)
@@ -774,6 +774,7 @@ endif()
                bf_intern_opennl
                bf_python
                bf_python_ext
+               bf_python_mathutils
                bf_ikplugin
                bf_modifiers
                bf_blenkernel
index 157124ebc810692fa80a9bfab2fcfb2e5072b865..587f3e4ef351c6379aa79b3e44c1bef5e4f39e1c 100644 (file)
@@ -54,7 +54,7 @@
 #ifdef WITH_PYTHON
 #ifdef USE_MATHUTILS
 extern "C" {
-#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */
+#include "../../blender/python/mathutils/mathutils.h" /* so we can have mathutils callbacks */
 }
 #endif
 
index b5a63f44729a80b5a1867eb4d39629ec0bf9428a..7b3906e0846046f6386e8cd98e16606e5a01ccce 100644 (file)
@@ -40,6 +40,7 @@ set(INC
        ../../../source/blender/blenkernel
        ../../../source/blender/python
        ../../../source/blender/python/generic
+       ../../../source/blender/python/mathutils
        ../../../source/blender 
        ../../../source/blender/makesdna 
        ../../../source/gameengine/Rasterizer 
index 9b198f85664bb9085c42836d46af5cd6077c3dd6..4864482c33b4fa84ac85856fd0aec57025e6de4c 100644 (file)
@@ -49,7 +49,7 @@
 #ifdef WITH_PYTHON
 #ifdef USE_MATHUTILS
 extern "C" {
-#include "../../blender/python/generic/mathutils.h" /* so we can have mathutils callbacks */
+#include "../../blender/python/mathutils/mathutils.h" /* so we can have mathutils callbacks */
 }
 #endif
 
index a927de60cd832aff7885a0806fdaa74f97779b7b..f643030e3a2a9f92f996146c4b754a471e2f763a 100644 (file)
@@ -54,7 +54,7 @@
 extern "C" {
        #include "bpy_internal_import.h"  /* from the blender python api, but we want to import text too! */
        #include "py_capi_utils.h"
-       #include "mathutils.h" // Blender.Mathutils module copied here so the blenderlayer can use.
+       #include "mathutils.h" // 'mathutils' module copied here so the blenderlayer can use.
        #include "bgl.h"
        #include "blf_py_api.h"
 
@@ -1749,7 +1749,7 @@ static void restorePySysObjects(void)
 
 // Copied from bpy_interface.c
 static struct _inittab bge_internal_modules[]= {
-       {(char *)"mathutils", BPyInit_mathutils},
+       {(char *)"mathutils", PyInit_mathutils},
        {(char *)"bgl", BPyInit_bgl},
        {(char *)"blf", BPyInit_blf},
        {(char *)"aud", AUD_initPython},
index 086422627247e1c6735bf20aeea98339f8810169..62caa602c239c45e193811d8690a72223625e371 100644 (file)
@@ -6,7 +6,8 @@ Import ('env')
 sources = env.Glob('*.cpp')
 defs = [ 'GLEW_STATIC' ]
 
-incs = '. #source/blender/python/generic' # Only for Mathutils! and bpy_internal_import.h, be very careful
+incs = '. #source/blender/python/generic' # Only for bpy_internal_import.h, be very careful
+incs += ' #source/blender/python/mathutils' # Only for mathutils, be very careful
 
 incs += ' #intern/string #intern/guardedalloc #intern/container'
 incs += ' #source/gameengine/Rasterizer/RAS_OpenGLRasterizer'