From 42ece56e91db997425f010e2cf18c9021113f5e7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Jun 2011 01:53:12 +0000 Subject: don't write file history in backgound mode (running ctest would overwrite all my recent-files.txt), and add an error about mingw/quicktime being unsupported. --- source/blender/windowmanager/intern/wm_files.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 5d005e23029..c088d0d2d43 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -747,7 +747,10 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re if(fileflags & G_FILE_AUTOPLAY) G.fileflags |= G_FILE_AUTOPLAY; else G.fileflags &= ~G_FILE_AUTOPLAY; - write_history(); + /* prevent background mode scripts from clobbering history */ + if(!G.background) { + write_history(); + } /* run this function after because the file cant be written before the blend is */ if (ibuf_thumb) { -- cgit v1.2.3 From 9dd066eb652c478b6eeba2630aea999490739849 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Jun 2011 05:39:58 +0000 Subject: cmake: remove python include in the wm module, set opengl as a system include. --- source/blender/windowmanager/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 6d125c01af4..0cf59a9b598 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -101,7 +101,6 @@ endif() if(WITH_PYTHON) list(APPEND INC ../python) - list(APPEND INC_SYS ${PYTHON_INCLUDE_DIRS}) add_definitions(-DWITH_PYTHON) if(WITH_PYTHON_SECURITY) -- cgit v1.2.3 From cede08e1e25c3a37b5276c80302bdb7acc27cd78 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 9 Jun 2011 15:26:05 +0000 Subject: Bugfix #26886 Operator redo: F6 menu didn't work for macros yet (like Duplicate-grab). --- source/blender/windowmanager/intern/wm_operators.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 1b7333024e7..8f15a21c624 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -921,7 +921,16 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) if(ED_undo_valid(C, op->type->name)==0) uiLayoutSetEnabled(layout, 0); - uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE); + if(op->type->flag & OPTYPE_MACRO) { + for(op= op->macro.first; op; op= op->next) { + uiItemL(layout, op->type->name, ICON_NONE); + uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE); + } + } + else { + uiLayoutOperatorButs(C, layout, op, NULL, 'H', UI_LAYOUT_OP_SHOW_TITLE); + } + uiPopupBoundsBlock(block, 4, 0, 0); uiEndBlock(C, block); @@ -3125,7 +3134,6 @@ static int radial_control_cancel(bContext *C, wmOperator *op) static int radial_control_modal(bContext *C, wmOperator *op, wmEvent *event) { RadialControl *rc = op->customdata; - wmWindowManager *wm; float new_value, dist, zoom[2]; float delta[2], snap, ret = OPERATOR_RUNNING_MODAL; -- cgit v1.2.3 From 9cf0bbb95c00129501d14f97be3f33cc208771fb Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 10 Jun 2011 09:44:27 +0000 Subject: added a check to console auto-compleation for pythons struct_seq type, so bpy.app and sys.float_info autocompleate their attributes rather then bring treated as a typle. --- source/blender/windowmanager/intern/wm_operators.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 8f15a21c624..06d049d2cb5 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1485,6 +1485,14 @@ static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED( { const char *openname= G.main->name; + if(CTX_wm_window(C) == NULL) { + /* in rare cases this could happen, when trying to invoke in background + * mode on load for example. Don't use poll for this because exec() + * can still run without a window */ + BKE_report(op->reports, RPT_ERROR, "Context window not set"); + return OPERATOR_CANCELLED; + } + /* if possible, get the name of the most recently used .blend file */ if (G.recent_files.first) { struct RecentFile *recent = G.recent_files.first; @@ -1535,7 +1543,7 @@ static void WM_OT_open_mainfile(wmOperatorType *ot) ot->invoke= wm_open_mainfile_invoke; ot->exec= wm_open_mainfile_exec; - ot->poll= WM_operator_winactive; + /* ommit window poll so this can work in background mode */ WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_OPENFILE, WM_FILESEL_FILEPATH); @@ -1954,7 +1962,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; - ot->poll= NULL; + /* ommit window poll so this can work in background mode */ WM_operator_properties_filesel(ot, FOLDERFILE|BLENDERFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH); RNA_def_boolean(ot->srna, "compress", 0, "Compress", "Write compressed .blend file"); -- cgit v1.2.3 From 97b966f2d6811a8476bfc42a69551073cb96a9cb Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 13 Jun 2011 12:03:13 +0000 Subject: Fix #27594: non-active object in weight paint mode doesn't free memory. Also removed some commented out 2.4x code that is already replaced. --- source/blender/windowmanager/intern/wm_init_exit.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 2e4148ca51d..d57c94a5826 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -328,7 +328,6 @@ static void free_openrecent(void) /* bad stuff*/ -extern ListBase editelems; extern wchar_t *copybuf; extern wchar_t *copybufinfo; @@ -394,10 +393,6 @@ void WM_exit(bContext *C) free_anim_drivers_copybuf(); free_fmodifiers_copybuf(); free_posebuf(); -// free_vertexpaint(); -// free_imagepaint(); - -// fsmenu_free(); BLF_exit(); @@ -420,10 +415,6 @@ void WM_exit(bContext *C) BPY_python_end(); #endif - if (!G.background) { -// XXX UI_filelist_free_icons(); - } - GPU_buffer_pool_free(NULL); GPU_free_unused_buffers(); GPU_extensions_exit(); -- cgit v1.2.3 From aaf7dae5f18d918cce34e6c54eb971778cdd1bb9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 15 Jun 2011 10:17:06 +0000 Subject: Code cleanup: remove unused shaded draw mode code. --- source/blender/windowmanager/intern/wm_init_exit.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index d57c94a5826..2a733bf28a9 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -379,7 +379,6 @@ void WM_exit(bContext *C) BKE_freecubetable(); - fastshade_free_render(); /* shaded view */ ED_preview_free_dbase(); /* frees a Main dbase, before free_blender! */ if(C && CTX_wm_manager(C)) -- cgit v1.2.3 From a3e296fc4060ab9aac46a8ec2f18696d6776d653 Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Wed, 15 Jun 2011 18:59:22 +0000 Subject: Committing patch #25676 Anisotropic filtering in viewport and BGE by me. This patch adds anisotropic filtering of textures in the viewport and the BGE. The quality of the filtering is adjustable in the user preferences under System. For more information on anisotropic filtering: http://en.wikipedia.org/wiki/Anisotropic_filtering One current limitation of this setup (having the option a user preference) is it makes runtimes more troublesome. Runtimes don't have user preferences set, so for now the blender player defaults to 2x AF. Options will be added later to change this value (probably a command line option). --- source/blender/windowmanager/intern/wm_init_exit.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 2a733bf28a9..c61db1d653e 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -169,6 +169,7 @@ void WM_init(bContext *C, int argc, const char **argv) if (!G.background) { GPU_extensions_init(); GPU_set_mipmap(!(U.gameflags & USER_DISABLE_MIPMAP)); + GPU_set_anisotropic(U.anisotropic_filter); UI_init(); } -- cgit v1.2.3 From 68a12c74b6ebd64f85b22b13902a467bc5d6b496 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 17 Jun 2011 12:48:33 +0000 Subject: fix [#26621] Memory leaks when creating popup window. also fixes memory leak when cancelling a popup dialog (new image for example). --- source/blender/windowmanager/intern/wm_operators.c | 74 +++++++++++++++------- 1 file changed, 51 insertions(+), 23 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 06d049d2cb5..e840aca4a6a 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -938,13 +938,28 @@ static uiBlock *wm_block_create_redo(bContext *C, ARegion *ar, void *arg_op) return block; } -/* Only invoked by OK button in popups created with wm_block_create_dialog() */ +typedef struct wmOpPopUp +{ + wmOperator *op; + int width; + int height; + int free_op; +} wmOpPopUp; + +/* Only invoked by OK button in popups created with wm_block_dialog_create() */ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) { - wmOperator *op= arg1; + wmOpPopUp *data= arg1; uiBlock *block= arg2; - WM_operator_call(C, op); + WM_operator_call(C, data->op); + + /* let execute handle freeing it */ + //data->free_op= FALSE; + //data->op= NULL; + + /* in this case, wm_operator_ui_popup_cancel wont run */ + MEM_freeN(data); uiPupBlockClose(C, block); } @@ -960,9 +975,9 @@ static void dialog_check_cb(bContext *C, void *op_ptr, void *UNUSED(arg)) } /* Dialogs are popups that require user verification (click OK) before exec */ -static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData) +static uiBlock *wm_block_dialog_create(bContext *C, ARegion *ar, void *userData) { - struct { wmOperator *op; int width; int height; } * data = userData; + wmOpPopUp *data= userData; wmOperator *op= data->op; uiBlock *block; uiLayout *layout; @@ -991,7 +1006,7 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData) col_block= uiLayoutGetBlock(col); /* Create OK button, the callback of which will execute op */ btn= uiDefBut(col_block, BUT, 0, "OK", 0, -30, 0, UI_UNIT_Y, NULL, 0, 0, 0, 0, ""); - uiButSetFunc(btn, dialog_exec_cb, op, col_block); + uiButSetFunc(btn, dialog_exec_cb, data, col_block); } /* center around the mouse */ @@ -1001,9 +1016,9 @@ static uiBlock *wm_block_create_dialog(bContext *C, ARegion *ar, void *userData) return block; } -static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData) +static uiBlock *wm_operator_ui_create(bContext *C, ARegion *ar, void *userData) { - struct { wmOperator *op; int width; int height; } * data = userData; + wmOpPopUp *data= userData; wmOperator *op= data->op; uiBlock *block; uiLayout *layout; @@ -1024,6 +1039,28 @@ static uiBlock *wm_operator_create_ui(bContext *C, ARegion *ar, void *userData) return block; } +static void wm_operator_ui_popup_cancel(void *userData) +{ + wmOpPopUp *data= userData; + if(data->free_op && data->op) { + wmOperator *op= data->op; + WM_operator_free(op); + } + + MEM_freeN(data); +} + +int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height) +{ + wmOpPopUp *data= MEM_callocN(sizeof(wmOpPopUp), "WM_operator_ui_popup"); + data->op= op; + data->width= width; + data->height= height; + data->free_op= TRUE; /* if this runs and gets registered we may want not to free it */ + uiPupBlockEx(C, wm_operator_ui_create, wm_operator_ui_popup_cancel, data); + return OPERATOR_RUNNING_MODAL; +} + /* operator menu needs undo, for redo callback */ int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { @@ -1043,28 +1080,19 @@ int WM_operator_props_popup(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) int WM_operator_props_dialog_popup(bContext *C, wmOperator *op, int width, int height) { - struct { wmOperator *op; int width; int height; } data; + wmOpPopUp *data= MEM_callocN(sizeof(wmOpPopUp), "WM_operator_props_dialog_popup"); - data.op= op; - data.width= width; - data.height= height; + data->op= op; + data->width= width; + data->height= height; + data->free_op= TRUE; /* if this runs and gets registered we may want not to free it */ /* op is not executed until popup OK but is clicked */ - uiPupBlock(C, wm_block_create_dialog, &data); + uiPupBlockEx(C, wm_block_dialog_create, wm_operator_ui_popup_cancel, data); return OPERATOR_RUNNING_MODAL; } -int WM_operator_ui_popup(bContext *C, wmOperator *op, int width, int height) -{ - struct { wmOperator *op; int width; int height; } data; - data.op = op; - data.width = width; - data.height = height; - uiPupBlock(C, wm_operator_create_ui, &data); - return OPERATOR_RUNNING_MODAL; -} - int WM_operator_redo_popup(bContext *C, wmOperator *op) { /* CTX_wm_reports(C) because operator is on stack, not active in event system */ -- cgit v1.2.3 From 968b2a8afbef552988d10df38e358d97d273dc8c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 18 Jun 2011 14:12:54 +0000 Subject: rename cmake include/libraries to conform with suggested cmake names --- source/blender/windowmanager/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index 0cf59a9b598..f9c1d800c02 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -90,12 +90,12 @@ endif() if(WITH_CODEC_QUICKTIME) list(APPEND INC ../quicktime) - list(APPEND INC_SYS ${QUICKTIME_INC}) + list(APPEND INC_SYS ${QUICKTIME_INCLUDE_DIRS}) add_definitions(-DWITH_QUICKTIME) endif() if(WITH_CODEC_FFMPEG) - list(APPEND INC_SYS ${FFMPEG_INC}) + list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS}) add_definitions(-DWITH_FFMPEG) endif() -- cgit v1.2.3 From ed3dadf48998a23eef64e6de06dc72f1d094b40c Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 20 Jun 2011 20:21:52 +0000 Subject: Blender 2.58 release preparations: * Update of Release Log Links to point to: http://www.blender.org/development/release-logs/blender-258/ --- source/blender/windowmanager/intern/wm_operators.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index e840aca4a6a..f65485b84dd 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -1247,7 +1247,7 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *ar, void *UNUSED(ar col = uiLayoutColumn(split, 0); uiItemL(col, "Links", ICON_NONE); uiItemStringO(col, "Donations", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/blenderorg/blender-foundation/donation-payment/"); - uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-257/"); + uiItemStringO(col, "Release Log", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/development/release-logs/blender-258/"); uiItemStringO(col, "Manual", ICON_URL, "WM_OT_url_open", "url", "http://wiki.blender.org/index.php/Doc:2.5/Manual"); uiItemStringO(col, "Blender Website", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/"); uiItemStringO(col, "User Community", ICON_URL, "WM_OT_url_open", "url", "http://www.blender.org/community/user-community/"); // -- cgit v1.2.3 From c518aa13838d43e7311d65aeb9e3745e5057b806 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 23 Jun 2011 19:55:47 +0000 Subject: GHOST Cocoa: move y origin top/bottom conversions out of windowmanager module and into GHOST. Also fixes a problem where e.g. the user preferences window would not open under the mouse cursor correctly. --- .../blender/windowmanager/intern/wm_event_system.c | 25 ++++++---------------- source/blender/windowmanager/intern/wm_window.c | 21 +----------------- 2 files changed, 8 insertions(+), 38 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 2613cb8f14f..83ef46d109c 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2365,18 +2365,11 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U if(win->active) { GHOST_TEventCursorData *cd= customdata; wmEvent *lastevent= win->queue.last; - -#if defined(__APPLE__) && defined(GHOST_COCOA) - //Cocoa already uses coordinates with y=0 at bottom, and returns inwindow coordinates on mouse moved event - evt->x= cd->x; - evt->y= cd->y; -#else int cx, cy; GHOST_ScreenToClient(win->ghostwin, cd->x, cd->y, &cx, &cy); evt->x= cx; evt->y= (win->sizey-1) - cy; -#endif event.x= evt->x; event.y= evt->y; @@ -2423,21 +2416,17 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U event.type= MOUSEPAN; break; } -#if defined(__APPLE__) && defined(GHOST_COCOA) - //Cocoa already uses coordinates with y=0 at bottom, and returns inwindow coordinates on mouse moved event - event.x= evt->x = pd->x; - event.y = evt->y = pd->y; -#else + { - int cx, cy; - GHOST_ScreenToClient(win->ghostwin, pd->x, pd->y, &cx, &cy); - event.x= evt->x= cx; - event.y= evt->y= (win->sizey-1) - cy; + int cx, cy; + GHOST_ScreenToClient(win->ghostwin, pd->x, pd->y, &cx, &cy); + event.x= evt->x= cx; + event.y= evt->y= (win->sizey-1) - cy; } -#endif + // Use prevx/prevy so we can calculate the delta later event.prevx= event.x - pd->deltaX; - event.prevy= event.y - pd->deltaY; + event.prevy= event.y - (-pd->deltaY); update_tablet_data(win, &event); wm_event_add(win, &event); diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 9ee39132521..9b1695be67a 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -673,13 +673,7 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) GHOST_ScreenToClient(win->ghostwin, wx, wy, &cx, &cy); win->eventstate->x= cx; - -#if defined(__APPLE__) && defined(GHOST_COCOA) - //Cocoa already uses coordinates with y=0 at bottom - win->eventstate->y= cy; -#else win->eventstate->y= (win->sizey-1) - cy; -#endif win->addmousemove= 1; /* enables highlighted buttons */ @@ -796,20 +790,13 @@ static int ghost_event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) wmEvent event; GHOST_TEventDragnDropData *ddd= GHOST_GetEventData(evt); int cx, cy, wx, wy; - /* entering window, update mouse pos */ GHOST_GetCursorPosition(g_system, &wx, &wy); GHOST_ScreenToClient(win->ghostwin, wx, wy, &cx, &cy); win->eventstate->x= cx; - -#if defined(__APPLE__) && defined(GHOST_COCOA) - //Cocoa already uses coordinates with y=0 at bottom - win->eventstate->y= cy; -#else win->eventstate->y= (win->sizey-1) - cy; -#endif event= *(win->eventstate); /* copy last state, like mouse coords */ @@ -1149,12 +1136,7 @@ void wm_get_cursor_position(wmWindow *win, int *x, int *y) { GHOST_GetCursorPosition(g_system, x, y); GHOST_ScreenToClient(win->ghostwin, *x, *y, x, y); -#if defined(__APPLE__) && defined(GHOST_COCOA) - //Cocoa has silly exception that should be fixed at the ghost level - //(ghost is an allegory for an invisible system specific code) -#else *y = (win->sizey-1) - *y; -#endif } /* ******************* exported api ***************** */ @@ -1187,9 +1169,8 @@ void WM_cursor_warp(wmWindow *win, int x, int y) if (win && win->ghostwin) { int oldx=x, oldy=y; -#if !defined(__APPLE__) || !defined(GHOST_COCOA) y= win->sizey -y - 1; -#endif + GHOST_ClientToScreen(win->ghostwin, x, y, &x, &y); GHOST_SetCursorPosition(g_system, x, y); -- cgit v1.2.3 From 12e02fd4746308746e2f9e316a3b5e8bcd5f2896 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 24 Jun 2011 16:54:30 +0000 Subject: own patch [#27752] Python Callback (Scriptlink functionality) Python: * adds bpy.app.handlers which contains lists, each for an event type: render_pre, render_post, load_pre, load_post, save_pre, save_post * each list item needs to be a callable object which takes 1 argument (the ID). * callbacks are cleared on file load. Example: def MyFunc(scene): print("Callback:", data) bpy.app.handlers.render_post.append(MyFunc) C: * This patch adds a generic C callback api which is currently only used by python. * Unlike python callbacks these are not cleared on file load. --- source/blender/windowmanager/intern/wm_files.c | 12 +++++++++++- source/blender/windowmanager/intern/wm_init_exit.c | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index c088d0d2d43..4693c8079d2 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -57,6 +57,7 @@ #include "BLI_blenlib.h" #include "BLI_linklist.h" #include "BLI_utildefines.h" +#include "BLI_callbacks.h" #include "DNA_anim_types.h" #include "DNA_ipo_types.h" // XXX old animation system @@ -342,6 +343,8 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) WM_cursor_wait(1); + BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_PRE); + /* first try to append data from exotic file formats... */ /* it throws error box when file doesnt exist and returns -1 */ /* note; it should set some error message somewhere... (ton) */ @@ -392,6 +395,7 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) #ifdef WITH_PYTHON /* run any texts that were loaded in and flagged as modules */ BPY_driver_reset(); + BPY_app_handlers_reset(); BPY_modules_load_user(C); #endif CTX_wm_window_set(C, NULL); /* exits queues */ @@ -411,7 +415,8 @@ void WM_read_file(bContext *C, const char *filepath, ReportList *reports) // XXX undo_editmode_clear(); BKE_reset_undo(); BKE_write_undo(C, "original"); /* save current state */ - + + BLI_exec_cb(CTX_data_main(C), NULL, BLI_CB_EVT_LOAD_POST); } else if(retval == BKE_READ_EXOTIC_OK_OTHER) BKE_write_undo(C, "Import file"); @@ -518,6 +523,7 @@ int WM_read_homefile(bContext *C, ReportList *reports, short from_memory) BPY_string_exec(C, "__import__('addon_utils').reset_all()"); BPY_driver_reset(); + BPY_app_handlers_reset(); BPY_modules_load_user(C); } #endif @@ -716,6 +722,8 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re } } + BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_PRE); + /* operator now handles overwrite checks */ if (G.fileflags & G_AUTOPACK) { @@ -752,6 +760,8 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re write_history(); } + BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_POST); + /* run this function after because the file cant be written before the blend is */ if (ibuf_thumb) { ibuf_thumb= IMB_thumb_create(filepath, THB_NORMAL, THB_SOURCE_BLEND, ibuf_thumb); diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index c61db1d653e..0bc2e5da1c5 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -155,6 +155,7 @@ void WM_init(bContext *C, int argc, const char **argv) BPY_python_start(argc, argv); BPY_driver_reset(); + BPY_app_handlers_reset(); BPY_modules_load_user(C); #else (void)argc; /* unused */ -- cgit v1.2.3 From 08cf05d8d593db9862b3b57a8c89464044730b26 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Sat, 25 Jun 2011 15:54:20 +0000 Subject: Bugfix #27765 Thumbnail save for .blend crashed, when being in editmode for a mesh that has other object users as well. Derivedmesh confusement... Thanks to Sergey for finding the cause! --- source/blender/windowmanager/intern/wm_files.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 4693c8079d2..e0cfb86ce05 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -722,6 +722,10 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re } } + /* blend file thumbnail */ + /* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */ + ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); + BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_PRE); /* operator now handles overwrite checks */ @@ -736,9 +740,6 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re /* don't forget not to return without! */ WM_cursor_wait(1); - /* blend file thumbnail */ - ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); - fileflags |= G_FILE_HISTORY; /* write file history */ if (BLO_write_file(CTX_data_main(C), filepath, fileflags, reports, thumb)) { -- cgit v1.2.3 From f10f3d3651a498b53e191df3bea7909462ca4ac0 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 27 Jun 2011 11:21:25 +0000 Subject: Bugfix #27768 On clicking in a non-active Blender window (when you activated others), the mouse position of the first click was still the old position. Problem is in GHOST; it sends out the 'activate window' event after the mouseclick event itself. Code now checks for this case and reads the correct mouse position. --- source/blender/windowmanager/intern/wm_event_system.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 83ef46d109c..ce3830b059c 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2449,6 +2449,16 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, int U else event.type= MIDDLEMOUSE; + if(win->active==0) { + int cx, cy; + + /* entering window, update mouse pos. (ghost sends win-activate *after* the mouseclick in window!) */ + wm_get_cursor_position(win, &cx, &cy); + + event.x= evt->x= cx; + event.y= evt->y= cy; + } + /* add to other window if event is there (not to both!) */ owin= wm_event_cursor_other_windows(wm, win, &event); if(owin) { -- cgit v1.2.3 From 0e0eba9f79b122eeef613fbd3733b339a95094a4 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 4 Jul 2011 05:23:36 +0000 Subject: fix for crash when setting layers or saving when there is no active scene - only really happens when running python scripts on startup. --- source/blender/windowmanager/intern/wm_files.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index e0cfb86ce05..aabaf6d4055 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -635,8 +635,9 @@ static ImBuf *blend_file_thumb(Scene *scene, int **thumb_pt) char err_out[256]= "unknown"; *thumb_pt= NULL; - - if(G.background || scene->camera==NULL) + + /* scene can be NULL if running a script at startup and calling the save operator */ + if(G.background || scene==NULL || scene->camera==NULL) return NULL; /* gets scaled to BLEN_THUMB_SIZE */ -- cgit v1.2.3 From cf43e48fc781611c0850e09dae6f6fa1c95cc28b Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Mon, 4 Jul 2011 08:59:28 +0000 Subject: Apply patch 4636051. COLLADA: Export selection. Original patch by Jan Diederich, adapted by Pelle Johnsen. Review assistance by Daniel Tavares. This patch adds an option to export only the selection. --- source/blender/windowmanager/intern/wm_operators.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index f65485b84dd..35afdf29b53 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -2004,6 +2004,8 @@ static void WM_OT_save_mainfile(wmOperatorType *ot) static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED(event)) { + int selected = 0; + if(!RNA_property_is_set(op->ptr, "filepath")) { char filepath[FILE_MAX]; BLI_strncpy(filepath, G.main->name, sizeof(filepath)); @@ -2020,6 +2022,7 @@ static int wm_collada_export_invoke(bContext *C, wmOperator *op, wmEvent *UNUSED static int wm_collada_export_exec(bContext *C, wmOperator *op) { char filename[FILE_MAX]; + int selected; if(!RNA_property_is_set(op->ptr, "filepath")) { BKE_report(op->reports, RPT_ERROR, "No filename given"); @@ -2027,7 +2030,8 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) } RNA_string_get(op->ptr, "filepath", filename); - if(collada_export(CTX_data_scene(C), filename)) { + selected = RNA_boolean_get(op->ptr, "selected"); + if(collada_export(CTX_data_scene(C), filename, selected)) { return OPERATOR_FINISHED; } else { @@ -2045,6 +2049,8 @@ static void WM_OT_collada_export(wmOperatorType *ot) ot->poll= WM_operator_winactive; WM_operator_properties_filesel(ot, FOLDERFILE|COLLADAFILE, FILE_BLENDER, FILE_SAVE, WM_FILESEL_FILEPATH); + RNA_def_boolean(ot->srna, "selected", 0, "Export only selected", + "Export only selected elements"); } /* function used for WM_OT_save_mainfile too */ -- cgit v1.2.3 From abdf420a6dbb4dbccba0d0d6b8ca2d7370681f4f Mon Sep 17 00:00:00 2001 From: Nicholas Bishop Date: Fri, 8 Jul 2011 19:58:02 +0000 Subject: == GPU Buffers == This patch attempts to clean up and document the GPU buffers code. There are a few bug fixes as well. Patch reviewed here: http://codereview.appspot.com/4631052/ Summary: * Bugfix: make GPU_buffer_copy_normal convert from shorts to floats correctly, also fixed the use of cached face normal CustomData. * Bugfix: changed the `mat_nr' field of GPUBufferMaterial from char to short. * Changed color buffer setup to not alloc a temporary copy of color data, just passes the MCol data in directly. * Changed the GPU buffer pool code to make clearer what operates specifically on the global pool. * Lots of refactoring for GPU_drawobject_new; should operate mostly the same (except got rid of one unecessary allocation), just split into more functions and without macros now. * Converted some #defines into enumerations. * Made some stuff private, pulled out of header file. * Deleted unused function GPU_buffer_pool_free_unused(). * Removed GPU_interleaved_setup and related #defines. (I think this was used for editmode VBOs, but those were disabled.) * Added lots of comments. * Added a few comments in the code signed `--nicholas' to note places where I am unsure about design or usage, would be good to address these better. * Code formatting changed to be more consistent with the rest of Blender. * Renamed some fields and variables to be more consistent with Blender's naming conventions. * Renamed some fields and variables to use more descriptive names, e.g. renamed `redir' to `mat_orig_to_new'. * Removed print outs with DEBUG_VBO -- don't feel too strongly about this one, just not used elsewhere in Blender, could be easily added back if others disagree though. * Moved the PBVH drawing code down to the bottom of the file, before was sitting in the middle of the other VBO code --- source/blender/windowmanager/intern/wm_init_exit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 0bc2e5da1c5..ed28696ef69 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -416,7 +416,7 @@ void WM_exit(bContext *C) BPY_python_end(); #endif - GPU_buffer_pool_free(NULL); + GPU_global_buffer_pool_free(); GPU_free_unused_buffers(); GPU_extensions_exit(); -- cgit v1.2.3 From c3fcd6c4c7ec1aebff5bd386328023010d9c48d5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 13 Jul 2011 19:16:25 +0000 Subject: reuse USER_SAVE_PREVIEWS to not save thumbnails into blend file header --- source/blender/windowmanager/intern/wm_files.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index aabaf6d4055..27fc0caeccc 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -725,8 +725,10 @@ int WM_write_file(bContext *C, const char *target, int fileflags, ReportList *re /* blend file thumbnail */ /* save before exit_editmode, otherwise derivedmeshes for shared data corrupt #27765) */ - ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); - + if(U.flag & USER_SAVE_PREVIEWS) { + ibuf_thumb= blend_file_thumb(CTX_data_scene(C), &thumb); + } + BLI_exec_cb(G.main, NULL, BLI_CB_EVT_SAVE_PRE); /* operator now handles overwrite checks */ -- cgit v1.2.3 From 410c5e3cd284eba6b17c79042b161eaa9efe6e71 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 16 Jul 2011 23:01:14 +0000 Subject: cmake source definitions: remove missing includes and use more strict formatting. --- source/blender/windowmanager/CMakeLists.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index f9c1d800c02..c815b4aad2f 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -89,18 +89,26 @@ if(WITH_OPENCOLLADA) endif() if(WITH_CODEC_QUICKTIME) - list(APPEND INC ../quicktime) - list(APPEND INC_SYS ${QUICKTIME_INCLUDE_DIRS}) + list(APPEND INC + ../quicktime + ) + list(APPEND INC_SYS + ${QUICKTIME_INCLUDE_DIRS} + ) add_definitions(-DWITH_QUICKTIME) endif() if(WITH_CODEC_FFMPEG) - list(APPEND INC_SYS ${FFMPEG_INCLUDE_DIRS}) + list(APPEND INC_SYS + ${FFMPEG_INCLUDE_DIRS} + ) add_definitions(-DWITH_FFMPEG) endif() if(WITH_PYTHON) - list(APPEND INC ../python) + list(APPEND INC + ../python + ) add_definitions(-DWITH_PYTHON) if(WITH_PYTHON_SECURITY) -- cgit v1.2.3 From 5792bd7cc74581a5ac37325207c1cc6a338be9c7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 17 Jul 2011 09:11:13 +0000 Subject: cmake: cleanup include paths, some duplicates and going up some unneeded dirs. --- source/blender/windowmanager/CMakeLists.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/CMakeLists.txt b/source/blender/windowmanager/CMakeLists.txt index c815b4aad2f..20ac3ba7077 100644 --- a/source/blender/windowmanager/CMakeLists.txt +++ b/source/blender/windowmanager/CMakeLists.txt @@ -26,23 +26,23 @@ set(INC . - ../nodes - ../gpu ../blenfont - ../blenlib - ../makesdna - ../makesrna ../blenkernel - ../imbuf + ../blenlib ../blenloader ../editors/include + ../gpu + ../imbuf + ../makesdna + ../makesrna + ../nodes ../render/extern/include - ../../../intern/guardedalloc - ../../../intern/memutil + ../../gameengine/BlenderRoutines ../../../intern/elbeem/extern ../../../intern/ghost + ../../../intern/guardedalloc + ../../../intern/memutil ../../../intern/opennl/extern - ../../../source/gameengine/BlenderRoutines ) set(INC_SYS -- cgit v1.2.3 From 384831dd9d0944b2d2c80e09d402192a67a6a2db Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Mon, 18 Jul 2011 14:41:59 +0000 Subject: Bugfix #27927 This fixes assigning 'tweak' keymap option for border selecting in Node editor. Thanks Perry Parks for the patch! --- source/blender/windowmanager/intern/wm_operators.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source/blender/windowmanager') diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 35afdf29b53..29afdb570ea 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3567,10 +3567,12 @@ static void gesture_border_modal_keymap(wmKeyConfig *keyconf) /* items for modal map */ WM_modalkeymap_add_item(keymap, ESCKEY, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL); - WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_ANY, KM_ANY, 0, GESTURE_MODAL_CANCEL); + /* Note: cancel only on press otherwise you cannot map this to RMB-gesture */ + WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_PRESS, KM_ANY, 0, GESTURE_MODAL_CANCEL); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, 0, 0, GESTURE_MODAL_BEGIN); WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT); + WM_modalkeymap_add_item(keymap, RIGHTMOUSE, KM_RELEASE, KM_ANY, 0, GESTURE_MODAL_SELECT); #if 0 // Durian guys like this WM_modalkeymap_add_item(keymap, LEFTMOUSE, KM_PRESS, KM_SHIFT, 0, GESTURE_MODAL_BEGIN); -- cgit v1.2.3