Multires: Enable sculpting in all subdivision levels
Return the correct sculpt level in BKE_multires_sculpt_level_get and enable the property in the UI Reviewed By: sergey Differential Revision: https://developer.blender.org/D7575
This commit is contained in:
@@ -686,8 +686,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
|||||||
split = layout.split()
|
split = layout.split()
|
||||||
col = split.column()
|
col = split.column()
|
||||||
col.prop(md, "levels", text="Preview")
|
col.prop(md, "levels", text="Preview")
|
||||||
# TODO(sergey): Expose it again after T58473 is solved.
|
col.prop(md, "sculpt_levels", text="Sculpt")
|
||||||
# col.prop(md, "sculpt_levels", text="Sculpt")
|
|
||||||
col.prop(md, "render_levels", text="Render")
|
col.prop(md, "render_levels", text="Render")
|
||||||
|
|
||||||
row = col.row()
|
row = col.row()
|
||||||
|
@@ -213,8 +213,6 @@ BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3]
|
|||||||
const float dPdv[3],
|
const float dPdv[3],
|
||||||
const int corner);
|
const int corner);
|
||||||
|
|
||||||
int BKE_multires_sculpt_level_get(const struct MultiresModifierData *mmd);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -901,7 +901,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
|
|
||||||
/* Sculpt can skip certain modifiers. */
|
/* Sculpt can skip certain modifiers. */
|
||||||
MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
|
MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
|
||||||
const bool has_multires = (mmd && BKE_multires_sculpt_level_get(mmd) != 0);
|
const bool has_multires = (mmd && mmd->sculptlvl != 0);
|
||||||
bool multires_applied = false;
|
bool multires_applied = false;
|
||||||
const bool sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt && !use_render;
|
const bool sculpt_mode = ob->mode & OB_MODE_SCULPT && ob->sculpt && !use_render;
|
||||||
const bool sculpt_dyntopo = (sculpt_mode && ob->sculpt->bm) && !use_render;
|
const bool sculpt_dyntopo = (sculpt_mode && ob->sculpt->bm) && !use_render;
|
||||||
@@ -1020,8 +1020,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
if (sculpt_mode && (!has_multires || multires_applied || sculpt_dyntopo)) {
|
if (sculpt_mode && (!has_multires || multires_applied || sculpt_dyntopo)) {
|
||||||
bool unsupported = false;
|
bool unsupported = false;
|
||||||
|
|
||||||
if (md->type == eModifierType_Multires &&
|
if (md->type == eModifierType_Multires && ((MultiresModifierData *)md)->sculptlvl == 0) {
|
||||||
BKE_multires_sculpt_level_get((MultiresModifierData *)md) == 0) {
|
|
||||||
/* If multires is on level 0 skip it silently without warning message. */
|
/* If multires is on level 0 skip it silently without warning message. */
|
||||||
if (!sculpt_dyntopo) {
|
if (!sculpt_dyntopo) {
|
||||||
continue;
|
continue;
|
||||||
|
@@ -386,7 +386,7 @@ int BKE_sculpt_get_first_deform_matrices(struct Depsgraph *depsgraph,
|
|||||||
crazyspace_init_object_for_eval(depsgraph, object, &object_eval);
|
crazyspace_init_object_for_eval(depsgraph, object, &object_eval);
|
||||||
MultiresModifierData *mmd = get_multires_modifier(scene, &object_eval, 0);
|
MultiresModifierData *mmd = get_multires_modifier(scene, &object_eval, 0);
|
||||||
const bool is_sculpt_mode = (object->mode & OB_MODE_SCULPT) != 0;
|
const bool is_sculpt_mode = (object->mode & OB_MODE_SCULPT) != 0;
|
||||||
const bool has_multires = mmd != NULL && BKE_multires_sculpt_level_get(mmd) > 0;
|
const bool has_multires = mmd != NULL && mmd->sculptlvl > 0;
|
||||||
const ModifierEvalContext mectx = {depsgraph, &object_eval, 0};
|
const ModifierEvalContext mectx = {depsgraph, &object_eval, 0};
|
||||||
|
|
||||||
if (is_sculpt_mode && has_multires) {
|
if (is_sculpt_mode && has_multires) {
|
||||||
|
@@ -407,7 +407,7 @@ int multires_get_level(const Scene *scene,
|
|||||||
mmd->renderlvl;
|
mmd->renderlvl;
|
||||||
}
|
}
|
||||||
else if (ob->mode == OB_MODE_SCULPT) {
|
else if (ob->mode == OB_MODE_SCULPT) {
|
||||||
return BKE_multires_sculpt_level_get(mmd);
|
return mmd->sculptlvl;
|
||||||
}
|
}
|
||||||
else if (ignore_simplify) {
|
else if (ignore_simplify) {
|
||||||
return mmd->lvl;
|
return mmd->lvl;
|
||||||
@@ -2516,12 +2516,3 @@ int mdisp_rot_face_to_crn(struct MVert *UNUSED(mvert),
|
|||||||
|
|
||||||
return S;
|
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;
|
|
||||||
}
|
|
||||||
|
@@ -1414,7 +1414,7 @@ MultiresModifierData *BKE_sculpt_multires_active(Scene *scene, Object *ob)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BKE_multires_sculpt_level_get(mmd) > 0) {
|
if (mmd->sculptlvl > 0) {
|
||||||
return mmd;
|
return mmd;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1686,7 +1686,7 @@ int BKE_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd)
|
|||||||
* isn't one already */
|
* isn't one already */
|
||||||
if (mmd && !CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK)) {
|
if (mmd && !CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK)) {
|
||||||
GridPaintMask *gmask;
|
GridPaintMask *gmask;
|
||||||
int level = max_ii(1, BKE_multires_sculpt_level_get(mmd));
|
int level = max_ii(1, mmd->sculptlvl);
|
||||||
int gridsize = BKE_ccg_gridsize(level);
|
int gridsize = BKE_ccg_gridsize(level);
|
||||||
int gridarea = gridsize * gridsize;
|
int gridarea = gridsize * gridsize;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@@ -7517,7 +7517,7 @@ static int ed_object_sculptmode_flush_recalc_flag(Scene *scene,
|
|||||||
{
|
{
|
||||||
int flush_recalc = 0;
|
int flush_recalc = 0;
|
||||||
/* Multires in sculpt mode could have different from object mode subdivision level. */
|
/* Multires in sculpt mode could have different from object mode subdivision level. */
|
||||||
flush_recalc |= mmd && BKE_multires_sculpt_level_get(mmd) != mmd->lvl;
|
flush_recalc |= mmd && mmd->sculptlvl != mmd->lvl;
|
||||||
/* If object has got active modifiers, it's dm could be different in sculpt mode. */
|
/* If object has got active modifiers, it's dm could be different in sculpt mode. */
|
||||||
flush_recalc |= sculpt_has_active_modifiers(scene, ob);
|
flush_recalc |= sculpt_has_active_modifiers(scene, ob);
|
||||||
return flush_recalc;
|
return flush_recalc;
|
||||||
|
Reference in New Issue
Block a user