[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18025] branches/blender2.5/blender/source /blender/editors: 2.5 Action Editor - Big WIP Commit

Joshua Leung aligorith at gmail.com
Tue Dec 23 12:02:40 CET 2008


Revision: 18025
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18025
Author:   aligorith
Date:     2008-12-23 12:02:39 +0100 (Tue, 23 Dec 2008)

Log Message:
-----------
2.5 Action Editor - Big WIP Commit 

* Brought back backend for editing keyframes IPO/IPO-Curves. Did some refactoring work here that will still have to be verified when operators using them are added.

* Animation channel filtering code now returns the number of channels filtered (for Action Editor to set totrect of channels - TODO still!)

* View2D - made function to check if mouse is in View2D scrollers an API function

* Renamed keyframe related files. The old names were too clumsy.

* Started porting click-select operators for Action Editor. These don't work currently, as the events are being stolen by the markers. This needs to be fixed ASAP.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
    branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
    branches/blender2.5/blender/source/blender/editors/include/ED_markers.h
    branches/blender2.5/blender/source/blender/editors/include/UI_view2d.h
    branches/blender2.5/blender/source/blender/editors/interface/view2d.c
    branches/blender2.5/blender/source/blender/editors/interface/view2d_ops.c
    branches/blender2.5/blender/source/blender/editors/space_action/SConscript
    branches/blender2.5/blender/source/blender/editors/space_action/action_intern.h
    branches/blender2.5/blender/source/blender/editors/space_action/space_action.c

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/animation/keyframes_draw.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframes_edit.c
    branches/blender2.5/blender/source/blender/editors/animation/keyframing.c
    branches/blender2.5/blender/source/blender/editors/include/ED_keyframes_edit.h
    branches/blender2.5/blender/source/blender/editors/space_action/action_ops.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_select.c

Removed Paths:
-------------
    branches/blender2.5/blender/source/blender/editors/animation/anim_keyframes_draw.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_keyframing.c

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c	2008-12-23 09:59:02 UTC (rev 18024)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c	2008-12-23 11:02:39 UTC (rev 18025)
@@ -254,4 +254,39 @@
 	}
 }
 
+/* Apply/Unapply NLA mapping to all keyframes in the nominated IPO block
+ * 	- restore = whether to map points back to ipo-time 
+ * 	- only_keys = whether to only adjust the location of the center point of beztriples
+ */
+// was called actstrip_map_ipo_keys()
+void ANIM_nla_mapping_apply(Object *ob, Ipo *ipo, short restore, short only_keys)
+{
+	IpoCurve *icu;
+	BezTriple *bezt;
+	int a;
+	
+	if (ipo==NULL) return;
+	
+	/* loop through all ipo curves, adjusting the times of the selected keys */
+	for (icu= ipo->curve.first; icu; icu= icu->next) {
+		for (a=0, bezt=icu->bezt; a<icu->totvert; a++, bezt++) {
+			/* are the times being adjusted for editing, or has editing finished */
+			if (restore) {
+				if (only_keys == 0) {
+					bezt->vec[0][0]= get_action_frame(ob, bezt->vec[0][0]);
+					bezt->vec[2][0]= get_action_frame(ob, bezt->vec[2][0]);
+				}					
+				bezt->vec[1][0]= get_action_frame(ob, bezt->vec[1][0]);
+			}
+			else {
+				if (only_keys == 0) {
+					bezt->vec[0][0]= get_action_frame_inv(ob, bezt->vec[0][0]);
+					bezt->vec[2][0]= get_action_frame_inv(ob, bezt->vec[2][0]);
+				}
+				bezt->vec[1][0]= get_action_frame_inv(ob, bezt->vec[1][0]);
+			}
+		}
+	}
+}
+
 /* *************************************************** */

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c	2008-12-23 09:59:02 UTC (rev 18024)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c	2008-12-23 11:02:39 UTC (rev 18025)
@@ -490,12 +490,13 @@
  
 /* ----------------------------------------- */
 
-static void animdata_filter_animionchannel (ListBase *anim_data, bActionChannel *achan, int filter_mode, void *owner, short ownertype)
+static int animdata_filter_actionchannel (ListBase *anim_data, bActionChannel *achan, int filter_mode, void *owner, short ownertype)
 {
 	bAnimListElem *ale = NULL;
 	bConstraintChannel *conchan;
 	IpoCurve *icu;
 	short owned= (owner && ownertype)? 1 : 0;
+	int items = 0;
 	
 	/* only work with this channel and its subchannels if it is visible */
 	if (!(filter_mode & ANIMFILTER_VISIBLE) || VISIBLE_ACHAN(achan)) {
@@ -510,19 +511,20 @@
 					if (ale) {
 						if (owned) ale->id= owner;
 						BLI_addtail(anim_data, ale);
+						items++;
 					}
 				}
 			}
 			else {
 				/* for insert key... this check could be improved */
-				return;
+				//return;  // FIXME...
 			}
 			
 			/* check if expanded - if not, continue on to next animion channel */
 			if (EXPANDED_ACHAN(achan) == 0 && (filter_mode & ANIMFILTER_ONLYICU)==0) {
 				/* only exit if we don't need to include constraint channels for group-channel keyframes */
 				if ( !(filter_mode & ANIMFILTER_IPOKEYS) || (achan->grp == NULL) || (EXPANDED_AGRP(achan->grp)==0) )
-					return;
+					return items;
 			}
 				
 			/* ipo channels */
@@ -534,6 +536,7 @@
 					if (ale) {
 						if (owned) ale->id= owner;
 						BLI_addtail(anim_data, ale);
+						items++;
 					}
 				}
 				
@@ -546,6 +549,7 @@
 						if (ale) {
 							if (owned) ale->id= owner;
 							BLI_addtail(anim_data, ale); 
+							items++;
 						}
 					}
 				}
@@ -562,6 +566,7 @@
 					if (ale) {
 						if (owned) ale->id= owner;
 						BLI_addtail(anim_data, ale);
+						items++;
 					}
 				}
 				
@@ -574,12 +579,12 @@
 							/* check if this conchan should only be included if it is selected */
 							if (!(filter_mode & ANIMFILTER_SEL) || SEL_CONCHAN(conchan)) {
 								if (filter_mode & ANIMFILTER_IPOKEYS) {
-									if (ale) BLI_addtail(anim_data, ale);
 									ale= make_new_animlistelem(conchan, ANIMTYPE_CONCHAN2, achan, ANIMTYPE_ACHAN);
 									
 									if (ale) {
 										if (owned) ale->id= owner;
 										BLI_addtail(anim_data, ale);
+										items++;
 									}
 								}
 								else {
@@ -588,6 +593,7 @@
 									if (ale) {
 										if (owned) ale->id= owner;
 										BLI_addtail(anim_data, ale);
+										items++;
 									}
 								}
 							}
@@ -597,14 +603,18 @@
 			}
 		}		
 	}
+	
+	/* return the number of items added to the list */
+	return items;
 }
 
-static void animdata_filter_action (ListBase *anim_data, bAction *act, int filter_mode, void *owner, short ownertype)
+static int animdata_filter_action (ListBase *anim_data, bAction *act, int filter_mode, void *owner, short ownertype)
 {
 	bAnimListElem *ale=NULL;
 	bActionGroup *agrp;
 	bActionChannel *achan, *lastchan=NULL;
 	short owned= (owner && ownertype) ? 1 : 0;
+	int items = 0;
 	
 	/* loop over groups */
 	for (agrp= act->groups.first; agrp; agrp= agrp->next) {
@@ -616,6 +626,7 @@
 				if (ale) {
 					if (owned) ale->id= owner;
 					BLI_addtail(anim_data, ale);
+					items++;
 				}
 			}
 		}
@@ -642,7 +653,7 @@
 			{
 				if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_AGRP(agrp)) {					
 					for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next) {
-						animdata_filter_animionchannel(anim_data, achan, filter_mode, owner, ownertype);
+						items += animdata_filter_actionchannel(anim_data, achan, filter_mode, owner, ownertype);
 					}
 					
 					/* remove group from filtered list if last element is group 
@@ -653,6 +664,7 @@
 						 (ale->data == agrp) && (agrp->channels.first) ) 
 					{
 						BLI_freelinkN(anim_data, ale);
+						items--;
 					}
 				}
 			}
@@ -661,19 +673,22 @@
 	
 	/* loop over un-grouped animion channels (only if we're not only considering those channels in the animive group) */
 	if (!(filter_mode & ANIMFILTER_ACTGROUPED))  {
-		for (achan=(lastchan)?lastchan->next:act->chanbase.first; achan; achan=achan->next) {
-			animdata_filter_animionchannel(anim_data, achan, filter_mode, owner, ownertype);
+		for (achan=(lastchan)?(lastchan->next):(act->chanbase.first); achan; achan=achan->next) {
+			items += animdata_filter_actionchannel(anim_data, achan, filter_mode, owner, ownertype);
 		}
 	}
+	
+	/* return the number of items added to the list */
+	return items;
 }
 
-static void animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_mode, void *owner, short ownertype)
+static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_mode, void *owner, short ownertype)
 {
 	bAnimListElem *ale;
 	KeyBlock *kb;
 	IpoCurve *icu;
 	short owned= (owner && ownertype)? 1 : 0;
-	int i;
+	int i, items=0;
 	
 	/* are we filtering for display or editing */
 	if (filter_mode & ANIMFILTER_FORDRAWING) {
@@ -705,6 +720,7 @@
 			if (owned) ale->id= owner;
 			
 			BLI_addtail(anim_data, ale);
+			items++;
 		}
 	}
 	else {
@@ -715,6 +731,7 @@
 				if (ale) {
 					if (owned) ale->id= owner;
 					BLI_addtail(anim_data, ale);
+					items++;
 				}
 			}
 			else {
@@ -723,21 +740,26 @@
 					if (ale) {
 						if (owned) ale->id= owner;
 						BLI_addtail(anim_data, ale);
+						items++;
 					}
 				}
 			}
 		}
 	}
+	
+	/* return the number of items added to the list */
+	return items;
 }
  
 #if 0
 // FIXME: switch this to use the bDopeSheet...
-static void animdata_filter_gpencil (ListBase *anim_data, bScreen *sc, int filter_mode)
+static int animdata_filter_gpencil (ListBase *anim_data, bScreen *sc, int filter_mode)
 {
 	bAnimListElem *ale;
 	ScrArea *sa, *curarea;
 	bGPdata *gpd;
 	bGPDlayer *gpl;
+	int items = 0;
 	
 	/* check if filtering types are appropriate */
 	if ( !(filter_mode & (ANIMFILTER_IPOKEYS|ANIMFILTER_ONLYICU|ANIMFILTER_ACTGROUPED)) ) 
@@ -762,7 +784,10 @@
 			if ((filter_mode & ANIMFILTER_FORDRAWING) && (gpd->layers.first)) {
 				/* add to list */
 				ale= make_new_animlistelem(gpd, ANIMTYPE_GPDATABLOCK, sa, ANIMTYPE_SPECIALDATA);
-				if (ale) BLI_addtail(anim_data, ale);
+				if (ale) {
+					BLI_addtail(anim_data, ale);
+					items++;
+				}
 			}
 			
 			/* only add layers if they will be visible (if drawing channels) */
@@ -775,26 +800,36 @@
 						if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_GPL(gpl)) {
 							/* add to list */
 							ale= make_new_animlistelem(gpl, ANIMTYPE_GPLAYER, gpd, ANIMTYPE_GPDATABLOCK);
-							if (ale) BLI_addtail(anim_data, ale);
+							if (ale) {
+								BLI_addtail(anim_data, ale);
+								items++;
+							}
 						}
 					}
 				}
 			}
 		}
 	}
+	
+	/* return the number of items added to the list */
+	return items;
 }
 #endif 
 
-static void animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
+static int animdata_filter_dopesheet_mats (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
 {
 	bAnimListElem *ale=NULL;
 	Object *ob= base->object;
 	IpoCurve *icu;
+	int items = 0;
 	
 	/* include materials-expand widget? */
 	if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & (ANIMFILTER_IPOKEYS|ANIMFILTER_ONLYICU))) {
 		ale= make_new_animlistelem(ob, ANIMTYPE_FILLMATD, base, ANIMTYPE_OBJECT);
-		if (ale) BLI_addtail(anim_data, ale);
+		if (ale) {
+			BLI_addtail(anim_data, ale);
+			items++;
+		}
 	}
 	
 	/* add materials? */
@@ -812,7 +847,10 @@
 			// hmm... do we need to store the index of this material in the array anywhere?
 			if (filter_mode & (ANIMFILTER_CHANNELS|ANIMFILTER_IPOKEYS)) {
 				ale= make_new_animlistelem(ma, ANIMTYPE_DSMAT, base, ANIMTYPE_OBJECT);
-				if (ale) BLI_addtail(anim_data, ale);
+				if (ale) {
+					BLI_addtail(anim_data, ale);
+					items++;
+				}
 			}
 			
 			/* add material's ipo-curve channels? */
@@ -828,25 +866,33 @@
 							/* make owner the material not object, so that indent is not just object level */
 							ale->id= (ID *)ma;
 							BLI_addtail(anim_data, ale);
+							items++;
 						}
 					}
 				}
 			}
 		}
 	}
+	
+	/* return the number of items added to the list */
+	return items;
 }
 
-static void animdata_filter_dopesheet_cam (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
+static int animdata_filter_dopesheet_cam (ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
 {
 	bAnimListElem *ale=NULL;
 	Object *ob= base->object;
 	Camera *ca= (Camera *)ob->data;
 	IpoCurve *icu;
+	int items = 0;
 	

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list