From 8e8952b7e363b878cfc97440c1d2254dffbaf840 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 14 Sep 2018 10:56:54 +0200 Subject: Multires: Initial work to get sculpting to work with OpenSubdiv Allows to go to sculpt mode, do brush strokes, get out of sculpt mode and have deformation preserved. The issues currently is that the current implementation of CCG storage is created from the limit surface, without displacement taken into account. It is trivial to get displaced coordinates, but it is more tricky to get displaced normals. This is something to be solved next. Another limitation is that this only works for sculpting at a maximal multires level. There is code to be done to support propagation of displacement onto a higher levels. --- source/blender/modifiers/intern/MOD_multires.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/modifiers/intern/MOD_multires.c') diff --git a/source/blender/modifiers/intern/MOD_multires.c b/source/blender/modifiers/intern/MOD_multires.c index ca62560caa8..813ce830b04 100644 --- a/source/blender/modifiers/intern/MOD_multires.c +++ b/source/blender/modifiers/intern/MOD_multires.c @@ -200,6 +200,7 @@ static Mesh *multires_as_ccg(MultiresModifierData *mmd, if (ccg_settings.resolution < 3) { return result; } + BKE_subdiv_displacement_attach_from_multires(subdiv, mesh, mmd); result = BKE_subdiv_to_ccg_mesh(subdiv, &ccg_settings, mesh); return result; } @@ -226,7 +227,11 @@ static Mesh *applyModifier_subdiv(ModifierData *md, * a wrong impression that things do work, even though crucial areas are * still missing in implementation. */ - if ((ctx->object->mode & OB_MODE_SCULPT) && G.debug_value == 128) { + const bool for_orco = (ctx->flag & MOD_APPLY_ORCO) != 0; + if ((ctx->object->mode & OB_MODE_SCULPT) && + G.debug_value == 128 && + !for_orco) + { /* NOTE: CCG takes ownership over Subdiv. */ result = multires_as_ccg(mmd, ctx, mesh, subdiv); // BKE_subdiv_stats_print(&subdiv->stats); -- cgit v1.2.3