I'm getting a crash in MeshTexturePolyLayer_name_length() when switching to the Object Data panel (with any mesh selected) that I think is caused by this commit.
-Nicholas On Sat, Mar 10, 2012 at 12:20 AM, Campbell Barton <[email protected]> wrote: > Revision: 44781 > > http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44781 > Author: campbellbarton > Date: 2012-03-10 05:20:41 +0000 (Sat, 10 Mar 2012) > Log Message: > ----------- > fix [#30500] Mesh.tessface_uv_textures or Mesh.tessface_vertex_colors crash > on access in editmode > > just missing NULL checks on face data. > > Modified Paths: > -------------- > trunk/blender/source/blender/makesrna/intern/rna_mesh_utils.h > > Modified: trunk/blender/source/blender/makesrna/intern/rna_mesh_utils.h > =================================================================== > --- trunk/blender/source/blender/makesrna/intern/rna_mesh_utils.h > 2012-03-10 05:15:17 UTC (rev 44780) > +++ trunk/blender/source/blender/makesrna/intern/rna_mesh_utils.h > 2012-03-10 05:20:41 UTC (rev 44781) > @@ -35,77 +35,94 @@ > /* Macros to help reduce code clutter in rna_mesh.c */ > > /* Define the accessors for a basic CustomDataLayer collection */ > -#define DEFINE_CUSTOMDATA_LAYER_COLLECTION(collection_name, customdata_type, > layer_type) \ > - > > \ > - static int rna_##collection_name##_check(CollectionPropertyIterator > *iter, void *data) \ > - { > > \ > - CustomDataLayer *layer = (CustomDataLayer*)data; > \ > - return (layer->type != layer_type); > \ > - } > > \ > - > > \ > - static void > rna_Mesh_##collection_name##s_begin(CollectionPropertyIterator *iter, > PointerRNA *ptr) \ > - { > > \ > - CustomData *data = rna_mesh_##customdata_type(ptr); > \ > - rna_iterator_array_begin(iter, (void*)data->layers, > sizeof(CustomDataLayer), data->totlayer, 0, rna_##collection_name##_check); \ > - } > > \ > - > > \ > - static int rna_Mesh_##collection_name##s_length(PointerRNA *ptr) > \ > - { > > \ > - CustomData *data = rna_mesh_##customdata_type(ptr); > \ > - return data ? CustomData_number_of_layers(data, layer_type) : > 0; \ > - } > > \ > - > > \ > - static void rna_Mesh_##collection_name##_index_range(PointerRNA *ptr, > int *min, int *max) \ > - { > > \ > - CustomData *data = rna_mesh_##customdata_type(ptr); > \ > - > > \ > - *min = 0; > > \ > - *max = data ? CustomData_number_of_layers(data, layer_type) - > 1 : 0; \ > - *max = MAX2(0, *max); > > \ > +#define DEFINE_CUSTOMDATA_LAYER_COLLECTION(collection_name, customdata_type, > layer_type) \ > + /* check */ > \ > + static int rna_##collection_name##_check(CollectionPropertyIterator > *iter, void *data) \ > + { > \ > + CustomDataLayer *layer = (CustomDataLayer*)data; > \ > + return (layer->type != layer_type); > \ > + } > \ > + /* begin */ > \ > + static void > rna_Mesh_##collection_name##s_begin(CollectionPropertyIterator *iter, > \ > + PointerRNA *ptr) > \ > + { > \ > + CustomData *data = rna_mesh_##customdata_type(ptr); > \ > + if (data) { > \ > + rna_iterator_array_begin(iter, > \ > + (void *)data->layers, > sizeof(CustomDataLayer), \ > + data->totlayer, 0, > \ > + > rna_##collection_name##_check); \ > + } > \ > + else { > \ > + rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL); > \ > + } > \ > + } > \ > + /* length */ > \ > + static int rna_Mesh_##collection_name##s_length(PointerRNA *ptr) > \ > + { > \ > + CustomData *data = rna_mesh_##customdata_type(ptr); > \ > + return data ? CustomData_number_of_layers(data, layer_type) : > 0; \ > + } > \ > + /* index range */ > \ > + static void rna_Mesh_##collection_name##_index_range(PointerRNA *ptr, > int *min, int *max) \ > + { > \ > + CustomData *data = rna_mesh_##customdata_type(ptr); > \ > + *min = 0; > \ > + *max = data ? CustomData_number_of_layers(data, layer_type) - > 1 : 0; \ > + *max = MAX2(0, *max); > \ > } > > /* Define the accessors for special CustomDataLayers in the collection > - (active, render, clone, stencil, etc) */ > -#define DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(collection_name, > customdata_type, layer_type, active_type, layer_rna_type) \ > - > > \ > - static PointerRNA > rna_Mesh_##collection_name##_##active_type##_get(PointerRNA *ptr) \ > - { > > \ > - CustomData *data = rna_mesh_##customdata_type(ptr); > \ > - int index = CustomData_get_##active_type##_layer_index(data, > layer_type); \ > - CustomDataLayer *cdl = (index == -1)? NULL: > &data->layers[index]; \ > - > > \ > - return rna_pointer_inherit_refine(ptr, &RNA_##layer_rna_type, > cdl); \ > - } > > \ > - > > \ > - static void > rna_Mesh_##collection_name##_##active_type##_set(PointerRNA *ptr, PointerRNA > value) \ > - { > > \ > - Mesh *me = rna_mesh(ptr); > \ > - CustomData *data = rna_mesh_##customdata_type(ptr); > \ > - CustomDataLayer *cdl; > \ > - int a; > > \ > - > > \ > - for (cdl = data->layers, a = 0; a<data->totlayer; cdl++, a++) > { \ > - if (value.data == cdl) { > > \ > - > CustomData_set_layer_##active_type##_index(data, layer_type, a); \ > - mesh_update_customdata_pointers(me, TRUE); > \ > - return; > > \ > - } > > \ > - } > > \ > - } > > \ > - > > \ > - static int > rna_Mesh_##collection_name##_##active_type##_index_get(PointerRNA *ptr) \ > - { > > \ > - CustomData *data = rna_mesh_##customdata_type(ptr); > \ > - return CustomData_get_##active_type##_layer(data, > layer_type); \ > - } > > \ > - > > \ > + * (active, render, clone, stencil, etc) */ > +#define DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(collection_name, > customdata_type, \ > + layer_type, > active_type, layer_rna_type) \ > + > \ > + static PointerRNA > rna_Mesh_##collection_name##_##active_type##_get(PointerRNA *ptr) \ > + { > \ > + CustomData *data = rna_mesh_##customdata_type(ptr); > \ > + CustomDataLayer *cdl; > \ > + if (data) { > \ > + int index = > CustomData_get_##active_type##_layer_index(data, layer_type); \ > + CustomDataLayer *cdl = (index == -1)? NULL: > &data->layers[index]; \ > + } > \ > + else { > \ > + cdl = NULL; > \ > + } > \ > + return rna_pointer_inherit_refine(ptr, &RNA_##layer_rna_type, > cdl); \ > + } > \ > + > \ > + static void > rna_Mesh_##collection_name##_##active_type##_set(PointerRNA *ptr, > \ > + > PointerRNA value) \ > + { > \ > + Mesh *me = rna_mesh(ptr); > \ > + CustomData *data = rna_mesh_##customdata_type(ptr); > \ > + CustomDataLayer *cdl; > \ > + int a; > \ > + if (data) { > \ > + for (cdl = data->layers, a = 0; a<data->totlayer; > cdl++, a++) { \ > + if (value.data == cdl) { > \ > + > CustomData_set_layer_##active_type##_index(data, layer_type, a); \ > + mesh_update_customdata_pointers(me, > TRUE); \ > + return; > \ > + } > \ > + } > \ > + } > \ > + } > \ > + > \ > + static int > rna_Mesh_##collection_name##_##active_type##_index_get(PointerRNA *ptr) > \ > > @@ Diff output truncated at 10240 characters. @@ > _______________________________________________ > Bf-blender-cvs mailing list > [email protected] > http://lists.blender.org/mailman/listinfo/bf-blender-cvs _______________________________________________ Bf-committers mailing list [email protected] http://lists.blender.org/mailman/listinfo/bf-committers
