diff options
author | Ton Roosendaal <ton@blender.org> | 2010-12-21 18:10:09 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2010-12-21 18:10:09 +0300 |
commit | fae8dc5a735d6e47d96d5757fbc51a33b45a4cea (patch) | |
tree | fcced0ae10dba2d9afbcc6ef4c997edb6d762d8f /source/blender/editors/mesh | |
parent | b0f87a17460578382cabb8447934cb045eee223a (diff) |
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)
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 14 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_mods.c | 26 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 36 | ||||
-rw-r--r-- | source/blender/editors/mesh/loopcut.c | 12 | ||||
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 14 |
5 files changed, 55 insertions, 47 deletions
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index c601a583d02..16f629f0450 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -359,13 +359,13 @@ int make_fgon(EditMesh *em, wmOperator *op, int make) 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 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op) 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 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op) 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 @@ static void addedgeface_mesh(EditMesh *em, wmOperator *op) 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) { diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index 5a2464bb0c6..661539d536b 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -1458,7 +1458,7 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) 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 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) 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 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) 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 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) 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 @@ void EM_mesh_copy_face(EditMesh *em, wmOperator *op, short type) 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 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type) 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 @@ void EM_mesh_copy_face_layer(EditMesh *em, wmOperator *op, short type) 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 @@ int select_by_number_vertices_exec(bContext *C, wmOperator *op) 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 @@ static int select_sharp_edges_exec(bContext *C, wmOperator *op) /* '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 @@ static void select_linked_flat_faces(EditMesh *em, wmOperator *op, float sharpne 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 @@ void select_non_manifold(EditMesh *em, wmOperator *op ) */ 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 @@ void faceselect_align_view_to_selected(View3D *v3d, RegionView3D *rv3d, Mesh *me } 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 @@ void editmesh_align_view_to_selected(Object *obedit, EditMesh *em, wmOperator *o 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; diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index b1306a5c262..7c3262f3747 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -635,7 +635,7 @@ static void extrude_mesh(Object *obedit, EditMesh *em, wmOperator *op, short typ 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 @@ static int spin_mesh_exec(bContext *C, wmOperator *op) 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 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) } } 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 @@ static int screw_mesh_exec(bContext *C, wmOperator *op) 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 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) } 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 @@ static int edge_rotate_selected(bContext *C, wmOperator *op) } } 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 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) } 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 @@ static int mesh_rip_invoke(bContext *C, wmOperator *op, wmEvent *event) } 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 @@ static void shape_propagate(Object *obedit, EditMesh *em, wmOperator *op) 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 @@ static void shape_propagate(Object *obedit, EditMesh *em, wmOperator *op) } } } else { - BKE_report(op->reports, RPT_ERROR, "Object Has No Blendshapes"); + BKE_report(op->reports, RPT_WARNING, "Object Has No Blendshapes"); return; } @@ -5858,7 +5858,7 @@ static int merge_exec(bContext *C, wmOperator *op) if(ese && ese->type == EDITVERT) { count = merge_firstlast(em, 0, uvs); } else { - BKE_report(op->reports, RPT_ERROR, "no last selected vertex set"); + BKE_report(op->reports, RPT_WARNING, "no last selected vertex set"); } break; case 6: @@ -5867,7 +5867,7 @@ static int merge_exec(bContext *C, wmOperator *op) count = merge_firstlast(em, 1, uvs); } else { - BKE_report(op->reports, RPT_ERROR, "no last selected vertex set"); + BKE_report(op->reports, RPT_WARNING, "no last selected vertex set"); } break; case 5: @@ -6123,7 +6123,7 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op) } else { BKE_mesh_end_editmesh(obedit->data, em); - BKE_report(op->reports, RPT_ERROR, "Path Selection requires that exactly two vertices be selected"); + BKE_report(op->reports, RPT_WARNING, "Path Selection requires that exactly two vertices be selected"); return OPERATOR_CANCELLED; } @@ -6408,7 +6408,7 @@ static int mesh_rotate_uvs(bContext *C, wmOperator *op) int dir= RNA_enum_get(op->ptr, "direction"); if (!EM_texFaceCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -6482,7 +6482,7 @@ static int mesh_mirror_uvs(bContext *C, wmOperator *op) int axis= RNA_enum_get(op->ptr, "axis"); if (!EM_texFaceCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no uv/image layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no uv/image layers."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -6570,7 +6570,7 @@ static int mesh_rotate_colors(bContext *C, wmOperator *op) int dir= RNA_enum_get(op->ptr, "direction"); if (!EM_vertColorCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers."); + BKE_report(op->reports, RPT_WARNING, "Mesh has no color layers."); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } @@ -6627,7 +6627,7 @@ static int mesh_mirror_colors(bContext *C, wmOperator *op) int axis= RNA_enum_get(op->ptr, "axis"); if (!EM_vertColorCheck(em)) { - BKE_report(op->reports, RPT_ERROR, "Mesh has no color layers"); + BKE_report(op->reports, RPT_WARNING, "Mesh has no color layers"); BKE_mesh_end_editmesh(obedit->data, em); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index f39180bbe1b..bc42bd2747b 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -32,11 +32,11 @@ #include <stdio.h> #include "DNA_ID.h" +#include "DNA_object_types.h" #include "DNA_screen_types.h" #include "DNA_scene_types.h" #include "DNA_userdef_types.h" #include "DNA_windowmanager_types.h" -#include "DNA_object_types.h" #include "MEM_guardedalloc.h" @@ -50,8 +50,10 @@ #include "BKE_blender.h" #include "BKE_context.h" #include "BKE_depsgraph.h" -#include "BKE_scene.h" #include "BKE_mesh.h" +#include "BKE_modifier.h" +#include "BKE_report.h" +#include "BKE_scene.h" #include "BIF_gl.h" #include "BIF_glutil.h" /* for paint cursor */ @@ -385,6 +387,12 @@ static int ringcut_invoke (bContext *C, wmOperator *op, wmEvent *evt) EditEdge *edge; int dist = 75; + + if(modifiers_getCageIndex(CTX_data_scene(C), CTX_data_edit_object(C), NULL, 1)>=0) { + BKE_report(op->reports, RPT_WARNING, "Loop cut can't work on deformed edit mesh display"); + return OPERATOR_CANCELLED; + } + view3d_operator_needs_opengl(C); if (!ringsel_init(C, op, 1)) diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 1f3950f561b..6cf0fe0874e 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -105,13 +105,13 @@ int join_mesh_exec(bContext *C, wmOperator *op) CustomData vdata, edata, fdata; if(scene->obedit) { - BKE_report(op->reports, RPT_ERROR, "Cant join while in editmode"); + BKE_report(op->reports, RPT_WARNING, "Cant join while in editmode"); return OPERATOR_CANCELLED; } /* ob is the object we are adding geometry to */ if(!ob || ob->type!=OB_MESH) { - BKE_report(op->reports, RPT_ERROR, "Active object is not a mesh"); + BKE_report(op->reports, RPT_WARNING, "Active object is not a mesh"); return OPERATOR_CANCELLED; } @@ -137,7 +137,7 @@ int join_mesh_exec(bContext *C, wmOperator *op) /* that way the active object is always selected */ if(ok==0) { - BKE_report(op->reports, RPT_ERROR, "Active object is not a selected mesh"); + BKE_report(op->reports, RPT_WARNING, "Active object is not a selected mesh"); return OPERATOR_CANCELLED; } @@ -146,12 +146,12 @@ int join_mesh_exec(bContext *C, wmOperator *op) key= me->key; if(totvert==0 || totvert==me->totvert) { - BKE_report(op->reports, RPT_ERROR, "No mesh data to join"); + BKE_report(op->reports, RPT_WARNING, "No mesh data to join"); return OPERATOR_CANCELLED; } if(totvert > MESH_MAX_VERTS) { - BKE_reportf(op->reports, RPT_ERROR, "Joining results in %d vertices, limit is " STRINGIFY(MESH_MAX_VERTS), totvert); + BKE_reportf(op->reports, RPT_WARNING, "Joining results in %d vertices, limit is " STRINGIFY(MESH_MAX_VERTS), totvert); return OPERATOR_CANCELLED; } @@ -571,9 +571,9 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op) if (!ok) { if (nonequal_verts) - BKE_report(op->reports, RPT_ERROR, "Selected meshes must have equal numbers of vertices."); + BKE_report(op->reports, RPT_WARNING, "Selected meshes must have equal numbers of vertices."); else - BKE_report(op->reports, RPT_ERROR, "No additional selected meshes with equal vertex count to join."); + BKE_report(op->reports, RPT_WARNING, "No additional selected meshes with equal vertex count to join."); return OPERATOR_CANCELLED; } |