[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [35002] trunk/blender/source/blender/ editors: Bugfixes:

Joshua Leung aligorith at gmail.com
Sun Feb 20 22:32:21 CET 2011


Revision: 35002
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=35002
Author:   aligorith
Date:     2011-02-20 21:32:21 +0000 (Sun, 20 Feb 2011)
Log Message:
-----------
Bugfixes:
- Fix for crash with Keying Sets when a Keying Set path has no ID-
block to target
- Info window now indicates the types of the reports shown by
colouring their entries if the entries are not selected.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/animation/keyingsets.c
    trunk/blender/source/blender/editors/armature/poselib.c
    trunk/blender/source/blender/editors/space_info/info_draw.c

Modified: trunk/blender/source/blender/editors/animation/keyingsets.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyingsets.c	2011-02-20 15:48:01 UTC (rev 35001)
+++ trunk/blender/source/blender/editors/animation/keyingsets.c	2011-02-20 21:32:21 UTC (rev 35002)
@@ -937,6 +937,14 @@
 		int arraylen, i;
 		short kflag2;
 		
+		/* skip path if no ID pointer is specified */
+		if (ksp->id == NULL) {
+			BKE_reportf(reports, RPT_WARNING,
+				"Skipping path in Keying Set, as it has no ID (KS = '%s', Path = '%s'[%d])",
+				ks->name, ksp->rna_path, ksp->array_index);
+			continue;
+		}
+		
 		/* since keying settings can be defined on the paths too, extend the path before using it */
 		kflag2 = (kflag | ksp->keyingflag);
 		
@@ -980,20 +988,18 @@
 		}
 		
 		/* set recalc-flags */
-		if (ksp->id) {
-			switch (GS(ksp->id->name)) {
-				case ID_OB: /* Object (or Object-Related) Keyframes */
-				{
-					Object *ob= (Object *)ksp->id;
-					
-					ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; // XXX: only object transforms only?
-				}
-					break;
+		switch (GS(ksp->id->name)) {
+			case ID_OB: /* Object (or Object-Related) Keyframes */
+			{
+				Object *ob= (Object *)ksp->id;
+				
+				ob->recalc |= OB_RECALC_OB|OB_RECALC_DATA|OB_RECALC_TIME; // XXX: only object transforms only?
 			}
-			
-			/* send notifiers for updates (this doesn't require context to work!) */
-			WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
+				break;
 		}
+		
+		/* send notifiers for updates (this doesn't require context to work!) */
+		WM_main_add_notifier(NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
 	}
 	
 	/* return the number of channels successfully affected */

Modified: trunk/blender/source/blender/editors/armature/poselib.c
===================================================================
--- trunk/blender/source/blender/editors/armature/poselib.c	2011-02-20 15:48:01 UTC (rev 35001)
+++ trunk/blender/source/blender/editors/armature/poselib.c	2011-02-20 21:32:21 UTC (rev 35002)
@@ -145,7 +145,11 @@
 {
 	ScrArea *sa = CTX_wm_area(C);
 	
-	if (sa->spacetype == SPACE_BUTS) 
+	/* sanity check */
+	if (C == NULL)
+		return NULL;
+	
+	if (sa && (sa->spacetype == SPACE_BUTS)) 
 		return CTX_data_pointer_get_type(C, "object", &RNA_Object).data;
 	else
 		return ED_object_pose_armature(CTX_data_active_object(C));
@@ -342,7 +346,7 @@
 static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, void *UNUSED(arg))
 {
 	Object *ob= get_poselib_object(C);
-	bAction *act= ob->poselib;
+	bAction *act= (ob) ? ob->poselib : NULL;
 	TimeMarker *marker;
 	
 	/* set the operator execution context correctly */
@@ -473,8 +477,8 @@
 /* can be called with C == NULL */
 static EnumPropertyItem *poselib_stored_pose_itemf(bContext *C, PointerRNA *UNUSED(ptr), int *free)
 {
-	Object *ob;
-	bAction *act;
+	Object *ob = get_poselib_object(C);
+	bAction *act = (ob) ? ob->poselib : NULL;;
 	TimeMarker *marker;
 	EnumPropertyItem *item= NULL, item_tmp= {0};
 	int totitem= 0;
@@ -484,9 +488,6 @@
 		return DummyRNA_DEFAULT_items;
 	}
 	
-	ob= get_poselib_object(C);
-	act= (ob) ? ob->poselib : NULL;
-	
 	/* check that the action exists */
 	if (act) {
 		/* add each marker to the list */

Modified: trunk/blender/source/blender/editors/space_info/info_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_info/info_draw.c	2011-02-20 15:48:01 UTC (rev 35001)
+++ trunk/blender/source/blender/editors/space_info/info_draw.c	2011-02-20 21:32:21 UTC (rev 35002)
@@ -62,14 +62,6 @@
 
 static void info_report_color(unsigned char *fg, unsigned char *bg, Report *report, int bool)
 {
-	/*
-	if		(type & RPT_ERROR_ALL)		{ fg[0]=220; fg[1]=0; fg[2]=0; }
-	else if	(type & RPT_WARNING_ALL)	{ fg[0]=220; fg[1]=96; fg[2]=96; }
-	else if	(type & RPT_OPERATOR_ALL)	{ fg[0]=96; fg[1]=128; fg[2]=255; }
-	else if	(type & RPT_INFO_ALL)		{ fg[0]=0; fg[1]=170; fg[2]=0; }
-	else if	(type & RPT_DEBUG_ALL)		{ fg[0]=196; fg[1]=196; fg[2]=196; }
-	else								{ fg[0]=196; fg[1]=196; fg[2]=196; }
-	*/
 	if(report->flag & SELECT) {
 		fg[0]=255; fg[1]=255; fg[2]=255;
 		if(bool) {
@@ -79,17 +71,35 @@
 			bg[0]=90; bg[1]=122; bg[2]=249;
 		}
 	}
-
 	else {
 		fg[0]=0; fg[1]=0; fg[2]=0;
-
-		if(bool) {
-			bg[0]=120; bg[1]=120; bg[2]=120;
+		
+		if (report->type & RPT_ERROR_ALL) {
+			if (bool) { bg[0]=220; bg[1]=0;   bg[2]=0;   }
+			else      { bg[0]=214; bg[1]=0;   bg[2]=0;   }
 		}
+		else if (report->type & RPT_WARNING_ALL) {
+			if (bool) { bg[0]=220; bg[1]=128; bg[2]=96;  }
+			else      { bg[0]=214; bg[1]=122; bg[2]=90;  }
+		}
+#if 0 // XXX: this looks like the selected colour, so don't use this
+		else if (report->type & RPT_OPERATOR_ALL) {
+			if (bool) { bg[0]=96;  bg[1]=128; bg[2]=255; }
+			else      { bg[0]=90;  bg[1]=122; bg[2]=249; }
+		}
+#endif
+		else if (report->type & RPT_INFO_ALL) {
+			if (bool) { bg[0]=0;   bg[1]=170; bg[2]=0;   }
+			else      { bg[0]=0;   bg[1]=164; bg[2]=0;   }
+		}
+		else if (report->type & RPT_DEBUG_ALL) {
+			if (bool) { bg[0]=196; bg[1]=196; bg[2]=196; }
+			else      { bg[0]=190; bg[1]=190; bg[2]=190; }
+		}
 		else {
-			bg[0]=114; bg[1]=114; bg[2]=114;
+			if (bool) { bg[0]=120; bg[1]=120; bg[2]=120; }
+			else      { bg[0]=114; bg[1]=114; bg[2]=114; }
 		}
-
 	}
 }
 




More information about the Bf-blender-cvs mailing list