From fc7c3c663ef6d908e3c165515a144bdbfddee867 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 22 Mar 2011 14:04:47 +0000 Subject: [PATCH] - weight paint poll would crash if no area was found. - don't print a line for each operator run when in background mode. - extrude was using an invalid type for RNA access. --- source/blender/editors/mesh/editmesh_tools.c | 2 +- .../editors/sculpt_paint/paint_vertex.c | 19 +++++++++++-------- .../windowmanager/intern/wm_event_system.c | 10 ++++++---- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 0dc4314d589..5525a486438 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -728,7 +728,7 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(even Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data); - extrude_mesh(obedit, em, op, RNA_int_get(op->ptr, "type")); + extrude_mesh(obedit, em, op, RNA_enum_get(op->ptr, "type")); BKE_mesh_end_editmesh(obedit->data, em); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index b0979817c88..6859fd333bc 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -127,15 +127,18 @@ int weight_paint_mode_poll(bContext *C) int weight_paint_poll(bContext *C) { - Object *ob = CTX_data_active_object(C); + Object *ob= CTX_data_active_object(C); + ScrArea *sa; - if(ob && ob->mode & OB_MODE_WEIGHT_PAINT && - paint_brush(&CTX_data_tool_settings(C)->wpaint->paint)) { - ScrArea *sa= CTX_wm_area(C); - if(sa->spacetype==SPACE_VIEW3D) { - ARegion *ar= CTX_wm_region(C); - if(ar->regiontype==RGN_TYPE_WINDOW) - return 1; + if( (ob != NULL) && + (ob->mode & OB_MODE_WEIGHT_PAINT) && + (paint_brush(&CTX_data_tool_settings(C)->wpaint->paint) != NULL) && + (sa= CTX_wm_area(C)) && + (sa->spacetype == SPACE_VIEW3D) + ) { + ARegion *ar= CTX_wm_region(C); + if(ar->regiontype==RGN_TYPE_WINDOW) { + return 1; } } return 0; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 15964b8c1e5..8dcd3fa34d1 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -446,10 +446,12 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int pop wm_operator_print(C, op); /* todo - this print may double up, might want to check more flags then the FINISHED */ if (op->type->flag & OPTYPE_REGISTER) { - /* Report the python string representation of the operator */ - char *buf = WM_operator_pystring(C, op->type, op->ptr, 1); - BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf); - MEM_freeN(buf); + if(G.background == 0) { /* ends up printing these in the terminal, gets annoying */ + /* Report the python string representation of the operator */ + char *buf = WM_operator_pystring(C, op->type, op->ptr, 1); + BKE_report(CTX_wm_reports(C), RPT_OPERATOR, buf); + MEM_freeN(buf); + } } }