[Bf-blender-cvs] [a9bffb12de1] soc-2020-info-editor: Merge branch 'D8147-add-log-report' into soc-2020-info-editor
Mateusz GrzeliÅski
noreply at git.blender.org
Tue Jun 30 17:24:58 CEST 2020
Commit: a9bffb12de16ea2636c62cb7e2ec22211d806ab7
Author: Mateusz Grzeliński
Date: Tue Jun 30 17:23:33 2020 +0200
Branches: soc-2020-info-editor
https://developer.blender.org/rBa9bffb12de16ea2636c62cb7e2ec22211d806ab7
Merge branch 'D8147-add-log-report' into soc-2020-info-editor
===================================================================
===================================================================
diff --cc source/blender/editors/space_info/info_intern.h
index 9eef804aaea,4470c19c317..630028c5e44
--- a/source/blender/editors/space_info/info_intern.h
+++ b/source/blender/editors/space_info/info_intern.h
@@@ -57,8 -59,8 +59,9 @@@ void info_textview_main(const struct Sp
const struct ReportList *reports);
/* info_report.c */
+ ReportList *clog_to_report_list(void);
int info_report_mask(const struct SpaceInfo *sinfo);
+bool info_filter_text(const Report *report, const char *search_string);
void INFO_OT_select_pick(struct wmOperatorType *ot); /* report selection */
void INFO_OT_select_all(struct wmOperatorType *ot);
void INFO_OT_select_box(struct wmOperatorType *ot);
diff --cc source/blender/editors/space_info/info_report.c
index 6b721630ceb,00c2b504aed..ae7a4b5def5
--- a/source/blender/editors/space_info/info_report.c
+++ b/source/blender/editors/space_info/info_report.c
@@@ -39,17 -41,10 +41,18 @@@
#include "RNA_access.h"
#include "RNA_define.h"
+ #include "../../../../intern/clog/CLG_log.h"
#include "info_intern.h"
-static void reports_select_all(ReportList *reports, int report_mask, int action)
+#define REPORT_INDEX_INVALID -1
+
+/* return true if substring is found */
+bool info_filter_text(const Report *report, const char *search_string)
+{
+ return strstr(report->message, search_string) != NULL;
+}
+
+static void reports_select_all(ReportList *reports, int report_mask, const char *search_string, int action)
{
if (action == SEL_TOGGLE) {
action = SEL_SELECT;
@@@ -153,79 -150,25 +156,80 @@@ void INFO_OT_report_replay(wmOperatorTy
static int select_report_pick_exec(bContext *C, wmOperator *op)
{
- int report_index = RNA_int_get(op->ptr, "report_index");
- bool extend = RNA_boolean_get(op->ptr, "extend");
+ const int report_index = RNA_int_get(op->ptr, "report_index");
+ const bool extend = RNA_boolean_get(op->ptr, "extend");
+ const bool use_range = RNA_boolean_get(op->ptr, "extend_range");
+ const bool deselect_all = RNA_boolean_get(op->ptr, "deselect_all");
+
SpaceInfo *sinfo = CTX_wm_space_info(C);
- ReportList *reports = CTX_wm_reports(C);
+
+ ReportList *reports = sinfo->active_reports;
+ Report *report = BLI_findlink(&reports->list, report_index);
+
const int report_mask = info_report_mask(sinfo);
+
+ if (report_index == REPORT_INDEX_INVALID) { // click in empty area
+ reports_select_all(reports, report_mask, sinfo->search_string, SEL_DESELECT);
+ ED_area_tag_redraw(CTX_wm_area(C));
+ return OPERATOR_FINISHED;
+ }
+
- Report *report = BLI_findlink((const struct ListBase *)reports, report_index);
if (!report) {
return OPERATOR_CANCELLED;
}
-
- if (!extend) {
- reports_select_all(reports, report_mask, SEL_DESELECT);
+ const Report *active_report = BLI_findlink((const struct ListBase *)reports,
+ sinfo->active_report_index);
+ const bool is_active_report_selected = active_report->flag & SELECT;
+
+ if (deselect_all) {
+ reports_select_all(reports, report_mask, sinfo->search_string, SEL_DESELECT);
}
- report->flag ^= SELECT; /* toggle */
- ED_area_tag_redraw(CTX_wm_area(C));
+ if (active_report == NULL) {
+ report->flag = SELECT;
+ sinfo->active_report_index = report_index;
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+ return OPERATOR_FINISHED;
+ }
+
+ if (use_range) {
+ if (is_active_report_selected) {
+ if (report_index < sinfo->active_report_index) {
+ for (Report *i = report; i && i->prev != active_report; i = i->next) {
+ i->flag = SELECT;
+ }
+ }
+ else {
+ for (Report *report_iter = report; report_iter && report_iter->next != active_report;
+ report_iter = report_iter->prev) {
+ report_iter->flag = SELECT;
+ }
+ }
+ ED_area_tag_redraw(CTX_wm_area(C));
+ return OPERATOR_FINISHED;
+ }
+ else {
+ reports_select_all(reports, report_mask, sinfo->search_string, SEL_DESELECT);
+ report->flag = SELECT;
+ sinfo->active_report_index = report_index;
+
+ ED_area_tag_redraw(CTX_wm_area(C));
+ return OPERATOR_FINISHED;
+ }
+ }
+
+ if (extend && (report->flag & SELECT) && report_index == sinfo->active_report_index) {
+ report->flag = ~SELECT;
+ }
+ else {
+ report->flag = SELECT;
+ sinfo->active_report_index = BLI_findindex(&reports->list, report);
+ }
+
+ ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
}
diff --cc source/blender/makesdna/DNA_space_types.h
index b5698f3cc6b,4042b209bee..4a1d02f4fb7
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@@ -111,13 -112,27 +112,29 @@@ typedef struct SpaceInfo
char _pad0[6];
/* End 'SpaceLink' header. */
- char rpt_mask;
- /* determine which reports will be visible in info editor */
+ char report_mask_exclude;
+ char _pad[3];
+ int active_report_index;
+ char search_string[64];
+ char view;
- char _pad[6];
++ char _pad1[7];
+ /* reports that were converted from CLOG */
+ ReportList *active_reports;
+ // int clog_show;
} SpaceInfo;
+ typedef enum eSpaceInfo_View {
+ INFO_VIEW_REPORTS,
+ INFO_VIEW_CLOG,
+ } eSpaceInfo_View;
+
+ /* SpaceInfo.clog_show */
+ typedef enum eSpaceInfo_ClogShow {
+ INFO_CLOG_SHOW_TIMESTAMP = (1 << 0),
+ // ...
+ } eSpaceInfo_ClogShow;
+
-/* SpaceInfo.rpt_mask */
+/* SpaceInfo.report_mask_exclude */
typedef enum eSpaceInfo_RptMask {
INFO_RPT_DEBUG = (1 << 0),
INFO_RPT_INFO = (1 << 1),
diff --cc source/blender/makesrna/intern/rna_space.c
index 9b054f1d7fc,9bd92fca41c..57b168f46eb
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@@ -6089,23 -6085,21 +6089,35 @@@ static void rna_def_space_info(BlenderR
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
prop = RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_ERR);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "report_mask_exclude", INFO_RPT_ERR);
RNA_def_property_ui_text(prop, "Show Error", "Display error text");
+ RNA_def_property_ui_icon(prop, ICON_CANCEL, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+ prop = RNA_def_property(srna, "show_report_property", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "report_mask_exclude", INFO_RPT_PROP);
+ RNA_def_property_ui_text(prop, "Show Property", "Display property change");
+ RNA_def_property_ui_icon(prop, ICON_PROPERTIES, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+
+ prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "search_string");
+ RNA_def_property_ui_text(prop, "Log Filter", "Live filtering string");
+ RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO, NULL);
++
+ static const EnumPropertyItem view_type_items[] = {
+ {INFO_VIEW_REPORTS, "REPORTS", 0, "Reports", ""},
+ {INFO_VIEW_CLOG, "CLOGS", 0, "Logs", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+ prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "view");
+ RNA_def_property_enum_items(prop, view_type_items);
+ RNA_def_property_ui_text(prop, "View reports or logs", "");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_CHANGE_REPORT_SOURCE, NULL);
}
static void rna_def_space_userpref(BlenderRNA *brna)
More information about the Bf-blender-cvs
mailing list