Commit: c6a3009b15dcb6601aa7843839f84e56c3feac13 Author: Pablo Dobarro Date: Fri May 31 16:02:26 2019 +0200 Branches: sculpt-mode-features https://developer.blender.org/rBc6a3009b15dcb6601aa7843839f84e56c3feac13
Merge branch 'master' into sculpt-mode-features =================================================================== =================================================================== diff --cc source/blender/editors/sculpt_paint/sculpt_intern.h index e6932cc35e4,b29ca1b4dd7..2c34112dd9e --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@@ -33,9 -32,8 +33,10 @@@ #include "BLI_threads.h" #include "BKE_pbvh.h" +#include "BKE_mesh.h" +#include "BKE_paint.h" + struct Main; struct KeyBlock; struct Object; struct SculptOrigVertData; diff --cc source/blender/modifiers/intern/MOD_remesh.c index 8edb0ef7b0c,23da1ec2754..1703a545fb9 --- a/source/blender/modifiers/intern/MOD_remesh.c +++ b/source/blender/modifiers/intern/MOD_remesh.c @@@ -282,95 -144,11 +283,96 @@@ static Mesh *applyModifier(ModifierDat rmd = (RemeshModifierData *)md; + if (rmd->mode == MOD_REMESH_QUAD) { +# ifdef WITH_QEX + Object *ob_orig = DEG_get_original_object(ctx->object); + RemeshModifierData *rmd_orig = (RemeshModifierData *)modifiers_findByName(ob_orig, md->name); + + if (((rmd->flag & MOD_REMESH_LIVE_REMESH) == 0)) { + // access mesh cache on ORIGINAL object, cow should not copy / free this over and over again + if (rmd_orig->mesh_cached) { + return copy_mesh(rmd_orig->mesh_cached); + } + } + + result = BKE_remesh_quad( + mesh, rmd->gradient_size, rmd->stiffness, rmd->iter, rmd->flag & MOD_REMESH_DIRECT_ROUND); + + if (result) { + // update cache + if (rmd_orig->mesh_cached) { + BKE_mesh_free(rmd_orig->mesh_cached); + rmd_orig->mesh_cached = NULL; + } + + // save a copy + rmd_orig->mesh_cached = copy_mesh(result); + } + + return result; +# else + modifier_setError((ModifierData *)rmd, "Built without QEx support, cant execute quad remesh"); + return mesh; +# endif + } + else if (rmd->mode == MOD_REMESH_VOXEL) { +# if defined WITH_OPENVDB + CSGVolume_Object *vcob; + struct OpenVDBLevelSet *level_set; + + Object *ob_orig = DEG_get_original_object(ctx->object); + RemeshModifierData *rmd_orig = (RemeshModifierData *)modifiers_findByName(ob_orig, md->name); + + if (((rmd->flag & MOD_REMESH_LIVE_REMESH) == 0)) { + // access mesh cache on ORIGINAL object, cow should not copy / free this over and over again + if (rmd_orig->mesh_cached) { + return copy_mesh(rmd_orig->mesh_cached); + } + } + + if (rmd->voxel_size > 0.0f) { + + struct OpenVDBTransform *xform = OpenVDBTransform_create(); + OpenVDBTransform_create_linear_transform(xform, rmd->voxel_size); + level_set = BKE_remesh_voxel_ovdb_mesh_to_level_set_create(mesh, xform); + OpenVDBTransform_free(xform); + + for (vcob = rmd->csg_operands.first; vcob; vcob = vcob->next) { + if (vcob->object && (vcob->flag & MOD_REMESH_CSG_OBJECT_ENABLED)) { + level_set = csgOperation(level_set, vcob, ctx->object, rmd); + } + } + + result = voxel_remesh(rmd, mesh, level_set); + + if (result) { + // update cache + if (rmd_orig->mesh_cached) { + BKE_mesh_free(rmd_orig->mesh_cached); + rmd_orig->mesh_cached = NULL; + } + + // save a copy + rmd_orig->mesh_cached = copy_mesh(result); + } + + return result; + } + else { + return mesh; + } +# else + modifier_setError((ModifierData *)rmd, + "Built without OpenVDB support, cant execute voxel remesh"); + return mesh; +# endif + } + init_dualcon_mesh(&input, mesh); - if (rmd->flag & MOD_REMESH_FLOOD_FILL) + if (rmd->flag & MOD_REMESH_FLOOD_FILL) { flags |= DUALCON_FLOOD_FILL; + } switch (rmd->mode) { case MOD_REMESH_CENTROID: _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs