[Bf-committers] BKE_object_defgroup_clear() / use_selection inconsistency

Chad Fraleigh chadf at triularity.org
Tue Jul 21 06:16:43 CEST 2015

While looking at some of the vertex group code I noticed something that
doesn't look right. In BKE_object_defgroup_clear() [from object_deform.c]
it contains the following:

                        if (me->dvert) {
                                MVert *mv;
                                int i;

                                mv = me->mvert;
                                dv = me->dvert;

                                for (i = 0; i < me->totvert; i++, mv++,
dv++) {
                                        if (mv->flag & SELECT) {
                                                if (dv->dw &&
(!use_selection || (mv->flag & SELECT))) {
                                                        MDeformWeight *dw =
defvert_find_index(dv, def_nr);

defvert_remove_group(dv, dw);  /* dw can be NULL */
                                                        changed = true;

It is always checking/requiring the SELECT flag, regardless of the
use_selection parameter (and then checks the flag again as expected). Is
this some kind of valid work around for something else, legacy code that is
never reached, or a bug? I see some other functions calling
BKE_object_defgroup_clear() with use_selection as false.


More information about the Bf-committers mailing list