Compare commits

...

15 Commits

Author SHA1 Message Date
Jaume Bellet 280850ddf1 remving patches.py 2024-02-25 23:35:05 +01:00
Jaume Bellet 750c5f2723 Cleanup on bf-blender was removing an include, that is needed here 2024-02-23 23:29:26 +01:00
Jaume Bellet ea58d624cd Merge branch 'bf-blender' into mb-0012-custom-splash 2024-02-23 23:29:15 +01:00
Jaume Bellet dbaf864dde Merge branch 'bf-blender' into mb-0012-custom-splash
conflict with 2ccada61cb

 Conflicts:
	source/blender/windowmanager/intern/wm_splash_screen.cc
2024-02-11 21:32:37 +01:00
Jaume Bellet 63e9375ec8 0618de49ad
Cleanup: Replace MIN/MAX macros with C++ functions

Use `std::min` and `std::max` instead. Though keep MIN2 and MAX2
just for C code that hasn't been moved to C++ yet.

Pull Request: #117384
2024-01-28 19:27:15 +01:00
Jaume Bellet cde3c2f0c4 Merge branch 'bf-blender' into mb-0012-custom-splash 2024-01-28 19:23:28 +01:00
Jaume Bellet 236564a441 Merge branch 'bf-blender' into mb-0012-custom-splash 2023-12-03 18:16:59 +01:00
Jaume Bellet e1dba50d08 moving ID file 2023-12-03 18:08:53 +01:00
Jaume Bellet aa234d9e15 mv from mblender to tornavis, folder 2023-12-03 18:08:33 +01:00
Jaume Bellet 4ae40c1e3a remove deps.. 2023-11-20 22:52:39 +01:00
Jaume Bellet 3b5da577f7 added patch dependencies 2023-11-20 22:50:13 +01:00
Jaume Bellet b7e97dc8bb Merge branch 'bf-blender' into mb-0012-custom-splash 2023-11-20 22:46:30 +01:00
Jaume Bellet 9414fe8f70 fixes memory issue 2023-11-08 07:51:58 +01:00
Jaume Bellet ed86f7be23 added ID file 2023-11-06 06:21:19 +01:00
Jaume Bellet cca4693bdd works 2023-11-05 23:34:07 +01:00
4 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1 @@
/* Empty File */

View File

@ -4065,6 +4065,7 @@ void wm_operatortypes_register()
WM_operatortype_append(WM_OT_operator_defaults);
WM_operatortype_append(WM_OT_splash);
WM_operatortype_append(WM_OT_splash_about);
WM_operatortype_append(WM_OT_splash_custom);
WM_operatortype_append(WM_OT_search_menu);
WM_operatortype_append(WM_OT_search_operator);
WM_operatortype_append(WM_OT_search_single_menu);

View File

@ -17,6 +17,8 @@
#include <algorithm>
#include <cstring>
#include "CLG_log.h"
#include "DNA_ID.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
@ -45,6 +47,9 @@
#include "WM_api.hh"
#include "WM_types.hh"
#include "RNA_define.hh"
#include "RNA_access.hh"
#include "wm.hh"
/* -------------------------------------------------------------------- */
@ -369,4 +374,67 @@ void WM_OT_splash_about(wmOperatorType *ot)
ot->poll = WM_operator_winactive;
}
static uiBlock *wm_block_create_custom_splash(bContext *C, ARegion *region, void *arg) {
char *menutype_str = (char*) arg;
const uiStyle *style = UI_style_get_dpi();
const int text_points_max = std::max(style->widget.points, style->widgetlabel.points);
const int dialog_width = text_points_max * 42 * UI_SCALE_FAC;
uiBlock *block = UI_block_begin(C, region, "about", UI_EMBOSS);
UI_block_flag_enable(block, UI_BLOCK_KEEP_OPEN | UI_BLOCK_LOOP | UI_BLOCK_NO_WIN_CLIP);
UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP);
uiLayout *layout = UI_block_layout(
block, UI_LAYOUT_VERTICAL, UI_LAYOUT_PANEL, 0, 0, dialog_width, 0, 0, style);
uiLayout *col = uiLayoutColumn(layout, true);
MenuType *mt = WM_menutype_find(menutype_str, true);
if (mt) {
UI_menutype_draw(C, mt, col);
} else {
CLOG_ERROR(WM_LOG_OPERATORS, "cannot find WM menutype '%s'", menutype_str);
}
UI_block_bounds_set_centered(block, 22 * UI_SCALE_FAC);
return block;
}
static int wm_about_custom_exec(bContext *C, wmOperator *op)
{
char *menutype_str = MEM_cnew_array<char>(100, __func__);
*menutype_str = '\0';
if (RNA_struct_property_is_set(op->ptr, "menutype")) {
RNA_string_get(op->ptr, "menutype", menutype_str);
}
UI_popup_block_invoke(C, wm_block_create_custom_splash, menutype_str, MEM_freeN);
return OPERATOR_FINISHED;
}
static int wm_about_custom_invoke(bContext *C, wmOperator *op , const wmEvent * /*event*/) {
return op->type->exec(C, op);
}
void WM_OT_splash_custom(wmOperatorType *ot)
{
PropertyRNA *prop;
prop = RNA_def_string(ot->srna, "menutype", "MT_", 100, "", "MenuType class name");
ot->name = "Custom Splash";
ot->idname = "WM_OT_splash_custom";
ot->description = "Open a splash window with some custom information";
ot->exec = wm_about_custom_exec;
ot->invoke = wm_about_custom_invoke;
ot->poll = WM_operator_winactive;
}
/** \} */

View File

@ -98,6 +98,7 @@ void wm_autosave_delete();
void WM_OT_splash(wmOperatorType *ot);
void WM_OT_splash_about(wmOperatorType *ot);
void WM_OT_splash_custom(wmOperatorType *ot);
/* `wm_stereo.cc` */