Changeset View
Standalone View
source/blender/windowmanager/intern/wm_window.c
| Show First 20 Lines • Show All 1,639 Lines • ▼ Show 20 Lines | |||||
| #endif | #endif | ||||
| } | } | ||||
| /* Avoid control reaches end of non-void function compilation warning, which could be promoted | /* Avoid control reaches end of non-void function compilation warning, which could be promoted | ||||
| * to error. */ | * to error. */ | ||||
| BLI_assert_unreachable(); | BLI_assert_unreachable(); | ||||
| return GHOST_kDrawingContextTypeNone; | return GHOST_kDrawingContextTypeNone; | ||||
| } | } | ||||
jbakker: Add newline | |||||
| static uiBlock *block_create_opengl_usage_warning(struct bContext *C, | |||||
| struct ARegion *region, | |||||
| void *UNUSED(arg1)) | |||||
| { | |||||
| uiBlock *block = UI_block_begin(C, region, "autorun_warning_popup", UI_EMBOSS); | |||||
| UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); | |||||
| UI_block_emboss_set(block, UI_EMBOSS); | |||||
| uiLayout *layout = uiItemsAlertBox(block, 44, ALERT_ICON_ERROR); | |||||
| /* Title and explanation text. */ | |||||
| uiLayout *col = uiLayoutColumn(layout, false); | |||||
| uiItemL_ex(col, TIP_("Python script uses OpenGL for drawing."), ICON_NONE, true, false); | |||||
Done Inline Actions*picky* perhaps this should say "Python script uses OpenGL for drawing" ... as it's possible the script is not an add-on. campbellbarton: *picky* perhaps this should say "Python script uses OpenGL for drawing" ... as it's possible… | |||||
| uiItemL(col, TIP_("This may lead to unexpected behavior"), ICON_NONE); | |||||
| uiItemL(col, | |||||
| TIP_("One of the add-ons or scripts is using OpenGL and will not work correct on Metal."), | |||||
| ICON_NONE); | |||||
| uiItemL(col, | |||||
| TIP_("Please contact the developer of the add-on to migrate to use 'gpu' module."), | |||||
| ICON_NONE); | |||||
Done Inline ActionsIt would be good to include the source of the error, otherwise it's up to the user to find which script caused the problem. The Global could store the location of the error and report it here, suggest to use PyC_FileAndNum in report_deprecated_call_to_user to include the file and line the BGL call was made. campbellbarton: It would be good to include the source of the error, otherwise it's up to the user to find… | |||||
Done Inline ActionsNote that this is already reported in the Python warning, just didn't want to clutter this information to the end-user. But no hard objections adding some hints here as well. jbakker: Note that this is already reported in the Python warning, just didn't want to clutter this… | |||||
Done Inline ActionsWhile I see your point - if an inexperienced user runs into this message they wont know who to report the issue to if there are no hints as to the cause of the warning. campbellbarton: While I see your point - if an inexperienced user runs into this message they wont know who to… | |||||
| if (G.opengl_deprecation_usage_filename) { | |||||
| char location[1024]; | |||||
| SNPRINTF( | |||||
| location, "%s:%d", G.opengl_deprecation_usage_filename, G.opengl_deprecation_usage_lineno); | |||||
| uiItemL(col, location, ICON_NONE); | |||||
| } | |||||
| uiItemL(col, TIP_("See system tab in preferences to switch to OpenGL backend."), ICON_NONE); | |||||
| uiItemS(layout); | |||||
| UI_block_bounds_set_centered(block, 14 * U.dpi_fac); | |||||
| return block; | |||||
| } | |||||
| void wm_test_opengl_deprecation_warning(bContext *C) | |||||
| { | |||||
| static bool message_shown = false; | |||||
| /* Exit when no failure detected. */ | |||||
| if (!G.opengl_deprecation_usage_detected) { | |||||
| return; | |||||
| } | |||||
| /* Have we already shown a message during this Blender session. bgl calls are done in a draw | |||||
| * handler that will run many times. */ | |||||
| if (message_shown) { | |||||
| return; | |||||
| } | |||||
| wmWindowManager *wm = CTX_wm_manager(C); | |||||
| wmWindow *win = (wm->winactive) ? wm->winactive : wm->windows.first; | |||||
| BKE_report( | |||||
| &wm->reports, | |||||
| RPT_ERROR, | |||||
| TIP_("One of the add-ons or script is using OpenGL and will not work correct on Metal. " | |||||
| "Please contact the developer of the add-on to migrate to use 'gpu' module.")); | |||||
| if (win) { | |||||
| wmWindow *prevwin = CTX_wm_window(C); | |||||
| CTX_wm_window_set(C, win); | |||||
| UI_popup_block_invoke(C, block_create_opengl_usage_warning, NULL, NULL); | |||||
| CTX_wm_window_set(C, prevwin); | |||||
| } | |||||
| message_shown = true; | |||||
| } | |||||
| eWM_CapabilitiesFlag WM_capabilities_flag(void) | eWM_CapabilitiesFlag WM_capabilities_flag(void) | ||||
| { | { | ||||
| static eWM_CapabilitiesFlag flag = -1; | static eWM_CapabilitiesFlag flag = -1; | ||||
| if (flag != -1) { | if (flag != -1) { | ||||
| return flag; | return flag; | ||||
| } | } | ||||
| flag = 0; | flag = 0; | ||||
| ▲ Show 20 Lines • Show All 801 Lines • Show Last 20 Lines | |||||
Add newline