Cleanup: Remove unused Python OpenGL warning popup

Unused since decd88f67e
This commit is contained in:
Hans Goudey
2025-06-16 10:27:40 -04:00
parent 6bb10e8412
commit 6f0229b3a0
2 changed files with 0 additions and 65 deletions

View File

@@ -106,14 +106,6 @@ static int pygpu_shader_uniform_location_get(GPUShader *shader,
/** \name Shader Type
* \{ */
static std::optional<blender::StringRefNull> c_str_to_stringref_opt(const char *str)
{
if (!str) {
return std::nullopt;
}
return blender::StringRefNull(str);
}
PyDoc_STRVAR(
/* Wrap. */
pygpu_shader_bind_doc,

View File

@@ -2086,63 +2086,6 @@ GHOST_TDrawingContextType wm_ghost_drawing_context_type(const eGPUBackendType gp
return GHOST_kDrawingContextTypeNone;
}
static uiBlock *block_create_opengl_usage_warning(bContext *C, ARegion *region, void * /*arg1*/)
{
uiBlock *block = UI_block_begin(
C, region, "autorun_warning_popup", blender::ui::EmbossType::Emboss);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
UI_block_emboss_set(block, blender::ui::EmbossType::Emboss);
const char *title = RPT_("Python script uses OpenGL for drawing");
const char *message1 = RPT_("This may lead to unexpected behavior");
const char *message2 = RPT_(
"One of the add-ons or scripts is using OpenGL and will not work correct on Metal");
const char *message3 = RPT_(
"Please contact the developer of the add-on to migrate to use 'gpu' module");
const char *message4 = RPT_("See system tab in preferences to switch to OpenGL backend");
/* Measure strings to find the longest. */
const uiStyle *style = UI_style_get_dpi();
UI_fontstyle_set(&style->widget);
int text_width = int(BLF_width(style->widget.uifont_id, title, BLF_DRAW_STR_DUMMY_MAX));
text_width = std::max(text_width,
int(BLF_width(style->widget.uifont_id, message1, BLF_DRAW_STR_DUMMY_MAX)));
text_width = std::max(text_width,
int(BLF_width(style->widget.uifont_id, message2, BLF_DRAW_STR_DUMMY_MAX)));
text_width = std::max(text_width,
int(BLF_width(style->widget.uifont_id, message3, BLF_DRAW_STR_DUMMY_MAX)));
text_width = std::max(text_width,
int(BLF_width(style->widget.uifont_id, message4, BLF_DRAW_STR_DUMMY_MAX)));
const int dialog_width = std::max(int(400.0f * UI_SCALE_FAC),
text_width + int(style->columnspace * 2.5));
const short icon_size = 40 * UI_SCALE_FAC;
uiLayout *layout = uiItemsAlertBox(
block, style, dialog_width + icon_size, ALERT_ICON_ERROR, icon_size);
uiLayout *col = &layout->column(false);
col->scale_y_set(0.9f);
/* Title and explanation text. */
uiItemL_ex(col, title, ICON_NONE, true, false);
col->separator(0.8f, LayoutSeparatorType::Space);
uiLayout *messages = &col->column(false);
messages->scale_y_set(0.8f);
messages->label(message1, ICON_NONE);
messages->label(message2, ICON_NONE);
messages->label(message3, ICON_NONE);
messages->label(message4, ICON_NONE);
col->separator(0.5f, LayoutSeparatorType::Space);
UI_block_bounds_set_centered(block, 14 * UI_SCALE_FAC);
return block;
}
static uiBlock *block_create_gpu_backend_fallback(bContext *C, ARegion *region, void * /*arg1*/)
{
uiBlock *block = UI_block_begin(