[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18679] branches/blender2.5/blender/source /blender: Animato/2.5 - Graph Editor (i.e.

Joshua Leung aligorith at gmail.com
Mon Jan 26 12:33:16 CET 2009


Revision: 18679
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18679
Author:   aligorith
Date:     2009-01-26 12:33:16 +0100 (Mon, 26 Jan 2009)

Log Message:
-----------
Animato/2.5 - Graph Editor (i.e. the new 'IPO Editor') 

This commit brings back the drawing code for the 'Graph Editor'. I've decided to call it this, as currently it can show either F-Curves for Animation stored in Actions, or F-Curves for Drivers.

Currently, it shows all curves, since some of the necessary filtering code (i.e. for limiting curve visibility) hasn't been put in place yet. At least this serves as good proof that we can have F-Curves from multiple sources at least.

It should be noted that the code still has to be modified to work with some of the new Animato features, such as F-Curve Modifiers (cycles are an example of one of the features that use this). Also, a nicer way to set the colours of the curves needs to be investigated.

Notes:
* Fixed a few bugs in RNA User-Preferences wrapping

* The keyframe drawing uses the new-style drawing for handles from AnimSys2. There's a minor bug that sometimes occurs, where a distorted handle gets drawn at the origin of the grid on the first run. Hints anyone?

* Removed most of the old data from SpaceIpo struct, as the new code uses that. Maybe later, the directories/files at least should get renamed.

* Removed ancient hack for NVidia/TNT drivers. It is probably no longer needed, but could be restored if someone needs it.

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/BKE_fcurve.h
    branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    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/interface/resources.c
    branches/blender2.5/blender/source/blender/editors/space_action/action_draw.c
    branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_draw.c
    branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_header.c
    branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_intern.h
    branches/blender2.5/blender/source/blender/editors/space_ipo/space_ipo.c
    branches/blender2.5/blender/source/blender/makesdna/DNA_action_types.h
    branches/blender2.5/blender/source/blender/makesdna/DNA_space_types.h
    branches/blender2.5/blender/source/blender/makesrna/intern/rna_userdef.c
    branches/blender2.5/blender/source/blender/windowmanager/intern/wm_files.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/BKE_fcurve.h
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/BKE_fcurve.h	2009-01-26 09:13:15 UTC (rev 18678)
+++ branches/blender2.5/blender/source/blender/blenkernel/BKE_fcurve.h	2009-01-26 11:33:16 UTC (rev 18679)
@@ -95,6 +95,8 @@
 void sort_time_fcurve(struct FCurve *fcu);
 short test_time_fcurve(struct FCurve *fcu);
 
+void correct_bezpart(float *v1, float *v2, float *v3, float *v4);
+
 /* -------- Evaluation --------  */
 
 /* evaluate fcurve */

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c	2009-01-26 09:13:15 UTC (rev 18678)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c	2009-01-26 11:33:16 UTC (rev 18679)
@@ -1065,8 +1065,6 @@
 		 * are likely to be drivers, but it's hard to trace that from here, so move this to Ob loop?
 		 */
 		if (key->ipo) {
-			printf("\t\tconverting key->ipo %s -> %s \n", id->name+2, key->ipo->id.name+2);
-			
 			/* Add AnimData block */
 			adt= BKE_id_add_animdata(id);
 			

Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-01-26 09:13:15 UTC (rev 18678)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-01-26 11:33:16 UTC (rev 18679)
@@ -3932,63 +3932,6 @@
 	
 }
 
-/* Nasty exception; IpoWindow stores a non-ID pointer in *from for sequence
-   strips... bad code warning! 
-
-   We work around it by retrieving the missing pointer from the corresponding
-   Sequence-structure. 
-
-   This is needed, to make Ipo-Pinning work for Sequence-Ipos...
-*/
-// XXX old animation system - depreceated stuff...
-static Sequence * find_sequence_from_ipo_helper(Main * main, Ipo * ipo)
-{
-	Sequence *seq;
-	Scene *sce;
-	
-	for(sce=main->scene.first; sce; sce=sce->id.next) {
-		int found = 0;
-
-		SEQ_BEGIN(sce->ed, seq) {
-			if (seq->ipo == ipo) {
-				found = 1;
-				break;
-			}
-		} 
-		SEQ_END
-
-		if (found) {
-			break;
-		}
-		seq = NULL;
-	}
-
-	if (seq)
-        return seq;
-	else
-		return NULL;
-}
-
-static void lib_link_screen_sequence_ipos(Main *main)
-{
-	bScreen *sc;
-	ScrArea *sa;
-
-	for(sc= main->screen.first; sc; sc= sc->id.next) {
-		for(sa= sc->areabase.first; sa; sa= sa->next) {
-			SpaceLink *sl;
-			for (sl= sa->spacedata.first; sl; sl= sl->next) {
-				if(sl->spacetype == SPACE_IPO) {
-					SpaceIpo *sipo= (SpaceIpo *)sl;
-					if(sipo->blocktype==ID_SEQ) {
-						sipo->from = (ID*) find_sequence_from_ipo_helper(main, sipo->ipo);
-					}
-				}
-			}
-		}
-	}
-}
-
 /* ************ READ WM ***************** */
 
 static void direct_link_windowmanager(FileData *fd, wmWindowManager *wm)
@@ -4123,13 +4066,9 @@
 					}
 					else if(sl->spacetype==SPACE_IPO) {
 						SpaceIpo *sipo= (SpaceIpo *)sl;
-						sipo->editipo= 0;
 						
-						if(sipo->blocktype==ID_SEQ) sipo->from= NULL;	// no libdata
-						else sipo->from= newlibadr(fd, sc->id.lib, sipo->from);
-						
-						sipo->ipokey.first= sipo->ipokey.last= 0;
-						sipo->ipo= newlibadr(fd, sc->id.lib, sipo->ipo);
+						if(sipo->ads)
+							sipo->ads->source= newlibadr(fd, sc->id.lib, sipo->ads->source);
 					}
 					else if(sl->spacetype==SPACE_BUTS) {
 						SpaceButs *sbuts= (SpaceButs *)sl;
@@ -4325,17 +4264,6 @@
 					if((v3d->layact & v3d->lay)==0) v3d->layact= v3d->lay;
 					
 				}
-				else if(sl->spacetype==SPACE_IPO) {
-					SpaceIpo *sipo= (SpaceIpo *)sl;
-					
-					if(sipo->blocktype==ID_SEQ) sipo->from= NULL;	// no libdata
-					else sipo->from= restore_pointer_by_name(newmain, (ID *)sipo->from, 0);
-					
-					// not free sipo->ipokey, creates dependency with src/
-					sipo->ipo= restore_pointer_by_name(newmain, (ID *)sipo->ipo, 0);
-					if(sipo->editipo) MEM_freeN(sipo->editipo);
-					sipo->editipo= NULL;
-				}
 				else if(sl->spacetype==SPACE_BUTS) {
 					SpaceButs *sbuts= (SpaceButs *)sl;
 					sbuts->lockpoin= NULL;
@@ -4574,6 +4502,11 @@
 				
 				view3d_split_250(v3d, &sl->regionbase);
 			}
+			else if (sl->spacetype==SPACE_IPO) {
+				SpaceIpo *sipo= (SpaceIpo*)sl;
+				
+				sipo->ads= newdataadr(fd, sipo->ads);
+			}
 			else if (sl->spacetype==SPACE_OOPS) {
 				SpaceOops *soops= (SpaceOops*) sl;
 				
@@ -5518,8 +5451,14 @@
 				SpaceIpo *sipo= (SpaceIpo *)sl;
 				memcpy(&ar->v2d, &sipo->v2d, sizeof(View2D));
 				
+				/* init mainarea view2d */
 				ar->v2d.scroll |= (V2D_SCROLL_BOTTOM|V2D_SCROLL_SCALE_HORIZONTAL);
 				ar->v2d.scroll |= (V2D_SCROLL_LEFT|V2D_SCROLL_SCALE_VERTICAL);
+				
+				/* init dopesheet */
+				// XXX move this elsewhere instead?
+				sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
+				
 				//ar->v2d.flag |= V2D_IS_INITIALISED;
 				break;
 			}
@@ -8861,7 +8800,6 @@
 	lib_link_armature(fd, main);
 	lib_link_action(fd, main);
 	lib_link_vfont(fd, main);
-	lib_link_screen_sequence_ipos(main);
 	lib_link_nodetree(fd, main);	/* has to be done after scene/materials, this will verify group nodes */
 	lib_link_brush(fd, main);
 	lib_link_particlesettings(fd, main);

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c	2009-01-26 09:13:15 UTC (rev 18678)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_draw.c	2009-01-26 11:33:16 UTC (rev 18679)
@@ -193,25 +193,15 @@
 		return NULL;
 	
 	/* handling depends on the type of animation-context we've got */
-	if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_IPO)) {
-		/* Action Editor (action mode) or Ipo Editor (ipo mode):
+	if (ac->datatype == ANIMCONT_ACTION) {
+		/* Action Editor (action mode) or Graph Editor (ipo mode):
 		 * Only use if editor is not pinned, and active object has action
 		 */
 		if (ac->obact && ac->obact->action) {
-			/* Action Editor */
-			if (ac->datatype == ANIMCONT_ACTION) {
-				SpaceAction *saction= (SpaceAction *)ac->sa->spacedata.first;
-				
-				if (saction->pin == 0)
-					return ac->obact;
-			}
-			/* IPO Editor */
-			else if (ac->datatype == ANIMCONT_IPO) {
-				SpaceIpo *sipo= (SpaceIpo *)ac->sa->spacedata.first;
-				
-				if (sipo->pin == 0)
-					return ac->obact;
-			}
+			SpaceAction *saction= (SpaceAction *)ac->sa->spacedata.first;
+			
+			if (saction->pin == 0)
+				return ac->obact;
 		}
 	}
 	else if ((ac->datatype == ANIMCONT_DOPESHEET) && (ale)) {
@@ -225,6 +215,7 @@
 				return ob;
 		}
 	}
+	// XXX todo: add F-Curves mode (Graph Editor) ...
 	
 	/* no appropriate object found */
 	return NULL;

Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c	2009-01-26 09:13:15 UTC (rev 18678)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c	2009-01-26 11:33:16 UTC (rev 18679)
@@ -196,11 +196,40 @@
 
 /* ----------- Private Stuff - IPO Editor ------------- */
 
-/* Get data being edited in IPO Editor (depending on current 'mode') */
-static short ipoedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
+/* Get data being edited in Graph Editor (depending on current 'mode') */
+static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
 {
-	// XXX FIXME...
-	return 0;
+	/* sync settings with current view status, then return appropriate data */
+	switch (sipo->mode) {
+		case SIPO_MODE_ANIMATION:	/* Animation F-Curve Editor */
+			/* update scene-pointer (no need to check for pinning yet, as not implemented) */
+			sipo->ads->source= (ID *)ac->scene;
+			sipo->ads->filterflag &= ~ADS_FILTER_ONLYDRIVERS;
+			
+			ac->datatype= ANIMCONT_FCURVES;
+			ac->data= sipo->ads;
+			
+			ac->mode= sipo->mode;
+			return 1;
+		
+		case SIPO_MODE_DRIVERS:		/* Driver F-Curve Editor */
+			/* update scene-pointer (no need to check for pinning yet, as not implemented) */
+			sipo->ads->source= (ID *)ac->scene;
+			sipo->ads->filterflag |= ADS_FILTER_ONLYDRIVERS;
+			
+			ac->datatype= ANIMCONT_FCURVES;
+			ac->data= sipo->ads;
+			
+			ac->mode= sipo->mode;
+			return 1;
+		
+		default: /* unhandled yet */
+			ac->datatype= ANIMCONT_NONE;
+			ac->data= NULL;
+			
+			ac->mode= -1;
+			return 0;
+	}
 }
 
 /* ----------- Public API --------------- */
@@ -227,7 +256,7 @@
 			case SPACE_IPO:
 			{
 				SpaceIpo *sipo= (SpaceIpo *)sa->spacedata.first;
-				ok= ipoedit_get_context(ac, sipo);
+				ok= graphedit_get_context(ac, sipo);
 			}
 				break;
 		}
@@ -436,16 +465,19 @@
 	 * NOTE: we need to check if the F-Curves belong to the same group, as this gets called for groups too...
 	 */
 	for (fcu= first; ((fcu) && (fcu->grp==grp)); fcu= fcu->next) {
-		/* only work with this channel and its subchannels if it is editable */
-		if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) {
-			/* only include this curve if selected */
-			if (!(filter_mode & ANIMFILTER_SEL) || (SEL_FCU(fcu))) {
-				/* owner/ownertype will be either object or action-channel, depending if it was dopesheet or part of an action */
-				ale= make_new_animlistelem(fcu, ANIMTYPE_FCURVE, owner, ownertype, owner_id);
-				
-				if (ale) {
-					BLI_addtail(anim_data, ale);
-					items++;
+		/* only include if visible (Graph Editor check, not channels check) */
+		if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
+			/* only work with this channel and its subchannels if it is editable */
+			if (!(filter_mode & ANIMFILTER_FOREDIT) || EDITABLE_FCU(fcu)) {
+				/* only include this curve if selected */
+				if (!(filter_mode & ANIMFILTER_SEL) || (SEL_FCU(fcu))) {
+					/* owner/ownertype will be either object or action-channel, depending if it was dopesheet or part of an action */
+					ale= make_new_animlistelem(fcu, ANIMTYPE_FCURVE, owner, ownertype, owner_id);
+					
+					if (ale) {
+						BLI_addtail(anim_data, ale);
+						items++;
+					}
 				}
 			}
 		}
@@ -985,7 +1017,7 @@
 /* This function filters the active data source to leave only animation channels suitable for
  * usage by the caller. It will return the length of the list 
  * 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list