Bugfixes:
authorJoshua Leung <aligorith@gmail.com>
Sun, 26 Oct 2008 09:41:59 +0000 (09:41 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 26 Oct 2008 09:41:59 +0000 (09:41 +0000)
* #17900 - IK Constraint was not included regardless of what Visual-Keying method was used
* Deleting a Bone Group now corrects indices of those groups that occurred after the one that was deleted
* No more click-a-mania - Delete all vertex groups from a Mesh (Ctrl-Shift-G menu)

source/blender/include/BIF_editdeform.h
source/blender/src/editdeform.c
source/blender/src/keyframing.c
source/blender/src/poseobject.c

index 8e8b1be2dd3606b26311bbfabda0a490ddd4e956..6429b60a888cbc8b712e61ddb733c4f3e1d5f05a 100644 (file)
@@ -42,9 +42,10 @@ struct bDeformGroup;
 
 struct bDeformGroup *add_defgroup_name (struct Object *ob, char *name);
 void add_defgroup (struct Object *ob);
-void del_defgroup_in_object_mode ( Object *ob );
+void del_defgroup_in_object_mode (struct Object *ob );
 void del_defgroup (struct Object *ob);
-void duplicate_defgroup ( struct Object *ob );
+void del_all_defgroups (struct Object *ob);
+void duplicate_defgroup (struct Object *ob );
 void assign_verts_defgroup (void);
 void remove_verts_defgroup (int allverts);
 void remove_verts_defgroups (int allverts);
index 3f178e1ea2bcaf560334c9d6862a152730881791..8a07a4fddffbb0213ba56fff5c371b6f2cf53a46 100644 (file)
@@ -439,6 +439,32 @@ void del_defgroup (Object *ob)
        }
 }
 
+void del_all_defgroups (Object *ob)
+{
+       /* Sanity check */
+       if (ob == NULL)
+               return;
+       
+       /* Remove all DVerts */
+       if (ob->type==OB_MESH) {
+               Mesh *me= ob->data;
+               CustomData_free_layer_active(&me->vdata, CD_MDEFORMVERT, me->totvert);
+               me->dvert= NULL;
+       }
+       else {
+               if (editLatt->dvert) {
+                       MEM_freeN(editLatt->dvert);
+                       editLatt->dvert= NULL;
+               }
+       }
+       
+       /* Remove all DefGroups */
+       BLI_freelistN(&ob->defbase);
+       
+       /* Fix counters/indices */
+       ob->actdef= 0;
+}
+
 void create_dverts(ID *id)
 {
        /* create deform verts
@@ -1008,9 +1034,9 @@ void vgroup_operation_with_menu(void)
        
        /* give user choices of adding to current/new or removing from current */
        if (ob->actdef)
-               mode = pupmenu("Vertex Groups %t|Change Active Group%x1|Delete Active Group%x2");
+               mode = pupmenu("Vertex Groups %t|Change Active Group%x1|Delete Active Group%x2|Delete All Groups%x3");
        else
-               mode= pupmenu("Vertex Groups %t|Change Active Group%x1");
+               mode= pupmenu("Vertex Groups %t|Change Active Group%x1|Delete All Groups%x3");
        
        /* handle choices */
        switch (mode) {
@@ -1033,11 +1059,20 @@ void vgroup_operation_with_menu(void)
                case 2: /* delete active group  */
                        {
                                del_defgroup(ob);
-                               allqueue (REDRAWVIEW3D, 1);
+                               allqueue(REDRAWVIEW3D, 1);
                                allqueue(REDRAWOOPS, 0);
                                BIF_undo_push("Delete vertex group");
                        }
                        break;
+               case 3: /* delete all groups */
+                       {
+                               del_all_defgroups(ob);
+                               allqueue(REDRAWVIEW3D, 1);
+                               allqueue(REDRAWOOPS, 0);
+                               allqueue(REDRAWBUTSEDIT, 1);
+                               BIF_undo_push("Delete all vertex groups");
+                       }
+                       break;
        }
 }
 
index 2590bacd4b685a14b1710553f5d2076105b10c1b..d9c729e7df6a9d7d7288b70f576ade1d2c09fe5f 100644 (file)
@@ -590,6 +590,8 @@ static short visualkey_can_use (ID *id, int blocktype, char *actname, char *cons
                                        return 1;
                                case CONSTRAINT_TYPE_FOLLOWPATH:
                                        return 1;
+                               case CONSTRAINT_TYPE_KINEMATIC:
+                                       return 1;
                                        
                                /* single-transform constraits  */
                                case CONSTRAINT_TYPE_TRACKTO:
index 0f624d979d59c7031cfff2ac62744cb3ac71402e..c2a2be80e89ce98e206207e394cf47e4f763975c 100644 (file)
@@ -1065,10 +1065,15 @@ void pose_remove_posegroup ()
        /* get group to remove */
        grp= BLI_findlink(&pose->agroups, pose->active_group-1);
        if (grp) {
-               /* firstly, make sure nothing references it */
+               /* adjust group references (the trouble of using indices!):
+                *      - firstly, make sure nothing references it 
+                *      - also, make sure that those after this item get corrected
+                */
                for (pchan= pose->chanbase.first; pchan; pchan= pchan->next) {
                        if (pchan->agrp_index == pose->active_group)
                                pchan->agrp_index= 0;
+                       else if (pchan->agrp_index > pose->active_group)
+                               pchan->agrp_index--;
                }
                
                /* now, remove it from the pose */