123 if (
params->add_boundary_loop) {
129 for (
int repeat = 0; repeat <
params->num_smooth_iterations; repeat++) {
134 for (
int i = 0;
i < 3;
i++) {
137 "smooth_vert verts=%hv factor=%f mirror_clip_x=%b mirror_clip_y=%b "
139 "clip_dist=%f use_axis_x=%b use_axis_y=%b use_axis_z=%b",
158 for (
int i = 0;
i < 1;
i++) {
161 "smooth_vert verts=%hv factor=%f mirror_clip_x=%b mirror_clip_y=%b "
163 "clip_dist=%f use_axis_x=%b use_axis_y=%b use_axis_z=%b",
189 new_mesh->attributes_for_write().remove(
".sculpt_face_set");
192 new_mesh->attributes_for_write().remove(
".sculpt_mask");
202 ushort local_view_bits = 0;
210 if (
params->apply_shrinkwrap) {
214 if (
params->add_solidify) {
218 new_ob,
"mask_extract_solidify");
235 const float threshold =
params->mask_threshold;
244 bool keep_face =
true;
253 if (
mask < threshold) {
264 const int tag_face_set_id =
params->active_face_set;
282 if (!mesh->
attributes().contains(
".sculpt_mask")) {
308 C, op,
e,
IFACE_(
"Create Mesh From Paint Mask"),
IFACE_(
"Extract"));
317 "Add an extra edge loop to better preserve the shape when applying a "
318 "subdivision surface modifier");
325 "Smooth iterations applied to the extracted mesh",
332 "Project the extracted mesh into the original sculpt");
337 "Extract the mask as a solid object with a solidify modifier");
342 ot->name =
"Mask Extract";
343 ot->description =
"Create a new mesh object from the current paint mask";
344 ot->idname =
"SCULPT_OT_paint_mask_extract";
359 "Minimum mask value to consider the vertex valid to extract a face from the original mesh",
384 params.active_face_set = face_set_id;
385 params.num_smooth_iterations = 0;
386 params.add_boundary_loop =
false;
387 params.apply_shrinkwrap =
true;
388 params.add_solidify =
true;
394 ot->name =
"Face Set Extract";
395 ot->description =
"Create a new mesh object from the selected Face Set";
396 ot->idname =
"SCULPT_OT_face_set_extract";
420 bool keep_face =
true;
423 if (
mask < mask_threshold) {
433 keep_face = !keep_face;
447 "triangulate faces=%hf quad_method=%i ngon_method=%i",
455 "recalc_face_normals faces=%hf",
471 if (!
mesh->attributes().contains(
".sculpt_mask")) {
502 if (create_new_object) {
503 ushort local_view_bits = 0;
522 new_ob_mesh->attributes_for_write().remove(
".sculpt_mask");
537 if (
mesh->attributes().contains(
".sculpt_face_set")) {
542 if (!create_new_object) {
559 ot->name =
"Mask Slice";
560 ot->description =
"Slices the paint mask from the mesh";
561 ot->idname =
"SCULPT_OT_paint_mask_slice";
575 "Minimum mask value to consider the vertex valid to extract a face from the original mesh",
579 ot->srna,
"fill_holes",
true,
"Fill Holes",
"Fill holes after slicing the mask");
584 "Slice to New Object",
585 "Create a new object from the sliced mask");
void CTX_wm_operator_poll_msg_set(bContext *C, const char *msg)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
RegionView3D * CTX_wm_region_view3d(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
Depsgraph * CTX_data_depsgraph_on_load(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
CustomData interface, see also DNA_customdata_types.h.
int CustomData_get_offset_named(const CustomData *data, eCustomDataType type, blender::StringRef name)
void BKE_editmesh_free_data(BMEditMesh *em)
BMEditMesh * BKE_editmesh_create(BMesh *bm)
void BKE_id_free(Main *bmain, void *idv)
ID * BKE_id_copy(Main *bmain, const ID *id)
void BKE_mesh_batch_cache_dirty_tag(Mesh *mesh, eMeshBatchDirtyMode mode)
Mesh * BKE_mesh_from_bmesh_nomain(BMesh *bm, const BMeshToMeshParams *params, const Mesh *me_settings)
void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob, bool process_shape_keys=true)
@ BKE_MESH_BATCH_DIRTY_ALL
ModifierData * BKE_modifiers_findby_name(const Object *ob, const char *name)
#define SCULPT_FACE_SET_NONE
void BKE_sculptsession_free_pbvh(Object &object)
void BKE_shrinkwrap_mesh_nearest_surface_deform(Depsgraph *depsgraph, Scene *scene, Object *ob_source, Object *ob_target)
MINLINE void mul_v3_v3(float r[3], const float a[3])
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
Object is a sort of wrapper for general info.
bool ED_operator_object_active_editable_mesh(bContext *C)
void ED_undo_push_op(bContext *C, wmOperator *op)
Read Guarded memory(de)allocation.
@ OPTYPE_DEPENDS_ON_CURSOR
#define BM_ELEM_CD_GET_FLOAT(ele, offset)
#define BM_ELEM_CD_GET_INT(ele, offset)
void BM_mesh_delete_hflag_context(BMesh *bm, const char hflag, const int type)
void BM_mesh_edgenet(BMesh *bm, const bool use_edge_tag, const bool use_new_face_tag)
#define BM_elem_flag_set(ele, hflag, val)
#define BM_elem_flag_test_bool(ele, hflag)
#define BM_ITER_ELEM(ele, iter, data, itype)
#define BM_ITER_MESH(ele, iter, bm, itype)
void BM_mesh_elem_hflag_enable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char htype, const char hflag, const bool respecthide)
void BM_mesh_free(BMesh *bm)
BMesh Free Mesh.
BMesh * BM_mesh_create(const BMAllocTemplate *allocsize, const BMeshCreateParams *params)
BMesh Make Mesh.
#define BMALLOC_TEMPLATE_FROM_ME(...)
void BM_mesh_bm_from_me(BMesh *bm, const Mesh *mesh, const BMeshFromMeshParams *params)
void BM_mesh_normals_update(BMesh *bm)
bool BMO_op_callf(BMesh *bm, int flag, const char *fmt,...)
#define BMO_FLAG_DEFAULTS
bool BM_vert_is_boundary(const BMVert *v)
BLI_INLINE bool BM_edge_is_boundary(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
BPy_StructRNA * depsgraph
bool edbm_extrude_edges_indiv(BMEditMesh *em, wmOperator *op, const char hflag, const bool use_normal_flip)
bool EDBM_op_callf(BMEditMesh *em, wmOperator *op, const char *fmt,...)
CCL_NAMESPACE_BEGIN ccl_device float invert(const float color, const float factor)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
ModifierData * modifier_add(ReportList *reports, Main *bmain, Scene *scene, Object *ob, const char *name, int type)
Object * add_type(bContext *C, int type, const char *name, const float loc[3], const float rot[3], bool enter_editmode, unsigned short local_view_bits) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL
int find_next_available_id(Object &object)
void initialize_none_to_id(Mesh *mesh, int new_id)
int active_update_and_get(bContext *C, Object &ob, const float mval_fl[2])
void geometry_begin(const Scene &scene, Object &ob, const wmOperator *op)
void geometry_end(Object &ob)
void object_sculpt_mode_exit(Main &bmain, Depsgraph &depsgraph, Scene &scene, Object &ob)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
struct SculptSession * sculpt
unsigned short local_view_uid
struct ReportList * reports
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
wmOperatorStatus WM_operator_props_popup_confirm_ex(bContext *C, wmOperator *op, const wmEvent *, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default, std::optional< std::string > message)