diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-13 19:20:18 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-11-13 19:20:18 +0300 |
commit | 9462d911ead1dc93260792e314b9be6d370cde15 (patch) | |
tree | ee8e49a167e95828bc3aac4dadbe37257c8ecf88 | |
parent | d7b3b3b22fca3267f9be8c8ae2e8f6fb7b9fb617 (diff) | |
parent | fe86375d1c636a6ba95f0f9e9a0b4a9fdd883030 (diff) |
Merge branch 'blender-v2.81-release'
-rw-r--r-- | release/scripts/startup/bl_ui/properties_data_modifier.py | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_multires.h | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/crazyspace.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/multires.c | 11 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/paint.c | 5 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 2 |
7 files changed, 22 insertions, 8 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py index 3f1764faabe..889a011886f 100644 --- a/release/scripts/startup/bl_ui/properties_data_modifier.py +++ b/release/scripts/startup/bl_ui/properties_data_modifier.py @@ -645,7 +645,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel): split = layout.split() col = split.column() col.prop(md, "levels", text="Preview") - col.prop(md, "sculpt_levels", text="Sculpt") + # TODO(sergey): Expose it again after T58473 is solved. + # col.prop(md, "sculpt_levels", text="Sculpt") col.prop(md, "render_levels", text="Render") col.prop(md, "quality") diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index 7513717df41..50456fd4074 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -182,6 +182,8 @@ BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3] const float dPdv[3], const int corner); +int BKE_multires_sculpt_level_get(const struct MultiresModifierData *mmd); + #include "intern/multires_inline.h" #endif /* __BKE_MULTIRES_H__ */ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index cc9db5eafb5..9682ea74cfb 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -918,7 +918,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, /* Sculpt can skip certain modifiers. */ MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0); - const bool has_multires = (mmd && mmd->sculptlvl != 0); + const bool has_multires = (mmd && BKE_multires_sculpt_level_get(mmd) != 0); bool multires_applied = false; const bool sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt && !use_render; const bool sculpt_dyntopo = (sculpt_mode && ob->sculpt->bm) && !use_render; @@ -1036,7 +1036,8 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, if (sculpt_mode && (!has_multires || multires_applied || sculpt_dyntopo)) { bool unsupported = false; - if (md->type == eModifierType_Multires && ((MultiresModifierData *)md)->sculptlvl == 0) { + if (md->type == eModifierType_Multires && + BKE_multires_sculpt_level_get((MultiresModifierData *)md) == 0) { /* If multires is on level 0 skip it silently without warning message. */ if (!sculpt_dyntopo) { continue; diff --git a/source/blender/blenkernel/intern/crazyspace.c b/source/blender/blenkernel/intern/crazyspace.c index fe834658689..f2ed84b4125 100644 --- a/source/blender/blenkernel/intern/crazyspace.c +++ b/source/blender/blenkernel/intern/crazyspace.c @@ -385,7 +385,7 @@ int BKE_sculpt_get_first_deform_matrices(struct Depsgraph *depsgraph, crazyspace_init_object_for_eval(depsgraph, object, &object_eval); MultiresModifierData *mmd = get_multires_modifier(scene, &object_eval, 0); const bool is_sculpt_mode = (object->mode & OB_MODE_SCULPT) != 0; - const bool has_multires = mmd != NULL && mmd->sculptlvl > 0; + const bool has_multires = mmd != NULL && BKE_multires_sculpt_level_get(mmd) > 0; const ModifierEvalContext mectx = {depsgraph, &object_eval, 0}; if (is_sculpt_mode && has_multires) { diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 6a5e31bd2a2..a539aa45cf6 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -347,7 +347,7 @@ int multires_get_level(const Scene *scene, mmd->renderlvl; } else if (ob->mode == OB_MODE_SCULPT) { - return mmd->sculptlvl; + return BKE_multires_sculpt_level_get(mmd); } else if (ignore_simplify) { return mmd->lvl; @@ -2557,3 +2557,12 @@ int mdisp_rot_face_to_crn(struct MVert *UNUSED(mvert), return S; } + +/* This is a workaround for T58473. + * Force sculpting on the highest level for until the root of the issue is solved. + * + * When that issue is solved simple replace call of this function with mmd->sculptlvl. */ +int BKE_multires_sculpt_level_get(const struct MultiresModifierData *mmd) +{ + return mmd->totlvl; +} diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index cc9d1b98ba4..46ef24be5e9 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -60,6 +60,7 @@ #include "BKE_mesh_mapping.h" #include "BKE_mesh_runtime.h" #include "BKE_modifier.h" +#include "BKE_multires.h" #include "BKE_object.h" #include "BKE_paint.h" #include "BKE_pbvh.h" @@ -1117,7 +1118,7 @@ MultiresModifierData *BKE_sculpt_multires_active(Scene *scene, Object *ob) continue; } - if (mmd->sculptlvl > 0) { + if (BKE_multires_sculpt_level_get(mmd) > 0) { return mmd; } else { @@ -1360,7 +1361,7 @@ int BKE_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd) * isn't one already */ if (mmd && !CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK)) { GridPaintMask *gmask; - int level = max_ii(1, mmd->sculptlvl); + int level = max_ii(1, BKE_multires_sculpt_level_get(mmd)); int gridsize = BKE_ccg_gridsize(level); int gridarea = gridsize * gridsize; int i, j; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 43f1bbb33f3..f7a5052b74a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -7662,7 +7662,7 @@ static int ed_object_sculptmode_flush_recalc_flag(Scene *scene, { int flush_recalc = 0; /* multires in sculpt mode could have different from object mode subdivision level */ - flush_recalc |= mmd && mmd->sculptlvl != mmd->lvl; + flush_recalc |= mmd && BKE_multires_sculpt_level_get(mmd) != mmd->lvl; /* if object has got active modifiers, it's dm could be different in sculpt mode */ flush_recalc |= sculpt_has_active_modifiers(scene, ob); return flush_recalc; |