Merged changes in the trunk up to revision 35203.
[blender.git] / source / blender / blenkernel / intern / anim_sys.c
index b81d611065da584460b1cc63c67dce46cc56528a..2268a1535bd77092f87ac5f08eae87f11408f504 100644 (file)
@@ -1,4 +1,4 @@
-/**
+/*
  * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
@@ -36,8 +36,8 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
-#include "BKE_library.h"
 #include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
 
 #include "DNA_anim_types.h"
 #include "DNA_material_types.h"
@@ -50,6 +50,7 @@
 #include "BKE_nla.h"
 #include "BKE_global.h"
 #include "BKE_main.h"
+#include "BKE_library.h"
 #include "BKE_utildefines.h"
 
 #include "RNA_access.h"
@@ -78,6 +79,7 @@ short id_type_can_have_animdata (ID *id)
                case ID_PA:
                case ID_MA: case ID_TE: case ID_NT:
                case ID_LA: case ID_CA: case ID_WO:
+               case ID_LS:
                case ID_SCE:
                {
                        return 1;
@@ -645,7 +647,7 @@ void BKE_animdata_main_cb (Main *mainptr, ID_AnimData_Edit_Callback func, void *
                AnimData *adt= BKE_animdata_from_id(id); \
                if (adt) func(id, adt, user_data); \
        }
-       
+
        /* "embedded" nodetree cases (i.e. scene/material/texture->nodetree) */
 #define ANIMDATA_NODETREE_IDS_CB(first, NtId_Type) \
        for (id= first; id; id= id->next) { \
@@ -657,13 +659,13 @@ void BKE_animdata_main_cb (Main *mainptr, ID_AnimData_Edit_Callback func, void *
                } \
                if (adt) func(id, adt, user_data); \
        }
-       
+
        /* nodes */
        ANIMDATA_IDS_CB(mainptr->nodetree.first);
-       
+               
        /* textures */
        ANIMDATA_NODETREE_IDS_CB(mainptr->tex.first, Tex);
-       
+               
        /* lamps */
        ANIMDATA_IDS_CB(mainptr->lamp.first);
        
@@ -702,7 +704,10 @@ void BKE_animdata_main_cb (Main *mainptr, ID_AnimData_Edit_Callback func, void *
        
        /* scenes */
        ANIMDATA_NODETREE_IDS_CB(mainptr->scene.first, Scene);
-}
+       
+       /* line styles */
+       ANIMDATA_IDS_CB(mainptr->linestyle.first);
+       }
 
 /* Fix all RNA-Paths throughout the database (directly access the Global.main version)
  * NOTE: it is assumed that the structure we're replacing is <prefix><["><name><"]>
@@ -778,10 +783,13 @@ void BKE_all_animdata_fix_paths_rename (char *prefix, char *oldName, char *newNa
        /* worlds */
        RENAMEFIX_ANIM_IDS(mainptr->world.first);
        
+       /* linestyles */
+       RENAMEFIX_ANIM_IDS(mainptr->linestyle.first);
+       
        /* scenes */
        RENAMEFIX_ANIM_NODETREE_IDS(mainptr->scene.first, Scene);
-}
-
+               }
+               
 /* *********************************** */ 
 /* KeyingSet API */
 
@@ -808,7 +816,7 @@ KS_Path *BKE_keyingset_find_path (KeyingSet *ks, ID *id, const char group_name[]
                        eq_id= 0;
                
                /* path */
-               if ((ksp->rna_path==0) || strcmp(rna_path, ksp->rna_path))
+               if ((ksp->rna_path==NULL) || strcmp(rna_path, ksp->rna_path))
                        eq_path= 0;
                        
                /* index - need to compare whole-array setting too... */
@@ -886,7 +894,7 @@ KS_Path *BKE_keyingset_add_path (KeyingSet *ks, ID *id, const char group_name[],
        /* just store absolute info */
        ksp->id= id;
        if (group_name)
-               BLI_snprintf(ksp->group, 64, group_name);
+               BLI_strncpy(ksp->group, group_name, sizeof(ksp->group));
        else
                ksp->group[0]= '\0';
        
@@ -916,10 +924,11 @@ void BKE_keyingset_free_path (KeyingSet *ks, KS_Path *ksp)
        /* sanity check */
        if ELEM(NULL, ks, ksp)
                return;
-       
+
        /* free RNA-path info */
-       MEM_freeN(ksp->rna_path);
-       
+       if(ksp->rna_path)
+               MEM_freeN(ksp->rna_path);
+
        /* free path itself */
        BLI_freelinkN(&ks->paths, ksp);
 }
@@ -1854,7 +1863,7 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
                /* if there are strips, evaluate action as per NLA rules */
                if ((has_strips) || (adt->actstrip)) {
                        /* make dummy NLA strip, and add that to the stack */
-                       NlaStrip dummy_strip= {0};
+                       NlaStrip dummy_strip= {NULL};
                        ListBase dummy_trackslist;
                        
                        dummy_trackslist.first= dummy_trackslist.last= &dummy_strip;
@@ -1913,11 +1922,13 @@ static void animsys_evaluate_nla (PointerRNA *ptr, AnimData *adt, float ctime)
 /* Clear all overides */
 
 /* Add or get existing Override for given setting */
+#if 0
 AnimOverride *BKE_animsys_validate_override (PointerRNA *UNUSED(ptr), char *UNUSED(path), int UNUSED(array_index))
 {
        // FIXME: need to define how to get overrides
        return NULL;
 } 
+#endif
 
 /* -------------------- */
 
@@ -2123,6 +2134,9 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
        /* particles */
        EVAL_ANIM_IDS(main->particle.first, ADT_RECALC_ANIM);
        
+       /* linestyles */
+       EVAL_ANIM_IDS(main->linestyle.first, ADT_RECALC_ANIM);
+       
        /* objects */
                /* ADT_RECALC_ANIM doesn't need to be supplied here, since object AnimData gets 
                 * this tagged by Depsgraph on framechange. This optimisation means that objects