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:
authorArystanbek Dyussenov <arystan.d@gmail.com>2010-09-04 22:49:07 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2010-09-04 22:49:07 +0400
commit90b464d3728d9ed8ec26fdf59058d236b99dbcd9 (patch)
treee88cab4fb1358e962b19f658064ca8c9f8d29f5b /source/blender/editors/space_info/info_ops.c
parent08d02dd04d836976b25793bb1d4c6a86b3f924c7 (diff)
parentb0b787ef38f9947b3176642556f5282eb3518f69 (diff)
COLLADA branch: merge from trunk -r 28015:31610.soc-2009-chingachgook
Diffstat (limited to 'source/blender/editors/space_info/info_ops.c')
-rw-r--r--source/blender/editors/space_info/info_ops.c105
1 files changed, 100 insertions, 5 deletions
diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c
index e2baeb9abac..51767d3e006 100644
--- a/source/blender/editors/space_info/info_ops.c
+++ b/source/blender/editors/space_info/info_ops.c
@@ -36,6 +36,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
+#include "BLI_math.h"
#include "BLI_bpath.h"
#include "BKE_context.h"
@@ -44,14 +45,11 @@
#include "BKE_main.h"
#include "BKE_packedFile.h"
#include "BKE_report.h"
-#include "BKE_screen.h"
#include "WM_api.h"
#include "WM_types.h"
-#include "BIF_gl.h"
-#include "BIF_glutil.h"
#include "UI_interface.h"
@@ -270,7 +268,7 @@ static int find_missing_files_exec(bContext *C, wmOperator *op)
{
char *path;
- path= RNA_string_get_alloc(op->ptr, "path", NULL, 0);
+ path= RNA_string_get_alloc(op->ptr, "filepath", NULL, 0);
findMissingFiles(path, G.sce);
MEM_freeN(path);
@@ -298,5 +296,102 @@ void FILE_OT_find_missing_files(wmOperatorType *ot)
ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
/* properties */
- WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE);
+ WM_operator_properties_filesel(ot, 0, FILE_SPECIAL, FILE_OPENFILE, WM_FILESEL_FILEPATH);
+}
+
+/********************* report box operator *********************/
+
+/* Hard to decide whether to keep this as an operator,
+ * or turn it into a hardcoded ui control feature,
+ * handling TIMER events for all regions in interface_handlers.c
+ * Not sure how good that is to be accessing UI data from
+ * inactive regions, so use this for now. --matt
+ */
+
+#define INFO_TIMEOUT 5.0
+#define INFO_COLOR_TIMEOUT 3.0
+#define ERROR_TIMEOUT 10.0
+#define ERROR_COLOR_TIMEOUT 6.0
+#define COLLAPSE_TIMEOUT 0.2
+static int update_reports_display_invoke(bContext *C, wmOperator *op, wmEvent *event)
+{
+ wmWindowManager *wm= CTX_wm_manager(C);
+ ReportList *reports= CTX_wm_reports(C);
+ Report *report;
+ ReportTimerInfo *rti;
+ float progress=0.0, color_progress=0.0;
+ float neutral_col[3] = {0.35, 0.35, 0.35};
+ float neutral_grey= 0.6;
+ float timeout=0.0, color_timeout=0.0;
+
+ /* escape if not our timer */
+ if(reports->reporttimer==NULL || reports->reporttimer != event->customdata)
+ return OPERATOR_PASS_THROUGH;
+
+ report= BKE_reports_last_displayable(reports);
+ rti = (ReportTimerInfo *)reports->reporttimer->customdata;
+
+ timeout = (report->type & RPT_ERROR_ALL)?ERROR_TIMEOUT:INFO_TIMEOUT;
+ color_timeout = (report->type & RPT_ERROR_ALL)?ERROR_COLOR_TIMEOUT:INFO_COLOR_TIMEOUT;
+
+ /* clear the report display after timeout */
+ if (reports->reporttimer->duration > timeout) {
+ WM_event_remove_timer(wm, NULL, reports->reporttimer);
+ reports->reporttimer = NULL;
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL);
+
+ return (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH);
+ }
+
+ if (rti->widthfac == 0.0) {
+ /* initialise colours based on report type */
+ if(report->type & RPT_ERROR_ALL) {
+ rti->col[0] = 1.0;
+ rti->col[1] = 0.2;
+ rti->col[2] = 0.0;
+ } else if(report->type & RPT_WARNING_ALL) {
+ rti->col[0] = 1.0;
+ rti->col[1] = 1.0;
+ rti->col[2] = 0.0;
+ } else if(report->type & RPT_INFO_ALL) {
+ rti->col[0] = 0.3;
+ rti->col[1] = 0.45;
+ rti->col[2] = 0.7;
+ }
+ rti->greyscale = 0.75;
+ rti->widthfac=1.0;
+ }
+
+ progress = reports->reporttimer->duration / timeout;
+ color_progress = reports->reporttimer->duration / color_timeout;
+
+ /* fade colours out sharply according to progress through fade-out duration */
+ interp_v3_v3v3(rti->col, rti->col, neutral_col, color_progress);
+ rti->greyscale = interpf(neutral_grey, rti->greyscale, color_progress);
+
+ /* collapse report at end of timeout */
+ if (progress*timeout > timeout - COLLAPSE_TIMEOUT) {
+ rti->widthfac = (progress*timeout - (timeout - COLLAPSE_TIMEOUT)) / COLLAPSE_TIMEOUT;
+ rti->widthfac = 1.0 - rti->widthfac;
+ }
+
+ WM_event_add_notifier(C, NC_SPACE|ND_SPACE_INFO, NULL);
+
+ return (OPERATOR_FINISHED|OPERATOR_PASS_THROUGH);
+}
+
+void INFO_OT_reports_display_update(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name= "Update Reports Display";
+ ot->idname= "INFO_OT_reports_display_update";
+
+ /* api callbacks */
+ ot->invoke= update_reports_display_invoke;
+
+ /* flags */
+ ot->flag= 0;
+
+ /* properties */
}