From dd69f1968e51a26ff7560d5d1e545e55cc7f5944 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 10 Jan 2011 17:46:34 +0000 Subject: [PATCH] rna collection sizes for face data layers were invalid. This meant python could do... mesh.uv_textures[0] ...on a mesh with 1 vertex color layer instead. --- source/blender/makesrna/intern/rna_mesh.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index b4895b3c43d..846c612fc97 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -372,7 +372,7 @@ static void rna_Mesh_uv_textures_begin(CollectionPropertyIterator *iter, Pointer { Mesh *me= (Mesh*)ptr->data; CustomData *fdata= rna_mesh_fdata(me); - rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_uv_texture_check); + rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), rna_CustomDataLayer_length(ptr, CD_MTFACE), 0, rna_uv_texture_check); } static int rna_Mesh_uv_textures_length(PointerRNA *ptr) @@ -695,7 +695,7 @@ static void rna_Mesh_vertex_colors_begin(CollectionPropertyIterator *iter, Point { Mesh *me= (Mesh*)ptr->data; CustomData *fdata= rna_mesh_fdata(me); - rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_vertex_color_check); + rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), rna_CustomDataLayer_length(ptr, CD_MCOL), 0, rna_vertex_color_check); } static int rna_Mesh_vertex_colors_length(PointerRNA *ptr) @@ -820,7 +820,7 @@ static void rna_Mesh_float_layers_begin(CollectionPropertyIterator *iter, Pointe { Mesh *me= (Mesh*)ptr->data; CustomData *fdata= rna_mesh_fdata(me); - rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_float_layer_check); + rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), rna_CustomDataLayer_length(ptr, CD_PROP_FLT), 0, rna_float_layer_check); } static int rna_Mesh_float_layers_length(PointerRNA *ptr) @@ -851,7 +851,7 @@ static void rna_Mesh_int_layers_begin(CollectionPropertyIterator *iter, PointerR { Mesh *me= (Mesh*)ptr->data; CustomData *fdata= rna_mesh_fdata(me); - rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_int_layer_check); + rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), rna_CustomDataLayer_length(ptr, CD_PROP_INT), 0, rna_int_layer_check); } static int rna_Mesh_int_layers_length(PointerRNA *ptr) @@ -882,7 +882,7 @@ static void rna_Mesh_string_layers_begin(CollectionPropertyIterator *iter, Point { Mesh *me= (Mesh*)ptr->data; CustomData *fdata= rna_mesh_fdata(me); - rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), fdata->totlayer, 0, rna_string_layer_check); + rna_iterator_array_begin(iter, (void*)fdata->layers, sizeof(CustomDataLayer), rna_CustomDataLayer_length(ptr, CD_PROP_STR), 0, rna_string_layer_check); } static int rna_Mesh_string_layers_length(PointerRNA *ptr)