[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18949] branches/blender2.5/blender/source /blender: Keying Sets: Wrapped KeyingSets in RNA

Joshua Leung aligorith at gmail.com
Fri Feb 13 02:51:35 CET 2009


Revision: 18949
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18949
Author:   aligorith
Date:     2009-02-13 02:51:33 +0100 (Fri, 13 Feb 2009)

Log Message:
-----------
Keying Sets: Wrapped KeyingSets in RNA 

* The settings of KeyingSets can now be viewed/modified through RNA. 
* Shuffled RNA wrapping for AnimData over to its own file 
* Moved insert-key flags to DNA_anim_types.h, as they're now used for KeyingSets.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/BKE_animsys.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
    branches/blender2.5/blender/source/blender/editors/include/ED_keyframing.h
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_anim_types.h
    branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
    branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_action.c
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_internal.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_scene.c

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_animation.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_animsys.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_animsys.h	2009-02-12 23:25:36 UTC (rev 18948)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_animsys.h	2009-02-13 01:51:33 UTC (rev 18949)
@@ -33,7 +33,7 @@
 struct KeyingSet *BKE_keyingset_add(struct ListBase *list, const char name[], short flag, short keyingflag);
 
 /* Add a destination to a KeyingSet */
-void BKE_keyingset_add_destination(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, int flag);
+void BKE_keyingset_add_destination(struct KeyingSet *ks, struct ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode);
 
 /* Free data for KeyingSet but not set itself */
 void BKE_keyingset_free(struct KeyingSet *ks);

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c	2009-02-12 23:25:36 UTC (rev 18948)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/anim_sys.c	2009-02-13 01:51:33 UTC (rev 18949)
@@ -195,7 +195,7 @@
 /* Add a destination to a KeyingSet. Nothing is returned for now...
  * Checks are performed to ensure that destination is appropriate for the KeyingSet in question
  */
-void BKE_keyingset_add_destination (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, int flag)
+void BKE_keyingset_add_destination (KeyingSet *ks, ID *id, const char group_name[], const char rna_path[], int array_index, short flag, short groupmode)
 {
 	KS_Path *ksp;
 	
@@ -229,6 +229,7 @@
 	
 	/* store flags */
 	ksp->flag= flag;
+	ksp->groupmode= groupmode;
 	
 	/* add KeyingSet path to KeyingSet */
 	BLI_addtail(&ks->paths, ksp);

Modified: branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/keyframing.c	2009-02-12 23:25:36 UTC (rev 18948)
+++ branches/blender2.5/blender/source/blender/editors/animation/keyframing.c	2009-02-13 01:51:33 UTC (rev 18949)
@@ -2031,9 +2031,9 @@
 			int arraylen, i;
 			
 			/* get pointer to name of group to add channels to */
-			if (ksp->flag & KSP_FLAG_GROUP_NONE)
+			if (ksp->groupmode == KSP_GROUP_NONE)
 				groupname= NULL;
-			else if (ksp->flag & KSP_FLAG_GROUP_KSNAME)
+			else if (ksp->groupmode == KSP_GROUP_KSNAME)
 				groupname= ks->name;
 			else
 				groupname= ksp->group;

Modified: branches/blender2.5/blender/source/blender/editors/include/ED_keyframing.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_keyframing.h	2009-02-12 23:25:36 UTC (rev 18948)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_keyframing.h	2009-02-13 01:51:33 UTC (rev 18949)
@@ -52,23 +52,6 @@
  */
 void insert_vert_fcurve(struct FCurve *fcu, float x, float y, short flag);
 
-
-/* flags for use by keyframe creation/deletion calls */
-enum {
-		/* used by isnertkey() and insert_vert_icu() */
-	INSERTKEY_NEEDED 	= (1<<0),	/* only insert keyframes where they're needed */
-	INSERTKEY_MATRIX 	= (1<<1),	/* insert 'visual' keyframes where possible/needed */
-	INSERTKEY_FAST 		= (1<<2),	/* don't recalculate handles,etc. after adding key */
-	INSERTKEY_FASTR		= (1<<3),	/* don't realloc mem (or increase count, as array has already been set out) */
-	INSERTKEY_REPLACE 	= (1<<4),	/* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */
-	
-		/* used by common_*key() functions - Note: these are generally mutually exclusive (only one will work at a time) */
-	COMMONKEY_ADDMAP	= (1<<10),	/* common key: add texture-slot offset bitflag to adrcode before use */
-	COMMONKEY_PCHANROT	= (1<<11),	/* common key: extend channel list using relevant pchan-rotations */
-		/* all possible items for common_*key() functions */
-	COMMONKEY_MODES 	= (COMMONKEY_ADDMAP|COMMONKEY_PCHANROT)
-} eInsertKeyFlags;
-
 /* -------- */
 
 /* Main Keyframing API calls: 

Modified: branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c	2009-02-12 23:25:36 UTC (rev 18948)
+++ branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c	2009-02-13 01:51:33 UTC (rev 18949)
@@ -3151,7 +3151,8 @@
 	ID *id = NULL;
 	char *path=NULL, *newpath=NULL;
 	int array_index= 0;
-	int flag= KSP_FLAG_GROUP_KSNAME;
+	short flag = 0;
+	short groupmode= KSP_GROUP_KSNAME;
 	
 	/* optimise tricks:
 	 *	- Don't do anything if the selected item is a 'struct', but arrays are allowed
@@ -3159,7 +3160,7 @@
 	if (tselem->type == TSE_RNA_STRUCT)
 		return;
 	
-	//printf("ks_editop_add_cb() \n");
+	printf("ks_editop_add_cb() \n");
 	
 	/* Overview of Algorithm:
 	 * 	1. Go up the chain of parents until we find the 'root', taking note of the 
@@ -3188,11 +3189,20 @@
 		
 		/* check if we're looking for first ID, or appending to path */
 		if (id) {
+			if (tse->type == TSE_RNA_STRUCT)
+				printf("\t tem = RNA Struct '%s' \n", tem->name);
+			else if (tse->type == TSE_RNA_ARRAY_ELEM)
+				printf("\t tem = RNA Array Elem '%s' \n", tem->name);
+			else if (tse->type == TSE_RNA_PROPERTY)
+				printf("\t tem = RNA Property '%s' \n", tem->name);
+			else
+				printf("\t tem = WTF? \n");
+			
 			/* just 'append' property to path 
 			 *	- to prevent memory leaks, we must write to newpath not path, then free old path + swap them
 			 */
-			// TODO: how to do this? we must use 'string' identifiers for collections so that these don't break if data is added/removed
-			//newpath= RNA_path_append(path, NULL, prop, index, NULL);
+			// TODO: how should this be done?
+			//newpath= RNA_path_append(path, ptr, prop, tem->index, /*RNA_property_identifier(ptr, prop)*/0);
 			
 			if (path) MEM_freeN(path);
 			path= newpath;
@@ -3234,7 +3244,7 @@
 		/* add a new path with the information obtained (only if valid) */
 		// TODO: what do we do with group name? for now, we don't supply one, and just let this use the KeyingSet name
 		if (path)
-			BKE_keyingset_add_destination(ks, id, NULL, path, array_index, flag);
+			BKE_keyingset_add_destination(ks, id, NULL, path, array_index, flag, groupmode);
 	}
 	
 	/* free temp data */

Modified: branches/blender2.5/blender/source/blender/makesdna/DNA_anim_types.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesdna/DNA_anim_types.h	2009-02-12 23:25:36 UTC (rev 18948)
+++ branches/blender2.5/blender/source/blender/makesdna/DNA_anim_types.h	2009-02-13 01:51:33 UTC (rev 18949)
@@ -445,19 +445,25 @@
 	char *rna_path;			/* dynamically (or statically in the case of predefined sets) path */
 	int array_index;		/* index that path affects */
 	
-	int flag;				/* various settings, etc. */
+	short flag;				/* various settings, etc. */
+	short groupmode;		/* group naming (eKSP_Grouping) */
 } KS_Path;
 
 /* KS_Path->flag */
 enum {
 		/* entire array (not just the specified index) gets keyframed */
 	KSP_FLAG_WHOLE_ARRAY	= (1<<0),
-	
+} eKSP_Settings;
+
+/* KS_Path->groupmode */
+enum {
+		/* path should be grouped using its own group-name */
+	KSP_GROUP_NAMED = 0,
 		/* path should not be grouped at all */
-	KSP_FLAG_GROUP_NONE		= (1<<10),
+	KSP_GROUP_NONE,
 		/* path should be grouped under an ActionGroup KeyingSet's name */
-	KSP_FLAG_GROUP_KSNAME	= (1<<11),
-} eKSP_Settings;
+	KSP_GROUP_KSNAME,
+} eKSP_Grouping;
 
 /* ---------------- */
  
@@ -486,12 +492,19 @@
 enum {
 		/* keyingset cannot be removed (and doesn't need to be freed) */
 	KEYINGSET_BUILTIN		= (1<<0),
-		/* keyingset is the one currently in use */
-	KEYINGSET_ACTIVE		= (1<<1),
 		/* keyingset does not depend on context info (i.e. paths are absolute) */
-	KEYINGSET_ABSOLUTE		= (1<<2),
+	KEYINGSET_ABSOLUTE		= (1<<1),
 } eKS_Settings;
 
+/* Flags for use by keyframe creation/deletion calls */
+enum {
+	INSERTKEY_NEEDED 	= (1<<0),	/* only insert keyframes where they're needed */
+	INSERTKEY_MATRIX 	= (1<<1),	/* insert 'visual' keyframes where possible/needed */
+	INSERTKEY_FAST 		= (1<<2),	/* don't recalculate handles,etc. after adding key */
+	INSERTKEY_FASTR		= (1<<3),	/* don't realloc mem (or increase count, as array has already been set out) */
+	INSERTKEY_REPLACE 	= (1<<4),	/* only replace an existing keyframe (this overrides INSERTKEY_NEEDED) */
+} eInsertKeyFlags;
+
 /* ************************************************ */
 /* Animation Data */
 

Modified: branches/blender2.5/blender/source/blender/makesrna/RNA_access.h
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2009-02-12 23:25:36 UTC (rev 18948)
+++ branches/blender2.5/blender/source/blender/makesrna/RNA_access.h	2009-02-13 01:51:33 UTC (rev 18949)
@@ -117,6 +117,8 @@
 extern StructRNA RNA_JoystickSensor;
 extern StructRNA RNA_Key;
 extern StructRNA RNA_KeyboardSensor;
+extern StructRNA RNA_KeyingSet;
+extern StructRNA RNA_KeyingSetPath;
 extern StructRNA RNA_Lamp;
 extern StructRNA RNA_LampSkySettings;
 extern StructRNA RNA_LampTextureSlot;

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c	2009-02-12 23:25:36 UTC (rev 18948)
+++ branches/blender2.5/blender/source/blender/makesrna/intern/makesrna.c	2009-02-13 01:51:33 UTC (rev 18949)
@@ -1246,7 +1246,8 @@
 RNAProcessItem PROCESS_ITEMS[]= {
 	{"rna_ID.c", RNA_def_ID},
 	{"rna_texture.c", RNA_def_texture},
-	{"rna_action.c", RNA_def_animation},
+	{"rna_action.c", RNA_def_action},
+	{"rna_animation.c", RNA_def_animation},
 	{"rna_actuator.c", RNA_def_actuator},
 	{"rna_armature.c", RNA_def_armature},
 	{"rna_brush.c", RNA_def_brush},

Modified: branches/blender2.5/blender/source/blender/makesrna/intern/rna_action.c
===================================================================

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list