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
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-11-03 18:24:02 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-11-03 18:24:02 +0400
commit2190e6de0e971b5267925e609b73f0ce4931b02b (patch)
tree53fe781b13c5c3d1ef2906107a20dba950fa81c6 /source/blender/freestyle
parentbb9cbedf72961a45642e3f398ccb828d9b6d73a8 (diff)
Fix for missing calls of BaseMath_ReadCallback() when accessing vector/color elements.
This bug was causing wrong color blending results in Freestyle color modifiers. Problem report from Light BWK through personal communications, thanks!
Diffstat (limited to 'source/blender/freestyle')
-rw-r--r--source/blender/freestyle/intern/python/BPy_Convert.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp
index 3b1232c51af..bb907ec572c 100644
--- a/source/blender/freestyle/intern/python/BPy_Convert.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp
@@ -556,6 +556,8 @@ Vec2f *Vec2f_ptr_from_Vector(PyObject *obj)
{
if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 2)
return NULL;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return NULL;
float x = ((VectorObject *)obj)->vec[0];
float y = ((VectorObject *)obj)->vec[1];
return new Vec2f(x, y);
@@ -565,6 +567,8 @@ Vec3f *Vec3f_ptr_from_Vector(PyObject *obj)
{
if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3)
return NULL;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return NULL;
float x = ((VectorObject *)obj)->vec[0];
float y = ((VectorObject *)obj)->vec[1];
float z = ((VectorObject *)obj)->vec[2];
@@ -575,6 +579,8 @@ Vec3r *Vec3r_ptr_from_Vector(PyObject *obj)
{
if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3)
return NULL;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return NULL;
real x = ((VectorObject *)obj)->vec[0];
real y = ((VectorObject *)obj)->vec[1];
real z = ((VectorObject *)obj)->vec[2];
@@ -585,6 +591,8 @@ Vec3f *Vec3f_ptr_from_Color(PyObject *obj)
{
if (!ColorObject_Check(obj))
return NULL;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return NULL;
float r = ((ColorObject *)obj)->col[0];
float g = ((ColorObject *)obj)->col[1];
float b = ((ColorObject *)obj)->col[2];
@@ -595,6 +603,8 @@ Vec3r *Vec3r_ptr_from_Color(PyObject *obj)
{
if (!ColorObject_Check(obj))
return NULL;
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return NULL;
real r = ((ColorObject *)obj)->col[0];
real g = ((ColorObject *)obj)->col[1];
real b = ((ColorObject *)obj)->col[2];
@@ -696,10 +706,19 @@ Vec3r *Vec3r_ptr_from_PyTuple(PyObject *obj)
int float_array_from_PyObject(PyObject *obj, float *v, int n)
{
if (VectorObject_Check(obj) && ((VectorObject *)obj)->size == n) {
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return 0;
for (int i = 0; i < n; i++)
v[i] = ((VectorObject *)obj)->vec[i];
return 1;
}
+ else if (ColorObject_Check(obj) && n == 3) {
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ return 0;
+ for (int i = 0; i < n; i++)
+ v[i] = ((ColorObject *)obj)->col[i];
+ return 1;
+ }
else if (PyList_Check(obj) && PyList_Size(obj) == n) {
return float_array_from_PyList(obj, v, n);
}