Cleanup: Move curves sculpt poll functions to C++ namespace

This commit is contained in:
Hans Goudey 2024-01-24 14:08:43 -05:00
parent b689027b3a
commit f7303dbaa2
3 changed files with 10 additions and 12 deletions

View File

@ -171,7 +171,7 @@ struct CurvesConstraintSolver {
}
};
} // namespace blender::ed::sculpt_paint
bool curves_sculpt_poll(bContext *C);
bool curves_sculpt_poll_view3d(bContext *C);
bool CURVES_SCULPT_mode_poll(bContext *C);
bool CURVES_SCULPT_mode_poll_view3d(bContext *C);
} // namespace blender::ed::sculpt_paint

View File

@ -51,19 +51,21 @@
#include "GPU_matrix.h"
#include "GPU_state.h"
namespace blender::ed::sculpt_paint {
/* -------------------------------------------------------------------- */
/** \name Poll Functions
* \{ */
bool CURVES_SCULPT_mode_poll(bContext *C)
bool curves_sculpt_poll(bContext *C)
{
const Object *ob = CTX_data_active_object(C);
return ob && ob->mode & OB_MODE_SCULPT_CURVES;
}
bool CURVES_SCULPT_mode_poll_view3d(bContext *C)
bool curves_sculpt_poll_view3d(bContext *C)
{
if (!CURVES_SCULPT_mode_poll(C)) {
if (!curves_sculpt_poll(C)) {
return false;
}
if (CTX_wm_region_view3d(C) == nullptr) {
@ -74,10 +76,6 @@ bool CURVES_SCULPT_mode_poll_view3d(bContext *C)
/** \} */
namespace blender::ed::sculpt_paint {
using blender::bke::CurvesGeometry;
/* -------------------------------------------------------------------- */
/** \name Brush Stroke Operator
* \{ */
@ -294,7 +292,7 @@ static void curves_sculptmode_enter(bContext *C)
copy_v3_v3_uchar(paint->paint_cursor_col, PAINT_CURSOR_SCULPT_CURVES);
paint->paint_cursor_col[3] = 128;
ED_paint_cursor_start(&curves_sculpt->paint, CURVES_SCULPT_mode_poll_view3d);
ED_paint_cursor_start(&curves_sculpt->paint, curves_sculpt_poll_view3d);
paint_init_pivot(ob, scene);
/* Necessary to change the object mode on the evaluated object. */

View File

@ -1600,7 +1600,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf)
/* Curves Sculpt mode. */
keymap = WM_keymap_ensure(keyconf, "Sculpt Curves", SPACE_EMPTY, RGN_TYPE_WINDOW);
keymap->poll = CURVES_SCULPT_mode_poll;
keymap->poll = curves_sculpt_poll;
/* sculpt expand. */
expand::modal_keymap(keyconf);