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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-07-04 00:37:07 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-07-04 00:37:07 +0400
commit42f6136da8d7325bdb8580d734566b6c8e578e2a (patch)
treeb28d549836dc03afe8a0f30713dd1fcd151c9914 /source/blender/windowmanager
parent7eed4d5c4fa7e1acd179c1d340987bf735ec2963 (diff)
Fix #35991: show warning message to when trying to edit driven values in number buttons.
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/WM_api.h8
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c70
2 files changed, 60 insertions, 18 deletions
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 72b54e2f1f7..f7cd382dc91 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -178,6 +178,14 @@ void WM_event_add_notifier(const struct bContext *C, unsigned int type, void *r
void WM_main_add_notifier(unsigned int type, void *reference);
void WM_main_remove_notifier_reference(const void *reference);
+ /* reports */
+void WM_report(const struct bContext *C, ReportType type, const char *message);
+void WM_reportf(const struct bContext *C, ReportType type, const char *format, ...)
+#ifdef __GNUC__
+__attribute__ ((format(printf, 3, 4)))
+#endif
+;
+
void wm_event_add(struct wmWindow *win, const struct wmEvent *event_to_add);
/* at maximum, every timestep seconds it triggers event_type events */
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index e57baf8801b..dc2f19eded7 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -43,6 +43,7 @@
#include "GHOST_C-api.h"
#include "BLI_blenlib.h"
+#include "BLI_dynstr.h"
#include "BLI_utildefines.h"
#include "BLI_math.h"
@@ -533,6 +534,56 @@ void WM_event_print(const wmEvent *event)
#endif /* NDEBUG */
+static void wm_add_reports(const bContext *C, ReportList *reports)
+{
+ /* if the caller owns them, handle this */
+ if (reports->list.first && (reports->flag & RPT_OP_HOLD) == 0) {
+
+ wmWindowManager *wm = CTX_wm_manager(C);
+ ReportList *wm_reports = CTX_wm_reports(C);
+ ReportTimerInfo *rti;
+
+ /* add reports to the global list, otherwise they are not seen */
+ BLI_movelisttolist(&wm_reports->list, &reports->list);
+
+ /* After adding reports to the global list, reset the report timer. */
+ WM_event_remove_timer(wm, NULL, wm_reports->reporttimer);
+
+ /* Records time since last report was added */
+ wm_reports->reporttimer = WM_event_add_timer(wm, CTX_wm_window(C), TIMERREPORT, 0.05);
+
+ rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo");
+ wm_reports->reporttimer->customdata = rti;
+ }
+}
+
+void WM_report(const bContext *C, ReportType type, const char *message)
+{
+ ReportList reports;
+
+ BKE_reports_init(&reports, RPT_STORE);
+ BKE_report(&reports, type, message);
+
+ wm_add_reports(C, &reports);
+
+ BKE_reports_clear(&reports);
+}
+
+void WM_reportf(const bContext *C, ReportType type, const char *format, ...)
+{
+ DynStr *ds;
+ va_list args;
+
+ ds = BLI_dynstr_new();
+ va_start(args, format);
+ BLI_dynstr_vappendf(ds, format, args);
+ va_end(args);
+
+ WM_report(C, type, BLI_dynstr_get_cstring(ds));
+
+ BLI_dynstr_free(ds);
+}
+
/* (caller_owns_reports == TRUE) when called from python */
static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int caller_owns_reports)
{
@@ -575,24 +626,7 @@ static void wm_operator_reports(bContext *C, wmOperator *op, int retval, int cal
}
/* if the caller owns them, handle this */
- if (op->reports->list.first && (op->reports->flag & RPT_OP_HOLD) == 0) {
-
- wmWindowManager *wm = CTX_wm_manager(C);
- ReportList *wm_reports = CTX_wm_reports(C);
- ReportTimerInfo *rti;
-
- /* add reports to the global list, otherwise they are not seen */
- BLI_movelisttolist(&wm_reports->list, &op->reports->list);
-
- /* After adding reports to the global list, reset the report timer. */
- WM_event_remove_timer(wm, NULL, wm_reports->reporttimer);
-
- /* Records time since last report was added */
- wm_reports->reporttimer = WM_event_add_timer(wm, CTX_wm_window(C), TIMERREPORT, 0.05);
-
- rti = MEM_callocN(sizeof(ReportTimerInfo), "ReportTimerInfo");
- wm_reports->reporttimer->customdata = rti;
- }
+ wm_add_reports(C, op->reports);
}
/* this function is mainly to check that the rules for freeing