[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33837] trunk/blender/source/blender: Error/Warning report flipping.

Ton Roosendaal ton at blender.org
Tue Dec 21 16:10:11 CET 2010


Revision: 33837
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33837
Author:   ton
Date:     2010-12-21 16:10:09 +0100 (Tue, 21 Dec 2010)

Log Message:
-----------
Error/Warning report flipping.

An operator Error throws up a menu, a Warning only a flashy header print.
In mesh editmode the menus for simple failures got very annoying, like
"Already a face" for Fkey on a face.

Proposal is to use warning for contextual failures, like:
- wrong selection
- unsupported combination
- wrong modes

And use errors for cases you really need user attention, for example when
issues are invisble or potentially damaging work.
- Memory failures
- Files not found

List can grow in future :) let's test this for mesh now.
I'll tackle this for other ops later after review.

(Also changed: loopcut disabled when editmode shows deformed result)

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/modifier.c
    trunk/blender/source/blender/editors/mesh/editmesh_add.c
    trunk/blender/source/blender/editors/mesh/editmesh_mods.c
    trunk/blender/source/blender/editors/mesh/editmesh_tools.c
    trunk/blender/source/blender/editors/mesh/loopcut.c
    trunk/blender/source/blender/editors/mesh/meshtools.c
    trunk/blender/source/blender/editors/space_node/node_edit.c

Modified: trunk/blender/source/blender/blenkernel/intern/modifier.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/modifier.c	2010-12-21 15:10:04 UTC (rev 33836)
+++ trunk/blender/source/blender/blenkernel/intern/modifier.c	2010-12-21 15:10:09 UTC (rev 33837)
@@ -236,7 +236,8 @@
  * there
  * 
  * also used in transform_conversion.c, to detect CrazySpace [tm] (2nd arg
- * then is NULL)
+ * then is NULL) 
+ * also used for some mesh tools to give warnings
  */
 int modifiers_getCageIndex(struct Scene *scene, Object *ob, int *lastPossibleCageIndex_r, int virtual_)
 {

Modified: trunk/blender/source/blender/editors/mesh/editmesh_add.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_add.c	2010-12-21 15:10:04 UTC (rev 33836)
+++ trunk/blender/source/blender/editors/mesh/editmesh_add.c	2010-12-21 15:10:09 UTC (rev 33837)
@@ -359,13 +359,13 @@
 		if(eve->f1==1) break;
 	}
 	if(eve) {
-		BKE_report(op->reports, RPT_ERROR, "Cannot make a polygon with interior vertices");
+		BKE_report(op->reports, RPT_WARNING, "Cannot make a polygon with interior vertices");
 		return 0;
 	}
 	
 	// check for faces
 	if(nor==NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No faces were selected to make FGon");
+		BKE_report(op->reports, RPT_WARNING, "No faces were selected to make FGon");
 		return 0;
 	}
 
@@ -746,7 +746,7 @@
 		return;
 	}
 	else if(amount<2) {
-		BKE_report(op->reports, RPT_ERROR, "More vertices are needed to make an edge/face");
+		BKE_report(op->reports, RPT_WARNING, "More vertices are needed to make an edge/face");
 		return;
 	}
 
@@ -758,7 +758,7 @@
 			efa= addfacelist(em, neweve[0], neweve[1], neweve[2], 0, NULL, NULL);
 			EM_select_face(efa, 1);
 		}
-		else BKE_report(op->reports, RPT_ERROR, "The selected vertices already form a face");
+		else BKE_report(op->reports, RPT_WARNING, "The selected vertices already form a face");
 	}
 	else if(amount==4) {
 		/* this test survives when theres 2 triangles */
@@ -810,14 +810,14 @@
 						else if( convex(neweve[0]->co, neweve[3]->co, neweve[1]->co, neweve[2]->co) ) {
 							efa= addfacelist(em, neweve[0], neweve[3], neweve[1], neweve[2], NULL, NULL);
 						}
-						else BKE_report(op->reports, RPT_ERROR, "cannot find nice quad from concave set of vertices");
+						else BKE_report(op->reports, RPT_WARNING, "cannot find nice quad from concave set of vertices");
 
 					}
 				}
 			}
-			else BKE_report(op->reports, RPT_ERROR, "The selected vertices already form a face");
+			else BKE_report(op->reports, RPT_WARNING, "The selected vertices already form a face");
 		}
-		else BKE_report(op->reports, RPT_ERROR, "The selected vertices already form a face");
+		else BKE_report(op->reports, RPT_WARNING, "The selected vertices already form a face");
 	}
 	
 	if(efa) {

Modified: trunk/blender/source/blender/editors/mesh/editmesh_mods.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_mods.c	2010-12-21 15:10:04 UTC (rev 33836)
+++ trunk/blender/source/blender/editors/mesh/editmesh_mods.c	2010-12-21 15:10:09 UTC (rev 33837)
@@ -1458,7 +1458,7 @@
 		break;
 	case 2:	/* copy image */
 		if (!tf_act) {
-			BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
+			BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers.");
 			return;
 		}
 		for(efa=em->faces.first; efa; efa=efa->next) {
@@ -1479,7 +1479,7 @@
 
 	case 3: /* copy UV's */
 		if (!tf_act) {
-			BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
+			BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers.");
 			return;
 		}
 		for(efa=em->faces.first; efa; efa=efa->next) {
@@ -1492,7 +1492,7 @@
 		break;
 	case 4: /* mode's */
 		if (!tf_act) {
-			BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
+			BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers.");
 			return;
 		}
 		for(efa=em->faces.first; efa; efa=efa->next) {
@@ -1505,7 +1505,7 @@
 		break;
 	case 5: /* copy transp's */
 		if (!tf_act) {
-			BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers.");
+			BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers.");
 			return;
 		}
 		for(efa=em->faces.first; efa; efa=efa->next) {
@@ -1519,7 +1519,7 @@
 
 	case 6: /* copy vcols's */
 		if (!mcol_act) {
-			BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers.");
+			BKE_report(op->reports, RPT_WARNING, "Mesh has no color layers.");
 			return;
 		} else {
 			/* guess the 4th color if needs be */
@@ -1576,7 +1576,7 @@
 	case 8:
 	case 9:
 		if (CustomData_number_of_layers(&em->fdata, CD_MTFACE)<2) {
-			BKE_report(op->reports, RPT_ERROR, "mesh does not have multiple uv/image layers");
+			BKE_report(op->reports, RPT_WARNING, "mesh does not have multiple uv/image layers");
 			return;
 		} else {
 			int layer_orig_idx, layer_idx;
@@ -1603,7 +1603,7 @@
 
 	case 10: /* select vcol layers - make sure this stays in sync with above code */
 		if (CustomData_number_of_layers(&em->fdata, CD_MCOL)<2) {
-			BKE_report(op->reports, RPT_ERROR, "mesh does not have multiple color layers");
+			BKE_report(op->reports, RPT_WARNING, "mesh does not have multiple color layers");
 			return;
 		} else {
 			int layer_orig_idx, layer_idx;
@@ -2853,7 +2853,7 @@
 		EM_set_flag_all(em, SELECT);
 	}
 	else if(em->selectmode!=SCE_SELECT_FACE) {
-		BKE_report(op->reports, RPT_ERROR, "Only works in face selection mode");
+		BKE_report(op->reports, RPT_WARNING, "Only works in face selection mode");
 		return OPERATOR_CANCELLED;
 	}
 	
@@ -2949,7 +2949,7 @@
 	/* 'standard' behaviour - check if selected, then apply relevant selection */
 	
 	if(em->selectmode==SCE_SELECT_FACE) {
-		BKE_report(op->reports, RPT_ERROR, "Doesn't work in face selection mode");
+		BKE_report(op->reports, RPT_WARNING, "Doesn't work in face selection mode");
 		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_CANCELLED;
 	}
@@ -3067,7 +3067,7 @@
 	float fsharpness;
 	
 	if(em->selectmode!=SCE_SELECT_FACE) {
-		BKE_report(op->reports, RPT_ERROR, "Only works in face selection mode");
+		BKE_report(op->reports, RPT_WARNING, "Only works in face selection mode");
 		return;
 	}
 
@@ -3231,7 +3231,7 @@
 	 */
 	
 	if(em->selectmode==SCE_SELECT_FACE) {
-		BKE_report(op->reports, RPT_ERROR, "Doesn't work in face selection mode");
+		BKE_report(op->reports, RPT_WARNING, "Doesn't work in face selection mode");
 		return;
 	}
 
@@ -4129,7 +4129,7 @@
 	}
 
 	if (totselected == 0)
-		BKE_report(op->reports, RPT_ERROR, "No faces selected.");
+		BKE_report(op->reports, RPT_WARNING, "No faces selected.");
 	else
 		view3d_align_axis_to_vector(v3d, rv3d, axis, norm);
 }
@@ -4161,7 +4161,7 @@
 	float norm[3]={0.0, 0.0, 0.0}; /* used for storing the mesh normal */
 	
 	if (nselverts==0) {
-		BKE_report(op->reports, RPT_ERROR, "No faces or vertices selected.");
+		BKE_report(op->reports, RPT_WARNING, "No faces or vertices selected.");
 	} 
 	else if (EM_nfaces_selected(em)) {
 		EditFace *efa;

Modified: trunk/blender/source/blender/editors/mesh/editmesh_tools.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2010-12-21 15:10:04 UTC (rev 33836)
+++ trunk/blender/source/blender/editors/mesh/editmesh_tools.c	2010-12-21 15:10:09 UTC (rev 33837)
@@ -635,7 +635,7 @@
 	EM_stats_update(em);
 
 	if(transmode==0) {
-		BKE_report(op->reports, RPT_ERROR, "Not a valid selection for extrude");
+		BKE_report(op->reports, RPT_WARNING, "Not a valid selection for extrude");
 	}
 	else {
 		EM_fgon_flags(em);
@@ -991,7 +991,7 @@
 
 	ok= spin_mesh(C, op, NULL, RNA_int_get(op->ptr,"steps"), RNA_float_get(op->ptr,"degrees"), RNA_boolean_get(op->ptr,"dupli"));
 	if(ok==0) {
-		BKE_report(op->reports, RPT_ERROR, "No valid vertices are selected");
+		BKE_report(op->reports, RPT_WARNING, "No valid vertices are selected");
 		return OPERATOR_CANCELLED;
 	}
 
@@ -1077,7 +1077,7 @@
 		}
 	}
 	if(v1==NULL || v2==NULL) {
-		BKE_report(op->reports, RPT_ERROR, "You have to select a string of connected vertices too");
+		BKE_report(op->reports, RPT_WARNING, "You have to select a string of connected vertices too");
 		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_CANCELLED;
 	}
@@ -1103,7 +1103,7 @@
 		return OPERATOR_FINISHED;
 	}
 	else {
-		BKE_report(op->reports, RPT_ERROR, "No valid vertices are selected");
+		BKE_report(op->reports, RPT_WARNING, "No valid vertices are selected");
 		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_CANCELLED;
 	}
@@ -3777,7 +3777,7 @@
 		}
 		else
 		{
-			BKE_report(op->reports, RPT_ERROR, "Select one edge or two adjacent faces");
+			BKE_report(op->reports, RPT_WARNING, "Select one edge or two adjacent faces");
 			BKE_mesh_end_editmesh(obedit->data, em);
 			return OPERATOR_CANCELLED;
 		}
@@ -3792,7 +3792,7 @@
 		}
 	}
 	else  {
-		BKE_report(op->reports, RPT_ERROR, "Select one edge or two adjacent faces");
+		BKE_report(op->reports, RPT_WARNING, "Select one edge or two adjacent faces");
 		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_CANCELLED;
 	}
@@ -4878,12 +4878,12 @@
 	}
 
 	if(efa) {
-		BKE_report(op->reports, RPT_ERROR, "Can't perform ripping with faces selected this way");
+		BKE_report(op->reports, RPT_WARNING, "Can't perform ripping with faces selected this way");
 		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_CANCELLED;
 	}
 	if(sefa==NULL) {
-		BKE_report(op->reports, RPT_ERROR, "No proper selection or faces included");
+		BKE_report(op->reports, RPT_WARNING, "No proper selection or faces included");
 		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_CANCELLED;
 	}
@@ -4948,7 +4948,7 @@
 	}
 
 	if(seed==NULL) {	// never happens?
-		BKE_report(op->reports, RPT_ERROR, "No proper edge found to start");
+		BKE_report(op->reports, RPT_WARNING, "No proper edge found to start");
 		BKE_mesh_end_editmesh(obedit->data, em);
 		return OPERATOR_CANCELLED;
 	}
@@ -5078,7 +5078,7 @@
 	if(me->key){
 		ky = me->key;
 	} else {
-		BKE_report(op->reports, RPT_ERROR, "Object Has No Key");
+		BKE_report(op->reports, RPT_WARNING, "Object Has No Key");
 		return;
 	}
 
@@ -5093,7 +5093,7 @@
 			}
 		}
 	} else {
-		BKE_report(op->reports, RPT_ERROR, "Object Has No Blendshapes");
+		BKE_report(op->reports, RPT_WARNING, "Object Has No Blendshapes");
 		return;

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list