diff options
-rw-r--r-- | source/blender/blenkernel/BKE_deform.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/deform.c | 56 | ||||
-rw-r--r-- | source/blender/include/BIF_editdeform.h | 2 | ||||
-rw-r--r-- | source/blender/src/editdeform.c | 58 |
4 files changed, 58 insertions, 60 deletions
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 411225b0635..b15ccc6ecf3 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -45,6 +45,8 @@ struct bDeformGroup; void copy_defgroups (struct ListBase *lb1, struct ListBase *lb2); struct bDeformGroup* copy_defgroup (struct bDeformGroup *ingroup); void color_temperature (float input, unsigned char *r, unsigned char *g, unsigned char *b); +struct bDeformGroup *get_named_vertexgroup (Object *ob, char *name); +int get_defgroup_num (struct Object *ob, struct bDeformGroup *dg); void hook_object_deform(struct Object *ob, int index, float *vec); diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c index 19c2f15e7d3..d4b1e9defff 100644 --- a/source/blender/blenkernel/intern/deform.c +++ b/source/blender/blenkernel/intern/deform.c @@ -137,6 +137,62 @@ bDeformGroup* copy_defgroup (bDeformGroup *ingroup) return outgroup; } +bDeformGroup *get_named_vertexgroup(Object *ob, char *name) +{ + /* return a pointer to the deform group with this name + * or return NULL otherwise. + */ + bDeformGroup *curdef; + + for (curdef = ob->defbase.first; curdef; curdef=curdef->next){ + if (!strcmp(curdef->name, name)){ + return curdef; + } + } + return NULL; +} + +int get_defgroup_num (Object *ob, bDeformGroup *dg) +{ + /* Fetch the location of this deform group + * within the linked list of deform groups. + * (this number is stored in the deform + * weights of the deform verts to link them + * to this deform group) deform deform + * deform blah blah deform + */ + + bDeformGroup *eg; + int def_nr; + + eg = ob->defbase.first; + def_nr = 0; + + /* loop through all deform groups + */ + while (eg != NULL){ + + /* if the current deform group is + * the one we are after, return + * def_nr + */ + if (eg == dg){ + break; + } + ++def_nr; + eg = eg->next; + } + + /* if there was no deform group found then + * return -1 (should set up a nice symbolic + * constant for this) + */ + if (eg == NULL) return -1; + + return def_nr; + +} + /* *************** HOOK ****************** */ /* vec==NULL: init diff --git a/source/blender/include/BIF_editdeform.h b/source/blender/include/BIF_editdeform.h index 3720e8e3d8a..e50de0b5bec 100644 --- a/source/blender/include/BIF_editdeform.h +++ b/source/blender/include/BIF_editdeform.h @@ -43,7 +43,6 @@ struct MDeformVert; struct MDeformWeight; struct bDeformGroup; -struct bDeformGroup *get_named_vertexgroup (Object *ob, char *name); void unique_vertexgroup_name (struct bDeformGroup *dg, struct Object *ob); struct bDeformGroup *add_defgroup_name (struct Object *ob, char *name); void add_defgroup (struct Object *ob); @@ -53,7 +52,6 @@ void remove_verts_defgroup (int allverts); void sel_verts_defgroup (int select); struct MDeformWeight *verify_defweight (struct MDeformVert *dv, int defgroup); void verify_defgroups (struct Object *ob); -int get_defgroup_num (struct Object *ob, struct bDeformGroup *dg); void add_vert_to_defgroup (struct Object *ob, struct bDeformGroup *dg, int vertnum, float weight, int assignmode); diff --git a/source/blender/src/editdeform.c b/source/blender/src/editdeform.c index 583b4cb5133..5ac3681743c 100644 --- a/source/blender/src/editdeform.c +++ b/source/blender/src/editdeform.c @@ -204,48 +204,6 @@ void create_dverts(Mesh *me) } } -int get_defgroup_num (Object *ob, bDeformGroup *dg) -{ - /* Fetch the location of this deform group - * within the linked list of deform groups. - * (this number is stored in the deform - * weights of the deform verts to link them - * to this deform group) deform deform - * deform blah blah deform - */ - - bDeformGroup *eg; - int def_nr; - - eg = ob->defbase.first; - def_nr = 0; - - /* loop through all deform groups - */ - while (eg != NULL){ - - /* if the current deform group is - * the one we are after, return - * def_nr - */ - if (eg == dg){ - break; - } - ++def_nr; - eg = eg->next; - } - - /* if there was no deform group found then - * return -1 (should set up a nice symbolic - * constant for this) - */ - if (eg == NULL) return -1; - - return def_nr; - -} - - void remove_vert_def_nr (Object *ob, int def_nr, int vertnum) { /* This routine removes the vertex from the deform @@ -590,22 +548,6 @@ void verify_defgroups (Object *ob) } } -bDeformGroup *get_named_vertexgroup(Object *ob, char *name) -{ - /* return a pointer to the deform group with this name - * or return NULL otherwise. - */ - bDeformGroup *curdef; - - for (curdef = ob->defbase.first; curdef; curdef=curdef->next){ - if (!strcmp(curdef->name, name)){ - return curdef; - } - } - return NULL; -} - - void unique_vertexgroup_name (bDeformGroup *dg, Object *ob) { char tempname[64]; |