diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-11-13 03:12:30 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2011-11-13 03:12:30 +0400 |
commit | 0ca96e1eb1da42268c11c286c74e79ed31da2c37 (patch) | |
tree | 52bcd0a8f871b8cb491a7604ed1c8001832e78fc /source/blender/python | |
parent | 1ae159bff4c9c1d2e26df81744ab73c388b3bbe1 (diff) | |
parent | fc42a6185ddeb6a24ec92287dfa7b89beb059716 (diff) |
Merged changes in the trunk up to revision 41768.
Conflicts resolved:
source/blender/makesdna/intern/makesdna.c
source/blender/makesrna/RNA_enum_types.h
source/blender/render/intern/source/shadeinput.c
source/blenderplayer/bad_level_call_stubs/stubs.c
Additional changes:
* source/blender/makesrna/intern/rna_linestyle.c: Fixed white
space issues that generated a number of compiler errors. The
problem was that two string literals for enumerating MA_RAMP_SOFT
and MA_RAMP_LINEAR contained a space. The string literals are
supposed to represent a valid C identifier because of their use
for automatic code generation.
* Stroke transparency has been temporarily disabled due to a
functionality conflict with some merged changes. A fix of this
issue is planned.
Diffstat (limited to 'source/blender/python')
-rw-r--r-- | source/blender/python/SConscript | 5 | ||||
-rw-r--r-- | source/blender/python/generic/noise_py_api.c | 12 | ||||
-rw-r--r-- | source/blender/python/intern/CMakeLists.txt | 5 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_interface.c | 5 | ||||
-rw-r--r-- | source/blender/python/intern/bpy_rna.c | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_Quaternion.c | 2 | ||||
-rw-r--r-- | source/blender/python/mathutils/mathutils_geometry.c | 43 |
7 files changed, 62 insertions, 12 deletions
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index fa8238badaa..d42ad630e75 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -4,7 +4,7 @@ Import ('env') -incs = '. ../editors/include ../makesdna ../makesrna ../blenlib ../blenkernel ../nodes' +incs = '. ../editors/include ../makesdna ../makesrna ../blenfont ../blenlib ../blenkernel ../nodes' incs += ' ../imbuf ../blenloader ../gpu ../render/extern/include ../windowmanager' incs += ' ../freestyle/intern/python' incs += ' #intern/guardedalloc #intern/memutil #extern/glew/include' @@ -44,5 +44,8 @@ if env['BF_BUILDINFO']: if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') +if env['WITH_BF_CYCLES']: + defs.append('WITH_CYCLES') + sources = env.Glob('intern/*.c') env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361]) diff --git a/source/blender/python/generic/noise_py_api.c b/source/blender/python/generic/noise_py_api.c index c12cc1ccdd2..c84aab83b7e 100644 --- a/source/blender/python/generic/noise_py_api.c +++ b/source/blender/python/generic/noise_py_api.c @@ -263,10 +263,10 @@ static void noise_vector(float x, float y, float z, int nb, float v[3]) { /* Simply evaluate noise at 3 different positions */ v[0]= (float)(2.0f * BLI_gNoise(1.f, x + 9.321f, y - 1.531f, z - 7.951f, 0, - nb) - 1.0f); + nb) - 1.0f); v[1]= (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f); v[2]= (float)(2.0f * BLI_gNoise(1.f, x + 6.327f, y + 0.1671f, z - 2.672f, 0, - nb) - 1.0f); + nb) - 1.0f); } static PyObject *Noise_vector(PyObject *UNUSED(self), PyObject *args) @@ -442,10 +442,10 @@ static PyObject *Noise_voronoi(PyObject *UNUSED(self), PyObject *args) return NULL; voronoi(x, y, z, da, pa, me, dtype); return Py_BuildValue("[[ffff][[fff][fff][fff][fff]]]", - da[0], da[1], da[2], da[3], - pa[0], pa[1], pa[2], - pa[3], pa[4], pa[5], - pa[6], pa[7], pa[8], pa[9], pa[10], pa[11]); + da[0], da[1], da[2], da[3], + pa[0], pa[1], pa[2], + pa[3], pa[4], pa[5], + pa[6], pa[7], pa[8], pa[9], pa[10], pa[11]); } /*-------------------------------------------------------------------------*/ diff --git a/source/blender/python/intern/CMakeLists.txt b/source/blender/python/intern/CMakeLists.txt index 3fe8aada3ae..73b2285ca13 100644 --- a/source/blender/python/intern/CMakeLists.txt +++ b/source/blender/python/intern/CMakeLists.txt @@ -25,6 +25,7 @@ set(INC .. + ../../blenfont ../../blenkernel ../../blenlib ../../blenloader @@ -96,6 +97,10 @@ if(WITH_AUDASPACE) add_definitions(-DWITH_AUDASPACE) endif() +if(WITH_CYCLES) + add_definitions(-DWITH_CYCLES) +endif() + if(WITH_INTERNATIONAL) add_definitions(-DWITH_INTERNATIONAL) endif() diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index ffa9e5cc27c..7dee2ce6fb4 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -174,6 +174,8 @@ void BPY_context_set(bContext *C) /* defined in AUD_C-API.cpp */ extern PyObject *AUD_initPython(void); +/* defined in cycles/blender */ +extern PyObject *CYCLES_initPython(void); static struct _inittab bpy_internal_modules[]= { {(char *)"noise", BPyInit_noise}, @@ -184,6 +186,9 @@ static struct _inittab bpy_internal_modules[]= { #ifdef WITH_AUDASPACE {(char *)"aud", AUD_initPython}, #endif +#ifdef WITH_CYCLES + {(char *)"bcycles", CYCLES_initPython}, +#endif {(char *)"gpu", GPU_initPython}, {NULL, NULL} }; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index 44e26a56db6..15a9ba44552 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -77,7 +77,7 @@ #include "../generic/py_capi_utils.h" #ifdef WITH_INTERNATIONAL -#include "UI_interface.h" /* bad level call into editors */ +#include "BLF_translation.h" #endif #define USE_PEDANTIC_WRITE diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 3f0a5d55ec2..51ab5b50919 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -945,7 +945,7 @@ static int Quaternion_setAngle(QuaternionObject *self, PyObject *value, void *UN angle= PyFloat_AsDouble(value); - if (angle==-1.0 && PyErr_Occurred()) { /* parsed item not a number */ + if (angle==-1.0f && PyErr_Occurred()) { /* parsed item not a number */ PyErr_SetString(PyExc_TypeError, "Quaternion.angle = value: float expected"); return -1; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 3518c8008c6..a0a6ba277cf 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -420,7 +420,7 @@ static PyObject *M_Geometry_intersect_line_plane(PyObject *UNUSED(self), PyObjec return NULL; } - if ( BaseMath_ReadCallback(line_a) == -1 || + if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || BaseMath_ReadCallback(plane_co) == -1 || BaseMath_ReadCallback(plane_no) == -1 @@ -559,7 +559,7 @@ static PyObject *M_Geometry_intersect_line_sphere_2d(PyObject *UNUSED(self), PyO return NULL; } - if ( BaseMath_ReadCallback(line_a) == -1 || + if ( BaseMath_ReadCallback(line_a) == -1 || BaseMath_ReadCallback(line_b) == -1 || BaseMath_ReadCallback(sphere_co) == -1 ) { @@ -686,7 +686,7 @@ PyDoc_STRVAR(M_Geometry_intersect_point_quad_2d_doc, " Takes 5 vectors (using only the x and y coordinates): one is the point and the next 4 define the quad, only the x and y are used from the vectors. Returns 1 if the point is within the quad, otherwise 0.\n" "\n" " :arg pt: Point\n" -" :type v1: :class:`mathutils.Vector`\n" +" :type pt: :class:`mathutils.Vector`\n" " :arg quad_p1: First point of the quad\n" " :type quad_p1: :class:`mathutils.Vector`\n" " :arg quad_p2: Second point of the quad\n" @@ -717,6 +717,42 @@ 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)); } +PyDoc_STRVAR(M_Geometry_distance_point_to_plane_doc, +".. function:: distance_point_to_plane(pt, plane_co, plane_no)\n" +"\n" +" Returns the signed distance between a point and a plane " +" (negative when below the normal).\n" +"\n" +" :arg pt: Point\n" +" :type pt: :class:`mathutils.Vector`\n" +" :arg plane_co: First point of the quad\n" +" :type plane_co: :class:`mathutils.Vector`\n" +" :arg plane_no: Second point of the quad\n" +" :type plane_no: :class:`mathutils.Vector`\n" +" :rtype: float\n" +); +static PyObject *M_Geometry_distance_point_to_plane(PyObject *UNUSED(self), PyObject* args) +{ + VectorObject *pt, *plene_co, *plane_no; + + if (!PyArg_ParseTuple(args, "O!O!O!:distance_point_to_plane", + &vector_Type, &pt, + &vector_Type, &plene_co, + &vector_Type, &plane_no) + ) { + return NULL; + } + + if ( BaseMath_ReadCallback(pt) == -1 || + BaseMath_ReadCallback(plene_co) == -1 || + BaseMath_ReadCallback(plane_no) == -1) + { + return NULL; + } + + return PyFloat_FromDouble(dist_to_plane_v3(pt->vec, plene_co->vec, plane_no->vec)); +} + 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" @@ -1103,6 +1139,7 @@ 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}, + {"distance_point_to_plane", (PyCFunction) M_Geometry_distance_point_to_plane, METH_VARARGS, M_Geometry_distance_point_to_plane_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}, |