[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12765] branches/animsys-aligorith/source: == Animation System Refresh '07 - Initial Commit ==

Joshua Leung aligorith at gmail.com
Mon Dec 3 11:48:28 CET 2007


Revision: 12765
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12765
Author:   aligorith
Date:     2007-12-03 11:48:28 +0100 (Mon, 03 Dec 2007)

Log Message:
-----------
== Animation System Refresh '07 - Initial Commit ==

Initial commit of what code I've got written so far. It is currently impossible to compile this branch, as there are still many files which have not been updated. This is still a very WIP progress commit, with some stuff that is still subject to drastic change.

Code Cleanups/Reshuffles:
* Major code reshuffles and general code tidying in ipo.c for more organised code
* IpoCurve struct, IpoDriver struct and related settings have been moved from DNA_curve_types.h to DNA_ipo_types.h (where they should really belong!)
* Keyframing code (insert_key and common_insertkey) have now been moved into their own file - keyframing.c. insert_key code has been cleaned up in the process, making "Visual" and "Needed" become better integrated into keyframing process
* Removed the need for adding entries in multiple places (some duplicated) to add a new animatable type. This has been achieved by replacing the adrcode system with the bKeyableType system. This paves the way for "everything is animatable". 
* Also related to the bKeyableType system, quite a few of the sdna header files have had "tags" added so that they can be read by sdna2kt.py 
* Animating Layers and Materials should now be easier. Each one of these settings now has it's own channel, instead of just having a single channel which corresponded to an internal var (no longer exposed as evil bitmapped stuff). Once again related to the new system.
* Ipo blocktypes now have their own defines (as the enum IPOB_blocktype in DNA_ipo_types.h), as opposed to directly using ID's.
* All animation data for a particular datablock is now grouped together under a bAnimData struct. This means that there can be separate NLA datasets for Object-Level and Pose-Level animation for example.

What's New:
* In makesdna/intern folder, there's a new PyScript/utility called sdna2kt.py. This script parses the DNA_*_types.h files to extract tags in the comments, which define the settings for each keyable member of a struct (or enum). The data collected is used to automagically generate the keyabletypes.c file in blenkernel/intern, which contains definitions of all the bKeyableTypes available by default. Check the start of the script for documentation on usage.
* As a side effect of this new system, euler rotation curves can be used for bones. (Note: these are going to be slower than just straight quats and may be less reliable. Also, Ton doesn't really like these :/)  
* Ipo-Curves now have "piecewise" interpolation. The interpolation mode of a BezTriple, is used to determine how the stretch of curve between that BezTriple and the next one is interpolated. (Interface tools to set this still need to be coded, but the backend is done)
* KeyingSets (not totally implemented yet) will allow for defining custom groups of KeyableTypes to keyframe together. 

Modified Paths:
--------------
    branches/animsys-aligorith/source/blender/blenkernel/BKE_action.h
    branches/animsys-aligorith/source/blender/blenkernel/BKE_ipo.h
    branches/animsys-aligorith/source/blender/blenkernel/BKE_main.h
    branches/animsys-aligorith/source/blender/blenkernel/bad_level_call_stubs/stubs.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/action.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/blender.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/constraint.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/effect.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/ipo.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/key.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/lattice.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/library.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/object.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/scene.c
    branches/animsys-aligorith/source/blender/blenloader/intern/readfile.c
    branches/animsys-aligorith/source/blender/blenloader/intern/writefile.c
    branches/animsys-aligorith/source/blender/include/BIF_butspace.h
    branches/animsys-aligorith/source/blender/include/BSE_editipo.h
    branches/animsys-aligorith/source/blender/include/butspace.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_ID.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_action_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_camera_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_constraint_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_curve_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_ipo_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_lamp_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_material_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_modifier_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_object_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_particle_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_space_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_texture_types.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_world_types.h
    branches/animsys-aligorith/source/blender/makesdna/intern/makesdna.c
    branches/animsys-aligorith/source/blender/python/BPY_extern.h
    branches/animsys-aligorith/source/blender/python/api2_2x/Constraint.c
    branches/animsys-aligorith/source/blender/python/api2_2x/Object.c
    branches/animsys-aligorith/source/blender/src/butspace.c
    branches/animsys-aligorith/source/blender/src/buttons_object.c
    branches/animsys-aligorith/source/blender/src/drawaction.c
    branches/animsys-aligorith/source/blender/src/editipo.c
    branches/animsys-aligorith/source/blender/src/editipo_lib.c
    branches/animsys-aligorith/source/blender/src/editkey.c
    branches/animsys-aligorith/source/creator/creator.c

Added Paths:
-----------
    branches/animsys-aligorith/source/blender/blenkernel/intern/keyabletypes.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/keyingsets.c
    branches/animsys-aligorith/source/blender/include/BIF_keyframing.h
    branches/animsys-aligorith/source/blender/makesdna/DNA_animdata_types.h
    branches/animsys-aligorith/source/blender/makesdna/intern/_sdna2kt_extras.py
    branches/animsys-aligorith/source/blender/makesdna/intern/sdna2kt.py
    branches/animsys-aligorith/source/blender/src/buttons_props.c
    branches/animsys-aligorith/source/blender/src/keyframing.c

Property Changed:
----------------
    branches/animsys-aligorith/source/blender/makesdna/DNA_particle_types.h

Modified: branches/animsys-aligorith/source/blender/blenkernel/BKE_action.h
===================================================================
--- branches/animsys-aligorith/source/blender/blenkernel/BKE_action.h	2007-12-03 09:43:56 UTC (rev 12764)
+++ branches/animsys-aligorith/source/blender/blenkernel/BKE_action.h	2007-12-03 10:48:28 UTC (rev 12765)
@@ -95,8 +95,7 @@
  * already exists in this pose - if not a new one is
  * allocated and initialized.
  */
-struct bPoseChannel *verify_pose_channel(struct bPose* pose, 
-										 const char* name);
+struct bPoseChannel *verify_pose_channel(struct bPose *pose, const char *name);
 
 /* sets constraint flags */
 void update_pose_constraint_flags(struct bPose *pose);

Modified: branches/animsys-aligorith/source/blender/blenkernel/BKE_ipo.h
===================================================================
--- branches/animsys-aligorith/source/blender/blenkernel/BKE_ipo.h	2007-12-03 09:43:56 UTC (rev 12764)
+++ branches/animsys-aligorith/source/blender/blenkernel/BKE_ipo.h	2007-12-03 10:48:28 UTC (rev 12765)
@@ -27,19 +27,13 @@
  *
  * The Original Code is: all of this file.
  *
- * Contributor(s): none yet.
+ * Contributor(s): 2007, Joshua Leung, IPO System Recode
  *
  * ***** END GPL/BL DUAL LICENSE BLOCK *****
  */
 #ifndef BKE_IPO_H
 #define BKE_IPO_H
 
-typedef struct CfraElem {
-	struct CfraElem *next, *prev;
-	float cfra;
-	int sel;
-} CfraElem;
-
 struct Ipo;
 struct IpoCurve;
 struct MTex;
@@ -52,67 +46,122 @@
 struct bPoseChannel;
 struct bActionChannel;
 struct rctf;
+struct bKeyableType;
 
-float frame_to_float(int cfra);
+/* ------------ Struct Definitions ---------------------- */
 
+/* Frame Element: often used to find keyframe 'columns'  */
+typedef struct CfraElem {
+	struct CfraElem *next, *prev;
+	float cfra;
+	int sel;
+} CfraElem;
+
+
+/* ------------ Useful Macro Definitions ---------------- */
+
+
+/* the return value (i.e. the pointer we're returning) is calculated as follows:
+ *	pointer to data is cast into a pointer, then has the offset (in bytes) added, then converted back to a void pointer
+ *	this assumes that sizeof(char *) is 1 byte
+ */
+#define GIVE_VARADDR(data, offset) ((void *)( ((char *)data) + offset ))
+
+/* ------------- Data-Level Function Prototypes ---------- */
+
 void free_ipo_curve(struct IpoCurve *icu);
 void free_ipo(struct Ipo *ipo);
-void ipo_default_v2d_cur(int blocktype, struct rctf *cur);
-struct Ipo *add_ipo(char *name, int idcode);
+
+void ipo_default_v2d_cur(short blocktype, struct rctf *cur);
+
+struct Ipo *add_ipo(char *name, short blocktype);
 struct Ipo *copy_ipo(struct Ipo *ipo);
+
 void ipo_idnew(struct Ipo *ipo);
+
 void make_local_obipo(struct Ipo *ipo);
 void make_local_matipo(struct Ipo *ipo);
 void make_local_keyipo(struct Ipo *ipo);
 void make_local_ipo(struct Ipo *ipo);
-struct IpoCurve *find_ipocurve(struct Ipo *ipo, int adrcode);
 
+/* ------------- Keyframe Column Tools ---------- */
+
+void add_to_cfra_elem(struct ListBase *lb, struct BezTriple *bezt);
+void make_cfra_list(struct Ipo *ipo, struct ListBase *elems);
+
+/* ------------- IPO-Curve Data Integrity ---------- */
+
 void calchandles_ipocurve(struct IpoCurve *icu);
 void testhandles_ipocurve(struct IpoCurve *icu);
 void sort_time_ipocurve(struct IpoCurve *icu);
 int test_time_ipocurve(struct IpoCurve *icu);
 void correct_bezpart(float *v1, float *v2, float *v3, float *v4);
+
+/* ------------- Curve Calculations ---------- */
+
 int findzero(float x, float q0, float q1, float q2, float q3, float *o);
 void berekeny(float f1, float f2, float f3, float f4, float *o, int b);
 void berekenx(float *f, float *o, int b);
+
+/* -------------- Keyframing Tools  ---------------- */
+
+int insert_bezt_icu(struct IpoCurve *icu, struct BezTriple *bezt);
+void insert_vert_icu(struct IpoCurve *icu, float x, float y, short quick);
+
+/* ------------- Keyable-Type Get/Setters ----------- */
+
+void kt_write_ipo(struct bKeyableType *kt, void *data, float value);
+float kt_read_ipo(struct bKeyableType *kt, void *data);
+
+void kt_write_pyval(struct bKeyableType *kt, void *data, float value);
+float kt_read_pyval(struct bKeyableType *kt, void *data);
+
+/* ------------- Keyable-Type Tools ----------------- */
+
+short kt_is_match(struct bKeyableType *kt, struct bKeyableType *kta);
+struct bKeyableType *find_kt_blockname(short blocktype, char name[]);
+struct IpoCurve *find_icu_with_kt(struct Ipo *ipo, struct bKeyableType *kt);
+struct IpoCurve *find_icu_with_ktname(struct Ipo *ipo, char name[]);
+
+void icu_fix_ktpointers(struct Ipo *ipo, struct IpoCurve *icu);
+void ipo_fix_oldversions(struct Ipo *ipo);
+
+/* ------------- IPO - Calculations ------------------ */
+
 float eval_icu(struct IpoCurve *icu, float ipotime);
 void calc_icu(struct IpoCurve *icu, float ctime);
-float calc_ipo_time(struct Ipo *ipo, float ctime);
 void calc_ipo(struct Ipo *ipo, float ctime);
-void write_ipo_poin(void *poin, int type, float val);
-float read_ipo_poin(void *poin, int type);
-void *give_mtex_poin(struct MTex *mtex, int adrcode );
 
-void *get_ipo_poin(struct ID *id, struct IpoCurve *icu, int *type);
-void *get_pchan_ipo_poin(struct bPoseChannel *pchan, int adrcode);
+short calc_ipo_spec(struct Ipo *ipo, char name[], float *tval);
+float ipo_channel_getvalue(struct Ipo *ipo, char name[], float ctime);
 
-void set_icu_vars(struct IpoCurve *icu);
+/* ------------- IPO - Execution ------------------ */
 
-void execute_ipo(struct ID *id, struct Ipo *ipo);
-void execute_action_ipo(struct bActionChannel *achan, struct bPoseChannel *pchan);
+void apply_anim_ipo(struct Ipo *ipo, void *destination);
+void apply_driven_ipo(struct Ipo *ipo, void *destination, float ctime);
+void apply_poseanim_ipo(struct bActionChannel *achan, struct bPoseChannel *pchan);
 
+/* ------------- Old-Cruft Function Prototypes ---------- */
+
+float frame_to_float(int cfra);
+void clear_delta_obipo(struct Ipo *ipo);
+
+
+
+
+/*
 void do_ipo_nocalc(struct Ipo *ipo);
 void do_ipo(struct Ipo *ipo);
 void do_mat_ipo(struct Material *ma);
 void do_ob_ipo(struct Object *ob);
 void do_seq_ipo(struct Sequence *seq);
-void do_ob_ipodrivers(struct Object *ob, struct Ipo *ipo, float ctime);
 
-int has_ipo_code(struct Ipo *ipo, int code);
 void do_all_data_ipos(void);
-int calc_ipo_spec(struct Ipo *ipo, int adrcode, float *ctime);
-void clear_delta_obipo(struct Ipo *ipo);
-void add_to_cfra_elem(struct ListBase *lb, struct BezTriple *bezt);
-void make_cfra_list(struct Ipo *ipo, struct ListBase *elems);
 
-/* the sort is an IPO_Channel... */
+// the sort is an IPO_Channel... 
 int IPO_GetChannels(struct Ipo *ipo, short *channels);
+*/
 
-float IPO_GetFloatValue(struct Ipo *ipo,
-/*  						struct IPO_Channel channel, */
-						/* channels are shorts... bit ugly for now*/
-						short c,
-						float ctime);
 
 #endif
 

Modified: branches/animsys-aligorith/source/blender/blenkernel/BKE_main.h
===================================================================
--- branches/animsys-aligorith/source/blender/blenkernel/BKE_main.h	2007-12-03 09:43:56 UTC (rev 12764)
+++ branches/animsys-aligorith/source/blender/blenkernel/BKE_main.h	2007-12-03 10:48:28 UTC (rev 12765)
@@ -79,6 +79,7 @@
 	ListBase nodetree;
 	ListBase brush;
 	ListBase particle;
+	ListBase animdata;
 } Main;
 
 

Modified: branches/animsys-aligorith/source/blender/blenkernel/bad_level_call_stubs/stubs.c
===================================================================
--- branches/animsys-aligorith/source/blender/blenkernel/bad_level_call_stubs/stubs.c	2007-12-03 09:43:56 UTC (rev 12764)
+++ branches/animsys-aligorith/source/blender/blenkernel/bad_level_call_stubs/stubs.c	2007-12-03 10:48:28 UTC (rev 12765)
@@ -61,7 +61,6 @@
 struct ListBase;
 
 char *getIpoCurveName( struct IpoCurve * icu );
-void insert_vert_icu(struct IpoCurve *icu, float x, float y, short fast);
 struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int e);
 void elbeemDebugOut(char *msg);
 void fluidsimSettingsFree(struct FluidsimSettings* sb);
@@ -85,11 +84,6 @@
 	return 0;
 }
 
-void insert_vert_icu(struct IpoCurve *icu, float x, float y, short fast)
-{
-}
-
-
 struct IpoCurve *verify_ipocurve(struct ID *id, short a, char *b, char *d, int e)
 {
 	return 0;

Modified: branches/animsys-aligorith/source/blender/blenkernel/intern/action.c
===================================================================
--- branches/animsys-aligorith/source/blender/blenkernel/intern/action.c	2007-12-03 09:43:56 UTC (rev 12764)
+++ branches/animsys-aligorith/source/blender/blenkernel/intern/action.c	2007-12-03 10:48:28 UTC (rev 12765)
@@ -35,6 +35,7 @@
 #include <string.h>
 #include <math.h>
 #include <stdlib.h>	/* for NULL */
+#include <stdio.h> /* for sprintf */
 
 #include "MEM_guardedalloc.h"
 
@@ -548,7 +549,7 @@
 						/* Evaluates and sets the internal ipo value */
 						calc_ipo(achan->ipo, ctime);
 						/* This call also sets the pchan flags */
-						execute_action_ipo(achan, &pchan);
+						apply_poseanim_ipo(achan, &pchan);
 						
 						/* store offset that moves src to location of pchan */
 						VecSubf(vec, dpchan->loc, pchan.loc);
@@ -696,13 +697,11 @@
 void extract_pose_from_action(bPose *pose, bAction *act, float ctime) 
 {
 	bActionChannel *achan;
-	bPoseChannel	*pchan;
-	Ipo				*ipo;
+	bPoseChannel   *pchan;
+	Ipo	*ipo;
 
-	if (!act)
+	if (act==NULL || pose==NULL)
 		return;
-	if (!pose)
-		return;
 	
 	/* Copy the data from the action into the pose */
 	for (pchan= pose->chanbase.first; pchan; pchan=pchan->next) {
@@ -720,7 +719,7 @@
 				/* Evaluates and sets the internal ipo value */
 				calc_ipo(ipo, ctime);
 				/* This call also sets the pchan flags */
-				execute_action_ipo(achan, pchan);
+				apply_poseanim_ipo(achan, pchan);
 			}
 			/* 0 = do all ipos, not only drivers */
 			do_constraint_channels(&pchan->constraints, &achan->constraintChannels, ctime, 0);
@@ -803,11 +802,11 @@
 		
 		for(icu= achan->ipo->curve.first; icu; icu= icu->next) {
 			/* skip IPO_BITS, is for layers and cannot be blended */
-			if(icu->vartype != IPO_BITS) {
+			if(ELEM3(icu->vartype, IPO_CHAR_BIT, IPO_SHORT_BIT, IPO_INT_BIT)==0) {
 				nic= MEM_callocN(sizeof(NlaIpoChannel), "NlaIpoChannel");
 				BLI_addtail(lb, nic);
 				nic->val= icu->curval;
-				nic->poin= get_ipo_poin(id, icu, &nic->type);
+				//nic->poin= get_ipo_poin(id, icu, &nic->type);
 			}
 		}
 	}
@@ -823,7 +822,7 @@
 			
 			if(conchan && conchan->ipo) {
 				calc_ipo(conchan->ipo, ctime);
-				
+

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list