Revision: 14181
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14181
Author:   aligorith
Date:     2008-03-20 11:50:46 +0100 (Thu, 20 Mar 2008)

Log Message:
-----------
* Bugfix #8599a:
Deleting the first Action Channel in an Action Group acted odd. In some cases 
it crashed, other times it corrupted stuff (removing all subsequent Action 
Channels). Was missing a call to remove the Action Channel from group(s).

* Fixed whitespace in many places...

Modified Paths:
--------------
    trunk/blender/source/blender/src/drawaction.c
    trunk/blender/source/blender/src/editaction.c
    trunk/blender/source/blender/src/editarmature.c
    trunk/blender/source/blender/src/editipo.c

Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c       2008-03-20 04:59:59 UTC 
(rev 14180)
+++ trunk/blender/source/blender/src/drawaction.c       2008-03-20 10:50:46 UTC 
(rev 14181)
@@ -168,7 +168,7 @@
                for (i=1; i < key->totkey; i++) {
                        make_rvk_slider(block, ob, i, 
                                                        x, y, SLIDERWIDTH-2, 
CHANNELHEIGHT-1, "Slider to control Shape Keys");
-
+                       
                        y-=CHANNELHEIGHT+CHANNELSKIP;
                        
                        /* see sliderval array in editkey.c */
@@ -176,7 +176,6 @@
                }
        }
        uiDrawBlock(block);
-
 }
 
 static void icu_slider_func(void *voidicu, void *voidignore) 
@@ -238,7 +237,7 @@
        /* create a slider for the ipo-curve*/
        uiBut *but;
        
-       if(icu==NULL) return;
+       if(icu == NULL) return;
        
        if (IS_EQ(icu->slide_max, icu->slide_min)) {
                if (IS_EQ(icu->ymax, icu->ymin)) {
@@ -359,7 +358,7 @@
                                                // TODO...
                                        }
                                                break;
-                               }       
+                               }
                        }
                        
                        /* adjust y-position for next one */
@@ -905,7 +904,7 @@
        }
 }
 
-
+// currently not used...
 static void action_panel_properties(short cntrl)       // 
ACTION_HANDLER_PROPERTIES
 {
        uiBlock *block;
@@ -913,10 +912,10 @@
        block= uiNewBlock(&curarea->uiblocks, "action_panel_properties", 
UI_EMBOSS, UI_HELV, curarea->win);
        uiPanelControl(UI_PNL_SOLID | UI_PNL_CLOSE | cntrl);
        uiSetPanelHandler(ACTION_HANDLER_PROPERTIES);  // for close and esc
-       if(uiNewPanel(curarea, block, "Transform Properties", "Action", 10, 
230, 318, 204)==0) return;
+       if (uiNewPanel(curarea, block, "Transform Properties", "Action", 10, 
230, 318, 204)==0) 
+               return;
 
        uiDefBut(block, LABEL, 0, "test text",          10,180,300,19, 0, 0, 0, 
0, 0, "");
-
 }
 
 static void action_blockhandlers(ScrArea *sa)
@@ -924,17 +923,17 @@
        SpaceAction *sact= sa->spacedata.first;
        short a;
        
-       for(a=0; a<SPACE_MAXHANDLER; a+=2) {
+       for (a=0; a<SPACE_MAXHANDLER; a+=2) {
                switch(sact->blockhandler[a]) {
-
-               case ACTION_HANDLER_PROPERTIES:
-                       action_panel_properties(sact->blockhandler[a+1]);
-                       break;
-               
+                       case ACTION_HANDLER_PROPERTIES:
+                               
action_panel_properties(sact->blockhandler[a+1]);
+                               break;
                }
+               
                /* clear action value for event */
                sact->blockhandler[a+1]= 0;
        }
+       
        uiDrawBlocksPanels(sa, 0);
 }
 
@@ -959,7 +958,6 @@
 
        /* only try to refresh action that's displayed if not pinned */
        if (G.saction->pin==0) {
-               /* TODO: allow more than one active action sometime? */
                if (OBACT)
                        G.saction->action = OBACT->action;
                else
@@ -1508,7 +1506,7 @@
        if (agrp) {
                /* loop through action channels */
                for (achan= agrp->channels.first; achan && achan->grp==agrp; 
achan= achan->next) {
-                       if(VISIBLE_ACHAN(achan)) {
+                       if (VISIBLE_ACHAN(achan)) {
                                /* firstly, add keys from action channel's ipo 
block */
                                if (achan->ipo)
                                        ipo_to_keylist(achan->ipo, keys, 
blocks, aki);

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c       2008-03-20 04:59:59 UTC 
(rev 14180)
+++ trunk/blender/source/blender/src/editaction.c       2008-03-20 10:50:46 UTC 
(rev 14181)
@@ -1088,7 +1088,7 @@
                return;
        if (name[0] == 0)
                return;
-               
+       
        /* try to get the channels */
        pchan= get_pose_channel(pose, name);
        if (pchan == NULL) return;
@@ -1529,7 +1529,7 @@
                bConstraintChannel *conchan, *cnext;
                next= ale->next;
                
-               /* release reference to ipo users */
+               /* release references to ipo users */
                if (achan->ipo)
                        achan->ipo->id.us--;
                        
@@ -1540,12 +1540,16 @@
                                conchan->ipo->id.us--;
                }
                
+               /* remove action-channel from group(s) */
+               if (achan->grp)
+                       action_groups_removeachan(act, achan);
+               
                /* free memory */
                BLI_freelistN(&achan->constraintChannels);
                BLI_freelinkN(&act->chanbase, achan);
                BLI_freelinkN(&act_data, ale);
        }
-               
+       
        remake_action_ipos(data);
        
        BIF_undo_push("Delete Action Channels");
@@ -1867,7 +1871,7 @@
                                /* check if we have a corresponding action 
channel */
                                if ((no_name) || (strcmp(achan->name, 
achant->name)==0)) {
                                        actname= achan->name;
-
+                                       
                                        /* check if this is a constraint 
channel */
                                        if (ale->type == ACTTYPE_CONCHAN) {
                                                bConstraintChannel *conchant= 
ale->data;
@@ -1901,12 +1905,12 @@
                /* this shouldn't happen, but it might */
                if (ELEM(NULL, ipo_src, ipo_dst))
                        continue;
-
+               
                /* loop over curves, pasting keyframes */
                for (ico= ipo_src->curve.first; ico; ico= ico->next) {
                        icu= verify_ipocurve((ID*)OBACT, ico->blocktype, 
actname, conname, "", ico->adrcode);
-
-                       if(icu) {
+                       
+                       if (icu) {
                                /* just start pasting, with the the first 
keyframe on the current frame, and so on */
                                for (i=0, bezt=ico->bezt; i < ico->totvert; 
i++, bezt++) {                                              
                                        /* temporarily apply offset to src 
beztriple while copying */
@@ -4233,7 +4237,7 @@
                                 */
                                if (IN_2D_VERT_SCROLL(mval))
                                        selectall_action_keys(mval, 0, 
select_mode);
-               
+                               
                                /* Clicking in the horizontal scrollbar selects
                                 * all of the keys within 0.5 of the nearest 
integer
                                 * frame

Modified: trunk/blender/source/blender/src/editarmature.c
===================================================================
--- trunk/blender/source/blender/src/editarmature.c     2008-03-20 04:59:59 UTC 
(rev 14180)
+++ trunk/blender/source/blender/src/editarmature.c     2008-03-20 10:50:46 UTC 
(rev 14181)
@@ -3036,7 +3036,6 @@
 int bone_looper(Object *ob, Bone *bone, void *data,
                         int (*bone_func)(Object *, Bone *, void *)) 
 {
-
     /* We want to apply the function bone_func to every bone 
      * in an armature -- feed bone_looper the first bone and 
      * a pointer to the bone_func and watch it go!. The int count 
@@ -3046,19 +3045,15 @@
     int count = 0;
 
     if (bone) {
-
-        /* only do bone_func if the bone is non null
-         */
+               /* only do bone_func if the bone is non null */
         count += bone_func(ob, bone, data);
-
-        /* try to execute bone_func for the first child
-         */
-        count += bone_looper(ob, bone->childbase.first, data,
-                                    bone_func);
-
-        /* try to execute bone_func for the next bone at this
-         * depth of the recursion.
-         */
+               
+               /* try to execute bone_func for the first child */
+        count += bone_looper(ob, bone->childbase.first, data, bone_func);
+               
+               /* try to execute bone_func for the next bone at this
+                * depth of the recursion.
+                */
         count += bone_looper(ob, bone->next, data, bone_func);
     }
 
@@ -3096,15 +3091,15 @@
 
        if(!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) {
                if (!(bone->flag & BONE_NO_DEFORM)) {
-                       if(data->heat && data->armob->pose && 
get_pose_channel(data->armob->pose, bone->name))
+                       if (data->heat && data->armob->pose && 
get_pose_channel(data->armob->pose, bone->name))
                                segments = bone->segments;
                        else
                                segments = 1;
-
+                       
                        if (data->list != NULL) {
                                hbone = (Bone ***) &data->list;
                                
-                               for(a=0; a<segments; a++) {
+                               for (a=0; a<segments; a++) {
                                        **hbone = bone;
                                        ++*hbone;
                                }
@@ -3118,9 +3113,9 @@
 static int add_defgroup_unique_bone(Object *ob, Bone *bone, void *data) 
 {
     /* This group creates a vertex group to ob that has the
-     * same name as bone (provided the bone is skinnable). 
+      * same name as bone (provided the bone is skinnable). 
         * If such a vertex group aleady exist the routine exits.
-     */
+      */
        if (!(bone->flag & BONE_NO_DEFORM)) {
                if (!get_named_vertexgroup(ob,bone->name)) {
                        add_defgroup_name(ob, bone->name);
@@ -3159,19 +3154,19 @@
        int a, segments;
        struct { Object *armob; void *list; int heat; } *data= datap;
 
-       if(!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) {
+       if (!(G.f & G_WEIGHTPAINT) || !(bone->flag & BONE_HIDDEN_P)) {
           if (!(bone->flag & BONE_NO_DEFORM)) {
-                       if(data->heat && data->armob->pose && 
get_pose_channel(data->armob->pose, bone->name))
+                       if (data->heat && data->armob->pose && 
get_pose_channel(data->armob->pose, bone->name))
                                segments = bone->segments;
                        else
                                segments = 1;
-
-                       if(!(defgroup = get_named_vertexgroup(ob, bone->name)))
+                       
+                       if (!(defgroup = get_named_vertexgroup(ob, bone->name)))
                                defgroup = add_defgroup_name(ob, bone->name);
-
+                       
                        if (data->list != NULL) {
                                hgroup = (bDeformGroup ***) &data->list;
-
+                       
                                for(a=0; a<segments; a++) {
                                        **hgroup = defgroup;
                                        ++*hgroup;
@@ -3203,15 +3198,15 @@
        /* for each vertex in the mesh */
        for (i=0; i < mesh->totvert; i++) {
                iflip = (dgroupflip)? mesh_get_x_mirror_vert(ob, i): 0;
-
+               
                /* for each skinnable bone */
                for (j=0; j < numbones; ++j) {
                        if(!selected[j])
                                continue;
-
+                       
                        bone = bonelist[j];
                        dgroup = dgrouplist[j];
-
+                       
                        /* store the distance-factor from the vertex to the 
bone */
                        distance = distfactor_to_bone (verts[i], root[j], 
tip[j],
                                bone->rad_head * scale, bone->rad_tail * scale, 
bone->dist * scale);
@@ -3221,7 +3216,7 @@
                                add_vert_to_defgroup (ob, dgroup, i, distance, 
WEIGHT_REPLACE);
                        else
                                remove_vert_defgroup (ob, dgroup, i);
-
+                       
                        /* do same for mirror */
                        if (dgroupflip && dgroupflip[j] && iflip >= 0) {
                                if (distance!=0.0)
@@ -3306,7 +3301,7 @@
                        if(segments == 0) {
                                segments = 1;
                                bbone = NULL;
-
+                       
                                if(par->pose && 
(pchan=get_pose_channel(par->pose, bone->name))) {
                                        if(bone->segments > 1) {
                                                segments = bone->segments;
@@ -3314,10 +3309,10 @@
                                        }
                                }
                        }
-
+                       
                        segments--;
                }
-
+               
                /* compute root and tip */
                if(bbone) {
                        VECCOPY(root[j], bbone[segments].mat[3]);
@@ -3333,10 +3328,10 @@
                        VECCOPY(root[j], bone->arm_head);
                        VECCOPY(tip[j], bone->arm_tail);
                }
-
+               
                Mat4MulVecfl(par->obmat, root[j]);
                Mat4MulVecfl(par->obmat, tip[j]);
-
+               
                /* set selected */
                if(wpmode) {
                        if ((arm->layer & bone->layer) && (bone->flag & 
BONE_SELECTED))
@@ -3344,7 +3339,7 @@
                }
                else
                        selected[j] = 1;
-
+               
                /* find flipped group */
                if(mirror) {
                        char name[32];
@@ -3352,11 +3347,11 @@
                        BLI_strncpy(name, dgroup->name, 32);
                        // 0 = don't strip off number extensions
                        bone_flip_name(name, 0);
-
+                       
                        for (curdg = ob->defbase.first; curdg; 
curdg=curdg->next)
                                if (!strcmp(curdg->name, name))
                                        break;
-
+                       
                        dgroupflip[j] = curdg;
                }
        }
@@ -3368,12 +3363,12 @@
        if (wpmode) {
                /* if in weight paint mode, use final verts from derivedmesh */
                DerivedMesh *dm = mesh_get_derived_final(ob, CD_MASK_BAREMESH);
-
+               

@@ Diff output truncated at 10240 characters. @@

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to