Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-11-26 17:39:08 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-11-26 17:41:37 +0300
commit9abcf56fa88dd849bf0f83fafe5d4666d3531cd2 (patch)
tree928dd1bace4b53b8086aaa74e395762979d2f478 /source/blender/modifiers
parente6322abad23a8ae71b72e54befffc17ae35e30d9 (diff)
Enable OpenSubdiv modifier by default
This commit makes it so that subsurf/multires modifiers will respect the WITH_OPENSUBDIV option. The WITH_OPENSUBDIV_MODIFIER option is now gone. For artists it mean that subsurf modifier will behave same as it is planned for 2.80. Multires will now support sculpting, but it has some known limitations. Those will be worked on before the final release. If OpenSubdiv is disabled, no subsurf/multires functionality will present. For the details see: https://wiki.blender.org/wiki/Reference/Release_Notes/2.80/Modeling#Subsurf.2FMultires
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/CMakeLists.txt4
-rw-r--r--source/blender/modifiers/intern/MOD_multires.c96
-rw-r--r--source/blender/modifiers/intern/MOD_subsurf.c52
3 files changed, 6 insertions, 146 deletions
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 522e15be856..e914100249b 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -144,10 +144,6 @@ if(WITH_INTERNATIONAL)
add_definitions(-DWITH_INTERNATIONAL)
endif()
-if(WITH_OPENSUBDIV_MODIFIER)
- add_definitions(-DWITH_OPENSUBDIV_MODIFIER)
-endif()
-
# So we can have special tricks in modifier system.
add_definitions(${GL_DEFINITIONS})
diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c
index 73fa7aa0e0d..fc8a376d2d7 100644
--- a/source/blender/modifiers/intern/MOD_multires.c
+++ b/source/blender/modifiers/intern/MOD_multires.c
@@ -67,91 +67,6 @@ static void initData(ModifierData *md)
mmd->quality = 3;
}
-#ifndef WITH_OPENSUBDIV_MODIFIER
-
-static DerivedMesh *applyModifier_DM(
- ModifierData *md, const ModifierEvalContext *ctx,
- DerivedMesh *dm)
-{
- MultiresModifierData *mmd = (MultiresModifierData *)md;
- struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
- DerivedMesh *result;
- Mesh *me = (Mesh *)ctx->object->data;
- const bool useRenderParams = (ctx->flag & MOD_APPLY_RENDER) != 0;
- const bool ignore_simplify = (ctx->flag & MOD_APPLY_IGNORE_SIMPLIFY) != 0;
- MultiresFlags flags = 0;
- const bool has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK);
-
- if (mmd->totlvl) {
- if (!CustomData_get_layer(&me->ldata, CD_MDISPS)) {
- /* multires always needs a displacement layer */
- CustomData_add_layer(&me->ldata, CD_MDISPS, CD_CALLOC, NULL, me->totloop);
- }
- }
-
- if (has_mask)
- flags |= MULTIRES_ALLOC_PAINT_MASK;
-
- if (useRenderParams)
- flags |= MULTIRES_USE_RENDER_PARAMS;
-
- if (ignore_simplify)
- flags |= MULTIRES_IGNORE_SIMPLIFY;
-
- result = multires_make_derived_from_derived(dm, mmd, scene, ctx->object, flags);
-
- if (result == dm)
- return dm;
-
- if (useRenderParams || !(ctx->flag & MOD_APPLY_USECACHE)) {
- DerivedMesh *cddm;
-
- cddm = CDDM_copy(result);
-
- /* copy hidden/masks to vertices */
- if (!useRenderParams) {
- struct MDisps *mdisps;
- struct GridPaintMask *grid_paint_mask;
-
- mdisps = CustomData_get_layer(&me->ldata, CD_MDISPS);
- grid_paint_mask = CustomData_get_layer(&me->ldata, CD_GRID_PAINT_MASK);
-
- if (mdisps) {
- subsurf_copy_grid_hidden(result, me->mpoly,
- cddm->getVertArray(cddm),
- mdisps);
-
- BKE_mesh_flush_hidden_from_verts_ex(cddm->getVertArray(cddm),
- cddm->getLoopArray(cddm),
- cddm->getEdgeArray(cddm),
- cddm->getNumEdges(cddm),
- cddm->getPolyArray(cddm),
- cddm->getNumPolys(cddm));
- }
- if (grid_paint_mask) {
- float *paint_mask = CustomData_add_layer(&cddm->vertData,
- CD_PAINT_MASK,
- CD_CALLOC, NULL,
- cddm->getNumVerts(cddm));
-
- subsurf_copy_grid_paint_mask(result, me->mpoly,
- paint_mask, grid_paint_mask);
- }
- }
-
- result->release(result);
- result = cddm;
- }
-
- return result;
-}
-
-applyModifier_DM_wrapper(applyModifier, applyModifier_DM)
-
-#endif
-
-#ifdef WITH_OPENSUBDIV_MODIFIER
-
/* Subdivide into fully qualified mesh. */
static Mesh *multires_as_mesh(MultiresModifierData *mmd,
@@ -211,9 +126,9 @@ static Mesh *multires_as_ccg(MultiresModifierData *mmd,
return result;
}
-static Mesh *applyModifier_subdiv(ModifierData *md,
- const ModifierEvalContext *ctx,
- Mesh *mesh)
+static Mesh *applyModifier(ModifierData *md,
+ const ModifierEvalContext *ctx,
+ Mesh *mesh)
{
Mesh *result = mesh;
MultiresModifierData *mmd = (MultiresModifierData *)md;
@@ -247,7 +162,6 @@ static Mesh *applyModifier_subdiv(ModifierData *md,
}
return result;
}
-#endif
ModifierTypeInfo modifierType_Multires = {
/* name */ "Multires",
@@ -270,11 +184,7 @@ ModifierTypeInfo modifierType_Multires = {
/* deformMatrices */ NULL,
/* deformVertsEM */ NULL,
/* deformMatricesEM */ NULL,
-#ifdef WITH_OPENSUBDIV_MODIFIER
- /* applyModifier */ applyModifier_subdiv,
-#else
/* applyModifier */ applyModifier,
-#endif
/* initData */ initData,
/* requiredDataMask */ NULL,
diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c
index dee9089d7d3..9c6bff6b291 100644
--- a/source/blender/modifiers/intern/MOD_subsurf.c
+++ b/source/blender/modifiers/intern/MOD_subsurf.c
@@ -99,47 +99,6 @@ static bool isDisabled(const Scene *scene, ModifierData *md, bool useRenderParam
return get_render_subsurf_level(&scene->r, levels, useRenderParams != 0) == 0;
}
-#ifndef WITH_OPENSUBDIV_MODIFIER
-
-static DerivedMesh *applyModifier_DM(
- ModifierData *md, const ModifierEvalContext *ctx,
- DerivedMesh *derivedData)
-{
- SubsurfModifierData *smd = (SubsurfModifierData *) md;
- struct Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph);
- SubsurfFlags subsurf_flags = 0;
- DerivedMesh *result;
- const bool useRenderParams = (ctx->flag & MOD_APPLY_RENDER) != 0;
- const bool isFinalCalc = (ctx->flag & MOD_APPLY_USECACHE) != 0;
-
- bool do_cddm_convert = useRenderParams || !isFinalCalc;
-
- if (useRenderParams)
- subsurf_flags |= SUBSURF_USE_RENDER_PARAMS;
- if (isFinalCalc)
- subsurf_flags |= SUBSURF_IS_FINAL_CALC;
- if (ctx->object->mode & OB_MODE_EDIT)
- subsurf_flags |= SUBSURF_IN_EDIT_MODE;
-
- result = subsurf_make_derived_from_derived(derivedData, smd, scene, NULL, subsurf_flags);
- result->cd_flag = derivedData->cd_flag;
-
- {
- DerivedMesh *cddm = CDDM_copy(result);
- result->release(result);
- result = cddm;
- }
-
- (void) do_cddm_convert;
-
- return result;
-}
-
-applyModifier_DM_wrapper(applyModifier, applyModifier_DM)
-
-#endif
-
-#ifdef WITH_OPENSUBDIV_MODIFIER
static int subdiv_levels_for_modifier_get(const SubsurfModifierData *smd,
const ModifierEvalContext *ctx)
{
@@ -217,9 +176,9 @@ static Mesh *subdiv_as_ccg(SubsurfModifierData *smd,
/* Modifier itself. */
-static Mesh *applyModifier_subdiv(ModifierData *md,
- const ModifierEvalContext *ctx,
- Mesh *mesh)
+static Mesh *applyModifier(ModifierData *md,
+ const ModifierEvalContext *ctx,
+ Mesh *mesh)
{
Mesh *result = mesh;
SubsurfModifierData *smd = (SubsurfModifierData *) md;
@@ -248,7 +207,6 @@ static Mesh *applyModifier_subdiv(ModifierData *md,
BKE_subdiv_free(subdiv);
return result;
}
-#endif
ModifierTypeInfo modifierType_Subsurf = {
/* name */ "Subdivision",
@@ -273,11 +231,7 @@ ModifierTypeInfo modifierType_Subsurf = {
/* deformMatrices */ NULL,
/* deformVertsEM */ NULL,
/* deformMatricesEM */ NULL,
-#ifdef WITH_OPENSUBDIV_MODIFIER
- /* applyModifier */ applyModifier_subdiv,
-#else
/* applyModifier */ applyModifier,
-#endif
/* initData */ initData,
/* requiredDataMask */ NULL,