[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18546] branches/blender2.5/blender/source /blender: 2.5: Blender "Animato" - New Animation System

Joshua Leung aligorith at gmail.com
Sat Jan 17 04:13:08 CET 2009


Revision: 18546
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18546
Author:   aligorith
Date:     2009-01-17 04:12:50 +0100 (Sat, 17 Jan 2009)

Log Message:
-----------
2.5: Blender "Animato" - New Animation System 

Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.

Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action. 
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves. 
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still) 

There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html

So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.

Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/BKE_action.h
    branches/blender2.5/blender/source/blender/blenkernel/BKE_constraint.h
    branches/blender2.5/blender/source/blender/blenkernel/BKE_ipo.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/action.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/anim.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/armature.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/constraint.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/curve.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/depsgraph.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/key.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/lattice.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/library.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/material.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/object.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/particle.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/particle_system.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/pointcache.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/scene.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/seqeffects.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/sequence.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/texture.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/world.c
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_ops.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframes_edit.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframes_general.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
    branches/blender2.5/blender/source/blender/editors/armature/editarmature.c
    branches/blender2.5/blender/source/blender/editors/armature/poselib.c
    branches/blender2.5/blender/source/blender/editors/armature/poseobject.c
    branches/blender2.5/blender/source/blender/editors/curve/editcurve.c
    branches/blender2.5/blender/source/blender/editors/gpencil/editaction_gpencil.c
    branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
    branches/blender2.5/blender/source/blender/editors/include/ED_keyframes_edit.h
    branches/blender2.5/blender/source/blender/editors/include/ED_keyframing.h
    branches/blender2.5/blender/source/blender/editors/object/editconstraint.c
    branches/blender2.5/blender/source/blender/editors/object/editkey.c
    branches/blender2.5/blender/source/blender/editors/object/object_edit.c
    branches/blender2.5/blender/source/blender/editors/object/object_ops.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_edit.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_ops.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_select.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawobject.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/view3d_draw.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_conversions.c
    branches/blender2.5/blender/source/blender/editors/transform/transform_generics.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_camera_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_ipo_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_key_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_lamp_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_material_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_object_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_scene_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_texture_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_world_types.h
    branches/blender2.5/blender/source/blender/makesdna/intern/makesdna.c
    branches/blender2.5/blender/source/blender/render/intern/source/convertblender.c
    branches/blender2.5/blender/source/blender/render/intern/source/initrender.c
    branches/blender2.5/blender/source/blender/render/intern/source/texture.c
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/blenkernel/BKE_animsys.h
    branches/blender2.5/blender/source/blender/blenkernel/BKE_fcurve.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_anim_types.h

Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_action.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_action.h	2009-01-17 00:51:42 UTC (rev 18545)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_action.h	2009-01-17 03:12:50 UTC (rev 18546)
@@ -26,6 +26,7 @@
  * All rights reserved.
  *
  * Contributor(s): Full recode, Ton Roosendaal, Crete 2005
+ *				Full recode, Joshua Leung, 2009
  *
  * ***** END GPL LICENSE BLOCK *****
  */
@@ -36,11 +37,10 @@
 #include "DNA_listBase.h"
 
 /**
- * The following structures are defined in DNA_action_types.h
+ * The following structures are defined in DNA_action_types.h, and DNA_anim_types.h
  */
 
-struct bAction;
-struct bActionChannel;
+struct nAction;
 struct bPose;
 struct bPoseChannel;
 struct Object;
@@ -52,9 +52,25 @@
 extern "C" {
 #endif
 
-struct bAction *add_empty_action(const char name[]);
+struct nAction *add_empty_action(const char name[]);
 	
+	/**
+ * Allocate a new bAction on the heap and copy 
+ * the contents of src into it. If src is NULL NULL is returned.
+ */
+
+struct nAction *copy_action(struct nAction *src);
+
 /**
+ * Deallocate the action's channels including constraint channels.
+ * does not free the action structure.
+ */
+void free_action(struct nAction *act);
+
+// XXX is this needed?
+void make_local_action(struct nAction *act);
+	
+/**
  * Removes and deallocates all channels from a pose.
  * Does not free the pose itself.
  */
@@ -72,20 +88,8 @@
 void copy_pose(struct bPose **dst, struct bPose *src,
 			   int copyconstraints);
 
-/**
- * Deallocate the action's channels including constraint channels.
- * does not free the action structure.
- */
-void free_action(struct bAction * id);
 
-void make_local_action(struct bAction *act);
 
-/* only for armatures, doing pose actions only too */
-void do_all_pose_actions(struct Scene *scene, struct Object *);
-/* only for objects, doing only 1 channel */
-void do_all_object_actions(struct Scene *scene, struct Object *);
-
-
 /**
  * Return a pointer to the pose channel of the given name
  * from this pose.
@@ -114,13 +118,6 @@
 void framechange_poses_clear_unkeyed(void);
 
 /**
- * Allocate a new bAction on the heap and copy 
- * the contents of src into it. If src is NULL NULL is returned.
- */
-
-struct bAction *copy_action(struct bAction *src);
-
-/**
  * Some kind of bounding box operation on the action.
  */
 void calc_action_range(const struct bAction *act, float *start, float *end, int incl_hidden);
@@ -135,22 +132,6 @@
  */
 void what_does_obaction(struct Scene *scene, struct Object *ob, struct Object *workob, struct bAction *act, float cframe);
 
-/**
- * Iterate through the action channels of the action
- * and return the channel with the given name.
- * Returns NULL if no channel.
- */
-struct bActionChannel *get_action_channel(struct bAction *act,  const char *name);
-/**
- * Iterate through the action channels of the action
- * and return the channel with the given name.
- * Returns and adds new channel if no channel.
- */
-struct bActionChannel *verify_action_channel(struct bAction *act, const char *name);
-
-  /* baking */
-struct bAction *bake_obIPO_to_action(struct Object *ob);
-
 /* exported for game engine */
 void blend_poses(struct bPose *dst, struct bPose *src, float srcweight, short mode);
 void extract_pose_from_pose(struct bPose *pose, const struct bPose *src);
@@ -164,11 +145,8 @@
 float get_action_frame(struct Object *ob, float cframe);
 /* map strip time to global time (frame nr)  */
 float get_action_frame_inv(struct Object *ob, float cframe);
-/* builds a list of NlaIpoChannel with ipo values to write in datablock */
-void extract_ipochannels_from_action(ListBase *lb, struct ID *id, struct bAction *act, const char *name, float ctime);
-/* write values returned by extract_ipochannels_from_action, returns the number of value written */
-int execute_ipochannels(ListBase *lb);
 
+
 /* functions used by the game engine */
 void game_copy_pose(struct bPose **dst, struct bPose *src);
 void game_free_pose(struct bPose *pose);

Added: branches/blender2.5/blender/source/blender/blenkernel/BKE_animsys.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_animsys.h	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_animsys.h	2009-01-17 03:12:50 UTC (rev 18546)
@@ -0,0 +1,34 @@
+/* Testing code for new animation system in 2.5 
+ * Copyright 2009, Joshua Leung
+ */
+
+#ifndef BKE_ANIM_SYS_H
+#define BKE_ANIM_SYS_H
+
+struct ID;
+struct ListBase;
+struct Main;
+struct AnimData;
+
+/* ************************************* */
+/* AnimData API */
+
+/* Get AnimData from the given ID-block. */
+struct AnimData *BKE_animdata_from_id(struct ID *id);
+
+/* ************************************* */
+// TODO: overrides, remapping, and path-finding api's
+
+/* ************************************* */
+/* Evaluation API */
+
+/* Evaluation loop for evaluating animation data  */
+void BKE_animsys_evaluate_animdata(struct ID *id, struct AnimData *adt, float ctime, short recalc);
+
+/* Evaluation of all ID-blocks with Animation Data blocks - Animation Data Only */
+void BKE_animsys_evaluate_all_animation(struct Main *main, float ctime);
+
+
+/* ************************************* */
+
+#endif /* BKE_ANIM_SYS_H*/

Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_constraint.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_constraint.h	2009-01-17 00:51:42 UTC (rev 18545)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_constraint.h	2009-01-17 03:12:50 UTC (rev 18546)
@@ -35,7 +35,6 @@
 struct ListBase;
 struct Object;
 struct Scene;
-struct bConstraintChannel;
 struct bPoseChannel;
 
 /* ---------------------------------------------------------------------------- */
@@ -120,15 +119,6 @@
 void extract_proxylocal_constraints(struct ListBase *dst, struct ListBase *src);
 short proxylocked_constraints_owner(struct Object *ob, struct bPoseChannel *pchan);
 
-/* Constraint Channel function prototypes */
-struct bConstraintChannel *get_constraint_channel(struct ListBase *list, const char *name);
-struct bConstraintChannel *verify_constraint_channel(struct ListBase *list, const char *name);
-void do_constraint_channels(struct ListBase *conbase, struct ListBase *chanbase, float ctime, short onlydrivers);
-void copy_constraint_channels(struct ListBase *dst, struct ListBase *src);
-void clone_constraint_channels(struct ListBase *dst, struct ListBase *src);
-void free_constraint_channels(struct ListBase *chanbase);
-
-
 /* Constraint Evaluation function prototypes */
 struct bConstraintOb *constraints_make_evalob(struct Scene *scene, struct Object *ob, void *subdata, short datatype);
 void constraints_clear_evalob(struct bConstraintOb *cob);

Added: branches/blender2.5/blender/source/blender/blenkernel/BKE_fcurve.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_fcurve.h	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_fcurve.h	2009-01-17 03:12:50 UTC (rev 18546)
@@ -0,0 +1,100 @@
+/* Testing code for new animation system in 2.5 
+ * Copyright 2009, Joshua Leung
+ */
+
+#ifndef BKE_FCURVE_H
+#define BKE_FCURVE_H
+
+//struct ListBase;
+struct FCurve;
+struct FModifier;
+struct ChannelDriver;
+struct BezTriple;
+
+/* ************** Keyframe Tools ***************** */
+
+// XXX this stuff is defined in BKE_ipo.h too, so maybe skip for now?
+typedef struct CfraElem {
+	struct CfraElem *next, *prev;
+	float cfra;
+	int sel;
+} CfraElem;
+
+void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt);
+
+/* ************** F-Curve Drivers ***************** */
+
+void fcurve_free_driver(struct FCurve *fcu);
+
+/* ************** F-Curve Modifiers *************** */
+
+/* F-Curve Modifier Type-Info (fmi):
+ *  This struct provides function pointers for runtime, so that functions can be
+ *  written more generally (with fewer/no special exceptions for various modifiers).
+ *
+ *  Callers of these functions must check that they actually point to something useful,
+ *  as some constraints don't define some of these.
+ *
+ *  Warning: it is not too advisable to reorder order of members of this struct,
+ *			as you'll have to edit quite a few ($FMODIFIER_NUM_TYPES) of these
+ *			structs.
+ */
+typedef struct FModifierTypeInfo {
+	/* admin/ident */
+	short type;				/* FMODIFIER_TYPE_### */
+	short size;				/* size in bytes of the struct */
+	char name[32]; 			/* name of modifier in interface */
+	char structName[32];	/* name of struct for SDNA */
+	
+	/* data management function pointers - special handling */
+		/* free any data that is allocated separately (optional) */
+	void (*free_data)(struct FModifier *fcm);
+		/* copy any special data that is allocated separately (optional) */
+	void (*copy_data)(struct FModifier *fcm, struct FModifier *src);
+		/* set settings for data that will be used for FCuModifier.data (memory already allocated using MEM_callocN) */
+	void (*new_data)(void *mdata);
+	
+	/* evaluation */
+		/* evaluate the modifier for the given time and 'accumulated' value */
+	void (*evaluate_modifier)(struct FCurve *fcu, struct FModifier *fcm, float *cvalue, float evaltime);
+} FModifierTypeInfo;
+
+/* Function Prototypes for FModifierTypeInfo's */
+FModifierTypeInfo *fmodifier_get_typeinfo(struct FModifier *fcm);
+FModifierTypeInfo *get_fmodifier_typeinfo(int type);
+
+/* ---------------------- */
+
+// TODO... general API here..
+struct FModifier *fcurve_add_modifier(struct FCurve *fcu, int type);
+void fcurve_copy_modifiers(ListBase *dst, ListBase *src);
+void fcurve_remove_modifier(struct FCurve *fcu, struct FModifier *fcm);
+void fcurve_free_modifiers(struct FCurve *fcu);
+void fcurve_bake_modifiers(struct FCurve *fcu, int start, int end);
+
+/* ************** F-Curves API ******************** */
+
+/* -------- Data Managemnt  --------  */
+
+void free_fcurve(struct FCurve *fcu);
+struct FCurve *copy_fcurve(struct FCurve *fcu);
+
+/* find matching F-Curve in the given list of F-Curves */
+struct FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_index);
+
+/* -------- Curve Sanity --------  */
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list