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-01-17 08:36:58 +0300
committerJoshua Leung <aligorith@gmail.com>2009-01-17 08:36:58 +0300
commit023765eb48f277168ea4e937f153b3333361d534 (patch)
tree8e9774d694593fa6febbb8f43211f632f6e62d88 /source/blender/blenkernel
parentee180ff5ac140f5f19d9a00eb2b914760b06dc77 (diff)
2.5 - AnimData fixes
* Made AnimData blocks be stored as pointer instead of directly in the ID-datablock, so that fewer files will need to be recompiled everytime some animation settings change. * Tried to fix some of the compiler errors that pop up in Yafray code. If this commit doesn't fix it, just disable Yafray code for now (WITH_BF_YAFRAY=0 for scons)...
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_animsys.h3
-rw-r--r--source/blender/blenkernel/intern/anim_sys.c45
-rw-r--r--source/blender/blenkernel/intern/library.c1
3 files changed, 44 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h
index bdb39cd5982..f8a5d91bfa5 100644
--- a/source/blender/blenkernel/BKE_animsys.h
+++ b/source/blender/blenkernel/BKE_animsys.h
@@ -16,6 +16,9 @@ struct AnimData;
/* Get AnimData from the given ID-block. */
struct AnimData *BKE_animdata_from_id(struct ID *id);
+/* Add AnimData to the given ID-block */
+struct AnimData *BKE_id_add_animdata(struct ID *id);
+
/* ************************************* */
// TODO: overrides, remapping, and path-finding api's
diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c
index d377ce044fd..18172488908 100644
--- a/source/blender/blenkernel/intern/anim_sys.c
+++ b/source/blender/blenkernel/intern/anim_sys.c
@@ -25,7 +25,7 @@
/* AnimData API */
/* Get AnimData from the given ID-block. In order for this to work, we assume that
- * the AnimData block is stored immediately after the given ID-block in the struct,
+ * the AnimData pointer is stored immediately after the given ID-block in the struct,
* as per IdAdtTemplate.
*/
AnimData *BKE_animdata_from_id (ID *id)
@@ -36,7 +36,7 @@ AnimData *BKE_animdata_from_id (ID *id)
/* only some ID-blocks have this info for now, so we cast the
* types that do to be of type IdAdtTemplate, and extract the
- * animdata that way
+ * AnimData that way
*/
// TODO: finish adding this for the other blocktypes
switch (GS(id->name)) {
@@ -47,7 +47,7 @@ AnimData *BKE_animdata_from_id (ID *id)
case ID_SCE:
{
IdAdtTemplate *iat= (IdAdtTemplate *)id;
- return &(iat->adt);
+ return iat->adt;
}
break;
}
@@ -56,6 +56,41 @@ AnimData *BKE_animdata_from_id (ID *id)
return NULL;
}
+/* Add AnimData to the given ID-block. In order for this to work, we assume that
+ * the AnimData pointer is stored immediately after the given ID-block in the struct,
+ * as per IdAdtTemplate. Also note that
+ */
+AnimData *BKE_id_add_animdata (ID *id)
+{
+ /* sanity check */
+ if (id == NULL)
+ return NULL;
+
+ /* only some ID-blocks have this info for now, so we cast the
+ * types that do to be of type IdAdtTemplate, and add AnimData that
+ * way
+ */
+ // TODO: finish adding this for the other blocktypes
+ switch (GS(id->name)) {
+ case ID_OB:
+ case ID_KE:
+ case ID_MA: case ID_TE:
+ case ID_LA: case ID_CA: case ID_WO:
+ case ID_SCE:
+ {
+ IdAdtTemplate *iat= (IdAdtTemplate *)id;
+
+ iat->adt= MEM_callocN(sizeof(AnimData), "AnimData");
+ return iat->adt;
+ }
+ break;
+ }
+
+ /* no AnimData (ID-block does not contain this data) */
+ return NULL;
+}
+
+
/* Obtain an RNA-Path from the given ID-block to the property of interest
* - id: ID block that will be used as the 'root' of the path
* - ptr: pointer to struct where setting is stored
@@ -541,8 +576,8 @@ void BKE_animsys_evaluate_all_animation (Main *main, float ctime)
/* objects */
for (id= main->object.first; id; id= id->next) {
- IdAdtTemplate *iat= (IdAdtTemplate *)id;
- BKE_animsys_evaluate_animdata(id, &iat->adt, ctime, ADT_RECALC_ANIM);
+ AnimData *adt= BKE_animdata_from_id(id);
+ BKE_animsys_evaluate_animdata(id, adt, ctime, ADT_RECALC_ANIM);
}
}
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index fa728f1a951..d0e5da5f936 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -78,6 +78,7 @@
#include "DNA_particle_types.h"
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
+#include "DNA_anim_types.h"
#include "BLI_blenlib.h"
#include "BLI_dynstr.h"