[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18685] branches/blender2.5/blender/source /blender: Graph Editor: Added files + Bugfixes

Joshua Leung aligorith at gmail.com
Tue Jan 27 00:18:30 CET 2009


Revision: 18685
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18685
Author:   aligorith
Date:     2009-01-27 00:18:27 +0100 (Tue, 27 Jan 2009)

Log Message:
-----------
Graph Editor: Added files + Bugfixes

* Copied files containing code for tools from Action Editor to use as a base for the Graph Editor's tools. The toolsets are now very similar, so it should just be a case of making a few tweaks here and there. Currently all of these tools are #if-def'd out, as there are still a few things to clean up.
(BUILDSYSTEM MAINTAINERS BEWARE!)

* Tweaked some UI stuff (width of mode selector in header, names in the spacetype choosing menu)

* Fixed a few bugs which were causing crashes when loading old files with IPO Editors open. 

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
    branches/blender2.5/blender/source/blender/editors/screen/area.c
    branches/blender2.5/blender/source/blender/editors/space_ipo/SConscript
    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

Added Paths:
-----------
    branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_edit.c
    branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_ops.c
    branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_select.c

Modified: branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-01-26 22:43:12 UTC (rev 18684)
+++ branches/blender2.5/blender/source/blender/blenloader/intern/readfile.c	2009-01-26 23:18:27 UTC (rev 18685)
@@ -5454,11 +5454,7 @@
 				/* 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;
 			}

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 22:43:12 UTC (rev 18684)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c	2009-01-26 23:18:27 UTC (rev 18685)
@@ -199,6 +199,10 @@
 /* Get data being edited in Graph Editor (depending on current 'mode') */
 static short graphedit_get_context (bAnimContext *ac, SpaceIpo *sipo)
 {
+	/* init dopesheet data if non-existant (i.e. for old files) */
+	if (sipo->ads == NULL)
+		sipo->ads= MEM_callocN(sizeof(bDopeSheet), "GraphEdit DopeSheet");
+	
 	/* sync settings with current view status, then return appropriate data */
 	switch (sipo->mode) {
 		case SIPO_MODE_ANIMATION:	/* Animation F-Curve Editor */
@@ -466,7 +470,7 @@
 	 */
 	for (fcu= first; ((fcu) && (fcu->grp==grp)); fcu= fcu->next) {
 		/* only include if visible (Graph Editor check, not channels check) */
-		if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) {
+		//if (!(filter_mode & ANIMFILTER_CURVEVISIBLE) || (fcu->flag & FCURVE_VISIBLE)) { // XXX don't do this till we have tools to set this
 			/* 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 */
@@ -480,7 +484,7 @@
 					}
 				}
 			}
-		}
+		//}
 	}
 	
 	/* return the number of items added to the list */

Modified: branches/blender2.5/blender/source/blender/editors/screen/area.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/screen/area.c	2009-01-26 22:43:12 UTC (rev 18684)
+++ branches/blender2.5/blender/source/blender/editors/screen/area.c	2009-01-26 23:18:27 UTC (rev 18685)
@@ -764,8 +764,8 @@
 		   
 		   "|%l" // 33
 		   
-		   "|Ipo Curve Editor %x2" //54
-		   "|Action Editor %x12" //73
+		   "|Graph Editor %x2" //54
+		   "|DopeSheet Editor %x12" //73
 		   "|NLA Editor %x13" //94
 		   
 		   "|%l" //97

Modified: branches/blender2.5/blender/source/blender/editors/space_ipo/SConscript
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_ipo/SConscript	2009-01-26 22:43:12 UTC (rev 18684)
+++ branches/blender2.5/blender/source/blender/editors/space_ipo/SConscript	2009-01-26 23:18:27 UTC (rev 18685)
@@ -3,7 +3,7 @@
 
 sources = env.Glob('*.c')
 
-incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
+incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf'
 incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
 
 env.BlenderLib ( 'bf_editors_space_ipo', sources, Split(incs), [], libtype=['core'], priority=[50] )

Modified: branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_draw.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_draw.c	2009-01-26 22:43:12 UTC (rev 18684)
+++ branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_draw.c	2009-01-26 23:18:27 UTC (rev 18685)
@@ -247,9 +247,6 @@
 {
 	extern unsigned int nurbcol[];
 	unsigned int *col;
-	
-	BezTriple *bezt=fcu->bezt, *prevbezt=NULL;
-	float *fp;
 	int sel, b;
 	
 	/* don't draw handle lines if handles are not shown */
@@ -258,6 +255,9 @@
 	
 	/* slightly hacky, but we want to draw unselected points before selected ones*/
 	for (sel= 0; sel < 2; sel++) {
+		BezTriple *bezt=fcu->bezt, *prevbezt=NULL;
+		float *fp;
+		
 		if (sel) col= nurbcol+4;
 		else col= nurbcol;
 			
@@ -268,7 +268,7 @@
 				/* only draw first handle if previous segment had handles */
 				if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) 
 				{
-					cpack(col[bezt->h1]);
+					cpack(col[(unsigned char)bezt->h1]);
 					glBegin(GL_LINE_STRIP); 
 						glVertex2fv(fp); glVertex2fv(fp+3); 
 					glEnd();
@@ -278,7 +278,7 @@
 				/* only draw second handle if this segment is bezier */
 				if (bezt->ipo == BEZT_IPO_BEZ) 
 				{
-					cpack(col[bezt->h2]);
+					cpack(col[(unsigned char)bezt->h2]);
 					glBegin(GL_LINE_STRIP); 
 						glVertex2fv(fp+3); glVertex2fv(fp+6); 
 					glEnd();
@@ -290,7 +290,7 @@
 					 ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) ) 
 				{
 					fp= bezt->vec[0];
-					cpack(col[bezt->h1]);
+					cpack(col[(unsigned char)bezt->h1]);
 					
 					glBegin(GL_LINE_STRIP); 
 						glVertex2fv(fp); glVertex2fv(fp+3); 
@@ -302,7 +302,7 @@
 					 (bezt->ipo == BEZT_IPO_BEZ) )
 				{
 					fp= bezt->vec[1];
-					cpack(col[bezt->h2]);
+					cpack(col[(unsigned char)bezt->h2]);
 					
 					glBegin(GL_LINE_STRIP); 
 						glVertex2fv(fp); glVertex2fv(fp+3); 
@@ -604,7 +604,7 @@
 	
 	/* build list of curves to draw */
 		// XXX enable ANIMFILTER_CURVEVISIBLE when we have a method to set them
-	filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY/*|ANIMFILTER_CURVEVISIBLE*/);
+	filter= (ANIMFILTER_VISIBLE|ANIMFILTER_CURVESONLY|ANIMFILTER_CURVEVISIBLE);
 	items= ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
 		
 	/* for each curve:
@@ -630,7 +630,6 @@
 		draw_fcurve_handles(sipo, ar, fcu);
 		draw_fcurve_vertices(sipo, ar, fcu);
 		
-		
 		/* undo mapping of keyframes for drawing if scaled F-Curve */
 		if (nob)
 			ANIM_nla_mapping_apply_fcurve(nob, ale->key_data, 1, 1); 

Added: branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_edit.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_edit.c	                        (rev 0)
+++ branches/blender2.5/blender/source/blender/editors/space_ipo/ipo_edit.c	2009-01-26 23:18:27 UTC (rev 18685)
@@ -0,0 +1,1373 @@
+/**
+ * $Id: editaction.c 17746 2008-12-08 11:19:44Z aligorith $
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Joshua Leung
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+#include <float.h>
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_arithb.h"
+
+#include "DNA_anim_types.h"
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_camera_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_object_types.h"
+#include "DNA_screen_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_space_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
+#include "DNA_userdef_types.h"
+#include "DNA_gpencil_types.h"
+#include "DNA_windowmanager_types.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+
+#include "BKE_action.h"
+#include "BKE_depsgraph.h"
+#include "BKE_fcurve.h"
+#include "BKE_key.h"
+#include "BKE_material.h"
+#include "BKE_object.h"
+#include "BKE_context.h"
+#include "BKE_utildefines.h"
+
+#include "UI_view2d.h"
+
+#include "ED_anim_api.h"
+#include "ED_keyframing.h"
+#include "ED_keyframes_draw.h"
+#include "ED_keyframes_edit.h"
+#include "ED_screen.h"
+#include "ED_space_api.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ipo_intern.h"
+
+#if 0 // XXX code to be sanitied for new system
+
+/* ************************************************************************** */
+/* KEYFRAME-RANGE STUFF */
+
+/* *************************** Calculate Range ************************** */
+
+/* Get the min/max keyframes*/
+static void get_keyframe_extents (bAnimContext *ac, float *xmin, float *xmax, float *ymin, float *ymax)
+{
+	ListBase anim_data = {NULL, NULL};
+	bAnimListElem *ale;
+	int filter;
+	
+	/* get data to filter, from Dopesheet */
+	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE | ANIMFILTER_SEL | ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+	ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+	
+	/* set large values to try to override */
+	if (xmin) *xmin= 999999999.0f;
+	if (xmax) *xmax= -999999999.0f;
+	//if (ymin) *ymin= 999999999.0f;
+	//if (ymax) *ymax= -999999999.0f;
+	
+		// XXX
+	if (ymin) *ymin= -10;
+	if (ymax) *ymax= 10;
+	
+	/* check if any channels to set range with */
+	if (anim_data.first) {
+		/* go through channels, finding max extents */
+		for (ale= anim_data.first; ale; ale= ale->next) {
+			Object *nob= ANIM_nla_mapping_get(ac, ale);
+			FCurve *fcu= (FCurve *)ale->key_data;
+			float tmin, tmax;
+			
+			/* get range and apply necessary scaling before */
+			calc_fcurve_range(fcu, &tmin, &tmax);
+			tmin= tmax= 0.0f; // xxx
+			
+			if (nob) {

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list