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>2010-11-23 02:59:00 +0300
committerJoshua Leung <aligorith@gmail.com>2010-11-23 02:59:00 +0300
commite1506d1f12e57e126bcd9560dd8c98fbe9f40c5e (patch)
treef1da798d13c6ac4edbf5536fe61fde5ea5c85d30 /source/blender/blenkernel/intern/anim_sys.c
parent4816f8fd0063b471d111599aa8fdb53c53e108ef (diff)
Partial fix for #24773: Material Nodes - there isn't able to set keys on Mapping coordinates
Playback now works. The problem was that material/texture nodetrees were getting ignored completely, as I was assuming that all of these existed in the main->nodetree collection when in fact only the "group" nodetrees lived there. I don't really agree with this, but that's the way it is... TODO: animation editor support still to come
Diffstat (limited to 'source/blender/blenkernel/intern/anim_sys.c')
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index e50d4880fbe..deb4e51950c 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -39,9 +39,10 @@
#include "BKE_library.h"
#include "BLI_dynstr.h"
-
#include "DNA_anim_types.h"
+#include "DNA_material_types.h"
#include "DNA_scene_types.h"
+#include "DNA_texture_types.h"
#include "BKE_animsys.h"
#include "BKE_action.h"
@@ -1839,7 +1840,7 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
if (G.f & G_DEBUG)
printf("Evaluate all animation - %f \n", ctime);
- /* macro for less typing
+ /* macros 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?
@@ -1851,6 +1852,24 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
BKE_animsys_evaluate_animdata(id, adt, ctime, aflag); \
} \
}
+ /* another macro for the "embedded" nodetree cases
+ * - this is like EVAL_ANIM_IDS, but this handles the case "embedded nodetrees"
+ * (i.e. scene/material/texture->nodetree) which we need a special exception
+ * for, otherwise they'd get skipped
+ * - ntp = "node tree parent" = datablock where node tree stuff resides
+ */
+#define EVAL_ANIM_NODETREE_IDS(first, NtId_Type, aflag) \
+ for (id= first; id; id= id->next) { \
+ if (ID_REAL_USERS(id) > 0) { \
+ AnimData *adt= BKE_animdata_from_id(id); \
+ NtId_Type *ntp= (NtId_Type *)id; \
+ if (ntp->nodetree) { \
+ AnimData *adt2= BKE_animdata_from_id((ID *)ntp->nodetree); \
+ BKE_animsys_evaluate_animdata((ID *)ntp->nodetree, adt2, ctime, ADT_RECALC_ANIM); \
+ } \
+ 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,
@@ -1871,13 +1890,13 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
EVAL_ANIM_IDS(main->nodetree.first, ADT_RECALC_ANIM);
/* textures */
- EVAL_ANIM_IDS(main->tex.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_NODETREE_IDS(main->tex.first, Tex, ADT_RECALC_ANIM);
/* lamps */
EVAL_ANIM_IDS(main->lamp.first, ADT_RECALC_ANIM);
/* materials */
- EVAL_ANIM_IDS(main->mat.first, ADT_RECALC_ANIM);
+ EVAL_ANIM_NODETREE_IDS(main->mat.first, Material, ADT_RECALC_ANIM);
/* cameras */
EVAL_ANIM_IDS(main->camera.first, ADT_RECALC_ANIM);
@@ -1912,19 +1931,7 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
EVAL_ANIM_IDS(main->world.first, ADT_RECALC_ANIM);
/* scenes */
- for (id= main->scene.first; id; id= id->next) {
- AnimData *adt= BKE_animdata_from_id(id);
- Scene *scene= (Scene *)id;
-
- /* do compositing nodes first (since these aren't included in main tree) */
- if (scene->nodetree) {
- AnimData *adt2= BKE_animdata_from_id((ID *)scene->nodetree);
- BKE_animsys_evaluate_animdata((ID *)scene->nodetree, adt2, ctime, ADT_RECALC_ANIM);
- }
-
- /* now execute scene animation data as per normal */
- BKE_animsys_evaluate_animdata(id, adt, ctime, ADT_RECALC_ANIM);
- }
+ EVAL_ANIM_NODETREE_IDS(main->scene.first, Scene, ADT_RECALC_ANIM);
}
/* ***************************************** */