Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_remesh.c
| Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | new_mesh = BKE_mesh_remesh_voxel_to_mesh_nomain( | ||||
| mesh, mesh->remesh_voxel_size, mesh->remesh_voxel_adaptivity, isovalue); | mesh, mesh->remesh_voxel_size, mesh->remesh_voxel_adaptivity, isovalue); | ||||
| if (!new_mesh) { | if (!new_mesh) { | ||||
| BKE_report(op->reports, RPT_ERROR, "Voxel remesher failed to create mesh"); | BKE_report(op->reports, RPT_ERROR, "Voxel remesher failed to create mesh"); | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| if (ob->mode == OB_MODE_SCULPT) { | if (ob->mode == OB_MODE_SCULPT) { | ||||
| ED_sculpt_undo_geometry_begin(ob, op->type->name); | ED_sculpt_undo_geometry_begin(C, ob, op->type->name); | ||||
| } | } | ||||
| if (mesh->flag & ME_REMESH_FIX_POLES && mesh->remesh_voxel_adaptivity <= 0.0f) { | if (mesh->flag & ME_REMESH_FIX_POLES && mesh->remesh_voxel_adaptivity <= 0.0f) { | ||||
| new_mesh = BKE_mesh_remesh_voxel_fix_poles(new_mesh); | new_mesh = BKE_mesh_remesh_voxel_fix_poles(new_mesh); | ||||
| BKE_mesh_calc_normals(new_mesh); | BKE_mesh_calc_normals(new_mesh); | ||||
| } | } | ||||
| if (mesh->flag & ME_REMESH_REPROJECT_VOLUME || mesh->flag & ME_REMESH_REPROJECT_PAINT_MASK || | if (mesh->flag & ME_REMESH_REPROJECT_VOLUME || mesh->flag & ME_REMESH_REPROJECT_PAINT_MASK || | ||||
| Show All 20 Lines | static int voxel_remesh_exec(bContext *C, wmOperator *op) | ||||
| BKE_mesh_nomain_to_mesh(new_mesh, mesh, ob, &CD_MASK_MESH, true); | BKE_mesh_nomain_to_mesh(new_mesh, mesh, ob, &CD_MASK_MESH, true); | ||||
| if (mesh->flag & ME_REMESH_SMOOTH_NORMALS) { | if (mesh->flag & ME_REMESH_SMOOTH_NORMALS) { | ||||
| BKE_mesh_smooth_flag_set(ob->data, true); | BKE_mesh_smooth_flag_set(ob->data, true); | ||||
| } | } | ||||
| if (ob->mode == OB_MODE_SCULPT) { | if (ob->mode == OB_MODE_SCULPT) { | ||||
| ED_sculpt_undo_geometry_end(ob); | ED_sculpt_undo_geometry_end(C, ob); | ||||
| } | } | ||||
| BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); | BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 667 Lines • ▼ Show 20 Lines | if (new_mesh == NULL) { | ||||
| } | } | ||||
| return; | return; | ||||
| } | } | ||||
| /* Mirror the Quadriflow result to build the final mesh */ | /* Mirror the Quadriflow result to build the final mesh */ | ||||
| new_mesh = remesh_symmetry_mirror(qj->owner, new_mesh, qj->symmetry_axes); | new_mesh = remesh_symmetry_mirror(qj->owner, new_mesh, qj->symmetry_axes); | ||||
| if (ob->mode == OB_MODE_SCULPT) { | if (ob->mode == OB_MODE_SCULPT) { | ||||
| ED_sculpt_undo_geometry_begin(ob, "QuadriFlow Remesh"); | ED_sculpt_undo_geometry_begin(NULL, ob, "QuadriFlow Remesh"); | ||||
| } | } | ||||
| if (qj->preserve_paint_mask) { | if (qj->preserve_paint_mask) { | ||||
| BKE_mesh_runtime_clear_geometry(mesh); | BKE_mesh_runtime_clear_geometry(mesh); | ||||
| BKE_mesh_remesh_reproject_paint_mask(new_mesh, mesh); | BKE_mesh_remesh_reproject_paint_mask(new_mesh, mesh); | ||||
| } | } | ||||
| BKE_mesh_nomain_to_mesh(new_mesh, mesh, ob, &CD_MASK_MESH, true); | BKE_mesh_nomain_to_mesh(new_mesh, mesh, ob, &CD_MASK_MESH, true); | ||||
| if (qj->smooth_normals) { | if (qj->smooth_normals) { | ||||
| if (qj->use_paint_symmetry) { | if (qj->use_paint_symmetry) { | ||||
| BKE_mesh_calc_normals(ob->data); | BKE_mesh_calc_normals(ob->data); | ||||
| } | } | ||||
| BKE_mesh_smooth_flag_set(ob->data, true); | BKE_mesh_smooth_flag_set(ob->data, true); | ||||
| } | } | ||||
| if (ob->mode == OB_MODE_SCULPT) { | if (ob->mode == OB_MODE_SCULPT) { | ||||
| ED_sculpt_undo_geometry_end(ob); | ED_sculpt_undo_geometry_end(NULL, ob); | ||||
| } | } | ||||
| BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); | BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); | ||||
| *do_update = true; | *do_update = true; | ||||
| *stop = 0; | *stop = 0; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 301 Lines • Show Last 20 Lines | |||||