[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12827] branches/animsys-aligorith/source/ blender: == AnimSys Branch - Small changes ==

Joshua Leung aligorith at gmail.com
Sun Dec 9 05:06:14 CET 2007


Revision: 12827
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12827
Author:   aligorith
Date:     2007-12-09 05:06:14 +0100 (Sun, 09 Dec 2007)

Log Message:
-----------
== AnimSys Branch - Small changes ==

* Finished implementing KeyingSets (well, the generic stuff architecture + support for objects & bones). Other blocktypes will need to get implemented later...

* Increased the max lengths of shortname and longname for bKeyableType. Now shortname is 32 chars, while longname is 64 chars.

* More progress on keyframing code... 

Modified Paths:
--------------
    branches/animsys-aligorith/source/blender/blenkernel/BKE_ipo.h
    branches/animsys-aligorith/source/blender/blenkernel/intern/blender.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/ipo.c
    branches/animsys-aligorith/source/blender/blenkernel/intern/keyingsets.c
    branches/animsys-aligorith/source/blender/makesdna/DNA_animdata_types.h
    branches/animsys-aligorith/source/blender/src/keyframing.c

Modified: branches/animsys-aligorith/source/blender/blenkernel/BKE_ipo.h
===================================================================
--- branches/animsys-aligorith/source/blender/blenkernel/BKE_ipo.h	2007-12-08 21:53:17 UTC (rev 12826)
+++ branches/animsys-aligorith/source/blender/blenkernel/BKE_ipo.h	2007-12-09 04:06:14 UTC (rev 12827)
@@ -36,10 +36,7 @@
 
 struct Ipo;
 struct IpoCurve;
-struct MTex;
-struct Material;
 struct Object;
-struct Sequence;
 struct ListBase;
 struct BezTriple;
 struct ID;
@@ -47,6 +44,7 @@
 struct bActionChannel;
 struct rctf;
 struct bKeyableType;
+struct bKeyingSet;
 
 /* ------------ Struct Definitions ---------------------- */
 
@@ -67,6 +65,10 @@
  */
 #define GIVE_VARADDR(data, offset) ((void *)( ((char *)data) + offset ))
 
+
+/* this tests if the blocktype is valid */
+#define VALID_IPOBLOCKTYPE(blocktype) ((blocktype >= IPOB_OB) && (blocktype <= IPOB_TOTAL))
+
 /* ------------- Data-Level Function Prototypes ---------- */
 
 void free_ipo_curve(struct IpoCurve *icu);
@@ -79,6 +81,7 @@
 
 void ipo_idnew(struct Ipo *ipo);
 
+// FIX THESE...
 void make_local_obipo(struct Ipo *ipo);
 void make_local_matipo(struct Ipo *ipo);
 void make_local_keyipo(struct Ipo *ipo);
@@ -126,6 +129,17 @@
 void icu_fix_ktpointers(struct Ipo *ipo, struct IpoCurve *icu);
 void ipo_fix_oldversions(struct Ipo *ipo);
 
+/* ------------- Keying-Set Tools -------------------- */
+
+void free_keyingset(struct bKeyingSet *ks);
+struct bKeyingSet *make_new_keyingset(char name[]);
+void keyingset_add_kt(struct bKeyingSet *ks, struct bKeyableType *kt);
+
+void keyingset_default_getdata(struct bKeyingSet *ks, int blocktype);
+void keyingset_default_freedata(struct bKeyingSet *ks);
+
+void init_keyingsets(void);
+
 /* ------------- IPO - Calculations ------------------ */
 
 float eval_icu(struct IpoCurve *icu, float ipotime);

Modified: branches/animsys-aligorith/source/blender/blenkernel/intern/blender.c
===================================================================
--- branches/animsys-aligorith/source/blender/blenkernel/intern/blender.c	2007-12-08 21:53:17 UTC (rev 12826)
+++ branches/animsys-aligorith/source/blender/blenkernel/intern/blender.c	2007-12-09 04:06:14 UTC (rev 12827)
@@ -176,7 +176,6 @@
 
 	IMB_freeImBufdata();		/* imbuf lib */
 	
-	free_keyingsets();
 	free_nodesystem();	
 }
 

Modified: branches/animsys-aligorith/source/blender/blenkernel/intern/ipo.c
===================================================================
--- branches/animsys-aligorith/source/blender/blenkernel/intern/ipo.c	2007-12-08 21:53:17 UTC (rev 12826)
+++ branches/animsys-aligorith/source/blender/blenkernel/intern/ipo.c	2007-12-09 04:06:14 UTC (rev 12827)
@@ -1573,11 +1573,13 @@
 
 /* ************************ IPO-System Setup / Version Patching ************************ */
 
-/* helper function for patching curves - returns the short-name of the kt which replaces it
+/* helper function for patching curves - returns the short-name of the kt which replaces
  * the old adrcode + blocktype
  *
  * return codes for this function are as follows:
- *	1 = ok; -1 = needs special fixing (mostly bitflags); 0 = invalid/not found (delete it)
+ *	1 = ok; 0 = invalid/not found (delete it);
+ *	-1 = needs special fixing (mostly bitflags); 
+ *	-2 = needs special fixing2 (change of blocktype);
  */
 static short adrcode_to_ktname (short blocktype, short adrcode, char *sname)
 {
@@ -1607,6 +1609,46 @@
 			case 19: 	strcpy(sname, "Layer"); retval= -1; break;
 		}
 		break;
+		
+	case IPOB_MAT:
+		switch (adrcode) {
+			//case 1:
+		}
+		break;
+		
+	case IPOB_TEX:
+		switch (adrcode) {
+			//case 1:
+		}
+		break;
+		
+	case IPOB_CURVE:
+		switch (adrcode) {
+			case 1: 	strcpy(sname, "Speed"); retval= 1; break;
+		}
+		break;
+		
+	case IPOB_KEY:
+		// fixme
+		break;
+		
+	case IPOB_WORLD:
+		switch (adrcode) {
+			//case 1:
+		}
+		break;
+		
+	case IPOB_LAMP:
+		switch (adrcode) {
+			//case 1:
+		}
+		break;
+		
+	case IPOB_CAM:
+		switch (adrcode) {
+			//case 1:
+		}
+		break;
 	
 	case IPOB_POSE:
 		switch (adrcode) {
@@ -1621,6 +1663,31 @@
 			case 9:		strcpy(sname, "ScaleZ"); retval= 1; break;
 		}
 		break;
+	
+	case IPOB_CONS:
+		switch (adrcode) {
+			case 1:		strcpy(sname, "Inf"); retval= 1; break;
+			case 2:		strcpy(sname, "HeadTail"); retval= 1; break;
+		}
+		break;
+		
+	case IPOB_FLUID:
+		switch (adrcode) {
+			//case 1:
+		}
+		break;
+		
+	case IPOB_SEQ:
+		switch (adrcode) {
+			//case 1:
+		}
+		break;
+		
+	case IPOB_SOUND:
+		switch (adrcode) {
+			//case 1:
+		}
+		break;	
 	}
 	
 	return retval;
@@ -1673,6 +1740,9 @@
 			/* needs special conversion (i.e. bitflags) */
 			
 		}
+		else if (val == -2) {
+			/* needs special conversion (blocktype changed) */
+		}
 		else {
 			/* not recognised/depreceated - remove */
 			BLI_freelinkN(&ipo->curve, icu);

Modified: branches/animsys-aligorith/source/blender/blenkernel/intern/keyingsets.c
===================================================================
--- branches/animsys-aligorith/source/blender/blenkernel/intern/keyingsets.c	2007-12-08 21:53:17 UTC (rev 12826)
+++ branches/animsys-aligorith/source/blender/blenkernel/intern/keyingsets.c	2007-12-09 04:06:14 UTC (rev 12827)
@@ -48,24 +48,195 @@
 #include "BKE_nla.h"
 
 /* ********************************************************** */
-/* OVERVIEW OF KEYINGSETS:
+/* Overview of KeyingSets:
  *	KeyingSets define a set of bKeyableTypes that can get keyframed together.
  * 	They are named for identification in the UI (for editing, and for being used
  * 	to insert keyframes). They can also have a set of keyframing options applied
  *	for all keyframes inserted using them.
  *
- *	Each blocktype has a set of default types available. These are dynamically
- * 	allocated at startup (globally), as that's currently the best way to set them
- * 	up. These default types are defined in THIS FILE. 
+ *	Each blocktype has a set of default types available. These are declared in arrays
+ *	in this file, with the KS_TEMPLATE() macro being used to define the keyingsets available
+ *	per blocktype (though these are just empty shells). When they are needed, memory for
+ *	the bKeyingTypeLinks for a default keyingset is allocated by the keyingset_default_getdata
+ *	sub-functions (which use the same code to do so, as adding custom kt's to keyingsets). 
  *
  *	A user can also define a few KeyingSets per AnimData block. This is to allow
  *	custom keyable-types to be grouped together and with default keyable-types for
  *	keyframing at once. 
  */
 /* ********************************************************** */
+/* Default KeyingSets - definitions */
 
+/* --- Helper Macros --- */ 
+
+/* quick macro for declaring templates of default keyabletypes  */
+#define KS_TEMPLATE(name, flag) {NULL, NULL, {NULL, NULL}, "name", flag, KS_DEFAULT_SET}
+ 
+
+/* --- Blocktype: IPOB_OB --- */
+
+/* all KeyingSets for Object blocktype */
+static bKeyingSet default_ks_ob[] = {
+	/* name, flag */
+	KS_TEMPLATE("Loc", 0),
+	KS_TEMPLATE("Rot", 0),
+	KS_TEMPLATE("Scale", 0),
+	KS_TEMPLATE("LocRot", 0),
+	KS_TEMPLATE("LocScale", 0),
+	KS_TEMPLATE("RotScale", 0),
+	KS_TEMPLATE("LocRotScale", 0),
+	KS_TEMPLATE("Layer", 0)
+	
+	// include ob-physics stuff???
+};
+
+/* --- Blocktype: IPOB_MAT --- */
+
+/* all KeyingSets for Material blocktype */
+static bKeyingSet default_ks_mat[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here 
+};
+
+/* --- Blocktype: IPOB_MTEX --- */
+
+/* all KeyingSets for Material blocktype */
+static bKeyingSet default_ks_mtex[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here 
+};
+
+/* --- Blocktype: IPOB_TEX --- */
+
+/* all KeyingSets for Texture blocktype */
+static bKeyingSet default_ks_tex[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- Blocktype: IPOB_CURVE --- */
+
+/* all KeyingSets for Curve blocktype */
+static bKeyingSet default_ks_curve[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- Blocktype: IPOB_WORLD --- */
+
+/* all KeyingSets for World blocktype */
+static bKeyingSet default_ks_world[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- Blocktype: IPOB_LAMP --- */
+
+/* all KeyingSets for Lamp blocktype */
+static bKeyingSet default_ks_lamp[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- Blocktype: IPOB_CAM --- */
+
+/* all KeyingSets for Camera blocktype */
+static bKeyingSet default_ks_cam[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- Blocktype: IPOB_POSE --- */
+
+/* all KeyingSets for Pose blocktype */
+static bKeyingSet default_ks_pose[] = {
+	/* name, flag */
+	KS_TEMPLATE("Loc", 0),
+	KS_TEMPLATE("Rot", 0),
+	KS_TEMPLATE("Scale", 0),
+	KS_TEMPLATE("LocRot", 0),
+	KS_TEMPLATE("LocScale", 0),
+	KS_TEMPLATE("RotScale", 0),
+	KS_TEMPLATE("LocRotScale", 0),
+};
+
+/* --- Blocktype: IPOB_CONS --- */
+
+/* all KeyingSets for Constraint blocktype */
+static bKeyingSet default_ks_cons[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- Blocktype: IPOB_FLUID --- */
+
+/* all KeyingSets for FluidSim blocktype */
+static bKeyingSet default_ks_fluid[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- Blocktype: IPOB_SEQ --- */
+
+/* all KeyingSets for Sequence blocktype */
+static bKeyingSet default_ks_seq[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- Blocktype: IPOB_NODE --- */
+
+/* all KeyingSets for Node blocktype */
+static bKeyingSet default_ks_node[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- Blocktype: IPOB_MOD --- */
+
+/* all KeyingSets for Modifier blocktype */
+static bKeyingSet default_ks_mod[] = {
+	/* name, flag */
+	KS_TEMPLATE("Dummy", 0), // FIXME: add proper keyingset here
+};
+
+/* --- All Defaults --- */
+
+/* little struct for use here */
+typedef struct bDefaultKS_Ref {
+	bKeyingSet *ks;	/* pointer to array - default_ks_{blockname}[0]; */
+	short tot;		/* total number of items in array */	
+} bDefaultKS_Ref;
+
+/* macro for declaring bDefaultKS_Ref elements
+ *	- blockname: lowercase, short-name of blocktype (i.e. part after "IPOB_" of "IPOB_*")
+ */

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list