Sculpt: Add Transform, Trim, and Mesh Filter operators to Sculpt menu #104718

Merged
Joseph Eagar merged 19 commits from Tarek-Yasser/blender:sculpt_mode_add_menu_operators into main 2023-03-08 01:18:34 +01:00
2 changed files with 21 additions and 1 deletions
Showing only changes of commit 115ec325f2 - Show all commits

View File

@ -3224,6 +3224,9 @@ class VIEW3D_MT_sculpt(Menu):
layout.operator("transform.rotate")
layout.operator("transform.resize", text="Scale")
props = layout.operator("sculpt.mesh_filter", text="Sphere")
props.type = 'SPHERE'
layout.separator()
props = layout.operator("paint.hide_show", text="Box Hide")

View File

@ -5,6 +5,7 @@
* \ingroup edsculpt
*/
#include "DNA_modifier_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_hash.h"
@ -21,6 +22,7 @@
#include "BKE_context.h"
#include "BKE_paint.h"
#include "BKE_pbvh.h"
#include "BKE_modifier.h"
#include "DEG_depsgraph.h"
@ -1155,6 +1157,21 @@ static void sculpt_mesh_ui_exec(bContext * /*C*/, wmOperator *op)
uiItemR(layout, op->ptr, "deform_axis", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
}
// Check this out for more context:
// https://projects.blender.org/blender/blender/pulls/104718#issuecomment-888923
bool sculpt_filter_mesh_poll(bContext *C)
{
Object *ob = CTX_data_active_object(C);
bool multires_with_subdivision = false;
MultiresModifierData * md = (MultiresModifierData*)BKE_modifiers_findby_type(ob, eModifierType_Multires);
if (md && md->sculptlvl > 0) {
multires_with_subdivision = true;
}
return SCULPT_mode_poll(C) && !multires_with_subdivision;
}
Review

Don't use // comments.

Don't use // comments.
void SCULPT_OT_mesh_filter(wmOperatorType *ot)
{
/* Identifiers. */
@ -1165,7 +1182,7 @@ void SCULPT_OT_mesh_filter(wmOperatorType *ot)
/* API callbacks. */
ot->invoke = sculpt_mesh_filter_invoke;
ot->modal = sculpt_mesh_filter_modal;
ot->poll = SCULPT_mode_poll;
ot->poll = sculpt_filter_mesh_poll;
ot->exec = sculpt_mesh_filter_exec;
ot->ui = sculpt_mesh_ui_exec;