edits ontop of Alex's patch from r41292.
[blender.git] / source / blender / blenkernel / intern / action.c
index 9c24675..d02a1d6 100644 (file)
@@ -117,7 +117,7 @@ static void make_localact_apply_cb(ID *id, AnimData *adt, void *mlac_ptr)
        tMakeLocalActionContext *mlac = (tMakeLocalActionContext *)mlac_ptr;
        
        if (adt->action == mlac->act) {
-               if (id->lib==0) {
+               if (id->lib == NULL) {
                        adt->action = mlac->actn;
                        
                        id_us_plus(&mlac->actn->id);
@@ -137,19 +137,14 @@ void make_local_action(bAction *act)
        
        // XXX: double-check this; it used to be just single-user check, but that was when fake-users were still default
        if ((act->id.flag & LIB_FAKEUSER) && (act->id.us<=1)) {
-               act->id.lib= NULL;
-               act->id.flag= LIB_LOCAL;
-               new_id(&bmain->action, (ID *)act, NULL);
+               id_clear_lib_data(bmain, (ID *)act);
                return;
        }
        
        BKE_animdata_main_cb(bmain, make_localact_init_cb, &mlac);
        
        if (mlac.local && mlac.lib==0) {
-               act->id.lib= NULL;
-               act->id.flag= LIB_LOCAL;
-               //make_local_action_channels(act);
-               new_id(&bmain->action, (ID *)act, NULL);
+               id_clear_lib_data(bmain, (ID *)act);
        }
        else if (mlac.local && mlac.lib) {
                mlac.actn= copy_action(act);
@@ -270,7 +265,7 @@ bActionGroup *action_groups_add_new (bAction *act, const char name[])
        
        /* make it selected, with default name */
        agrp->flag = AGRP_SELECTED;
-       strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name));
+       BLI_strncpy(agrp->name, name[0] ? name : "Group", sizeof(agrp->name));
        
        /* add to action, and validate */
        BLI_addtail(&act->groups, agrp);
@@ -524,7 +519,6 @@ void copy_pose (bPose **dst, bPose *src, int copycon)
                if (copycon) {
                        copy_constraints(&listb, &pchan->constraints, TRUE);  // copy_constraints NULLs listb
                        pchan->constraints= listb;
-                       pchan->path= NULL; // XXX remove this line when the new motionpaths are ready... (depreceated code)
                        pchan->mpath= NULL; /* motion paths should not get copied yet... */
                }
                
@@ -595,17 +589,12 @@ void free_pose_channels_hash(bPose *pose)
 
 void free_pose_channel(bPoseChannel *pchan)
 {
-       // XXX this case here will need to be removed when the new motionpaths are ready
-       if (pchan->path) {
-               MEM_freeN(pchan->path);
-               pchan->path= NULL;
-       }
-       
+
        if (pchan->mpath) {
                animviz_free_motionpath(pchan->mpath);
                pchan->mpath= NULL;
        }
-       
+
        free_constraints(&pchan->constraints);
        
        if (pchan->prop) {
@@ -887,7 +876,7 @@ void calc_action_range(const bAction *act, float *start, float *end, short incl_
                                
                                /* get extents for this curve */
                                // TODO: allow enabling/disabling this?
-                               calc_fcurve_range(fcu, &nmin, &nmax, FALSE);
+                               calc_fcurve_range(fcu, &nmin, &nmax, FALSE, TRUE);
                                
                                /* compare to the running tally */
                                min= MIN2(min, nmin);