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:
authorJason Wilkins <Jason.A.Wilkins@gmail.com>2014-10-07 19:39:17 +0400
committerJason Wilkins <Jason.A.Wilkins@gmail.com>2014-10-07 19:39:17 +0400
commit189c2e9277d4abd3b750a5a60ef42549dcfe359d (patch)
tree1430a845f4aab56b9133c3d8c6ffac09ee6dd92a /source/blender/windowmanager
parent771bad9c6abaad4b742935e5d55067f281287650 (diff)
parent1519b6a23e0341e25bf5a5c714f9f3d119ab8781 (diff)
Merge branch 'master' into soc-2014-viewport_contextsoc-2014-viewport_context
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_keymap.c6
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c24
-rw-r--r--source/blender/windowmanager/intern/wm_playanim.c61
-rw-r--r--source/blender/windowmanager/intern/wm_window.c19
-rw-r--r--source/blender/windowmanager/wm_window.h2
5 files changed, 79 insertions, 33 deletions
diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c
index 748303f9082..1abe000a86c 100644
--- a/source/blender/windowmanager/intern/wm_keymap.c
+++ b/source/blender/windowmanager/intern/wm_keymap.c
@@ -589,8 +589,12 @@ static void wm_keymap_patch(wmKeyMap *km, wmKeyMap *diff_km)
/* add item */
if (kmdi->add_item) {
+ /* Do not re-add an already existing keymap item! See T42088. */
+ kmi_add = wm_keymap_find_item_equals(km, kmdi->add_item);
+ if (!kmi_add)
+ kmi_add = wm_keymap_find_item_equals_result(km, kmdi->add_item);
/* only if nothing to remove or item to remove found */
- if (!kmdi->remove_item || kmi_remove) {
+ if (!kmi_add && (!kmdi->remove_item || kmi_remove)) {
kmi_add = wm_keymap_item_copy(kmdi->add_item);
kmi_add->flag |= KMI_USER_MODIFIED;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index bc79879f1f4..b9a79a85455 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1893,7 +1893,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar
col = uiLayoutColumn(split, false);
uiItemL(col, IFACE_("Links"), ICON_NONE);
uiItemStringO(col, IFACE_("Support an Open Animation Movie"), ICON_URL, "WM_OT_url_open", "url",
- "http://cloud.blender.org/gooseberry");
+ "https://cloud.blender.org/join");
uiItemStringO(col, IFACE_("Donations"), ICON_URL, "WM_OT_url_open", "url",
"http://www.blender.org/foundation/donation-payment/");
uiItemStringO(col, IFACE_("Credits"), ICON_URL, "WM_OT_url_open", "url",
@@ -2208,7 +2208,7 @@ static void WM_OT_read_homefile(wmOperatorType *ot)
"Load user interface setup from the .blend file");
RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
- /* ommit poll to run in background mode */
+ /* omit poll to run in background mode */
}
static void WM_OT_read_factory_settings(wmOperatorType *ot)
@@ -2219,7 +2219,7 @@ static void WM_OT_read_factory_settings(wmOperatorType *ot)
ot->invoke = WM_operator_confirm;
ot->exec = wm_homefile_read_exec;
- /* ommit poll to run in background mode */
+ /* omit poll to run in background mode */
}
/* *************** open file **************** */
@@ -2372,7 +2372,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot)
ot->exec = wm_open_mainfile_exec;
ot->check = wm_open_mainfile_check;
ot->ui = wm_open_mainfile_ui;
- /* ommit window poll so this can work in background mode */
+ /* omit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_OPENFILE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -2860,7 +2860,7 @@ static void WM_OT_save_as_mainfile(wmOperatorType *ot)
ot->invoke = wm_save_as_mainfile_invoke;
ot->exec = wm_save_as_mainfile_exec;
ot->check = blend_save_check;
- /* ommit window poll so this can work in background mode */
+ /* omit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_SAVE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -2936,7 +2936,7 @@ static void WM_OT_save_mainfile(wmOperatorType *ot)
ot->invoke = wm_save_mainfile_invoke;
ot->exec = wm_save_as_mainfile_exec;
ot->check = blend_save_check;
- /* ommit window poll so this can work in background mode */
+ /* omit window poll so this can work in background mode */
WM_operator_properties_filesel(ot, FOLDERFILE | BLENDERFILE, FILE_BLENDER, FILE_SAVE,
WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY);
@@ -3749,8 +3749,8 @@ static void radial_control_set_initial_mouse(RadialControl *rc, const wmEvent *e
d[0] = (1 - rc->initial_value) * WM_RADIAL_CONTROL_DISPLAY_WIDTH + WM_RADIAL_CONTROL_DISPLAY_MIN_SIZE;
break;
case PROP_ANGLE:
- d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cos(rc->initial_value);
- d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sin(rc->initial_value);
+ d[0] = WM_RADIAL_CONTROL_DISPLAY_SIZE * cosf(rc->initial_value);
+ d[1] = WM_RADIAL_CONTROL_DISPLAY_SIZE * sinf(rc->initial_value);
break;
default:
return;
@@ -4251,7 +4251,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
if (snap) new_value = ((int)ceil(new_value * 10.f) * 10.0f) / 100.f;
break;
case PROP_ANGLE:
- new_value = atan2(delta[1], delta[0]) + M_PI + angle_precision;
+ new_value = atan2f(delta[1], delta[0]) + M_PI + angle_precision;
new_value = fmod(new_value, 2.0f * (float)M_PI);
if (new_value < 0.0f)
new_value += 2.0f * (float)M_PI;
@@ -4354,6 +4354,7 @@ static void redraw_timer_window_swap(bContext *C)
{
wmWindow *win = CTX_wm_window(C);
ScrArea *sa;
+ CTX_wm_menu_set(C, NULL);
for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next)
ED_area_tag_redraw(sa);
@@ -4392,7 +4393,8 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
}
else if (type == 1) {
wmWindow *win = CTX_wm_window(C);
-
+ CTX_wm_menu_set(C, NULL);
+
ED_region_tag_redraw(ar);
wm_draw_update(C);
@@ -4405,6 +4407,8 @@ static int redraw_timer_exec(bContext *C, wmOperator *op)
ScrArea *sa_back = CTX_wm_area(C);
ARegion *ar_back = CTX_wm_region(C);
+ CTX_wm_menu_set(C, NULL);
+
for (sa = CTX_wm_screen(C)->areabase.first; sa; sa = sa->next) {
ARegion *ar_iter;
CTX_wm_area_set(C, sa);
diff --git a/source/blender/windowmanager/intern/wm_playanim.c b/source/blender/windowmanager/intern/wm_playanim.c
index 024135e73e9..76add2f9aac 100644
--- a/source/blender/windowmanager/intern/wm_playanim.c
+++ b/source/blender/windowmanager/intern/wm_playanim.c
@@ -98,6 +98,8 @@ typedef struct PlayState {
bool go;
/* waiting for images to load */
bool loading;
+ /* x/y image flip */
+ bool draw_flip[2];
int fstep;
@@ -168,6 +170,15 @@ static void playanim_window_get_size(int *width_r, int *height_r)
GHOST_DisposeRectangle(bounds);
}
+static void playanim_gl_matrix(void)
+{
+ /* unified matrix, note it affects offset for drawing */
+ glMatrixMode(GL_PROJECTION);
+ glLoadIdentity();
+ glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
+ glMatrixMode(GL_MODELVIEW);
+}
+
/* implementation */
static void playanim_event_qual_update(void)
{
@@ -245,7 +256,8 @@ static int pupdate_time(void)
static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf *ibuf, int fontid, int fstep)
{
- float offsx, offsy;
+ float offs_x, offs_y;
+ float span_x, span_y;
if (ibuf == NULL) {
printf("%s: no ibuf for picture '%s'\n", __func__, picture ? picture->name : "<NIL>");
@@ -260,13 +272,17 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
GHOST_ActivateWindowDrawingContext(g_WS.ghost_window);
+ /* size within window */
+ span_x = (ps->zoom * ibuf->x) / (float)ps->win_x;
+ span_y = (ps->zoom * ibuf->y) / (float)ps->win_y;
+
/* offset within window */
- offsx = 0.5f * (((float)ps->win_x - ps->zoom * ibuf->x) / (float)ps->win_x);
- offsy = 0.5f * (((float)ps->win_y - ps->zoom * ibuf->y) / (float)ps->win_y);
+ offs_x = 0.5f * (1.0f - span_x);
+ offs_y = 0.5f * (1.0f - span_y);
- CLAMP(offsx, 0.0f, 1.0f);
- CLAMP(offsy, 0.0f, 1.0f);
- glRasterPos2f(offsx, offsy);
+ CLAMP(offs_x, 0.0f, 1.0f);
+ CLAMP(offs_y, 0.0f, 1.0f);
+ glRasterPos2f(offs_x, offs_y);
glClearColor(0.1, 0.1, 0.1, 0.0);
glClear(GL_COLOR_BUFFER_BIT);
@@ -276,9 +292,15 @@ static void playanim_toscreen(PlayState *ps, PlayAnimPict *picture, struct ImBuf
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- fdrawcheckerboard(offsx, offsy, offsx + (ps->zoom * ibuf->x) / (float)ps->win_x, offsy + (ps->zoom * ibuf->y) / (float)ps->win_y);
+ fdrawcheckerboard(offs_x, offs_y, offs_x + span_x, offs_y + span_y);
}
-
+
+ glRasterPos2f(offs_x + (ps->draw_flip[0] ? span_x : 0.0f),
+ offs_y + (ps->draw_flip[1] ? span_y : 0.0f));
+
+ glPixelZoom(ps->zoom * ps->draw_flip[0] ? -1.0f : 1.0f,
+ ps->zoom * ps->draw_flip[1] ? -1.0f : 1.0f);
+
glDrawPixels(ibuf->x, ibuf->y, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
glDisable(GL_BLEND);
@@ -518,6 +540,14 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
case GHOST_kKeyP:
if (val) ps->pingpong = !ps->pingpong;
break;
+ case GHOST_kKeyF:
+ {
+ if (val) {
+ int axis = (g_WS.qual & WS_QUAL_SHIFT) ? 1 : 0;
+ ps->draw_flip[axis] = !ps->draw_flip[axis];
+ }
+ break;
+ }
case GHOST_kKey1:
case GHOST_kKeyNumpad1:
if (val) swaptime = ps->fstep / 60.0;
@@ -780,13 +810,8 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr ps_void)
glViewport(0, 0, ps->win_x, ps->win_y);
glScissor(0, 0, ps->win_x, ps->win_y);
- /* unified matrix, note it affects offset for drawing */
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
- glMatrixMode(GL_MODELVIEW);
+ playanim_gl_matrix();
- glPixelZoom(ps->zoom, ps->zoom);
ptottime = 0.0;
playanim_toscreen(ps, ps->picture, ps->curframe_ibuf, ps->fontid, ps->fstep);
@@ -891,6 +916,8 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
ps.dropped_file[0] = 0;
ps.zoom = 1.0f;
/* resetmap = false */
+ ps.draw_flip[0] = false;
+ ps.draw_flip[1] = false;
ps.fstep = 1;
@@ -1008,11 +1035,7 @@ static char *wm_main_playanim_intern(int argc, const char **argv)
playanim_window_open("Blender:Anim", start_x, start_y, ibuf->x, ibuf->y);
- /* unified matrix, note it affects offset for drawing */
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glOrtho(0.0f, 1.0f, 0.0f, 1.0f, -1.0f, 1.0f);
- glMatrixMode(GL_MODELVIEW);
+ playanim_gl_matrix();
}
GHOST_GetMainDisplayDimensions(g_WS.ghost_system, &maxwinx, &maxwiny);
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index 20e5b1d8353..46a20d3bf88 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -339,6 +339,19 @@ void wm_window_title(wmWindowManager *wm, wmWindow *win)
}
}
+float wm_window_pixelsize(wmWindow *win)
+{
+ float pixelsize = GHOST_GetNativePixelSize(win->ghostwin);
+
+ switch (U.virtual_pixel) {
+ default:
+ case VIRTUAL_PIXEL_NATIVE:
+ return pixelsize;
+ case VIRTUAL_PIXEL_DOUBLE:
+ return 2.0f * pixelsize;
+ }
+}
+
/* belongs to below */
static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wmWindow *win)
{
@@ -400,7 +413,7 @@ static void wm_window_add_ghostwindow(wmWindowManager *wm, const char *title, wm
/* displays with larger native pixels, like Macbook. Used to scale dpi with */
/* needed here, because it's used before it reads userdef */
- U.pixelsize = GHOST_GetNativePixelSize(win->ghostwin);
+ U.pixelsize = wm_window_pixelsize(win);
BKE_userdef_state();
wm_window_swap_buffers(win);
@@ -688,7 +701,7 @@ void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
GHOST_ActivateWindowDrawingContext(win->ghostwin);
/* this can change per window */
- U.pixelsize = GHOST_GetNativePixelSize(win->ghostwin);
+ U.pixelsize = wm_window_pixelsize(win);
BKE_userdef_state();
}
}
@@ -1048,7 +1061,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr C_void_ptr
case GHOST_kEventNativeResolutionChange:
// printf("change, pixel size %f\n", GHOST_GetNativePixelSize(win->ghostwin));
- U.pixelsize = GHOST_GetNativePixelSize(win->ghostwin);
+ U.pixelsize = wm_window_pixelsize(win);
BKE_userdef_state();
WM_event_add_notifier(C, NC_SCREEN | NA_EDITED, NULL);
WM_event_add_notifier(C, NC_WINDOW | NA_EDITED, NULL);
diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h
index a71e0fd9fc9..9c9c79d2f54 100644
--- a/source/blender/windowmanager/wm_window.h
+++ b/source/blender/windowmanager/wm_window.h
@@ -61,6 +61,8 @@ void wm_window_swap_buffers (wmWindow *win);
void wm_window_set_swap_interval(wmWindow *win, int interval);
bool wm_window_get_swap_interval(wmWindow *win, int *intervalOut);
+float wm_window_pixelsize(wmWindow *win);
+
void wm_get_cursor_position (wmWindow *win, int *x, int *y);
wmWindow *wm_window_copy (bContext *C, wmWindow *winorig);