diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-07 01:59:16 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-07 01:59:16 +0400 |
commit | bf0102ffa405027ed4111d6c1635c3995241bb20 (patch) | |
tree | 8aa84da260321e462e1bd8e947618a788201b81d /source/blender/makesrna/intern/rna_texture.c | |
parent | 759e96164a8d3f0f3f5606ab5f4801859899dd50 (diff) |
fix for texture_slot path, would give incorrect path when used with brushes which only have one texture slot.
also quiet float/double warning.
Diffstat (limited to 'source/blender/makesrna/intern/rna_texture.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_texture.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index b212879512e..bdf9fa4e436 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -264,19 +264,24 @@ char *rna_TextureSlot_path(PointerRNA *ptr) * may be used multiple times in the same stack */ if (ptr->id.data) { - PointerRNA id_ptr; - PropertyRNA *prop; - - /* find the 'textures' property of the ID-struct */ - RNA_id_pointer_create(ptr->id.data, &id_ptr); - prop = RNA_struct_find_property(&id_ptr, "texture_slots"); - - /* get an iterator for this property, and try to find the relevant index */ - if (prop) { - int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr); - - if (index >= 0) - return BLI_sprintfN("texture_slots[%d]", index); + if (GS(((ID *)ptr->id.data)->name) == ID_BR) { + return BLI_strdup("texture_slot"); + } + else { + PointerRNA id_ptr; + PropertyRNA *prop; + + /* find the 'textures' property of the ID-struct */ + RNA_id_pointer_create(ptr->id.data, &id_ptr); + prop = RNA_struct_find_property(&id_ptr, "texture_slots"); + + /* get an iterator for this property, and try to find the relevant index */ + if (prop) { + int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr); + + if (index >= 0) + return BLI_sprintfN("texture_slots[%d]", index); + } } } |