Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-08-02 15:05:13 +0400
committerJoshua Leung <aligorith@gmail.com>2009-08-02 15:05:13 +0400
commit8aae02bb844538421aa61f04f590d1e20c429472 (patch)
treec7abb0ac4db9953ac5e540ba9053b8983923e91e /source/blender/blenkernel
parent90f089e6b600759acb45b34208540cf7d4d82af2 (diff)
2.5 - Animation Playback Tweaks
* Added some optimisations to avoid having to try evaluating some data that won't have any effect. * Converted playback buttons in timeline header to use operators too
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index 2b4a2c135eb..7278fee5ab8 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -1391,19 +1391,36 @@ void BKE_animsys_evaluate_animdata (ID *id, AnimData *adt, float ctime, short re
* 'local' (i.e. belonging in the nearest ID-block that setting is related to, not a
* standard 'root') block are overridden by a larger 'user'
*/
-// TODO: we currently go over entire 'main' database...
+// FIXME?: we currently go over entire 'main' database...
void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
{
ID *id;
if (G.f & G_DEBUG)
printf("Evaluate all animation - %f \n", ctime);
-
- /* macro for less typing */
-#define EVAL_ANIM_IDS(first, flag) \
+
+ /* macro for less typing
+ * - only evaluate animation data for id if it has users (and not just fake ones)
+ * - whether animdata exists is checked for by the evaluation function, though taking
+ * this outside of the function may make things slightly faster?
+ */
+#define EVAL_ANIM_IDS(first, aflag) \
for (id= first; id; id= id->next) { \
AnimData *adt= BKE_animdata_from_id(id); \
- BKE_animsys_evaluate_animdata(id, adt, ctime, flag); \
+ if ( (id->us > 1) || (id->us && !(id->flag & LIB_FAKEUSER)) ) \
+ BKE_animsys_evaluate_animdata(id, adt, ctime, aflag); \
+ }
+
+ /* optimisation:
+ * when there are no actions, don't go over database and loop over heaps of datablocks,
+ * which should ultimately be empty, since it is not possible for now to have any animation
+ * without some actions, and drivers wouldn't get affected by any state changes
+ */
+ if (main->action.first == NULL) {
+ if (G.f & G_DEBUG)
+ printf("\tNo Actions, so no animation needs to be evaluated...\n");
+
+ return;
}
/* nodes */