[Bf-blender-cvs] [04f9c795aae] master: UI: replace "reports to text" operator with showing info log

Brecht Van Lommel noreply at git.blender.org
Mon Aug 19 14:57:04 CEST 2019


Commit: 04f9c795aae6a70693fbf5eac880cffe26036cf3
Author: Brecht Van Lommel
Date:   Mon Aug 19 14:53:14 2019 +0200
Branches: master
https://developer.blender.org/rB04f9c795aae6a70693fbf5eac880cffe26036cf3

UI: replace "reports to text" operator with showing info log

This operator only existed to be able to see multiple reports, now instead the
info log can be opened and contents can be copy/pasted.

Patch by Valentin (Poulpator)

Differential Revision: https://developer.blender.org/D5510

===================================================================

M	source/blender/editors/interface/interface_ops.c
M	source/blender/editors/interface/interface_templates.c

===================================================================

diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c
index fbd422a9752..c7ce66cfcf6 100644
--- a/source/blender/editors/interface/interface_ops.c
+++ b/source/blender/editors/interface/interface_ops.c
@@ -27,7 +27,7 @@
 
 #include "DNA_armature_types.h"
 #include "DNA_screen_types.h"
-#include "DNA_text_types.h"   /* for UI_OT_reports_to_text */
+#include "DNA_text_types.h"
 #include "DNA_object_types.h" /* for OB_DATA_SUPPORT_ID */
 
 #include "BLI_blenlib.h"
@@ -45,7 +45,7 @@
 #include "BKE_node.h"
 #include "BKE_report.h"
 #include "BKE_screen.h"
-#include "BKE_text.h" /* for UI_OT_reports_to_text */
+#include "BKE_text.h"
 
 #include "IMB_colormanagement.h"
 
@@ -1095,60 +1095,6 @@ static void UI_OT_jump_to_target_button(wmOperatorType *ot)
 
 /** \} */
 
-/* -------------------------------------------------------------------- */
-/** \name 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 bool reports_to_text_poll(bContext *C)
-{
-  return CTX_wm_reports(C) != NULL;
-}
-
-static int reports_to_text_exec(bContext *C, wmOperator *UNUSED(op))
-{
-  ReportList *reports = CTX_wm_reports(C);
-  Main *bmain = CTX_data_main(C);
-  Text *txt;
-  char *str;
-
-  /* create new text-block to write to */
-  txt = BKE_text_add(bmain, "Recent Reports");
-
-  /* convert entire list to a display string, and add this to the text-block
-   * - if command-line debug option enabled, show debug reports too
-   * - otherwise, up to info (which is what users normally see)
-   */
-  str = BKE_reports_string(reports, (G.debug & G_DEBUG) ? RPT_DEBUG : RPT_INFO);
-
-  if (str) {
-    BKE_text_write(txt, str);
-    MEM_freeN(str);
-
-    return OPERATOR_FINISHED;
-  }
-  else {
-    return OPERATOR_CANCELLED;
-  }
-}
-
-static 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;
-}
-
-/** \} */
-
 /* -------------------------------------------------------------------- */
 /** \name Edit Python Source Operator
  * \{ */
@@ -1750,7 +1696,6 @@ void ED_operatortypes_ui(void)
   WM_operatortype_append(UI_OT_override_remove_button);
   WM_operatortype_append(UI_OT_copy_to_selected_button);
   WM_operatortype_append(UI_OT_jump_to_target_button);
-  WM_operatortype_append(UI_OT_reports_to_textblock); /* XXX: temp? */
   WM_operatortype_append(UI_OT_drop_color);
 #ifdef WITH_PYTHON
   WM_operatortype_append(UI_OT_editsource);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 22573c9c7d2..27e7601a2b8 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6378,7 +6378,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C)
   if (reports->list.first != reports->list.last) {
     uiDefIconButO(block,
                   UI_BTYPE_BUT,
-                  "UI_OT_reports_to_textblock",
+                  "SCREEN_OT_info_log_show",
                   WM_OP_INVOKE_REGION_WIN,
                   icon,
                   2,



More information about the Bf-blender-cvs mailing list