Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-08-22 18:15:28 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-08-22 18:15:28 +0400
commit0bab23633a07942586f963c19d053f26c44d799b (patch)
tree77065471bb213e0c782aa955eb77d1ca3a728d88 /source/blender/makesrna/intern/rna_object.c
parent96429a4792cb2b30c8e96ab6cedcd3f6c884fc38 (diff)
remove inline loops in a few places
replace with defgroup_find_name() and BLI_findstring()
Diffstat (limited to 'source/blender/makesrna/intern/rna_object.c')
-rw-r--r--source/blender/makesrna/intern/rna_object.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index dc8cd2d7a03..343e9c87ded 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -122,6 +122,7 @@ EnumPropertyItem object_type_curve_items[] = {
#include "BKE_mesh.h"
#include "BKE_particle.h"
#include "BKE_scene.h"
+#include "BKE_deform.h"
#include "BLI_editVert.h" /* for EditMesh->mat_nr */
@@ -448,32 +449,19 @@ int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
{
Object *ob= (Object*)ptr->id.data;
- bDeformGroup *dg;
- int a;
-
- for(a=1, dg=ob->defbase.first; dg; dg=dg->next, a++) {
- if(strcmp(dg->name, value) == 0) {
- *index= a;
- return;
- }
- }
-
- *index= 0;
+ *index= defgroup_name_index(ob, value) + 1;
}
void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
{
Object *ob= (Object*)ptr->id.data;
- bDeformGroup *dg;
-
- for(dg=ob->defbase.first; dg; dg=dg->next) {
- if(strcmp(dg->name, value) == 0) {
- BLI_strncpy(result, value, maxlen);
- return;
- }
+ bDeformGroup *dg= defgroup_find_name(ob, value);
+ if(dg) {
+ BLI_strncpy(result, value, maxlen);
+ return;
}
- BLI_strncpy(result, "", maxlen);
+ result[0]= '\0';
}
void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)