Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2010-11-17 15:02:36 +0300
committerJoshua Leung <aligorith@gmail.com>2010-11-17 15:02:36 +0300
commitf7137610390804b8016240bc6401540a912e2495 (patch)
treebc0409baecb7a837e93d5794e0bfd1128b5f7584 /source/blender/editors/interface
parent91217f117f739dc93381a4542094141f46639be3 (diff)
Keyframing Operators: Improved Error Messages
* Keyframing operators now use the reports system for displaying all its error messages. - The benefit of this is that users no longer need to check the console for error messages if keyframing fails. - Unfortunately, reports are not currently viewable in any space/view in Blender, so... * Added a temporary operator (UI_OT_reports_to_textblock), which can be accessed in the UI from the button which appears in place of the icon when more than one report exists. This dumps the current list of reports to a textblock "Recent Reports", from which they can be viewed. This isn't really nice, but at least we now have a way to view these again, which makes debugging some things a pain. * Bugfix #24606 - when trying to add keyframes to F-Curves with F-Modifiers already which alter the curve significantly enough that the keyframes will have no effect, there are now warnings which aim to alleviate any confusion.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_anim.c3
-rw-r--r--source/blender/editors/interface/interface_ops.c51
-rw-r--r--source/blender/editors/interface/interface_templates.c16
3 files changed, 64 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_anim.c b/source/blender/editors/interface/interface_anim.c
index 2a30a36ffe0..4021e4208dc 100644
--- a/source/blender/editors/interface/interface_anim.c
+++ b/source/blender/editors/interface/interface_anim.c
@@ -105,10 +105,11 @@ void ui_but_anim_autokey(bContext *C, uiBut *but, Scene *scene, float cfra)
// TODO: this should probably respect the keyingset only option for anim
if(autokeyframe_cfra_can_key(scene, id)) {
+ ReportList *reports = CTX_wm_reports(C);
short flag = ANIM_get_keyframing_flags(scene, 1);
fcu->flag &= ~FCURVE_SELECTED;
- insert_keyframe(id, action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
+ insert_keyframe(reports, id, action, ((fcu->grp)?(fcu->grp->name):(NULL)), fcu->rna_path, fcu->array_index, cfra, flag);
WM_event_add_notifier(C, NC_ANIMATION|ND_KEYFRAME|NA_EDITED, NULL);
}
}
diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index 10458a763e6..b4a6f9e77a3 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -34,11 +34,15 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
+#include "DNA_text_types.h" /* for UI_OT_reports_to_text */
#include "BLI_blenlib.h"
#include "BLI_math_color.h"
#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_text.h" /* for UI_OT_reports_to_text */
+#include "BKE_report.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -402,7 +406,51 @@ void UI_OT_copy_to_selected_button(wmOperatorType *ot)
/* properties */
RNA_def_boolean(ot->srna, "all", 1, "All", "Reset to default values all elements of the array.");
}
-
+
+/* Reports to Textblock Operator ------------------------ */
+
+/* FIXME: this is just a temporary operator so that we can see all the reports somewhere
+ * when there are too many to display...
+ */
+
+static int reports_to_text_poll(bContext *C)
+{
+ return CTX_wm_reports(C) != NULL;
+}
+
+static int reports_to_text_exec(bContext *C, wmOperator *op)
+{
+ ReportList *reports = CTX_wm_reports(C);
+ Text *txt;
+ char *str;
+
+ /* create new text-block to write to */
+ txt = add_empty_text("Recent Reports");
+
+ /* convert entire list to a display string, and add this to the text-block
+ * - if commandline debug option enabled, show debug reports too
+ * - otherwise, up to info (which is what users normally see)
+ */
+ str = BKE_reports_string(reports, (G.f & G_DEBUG)? RPT_DEBUG : RPT_INFO);
+
+ write_text(txt, str);
+ MEM_freeN(str);
+
+ return OPERATOR_FINISHED;
+}
+
+void UI_OT_reports_to_textblock(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Reports to Text Block";
+ ot->idname= "UI_OT_reports_to_textblock";
+ ot->description= "Write the reports ";
+
+ /* callbacks */
+ ot->poll= reports_to_text_poll;
+ ot->exec= reports_to_text_exec;
+}
+
/* ********************************************************* */
/* Registration */
@@ -413,5 +461,6 @@ void UI_buttons_operatortypes(void)
WM_operatortype_append(UI_OT_copy_data_path_button);
WM_operatortype_append(UI_OT_reset_default_button);
WM_operatortype_append(UI_OT_copy_to_selected_button);
+ WM_operatortype_append(UI_OT_reports_to_textblock); // XXX: temp?
}
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index a5964d595dd..8237e175794 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2331,6 +2331,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
uiBut *but;
uiStyle *style= U.uistyles.first;
int width;
+ int icon=0;
/* if the report display has timed out, don't show */
if (!reports->reporttimer) return;
@@ -2364,13 +2365,20 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
/* icon and report message on top */
if(report->type & RPT_ERROR_ALL)
- uiDefIconBut(block, LABEL, 0, ICON_ERROR, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+ icon = ICON_ERROR;
else if(report->type & RPT_WARNING_ALL)
- uiDefIconBut(block, LABEL, 0, ICON_ERROR, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+ icon = ICON_ERROR;
else if(report->type & RPT_INFO_ALL)
- uiDefIconBut(block, LABEL, 0, ICON_INFO, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
+ icon = ICON_INFO;
+
+ /* XXX: temporary operator to dump all reports to a text block, but only if more than 1 report
+ * to be shown instead of icon when appropriate...
+ */
+ if (reports->list.first != reports->list.last)
+ uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "Click to see rest of reports in textblock: 'Recent Reports'");
+ else
+ uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
uiDefBut(block, LABEL, 0, report->message, UI_UNIT_X+10, 0, UI_UNIT_X+width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, "");
-
}