[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23491] branches/ge_dyn_load/source: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r23484 :23490

Campbell Barton ideasman42 at gmail.com
Fri Sep 25 18:43:11 CEST 2009


Revision: 23491
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23491
Author:   campbellbarton
Date:     2009-09-25 18:43:11 +0200 (Fri, 25 Sep 2009)

Log Message:
-----------
svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r23484:23490

Modified Paths:
--------------
    branches/ge_dyn_load/source/blender/blenloader/BLO_readfile.h
    branches/ge_dyn_load/source/blender/blenloader/intern/readfile.c
    branches/ge_dyn_load/source/blender/editors/space_graph/graph_draw.c
    branches/ge_dyn_load/source/blender/editors/space_graph/graph_edit.c
    branches/ge_dyn_load/source/blender/editors/space_graph/graph_ops.c
    branches/ge_dyn_load/source/blender/editors/space_graph/graph_select.c
    branches/ge_dyn_load/source/creator/CMakeLists.txt
    branches/ge_dyn_load/source/gameengine/Converter/BL_ArmatureObject.h
    branches/ge_dyn_load/source/gameengine/Converter/BL_BlenderDataConversion.cpp
    branches/ge_dyn_load/source/gameengine/Converter/KX_BlenderSceneConverter.cpp

Modified: branches/ge_dyn_load/source/blender/blenloader/BLO_readfile.h
===================================================================
--- branches/ge_dyn_load/source/blender/blenloader/BLO_readfile.h	2009-09-25 16:30:15 UTC (rev 23490)
+++ branches/ge_dyn_load/source/blender/blenloader/BLO_readfile.h	2009-09-25 16:43:11 UTC (rev 23491)
@@ -211,7 +211,7 @@
 void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag);
 
 /* deprecated */
-#if 0
+#if 1
 void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, int idcode, short flag, struct Main *mainvar, struct Scene *scene, struct ReportList *reports);
 #endif
 

Modified: branches/ge_dyn_load/source/blender/blenloader/intern/readfile.c
===================================================================
--- branches/ge_dyn_load/source/blender/blenloader/intern/readfile.c	2009-09-25 16:30:15 UTC (rev 23490)
+++ branches/ge_dyn_load/source/blender/blenloader/intern/readfile.c	2009-09-25 16:43:11 UTC (rev 23491)
@@ -11057,7 +11057,7 @@
 /* this should probably be moved into the Python code anyway */
 /* tentatively removed, Python should be able to use the split functions too: */
 /* BLO_library_append_begin, BLO_library_append_end, BLO_library_append_named_part */
-#if 0 
+#if 1
 void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, 
 		int idcode, short flag, Main *mainvar, Scene *scene, ReportList *reports)
 {

Modified: branches/ge_dyn_load/source/blender/editors/space_graph/graph_draw.c
===================================================================
--- branches/ge_dyn_load/source/blender/editors/space_graph/graph_draw.c	2009-09-25 16:30:15 UTC (rev 23490)
+++ branches/ge_dyn_load/source/blender/editors/space_graph/graph_draw.c	2009-09-25 16:43:11 UTC (rev 23491)
@@ -91,26 +91,6 @@
 extern void gl_round_box(int mode, float minx, float miny, float maxx, float maxy, float rad);
 
 /* *************************** */
-/* Utility Drawing Defines */
-
-/* determine the alpha value that should be used when 
- * drawing components for some F-Curve (fcu)
- *	- selected F-Curves should be more visible than partially visible ones
- */
-#define drawFCurveFade(fcu) ( ((fcu)->flag & FCURVE_SELECTED)? 1.0f : 0.5f )
-
-/* set the colour for some point from some value given packed into an int 
- *	- intV: integer value containing color info packed into an int
- *	- alpha: float value describing the 
- */
-#define cpackA(intVC, alpha) \
-	{ \
-		float _cpackCol[3]; \
-		cpack_to_rgb(intVC, &_cpackCol[0], &_cpackCol[1], &_cpackCol[2]); \
-		glColor4f(_cpackCol[0], _cpackCol[1], _cpackCol[2], alpha); \
-	}
-
-/* *************************** */
 /* F-Curve Modifier Drawing */
 
 /* Envelope -------------- */
@@ -278,20 +258,22 @@
 /* helper func - set color to draw F-Curve data with */
 static void set_fcurve_vertex_color (SpaceIpo *sipo, FCurve *fcu, short sel)
 {
-	/* Fade the 'intensity' of the vertices based on the selection of the curves too */
-	int alphaOffset= (int)((drawFCurveFade(fcu) - 1.0f) * 255);
-	
-	/* Set color of curve vertex based on state of curve (i.e. 'Edit' Mode) */
-	if ((fcu->flag & FCURVE_PROTECTED)==0) {
-		/* Curve's points ARE BEING edited */
-		if (sel) UI_ThemeColorShadeAlpha(TH_VERTEX_SELECT, 0, alphaOffset); 
-		else UI_ThemeColorShadeAlpha(TH_VERTEX, 0, alphaOffset);
-	} 
-	else {
-		/* Curve's points CANNOT BE edited */
-		if (sel) UI_ThemeColorShadeAlpha(TH_TEXT_HI, 0, alphaOffset);
-		else UI_ThemeColorShadeAlpha(TH_TEXT, 0, alphaOffset);
-	}
+#if 0
+		if (sipo->showkey) {
+			if (sel) UI_ThemeColor(TH_TEXT_HI);
+			else UI_ThemeColor(TH_TEXT);
+		} 
+#endif
+		if ((fcu->flag & FCURVE_PROTECTED)==0) {
+			/* Curve's points are being edited */
+			if (sel) UI_ThemeColor(TH_VERTEX_SELECT); 
+			else UI_ThemeColor(TH_VERTEX);
+		} 
+		else {
+			/* Curve's points cannot be edited */
+			if (sel) UI_ThemeColor(TH_TEXT_HI);
+			else UI_ThemeColor(TH_TEXT);
+		}
 }
 
 
@@ -340,7 +322,7 @@
 	if ((sipo->flag & SIPO_NOHANDLES) || (fcu->flag & FCURVE_PROTECTED) || (fcu->flag & FCURVE_INT_VALUES))
 		return;
 	
-	/* slightly hacky, but we want to draw unselected points before selected ones */
+	/* 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;
@@ -355,7 +337,7 @@
 				/* only draw first handle if previous segment had handles */
 				if ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) 
 				{
-					cpackA(col[(unsigned char)bezt->h1], drawFCurveFade(fcu));
+					cpack(col[(unsigned char)bezt->h1]);
 					glBegin(GL_LINE_STRIP); 
 						glVertex2fv(fp); glVertex2fv(fp+3); 
 					glEnd();
@@ -365,7 +347,7 @@
 				/* only draw second handle if this segment is bezier */
 				if (bezt->ipo == BEZT_IPO_BEZ) 
 				{
-					cpackA(col[(unsigned char)bezt->h2], drawFCurveFade(fcu));
+					cpack(col[(unsigned char)bezt->h2]);
 					glBegin(GL_LINE_STRIP); 
 						glVertex2fv(fp+3); glVertex2fv(fp+6); 
 					glEnd();
@@ -377,7 +359,7 @@
 					 ( (!prevbezt && (bezt->ipo==BEZT_IPO_BEZ)) || (prevbezt && (prevbezt->ipo==BEZT_IPO_BEZ)) ) ) 
 				{
 					fp= bezt->vec[0];
-					cpackA(col[(unsigned char)bezt->h1], drawFCurveFade(fcu));
+					cpack(col[(unsigned char)bezt->h1]);
 					
 					glBegin(GL_LINE_STRIP); 
 						glVertex2fv(fp); glVertex2fv(fp+3); 
@@ -389,7 +371,7 @@
 					 (bezt->ipo == BEZT_IPO_BEZ) )
 				{
 					fp= bezt->vec[1];
-					cpackA(col[(unsigned char)bezt->h2], drawFCurveFade(fcu));
+					cpack(col[(unsigned char)bezt->h2]);
 					
 					glBegin(GL_LINE_STRIP); 
 						glVertex2fv(fp); glVertex2fv(fp+3); 
@@ -428,6 +410,7 @@
 	glScalef(1.0f/xscale*hsize, 1.0f/yscale*hsize, 1.0f);
 	
 	/* anti-aliased lines for more consistent appearance */
+		// XXX needed here?
 	glEnable(GL_LINE_SMOOTH);
 	glEnable(GL_BLEND);
 	
@@ -523,6 +506,7 @@
 }
 
 /* helper func - draw a samples-based F-Curve */
+// TODO: add offset stuff...
 static void draw_fcurve_curve_samples (FCurve *fcu, View2D *v2d)
 {
 	FPoint *prevfpt= fcu->fpt;
@@ -663,7 +647,7 @@
 			 */
 			
 			/* resol not depending on horizontal resolution anymore, drivers for example... */
-			// TODO: would be nice to make this depend on the scale of the graph too...
+			// XXX need to take into account the scale
 			if (fcu->driver) 
 				resol= 32;
 			else 
@@ -825,7 +809,7 @@
 				/* set whatever color the curve has set 
 				 *	- unselected curves draw less opaque to help distinguish the selected ones
 				 */
-				glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], drawFCurveFade(fcu));
+				glColor4f(fcu->color[0], fcu->color[1], fcu->color[2], ((sel) ? 1.0f : 0.5f));
 			}
 			
 			/* anti-aliased lines for less jagged appearance */
@@ -858,9 +842,6 @@
 		 *	- if the option to only show controls if the F-Curve is selected is enabled, we must obey this
 		 */
 		if (!(sipo->flag & SIPO_SELCUVERTSONLY) || (fcu->flag & FCURVE_SELECTED)) {
-			/* enable blending to allow fading of curves */
-			glEnable(GL_BLEND);
-			
 			if (fcurve_needs_draw_fmodifier_controls(fcu, fcm)) {
 				/* only draw controls if this is the active modifier */
 				if ((fcu->flag & FCURVE_ACTIVE) && (fcm)) {
@@ -882,9 +863,6 @@
 					draw_fcurve_samples(sipo, ar, fcu);
 				}
 			}
-			
-			/* restore settings */
-			glDisable(GL_BLEND);
 		}
 		
 		/* undo mapping of keyframes for drawing if scaled F-Curve */

Modified: branches/ge_dyn_load/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- branches/ge_dyn_load/source/blender/editors/space_graph/graph_edit.c	2009-09-25 16:30:15 UTC (rev 23490)
+++ branches/ge_dyn_load/source/blender/editors/space_graph/graph_edit.c	2009-09-25 16:43:11 UTC (rev 23491)
@@ -1710,13 +1710,18 @@
 	/* start from 1 to skip the 'Invalid' modifier type */
 	for (i = 1; i < FMODIFIER_NUM_TYPES; i++) {
 		FModifierTypeInfo *fmi= get_fmodifier_typeinfo(i);
+		PointerRNA props_ptr;
 		
 		/* check if modifier is valid for this context */
 		if (fmi == NULL)
 			continue;
 		
-		/* add entry to add this type of modifier */
-		uiItemEnumO(layout, fmi->name, 0, "GRAPH_OT_fmodifier_add", "type", i);
+		/* create operator menu item with relevant properties filled in */
+		props_ptr= uiItemFullO(layout, fmi->name, 0, "GRAPH_OT_fmodifier_add", NULL, WM_OP_EXEC_REGION_WIN, UI_ITEM_O_RETURN_PROPS);
+			/* the only thing that gets set from the menu is the type of F-Modifier to add */
+		RNA_enum_set(&props_ptr, "type", i);
+			/* the following properties are just repeats of existing ones... */
+		RNA_boolean_set(&props_ptr, "only_active", RNA_boolean_get(op->ptr, "only_active"));
 	}
 	uiItemS(layout);
 	
@@ -1728,36 +1733,41 @@
 static int graph_fmodifier_add_exec(bContext *C, wmOperator *op)
 {
 	bAnimContext ac;
+	ListBase anim_data = {NULL, NULL};
 	bAnimListElem *ale;
-	FCurve *fcu;
-	FModifier *fcm;
+	int filter;
 	short type;
 	
 	/* get editor data */
 	if (ANIM_animdata_get_context(C, &ac) == 0)
 		return OPERATOR_CANCELLED;
-		
-		// xxx call the raw methods here instead?
-	ale= get_active_fcurve_channel(&ac);
-	if (ale == NULL) 
-		return OPERATOR_CANCELLED;
 	
-	fcu= (FCurve *)ale->data;
-	MEM_freeN(ale);
-	if (fcu == NULL) 
-		return OPERATOR_CANCELLED;
-		
 	/* get type of modifier to add */
 	type= RNA_enum_get(op->ptr, "type");
 	
-	/* add F-Modifier of specified type to active F-Curve, and make it the active one */
-	fcm= add_fmodifier(&fcu->modifiers, type);
-	if (fcm)
-		set_active_fmodifier(&fcu->modifiers, fcm);
-	else {
-		BKE_report(op->reports, RPT_ERROR, "Modifier couldn't be added. See console for details.");
-		return OPERATOR_CANCELLED;
+	/* filter data */
+	filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CURVEVISIBLE| ANIMFILTER_FOREDIT | ANIMFILTER_CURVESONLY);
+	if (RNA_boolean_get(op->ptr, "only_active"))
+		filter |= ANIMFILTER_ACTIVE;
+	else
+		filter |= ANIMFILTER_SEL;
+	ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
+	
+	/* smooth keyframes */
+	for (ale= anim_data.first; ale; ale= ale->next) {
+		FCurve *fcu= (FCurve *)ale->data;
+		FModifier *fcm;
+		
+		/* add F-Modifier of specified type to active F-Curve, and make it the active one */
+		fcm= add_fmodifier(&fcu->modifiers, type);
+		if (fcm)
+			set_active_fmodifier(&fcu->modifiers, fcm);
+		else { // TODO: stop when this happens?

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list