main sync #3

Merged
Patrick Busch merged 318 commits from blender/blender:main into main 2023-03-17 15:52:21 +01:00
2 changed files with 29 additions and 27 deletions
Showing only changes of commit b228e5b118 - Show all commits

View File

@ -21,9 +21,9 @@
#include "BKE_brush.h" #include "BKE_brush.h"
#include "BKE_context.h" #include "BKE_context.h"
#include "BKE_modifier.h"
#include "BKE_paint.h" #include "BKE_paint.h"
#include "BKE_pbvh.h" #include "BKE_pbvh.h"
#include "BKE_modifier.h"
#include "DEG_depsgraph.h" #include "DEG_depsgraph.h"
@ -31,9 +31,8 @@
#include "WM_types.h" #include "WM_types.h"
#include "ED_screen.h" #include "ED_screen.h"
#include "ED_view3d.h"
#include "ED_util.h" #include "ED_util.h"
#include "ED_screen.h" #include "ED_view3d.h"
#include "paint_intern.h" #include "paint_intern.h"
#include "sculpt_intern.hh" #include "sculpt_intern.hh"
@ -739,24 +738,22 @@ wmKeyMap *filter_mesh_modal_keymap(wmKeyConfig *keyconf)
return keymap; return keymap;
} }
static void sculpt_mesh_update_status_bar(bContext* C, wmOperator* op) { static void sculpt_mesh_update_status_bar(bContext *C, wmOperator *op)
{
char header[UI_MAX_DRAW_STR]; char header[UI_MAX_DRAW_STR];
char buf[UI_MAX_DRAW_STR]; char buf[UI_MAX_DRAW_STR];
int available_len = sizeof(buf); int available_len = sizeof(buf);
char *p = buf;
char* p = buf;
#define WM_MODALKEY(_id) \ #define WM_MODALKEY(_id) \
WM_modalkeymap_operator_items_to_string_buf( \ WM_modalkeymap_operator_items_to_string_buf( \
op->type, (_id), true, UI_MAX_SHORTCUT_STR, &available_len, &p) op->type, (_id), true, UI_MAX_SHORTCUT_STR, &available_len, &p)
BLI_snprintf( BLI_snprintf(header,
header, sizeof(header),
sizeof(header), TIP_("%s: Confirm, %s: Cancel"),
TIP_("%s: Confirm, %s: Cancel"), WM_MODALKEY(FILTER_MESH_MODAL_CONFIRM),
WM_MODALKEY(FILTER_MESH_MODAL_CONFIRM), WM_MODALKEY(FILTER_MESH_MODAL_CANCEL));
WM_MODALKEY(FILTER_MESH_MODAL_CANCEL)
);
#undef WM_MODALKEY #undef WM_MODALKEY
@ -857,15 +854,18 @@ static void sculpt_mesh_filter_end(bContext *C)
SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COORDS); SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COORDS);
} }
static int sculpt_mesh_filter_confirm(SculptSession *ss, wmOperator* op, const eSculptMeshFilterType filter_type) { static int sculpt_mesh_filter_confirm(SculptSession *ss,
wmOperator *op,
const eSculptMeshFilterType filter_type)
{
float initial_strength = ss->filter_cache->start_filter_strength; float initial_strength = ss->filter_cache->start_filter_strength;
/* Don't update strength property if we're storing an event history. */ /* Don't update strength property if we're storing an event history. */
if (sculpt_mesh_filter_is_continuous(filter_type)) { if (sculpt_mesh_filter_is_continuous(filter_type)) {
RNA_float_set(op->ptr, "strength", initial_strength); RNA_float_set(op->ptr, "strength", initial_strength);
} }
return OPERATOR_FINISHED; return OPERATOR_FINISHED;
} }
static void sculpt_mesh_filter_cancel(bContext *C, wmOperator * /*op*/) static void sculpt_mesh_filter_cancel(bContext *C, wmOperator * /*op*/)
@ -929,7 +929,7 @@ static int sculpt_mesh_filter_modal(bContext *C, wmOperator *op, const wmEvent *
} }
sculpt_mesh_filter_end(C); sculpt_mesh_filter_end(C);
ED_workspace_status_text(C, nullptr); /* Clear status bar */ ED_workspace_status_text(C, nullptr); /* Clear status bar */
WM_cursor_modal_restore(CTX_wm_window(C)); WM_cursor_modal_restore(CTX_wm_window(C));
return ret; return ret;
@ -974,7 +974,9 @@ static int sculpt_mesh_filter_modal(bContext *C, wmOperator *op, const wmEvent *
return OPERATOR_RUNNING_MODAL; return OPERATOR_RUNNING_MODAL;
} }
static void sculpt_filter_specific_init(const eSculptMeshFilterType filter_type, wmOperator* op, SculptSession* ss) static void sculpt_filter_specific_init(const eSculptMeshFilterType filter_type,
wmOperator *op,
SculptSession *ss)
{ {
switch (filter_type) { switch (filter_type) {
case MESH_FILTER_SURFACE_SMOOTH: { case MESH_FILTER_SURFACE_SMOOTH: {
@ -1178,7 +1180,8 @@ void SCULPT_OT_mesh_filter(wmOperatorType *ot)
Check `sculpt_mesh_filter_modal` to see where it's really called. */ Check `sculpt_mesh_filter_modal` to see where it's really called. */
ot->cancel = sculpt_mesh_filter_cancel; ot->cancel = sculpt_mesh_filter_cancel;
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_CURSOR_X | OPTYPE_BLOCKING | OPTYPE_DEPENDS_ON_CURSOR; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_GRAB_CURSOR_X | OPTYPE_BLOCKING |
OPTYPE_DEPENDS_ON_CURSOR;
/* RNA. */ /* RNA. */
SCULPT_mesh_filter_properties(ot); SCULPT_mesh_filter_properties(ot);

View File

@ -1428,7 +1428,6 @@ void ED_operatortypes_sculpt(void)
WM_operatortype_append(SCULPT_OT_reveal_all); WM_operatortype_append(SCULPT_OT_reveal_all);
} }
void ED_keymap_sculpt(wmKeyConfig *keyconf) void ED_keymap_sculpt(wmKeyConfig *keyconf)
{ {
filter_mesh_modal_keymap(keyconf); filter_mesh_modal_keymap(keyconf);