[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33247] trunk/blender/source/blender/ blenkernel/intern/anim_sys.c: Partial fix for #24773: Material Nodes - there isn't able to set keys on Mapping coordinates
Joshua Leung
aligorith at gmail.com
Tue Nov 23 00:59:00 CET 2010
Revision: 33247
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33247
Author: aligorith
Date: 2010-11-23 00:59:00 +0100 (Tue, 23 Nov 2010)
Log Message:
-----------
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
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/anim_sys.c
Modified: trunk/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim_sys.c 2010-11-22 23:47:00 UTC (rev 33246)
+++ trunk/blender/source/blender/blenkernel/intern/anim_sys.c 2010-11-22 23:59:00 UTC (rev 33247)
@@ -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 @@
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 @@
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 @@
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 @@
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);
}
/* ***************************************** */
More information about the Bf-blender-cvs
mailing list