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:
authorTon Roosendaal <ton@blender.org>2012-11-11 22:33:35 +0400
committerTon Roosendaal <ton@blender.org>2012-11-11 22:33:35 +0400
commit731e15be069d0d4231a93c3eb48b936f3b36179b (patch)
tree5ce2b604b100134f1ee5427ae792cc11235f870f /source/blender/editors
parent6f32bece7faa16b9fbc5c794822c545c0ab51640 (diff)
Four fixes (own collection)
- Screencast: stops working on window resize - crashes movie file output - Screencast now draws simple brush overlay to indicate mouse cursor. - Greasepencil now works again to use MMB for view rotates (and missed proper redraw signal for toolbar, at end of paint)
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c8
-rw-r--r--source/blender/editors/screen/screendump.c60
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c2
3 files changed, 64 insertions, 6 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index fa681ae2f70..fcead283033 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1800,7 +1800,7 @@ static void gpencil_stroke_end(wmOperator *op)
static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
{
tGPsdata *p = op->customdata;
- int estate = OPERATOR_RUNNING_MODAL; /* default exit state - we don't pass on events, GP is used with key-modifiers */
+ int estate = OPERATOR_PASS_THROUGH; /* default exit state */
/* if (event->type == NDOF_MOTION)
* return OPERATOR_PASS_THROUGH;
@@ -1815,7 +1815,11 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, wmEvent *event)
* in 3D space.
*/
- /* printf("\tGP - handle modal event...\n"); */
+ /* we don't pass on key events, GP is used with key-modifiers - prevents Dkey to insert drivers */
+ if (ISKEYBOARD(event->type))
+ estate = OPERATOR_RUNNING_MODAL;
+
+ //printf("\tGP - handle modal event...\n");
/* exit painting mode (and/or end current stroke)
* NOTE: cannot do RIGHTMOUSE (as is standard for cancelling) as that would break polyline [#32647]
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 0ecac5fc497..b8d620ae714 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -30,6 +30,7 @@
#include <string.h>
+#include <math.h>
#include "MEM_guardedalloc.h"
@@ -52,6 +53,7 @@
#include "BKE_writeavi.h"
#include "BIF_gl.h"
+#include "BIF_glutil.h"
#include "RNA_access.h"
#include "RNA_define.h"
@@ -278,6 +280,7 @@ void SCREEN_OT_screenshot(wmOperatorType *ot)
typedef struct ScreenshotJob {
Main *bmain;
Scene *scene;
+ wmWindowManager *wm;
unsigned int *dumprect;
int x, y, dumpsx, dumpsy;
short *stop;
@@ -395,6 +398,54 @@ static void screenshot_startjob(void *sjv, short *stop, short *do_update, float
BKE_report(&sj->reports, RPT_INFO, "Screencast job stopped");
}
+/* Helper callback for drawing the cursor itself */
+static void screencast_draw_cursor(bContext *UNUSED(C), int x, int y, void *UNUSED(p_ptr))
+{
+
+ glPushMatrix();
+
+ glTranslatef((float)x, (float)y, 0.0f);
+
+
+ glEnable(GL_LINE_SMOOTH);
+ glEnable(GL_BLEND);
+
+ glColor4ub(0, 0, 0, 32);
+ glutil_draw_filled_arc(0.0, M_PI * 2.0, 20, 40);
+
+ glColor4ub(255, 255, 255, 128);
+ glutil_draw_lined_arc(0.0, M_PI * 2.0, 20, 40);
+
+ glDisable(GL_BLEND);
+ glDisable(GL_LINE_SMOOTH);
+
+ glPopMatrix();
+}
+
+/* Turn brush cursor in 3D view on/off */
+static void screencast_cursor_toggle(wmWindowManager *wm, short enable)
+{
+ static void *cursor = NULL;
+
+ if (cursor && !enable) {
+ /* clear cursor */
+ WM_paint_cursor_end(wm, cursor);
+ cursor = NULL;
+ }
+ else if (enable) {
+ /* enable cursor */
+ cursor = WM_paint_cursor_activate(wm, NULL, screencast_draw_cursor, NULL);
+ }
+}
+
+static void screenshot_endjob(void *sjv)
+{
+ ScreenshotJob *sj = sjv;
+
+ screencast_cursor_toggle(sj->wm, 0);
+}
+
+
static int screencast_exec(bContext *C, wmOperator *op)
{
bScreen *screen = CTX_wm_screen(C);
@@ -418,15 +469,18 @@ static int screencast_exec(bContext *C, wmOperator *op)
}
sj->bmain = CTX_data_main(C);
sj->scene = CTX_data_scene(C);
-
+ sj->wm = CTX_wm_manager(C);
+
BKE_reports_init(&sj->reports, RPT_PRINT);
/* setup job */
WM_jobs_customdata_set(wm_job, sj, screenshot_freejob);
WM_jobs_timer(wm_job, 0.1, 0, NC_SCREEN | ND_SCREENCAST);
- WM_jobs_callbacks(wm_job, screenshot_startjob, NULL, screenshot_updatejob, NULL);
+ WM_jobs_callbacks(wm_job, screenshot_startjob, NULL, screenshot_updatejob, screenshot_endjob);
+
+ WM_jobs_start(sj->wm, wm_job);
- WM_jobs_start(CTX_wm_manager(C), wm_job);
+ screencast_cursor_toggle(sj->wm, 1);
WM_event_add_notifier(C, NC_SCREEN | ND_SCREENCAST, screen);
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 6818c78bbd6..3413377c7b9 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -945,7 +945,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_GPENCIL:
- if (wmn->data == ND_DATA)
+ if (wmn->data == ND_DATA || wmn->action == NA_EDITED)
ED_region_tag_redraw(ar);
break;
}