More UI messages and BKE_reportf->BKE_report fixes...

This commit is contained in:
Bastien Montagne 2012-10-14 15:29:09 +00:00
parent 7b8dc4be0d
commit b7f4c69ef7
9 changed files with 25 additions and 26 deletions

@ -807,8 +807,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
}
if (text == NULL) {
BKE_reportf(op->reports, RPT_WARNING,
"File: '%s' can't be opened", filepath);
BKE_reportf(op->reports, RPT_WARNING, "File: '%s' can't be opened", filepath);
return OPERATOR_CANCELLED;
}
else {
@ -820,8 +819,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op,
st->text = text;
}
else {
BKE_reportf(op->reports, RPT_INFO,
"See '%s' in the text editor", text->id.name + 2);
BKE_reportf(op->reports, RPT_INFO, "See '%s' in the text editor", text->id.name + 2);
}
txt_move_toline(text, line - 1, FALSE);
@ -872,14 +870,12 @@ static int editsource_exec(bContext *C, wmOperator *op)
but_store->py_dbg_ln);
}
else {
BKE_report(op->reports, RPT_ERROR,
"Active button isn't from a script, cant edit source.");
BKE_report(op->reports, RPT_ERROR, "Active button isn't from a script, cant edit source");
ret = OPERATOR_CANCELLED;
}
}
else {
BKE_report(op->reports, RPT_ERROR,
"Active button match can't be found.");
BKE_report(op->reports, RPT_ERROR, "Active button match can't be found");
ret = OPERATOR_CANCELLED;
}
@ -978,19 +974,19 @@ static int edittranslation_exec(bContext *C, wmOperator *op)
if (!BLI_is_dir(root)) {
BKE_report(op->reports, RPT_ERROR, "Please set your User Preferences' \"Translation Branches "
"Directory\" path to a valid directory.");
"Directory\" path to a valid directory");
return OPERATOR_CANCELLED;
}
if (!WM_operatortype_find(EDTSRC_I18N_OP_NAME, 0)) {
BKE_reportf(op->reports, RPT_ERROR, "Could not find operator \"%s\"! Please enable ui_translate addon "
"in the User Preferences.", EDTSRC_I18N_OP_NAME);
"in the User Preferences", EDTSRC_I18N_OP_NAME);
return OPERATOR_CANCELLED;
}
/* Try to find a valid po file for current language... */
edittranslation_find_po_file(root, uilng, popath, FILE_MAX);
/* printf("po path: %s\n", popath);*/
if (popath[0] == '\0') {
BKE_reportf(op->reports, RPT_ERROR, "No valid po found for language '%s' under %s.", uilng, root);
BKE_reportf(op->reports, RPT_ERROR, "No valid po found for language '%s' under %s", uilng, root);
return OPERATOR_CANCELLED;
}

@ -1062,5 +1062,5 @@ void MESH_OT_rip(wmOperatorType *ot)
/* to give to transform */
Transform_Properties(ot, P_PROPORTIONAL);
RNA_def_boolean(ot->srna, "mirror", FALSE, "Mirror Editing", "");
RNA_def_boolean(ot->srna, "use_fill", FALSE, "Fill", "Fille the ripped region");
RNA_def_boolean(ot->srna, "use_fill", FALSE, "Fill", "Fill the ripped region");
}

@ -937,7 +937,7 @@ static int multiresbake_check(bContext *C, wmOperator *op)
ob = base->object;
if (ob->type != OB_MESH) {
BKE_report(op->reports, RPT_ERROR, "Basking of multires data only works with active object which is a mesh");
BKE_report(op->reports, RPT_ERROR, "Baking of multires data only works with an active mesh object");
ok = 0;
break;

@ -442,7 +442,7 @@ static int add_hook_object(Main *bmain, Scene *scene, Object *obedit, Object *ob
ok = object_hook_index_array(scene, obedit, &tot, &indexar, name, cent);
if (!ok) {
BKE_report(reports, RPT_ERROR, "Requires selected vertices or active Vertex Group");
BKE_report(reports, RPT_ERROR, "Requires selected vertices or active vertex group");
return FALSE;
}

@ -417,7 +417,8 @@ static int apply_objects_internal(bContext *C, ReportList *reports, int apply_lo
cu = ob->data;
if (!(cu->flag & CU_3D) && (apply_rot || apply_loc)) {
BKE_report(reports, RPT_ERROR, "Neither rotation nor location could be applied to a 2d curve, doing nothing");
BKE_report(reports, RPT_ERROR,
"Neither rotation nor location could be applied to a 2D curve, doing nothing");
change = 0;
}
if (cu->key) {
@ -961,9 +962,9 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
/* Warn if any errors occurred */
if (tot_lib_error + tot_multiuser_arm_error) {
BKE_reportf(op->reports, RPT_WARNING, "%i Object(s) Not Centered, %i Changed:", tot_lib_error + tot_multiuser_arm_error, tot_change);
BKE_reportf(op->reports, RPT_WARNING, "%i object(s) not centered, %i changed:", tot_lib_error + tot_multiuser_arm_error, tot_change);
if (tot_lib_error)
BKE_reportf(op->reports, RPT_WARNING, "|%i linked library objects", tot_lib_error);
BKE_reportf(op->reports, RPT_WARNING, "|%i linked library object(s)", tot_lib_error);
if (tot_multiuser_arm_error)
BKE_reportf(op->reports, RPT_WARNING, "|%i multiuser armature object(s)", tot_multiuser_arm_error);
}

@ -482,7 +482,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
/* sanity check */
if (!me_src->dvert) {
BKE_reportf(op->reports, RPT_ERROR, "Transfer failed. Source mesh does not have any vertex groups");
BKE_report(op->reports, RPT_ERROR, "Transfer failed (source mesh does not have any vertex groups)");
return 0;
}
@ -528,7 +528,7 @@ static int ed_vgroup_transfer_weight(Object *ob_dst, Object *ob_src, bDeformGrou
if (dv_array_src) MEM_freeN(dv_array_src);
if (dv_array_dst) MEM_freeN(dv_array_dst);
dmesh_src->release(dmesh_src);
BKE_reportf(op->reports, RPT_ERROR, "Transfer failed. Indices are not matching");
BKE_report(op->reports, RPT_ERROR, "Transfer failed (indices are not matching)");
return 0;
}
@ -3126,7 +3126,7 @@ static int vertex_group_limit_total_exec(bContext *C, wmOperator *op)
return OPERATOR_FINISHED;
}
else {
BKE_reportf(op->reports, RPT_WARNING, "No vertex groups limited");
BKE_report(op->reports, RPT_WARNING, "No vertex groups limited");
/* note, would normally return cancelled, except we want the redo
* UI to show up for users to change */
@ -3248,7 +3248,7 @@ static int vertex_group_copy_to_selected_exec(bContext *C, wmOperator *op)
if ((change == 0 && fail == 0) || fail) {
BKE_reportf(op->reports, RPT_ERROR,
"Copy to VGroups to Selected warning done %d, failed %d, object data must have matching indices",
"Copy VGroups to Selected warning, %d done, %d failed (object data must have matching indices)",
change, fail);
}

@ -1558,7 +1558,7 @@ static int image_save_sequence_exec(bContext *C, wmOperator *op)
BLI_strncpy(di, ibuf->name, FILE_MAX);
BLI_splitdirstring(di, fi);
BKE_reportf(op->reports, RPT_INFO, "%d Image(s) will be saved in %s", tot, di);
BKE_reportf(op->reports, RPT_INFO, "%d image(s) will be saved in %s", tot, di);
for (ibuf = sima->image->ibufs.first; ibuf; ibuf = ibuf->next) {
if (ibuf->userflags & IB_BITMAPDIRTY) {

@ -2742,7 +2742,7 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
const char *error_msg;
if (BKE_sequencer_active_get_pair(scene, &seq_act, &seq_other) == 0) {
BKE_report(op->reports, RPT_ERROR, "Must select 2 strips");
BKE_report(op->reports, RPT_ERROR, "Please select two strips");
return OPERATOR_CANCELLED;
}

@ -35,6 +35,8 @@
#include "BKE_report.h"
#include "BKE_context.h"
#include "BLF_translation.h"
#include "../generic/py_capi_utils.h"
static bContext *__py_context = NULL;
@ -98,7 +100,7 @@ short BPy_errors_to_report(ReportList *reports)
pystring = PyC_ExceptionBuffer();
if (pystring == NULL) {
BKE_report(reports, RPT_ERROR, "unknown py-exception, couldn't convert");
BKE_report(reports, RPT_ERROR, "Unknown py-exception, couldn't convert");
return 0;
}
@ -111,12 +113,12 @@ short BPy_errors_to_report(ReportList *reports)
#if 0 // ARG!. workaround for a bug in blenders use of vsnprintf
BKE_reportf(reports, RPT_ERROR, "%s\nlocation:%s:%d\n", cstring, filename, lineno);
#else
pystring_format = PyUnicode_FromFormat("%s\nlocation:%s:%d\n", cstring, filename, lineno);
pystring_format = PyUnicode_FromFormat(TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno);
cstring = _PyUnicode_AsString(pystring_format);
BKE_report(reports, RPT_ERROR, cstring);
#endif
fprintf(stderr, "%s\nlocation:%s:%d\n", cstring, filename, lineno); // not exactly needed. just for testing
fprintf(stderr, TIP_("%s\nlocation:%s:%d\n"), cstring, filename, lineno); // not exactly needed. just for testing
Py_DECREF(pystring);
Py_DECREF(pystring_format); // workaround