[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [28471] trunk/blender/source: remove redundant argument from mathutils callbacks

Campbell Barton ideasman42 at gmail.com
Thu May 6 23:34:35 CEST 2010


Sorry for the inconvenience, Ill look into fixing now.

On Thu, May 6, 2010 at 11:25 PM, Dalai Felinto <dfelinto at gmail.com> wrote:
> Hi Campbell
> This commit introduced a big bug in BGE:
>
> object vector operations (position) not working properly after rev. 28471
> http://projects.blender.org/tracker/index.php?func=detail&aid=22269&group_id=9&atid=498
>
> In case you don't have the time to fix it, could that be at least reverted?
> Thanks,
>
> Dalai
>
> --
> blenderecia.orgfree.com
>
> 2010/4/27 Campbell Barton <ideasman42 at gmail.com>:
>> Revision: 28471
>>          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=28471
>> Author:   campbellbarton
>> Date:     2010-04-27 21:21:36 +0200 (Tue, 27 Apr 2010)
>>
>> Log Message:
>> -----------
>> remove redundant argument from mathutils callbacks
>>
>> Modified Paths:
>> --------------
>>    trunk/blender/source/blender/python/generic/mathutils.c
>>    trunk/blender/source/blender/python/generic/mathutils.h
>>    trunk/blender/source/blender/python/generic/mathutils_matrix.c
>>    trunk/blender/source/blender/python/intern/bpy_rna.c
>>    trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
>>    trunk/blender/source/gameengine/Ketsji/KX_ObjectActuator.cpp
>>
>> Modified: trunk/blender/source/blender/python/generic/mathutils.c
>> ===================================================================
>> --- trunk/blender/source/blender/python/generic/mathutils.c     2010-04-27 18:55:25 UTC (rev 28470)
>> +++ trunk/blender/source/blender/python/generic/mathutils.c     2010-04-27 19:21:36 UTC (rev 28471)
>> @@ -646,7 +646,7 @@
>>  int _BaseMathObject_ReadCallback(BaseMathObject *self)
>>  {
>>        Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
>> -       if(cb->get(self, self->cb_subtype, self->data))
>> +       if(cb->get(self, self->cb_subtype))
>>                return 1;
>>
>>        PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name);
>> @@ -656,7 +656,7 @@
>>  int _BaseMathObject_WriteCallback(BaseMathObject *self)
>>  {
>>        Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
>> -       if(cb->set(self, self->cb_subtype, self->data))
>> +       if(cb->set(self, self->cb_subtype))
>>                return 1;
>>
>>        PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name);
>> @@ -666,7 +666,7 @@
>>  int _BaseMathObject_ReadIndexCallback(BaseMathObject *self, int index)
>>  {
>>        Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
>> -       if(cb->get_index(self, self->cb_subtype, self->data, index))
>> +       if(cb->get_index(self, self->cb_subtype, index))
>>                return 1;
>>
>>        PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name);
>> @@ -676,7 +676,7 @@
>>  int _BaseMathObject_WriteIndexCallback(BaseMathObject *self, int index)
>>  {
>>        Mathutils_Callback *cb= mathutils_callbacks[self->cb_type];
>> -       if(cb->set_index(self, self->cb_subtype, self->data, index))
>> +       if(cb->set_index(self, self->cb_subtype, index))
>>                return 1;
>>
>>        PyErr_Format(PyExc_SystemError, "%s user has become invalid", Py_TYPE(self)->tp_name);
>>
>> Modified: trunk/blender/source/blender/python/generic/mathutils.h
>> ===================================================================
>> --- trunk/blender/source/blender/python/generic/mathutils.h     2010-04-27 18:55:25 UTC (rev 28470)
>> +++ trunk/blender/source/blender/python/generic/mathutils.h     2010-04-27 19:21:36 UTC (rev 28471)
>> @@ -89,10 +89,10 @@
>>  typedef struct Mathutils_Callback Mathutils_Callback;
>>
>>  typedef int (*BaseMathCheckFunc)(BaseMathObject *);                                                    /* checks the user is still valid */
>> -typedef int (*BaseMathGetFunc)(BaseMathObject *, int, float *);                                /* gets the vector from the user */
>> -typedef int (*BaseMathSetFunc)(BaseMathObject *, int, float *);                                /* sets the users vector values once the vector is modified */
>> -typedef int (*BaseMathGetIndexFunc)(BaseMathObject *, int, float *, int);      /* same as above but only for an index */
>> -typedef int (*BaseMathSetIndexFunc)(BaseMathObject *, int, float *, int);      /* same as above but only for an index */
>> +typedef int (*BaseMathGetFunc)(BaseMathObject *, int);                         /* gets the vector from the user */
>> +typedef int (*BaseMathSetFunc)(BaseMathObject *, int);                         /* sets the users vector values once the vector is modified */
>> +typedef int (*BaseMathGetIndexFunc)(BaseMathObject *, int, int);       /* same as above but only for an index */
>> +typedef int (*BaseMathSetIndexFunc)(BaseMathObject *, int, int);       /* same as above but only for an index */
>>
>>  struct Mathutils_Callback {
>>        BaseMathCheckFunc               check;
>>
>> Modified: trunk/blender/source/blender/python/generic/mathutils_matrix.c
>> ===================================================================
>> --- trunk/blender/source/blender/python/generic/mathutils_matrix.c      2010-04-27 18:55:25 UTC (rev 28470)
>> +++ trunk/blender/source/blender/python/generic/mathutils_matrix.c      2010-04-27 19:21:36 UTC (rev 28471)
>> @@ -43,7 +43,7 @@
>>        return BaseMath_ReadCallback(self);
>>  }
>>
>> -static int mathutils_matrix_vector_get(BaseMathObject *bmo, int subtype, float *vec_from)
>> +static int mathutils_matrix_vector_get(BaseMathObject *bmo, int subtype)
>>  {
>>        MatrixObject *self= (MatrixObject *)bmo->cb_user;
>>        int i;
>> @@ -52,12 +52,12 @@
>>                return 0;
>>
>>        for(i=0; i < self->colSize; i++)
>> -               vec_from[i]= self->matrix[subtype][i];
>> +               bmo->data[i]= self->matrix[subtype][i];
>>
>>        return 1;
>>  }
>>
>> -static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype, float *vec_to)
>> +static int mathutils_matrix_vector_set(BaseMathObject *bmo, int subtype)
>>  {
>>        MatrixObject *self= (MatrixObject *)bmo->cb_user;
>>        int i;
>> @@ -66,31 +66,31 @@
>>                return 0;
>>
>>        for(i=0; i < self->colSize; i++)
>> -               self->matrix[subtype][i]= vec_to[i];
>> +               self->matrix[subtype][i]= bmo->data[i];
>>
>>        BaseMath_WriteCallback(self);
>>        return 1;
>>  }
>>
>> -static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int subtype, float *vec_from, int index)
>> +static int mathutils_matrix_vector_get_index(BaseMathObject *bmo, int subtype, int index)
>>  {
>>        MatrixObject *self= (MatrixObject *)bmo->cb_user;
>>
>>        if(!BaseMath_ReadCallback(self))
>>                return 0;
>>
>> -       vec_from[index]= self->matrix[subtype][index];
>> +       bmo->data[index]= self->matrix[subtype][index];
>>        return 1;
>>  }
>>
>> -static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int subtype, float *vec_to, int index)
>> +static int mathutils_matrix_vector_set_index(BaseMathObject *bmo, int subtype, int index)
>>  {
>>        MatrixObject *self= (MatrixObject *)bmo->cb_user;
>>
>>        if(!BaseMath_ReadCallback(self))
>>                return 0;
>>
>> -       self->matrix[subtype][index]= vec_to[index];
>> +       self->matrix[subtype][index]= bmo->data[index];
>>
>>        BaseMath_WriteCallback(self);
>>        return 1;
>>
>> Modified: trunk/blender/source/blender/python/intern/bpy_rna.c
>> ===================================================================
>> --- trunk/blender/source/blender/python/intern/bpy_rna.c        2010-04-27 18:55:25 UTC (rev 28470)
>> +++ trunk/blender/source/blender/python/intern/bpy_rna.c        2010-04-27 19:21:36 UTC (rev 28471)
>> @@ -74,13 +74,13 @@
>>        return self->prop ? 1:0;
>>  }
>>
>> -static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype, float *vec_from)
>> +static int mathutils_rna_vector_get(BaseMathObject *bmo, int subtype)
>>  {
>>        BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
>>        if(self->prop==NULL)
>>                return 0;
>>
>> -       RNA_property_float_get_array(&self->ptr, self->prop, vec_from);
>> +       RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
>>
>>        /* Euler order exception */
>>        if(subtype==MATHUTILS_CB_SUBTYPE_EUL) {
>> @@ -92,7 +92,7 @@
>>        return 1;
>>  }
>>
>> -static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype, float *vec_to)
>> +static int mathutils_rna_vector_set(BaseMathObject *bmo, int subtype)
>>  {
>>        BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
>>        float min, max;
>> @@ -104,11 +104,11 @@
>>        if(min != FLT_MIN || max != FLT_MAX) {
>>                int i, len= RNA_property_array_length(&self->ptr, self->prop);
>>                for(i=0; i<len; i++) {
>> -                       CLAMP(vec_to[i], min, max);
>> +                       CLAMP(bmo->data[i], min, max);
>>                }
>>        }
>>
>> -       RNA_property_float_set_array(&self->ptr, self->prop, vec_to);
>> +       RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
>>        RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
>>
>>        /* Euler order exception */
>> @@ -124,26 +124,26 @@
>>        return 1;
>>  }
>>
>> -static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, float *vec_from, int index)
>> +static int mathutils_rna_vector_get_index(BaseMathObject *bmo, int subtype, int index)
>>  {
>>        BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
>>
>>        if(self->prop==NULL)
>>                return 0;
>>
>> -       vec_from[index]= RNA_property_float_get_index(&self->ptr, self->prop, index);
>> +       bmo->data[index]= RNA_property_float_get_index(&self->ptr, self->prop, index);
>>        return 1;
>>  }
>>
>> -static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, float *vec_to, int index)
>> +static int mathutils_rna_vector_set_index(BaseMathObject *bmo, int subtype, int index)
>>  {
>>        BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
>>
>>        if(self->prop==NULL)
>>                return 0;
>>
>> -       RNA_property_float_clamp(&self->ptr, self->prop, &vec_to[index]);
>> -       RNA_property_float_set_index(&self->ptr, self->prop, index, vec_to[index]);
>> +       RNA_property_float_clamp(&self->ptr, self->prop, &bmo->data[index]);
>> +       RNA_property_float_set_index(&self->ptr, self->prop, index, bmo->data[index]);
>>        RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
>>        return 1;
>>  }
>> @@ -160,35 +160,35 @@
>>  /* bpyrna matrix callbacks */
>>  static int mathutils_rna_matrix_cb_index= -1; /* index for our callbacks */
>>
>> -static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype, float *mat_from)
>> +static int mathutils_rna_matrix_get(BaseMathObject *bmo, int subtype)
>>  {
>>        BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
>>
>>        if(self->prop==NULL)
>>                return 0;
>>
>> -       RNA_property_float_get_array(&self->ptr, self->prop, mat_from);
>> +       RNA_property_float_get_array(&self->ptr, self->prop, bmo->data);
>>        return 1;
>>  }
>>
>> -static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype, float *mat_to)
>> +static int mathutils_rna_matrix_set(BaseMathObject *bmo, int subtype)
>>  {
>>        BPy_PropertyRNA *self= (BPy_PropertyRNA *)bmo->cb_user;
>>
>>        if(self->prop==NULL)
>>                return 0;
>>        /* can ignore clamping here */
>> -       RNA_property_float_set_array(&self->ptr, self->prop, mat_to);
>> +       RNA_property_float_set_array(&self->ptr, self->prop, bmo->data);
>>        RNA_property_update(BPy_GetContext(), &self->ptr, self->prop);
>>        return 1;
>>  }
>>
>>  Mathutils_Callback mathutils_rna_matrix_cb = {
>> -       (BaseMathCheckFunc)             mathutils_rna_generic_check,
>> -       (BaseMathGetFunc)               mathutils_rna_matrix_get,
>> -       (BaseMathSetFunc)               mathutils_rna_matrix_set,
>> -       (BaseMathGetIndexFunc)  NULL,
>> -       (BaseMathSetIndexFunc)  NULL
>> +       mathutils_rna_generic_check,
>> +       mathutils_rna_matrix_get,
>> +       mathutils_rna_matrix_set,
>> +       NULL,
>> +       NULL
>>  };
>>
>>  /* same as RNA_enum_value_from_id but raises an exception  */
>>
>> Modified: trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp
>> ===================================================================
>> --- trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp    2010-04-27 18:55:25 UTC (rev 28470)
>> +++ trunk/blender/source/gameengine/Ketsji/KX_GameObject.cpp    2010-04-27 19:21:36 UTC (rev 28471)
>> @@ -1261,7 +1261,7 @@
>>        return 1;
>>  }
>>
>> -static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype, float *vec_from)
>> +static int mathutils_kxgameob_vector_get(BaseMathObject *bmo, int subtype)
>>  {
>>        KX_GameObject* self= static_cast<KX_GameObject*>BGE_PROXY_REF(bmo->cb_user);
>>        if(self==NULL)
>> @@ -1269,39 +1269,39 @@
>>
>>        switch(subtype) {
>>                case MATHUTILS_VEC_CB_POS_LOCAL:
>> -                       self->NodeGetLocalPosition().getValue(vec_from);
>> +                       self->NodeGetLocalPosition().getValue(bmo->data);
>>                        break;
>>                case MATHUTILS_VEC_CB_POS_GLOBAL:
>> -                       self->NodeGetWorldPosition().getValue(vec_from);
>>
>> @@ Diff output truncated at 10240 characters. @@
>>
>> _______________________________________________
>> Bf-blender-cvs mailing list
>> Bf-blender-cvs at blender.org
>> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at blender.org
> http://lists.blender.org/mailman/listinfo/bf-committers
>



-- 
- Campbell


More information about the Bf-committers mailing list