patch from Benoit Bolsee (ben2610) for 4 bugs in report [#20527] Several bugs in RNA

from the report...


# bug 1. UV properties are not raw editable but are reported 
#        as RAW_TYPE_INT by RNA causing wrong conversion 
#        internally (bpy_rna.c line 2205)
# bug 2. raw update of UV coordinates crash blender (rna_access.c line 252)
mtfaces.foreach_set("uv", rawuvs)
# workaround:
#for i in range(int(len(faces)/4)):
#   mtfaces[i].uv = uvs[i]

# bug 3. raw update of non-array property fails (rna_access.c line 2270)
mfaces.foreach_set("material_index", mats)
# workaround:
# for i in range(int(len(mfaces))):
#    mfaces[i].material_index = mats[i]

# bug 4. It is not possible to add a vertex color layer using mesh API.
me.add_vertex_color()
# no workaround...
This commit is contained in:
2010-01-04 22:30:09 +00:00
parent 7f03297fc8
commit e90b6eefb1
7 changed files with 99 additions and 9 deletions

View File

@@ -2237,7 +2237,7 @@ static void foreach_attr_type( BPy_PropertyRNA *self, char *attr,
RawPropertyType *raw_type, int *attr_tot, int *attr_signed )
{
PropertyRNA *prop;
*raw_type= -1;
*raw_type= PROP_RAW_UNSET;
*attr_tot= 0;
*attr_signed= FALSE;
@@ -2263,7 +2263,8 @@ static int foreach_parse_args(
int target_tot;
#endif
*size= *raw_type= *attr_tot= *attr_signed= FALSE;
*size= *attr_tot= *attr_signed= FALSE;
*raw_type= PROP_RAW_UNSET;
if(!PyArg_ParseTuple(args, "sO", attr, seq) || (!PySequence_Check(*seq) && PyObject_CheckBuffer(*seq))) {
PyErr_SetString( PyExc_TypeError, "foreach_get(attr, sequence) expects a string and a sequence" );
@@ -2296,6 +2297,10 @@ static int foreach_parse_args(
#endif
}
if (*size == 0) {
PyErr_SetString( PyExc_AttributeError, "attribute does not support foreach method" );
return -1;
}
return 0;
}