Fix related on #31984: Multires Displacement Bake creates ripples for each subidived...
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 2 Jul 2012 07:40:25 +0000 (07:40 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 2 Jul 2012 07:40:25 +0000 (07:40 +0000)
Skip applying subdivisions in cases when low resolution mesh is disabled
and baking happens from higher level to higher level/

source/blender/editors/object/object_bake.c

index 810fe2449841934d9375d1cfea0570bcaf6107c0..e1c715952d19954a4b43bc38c03a3fe2b4958c3c 100644 (file)
@@ -616,13 +616,15 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
 
                CLAMP(ss_lvl, 0, 6);
 
-               smd.levels = smd.renderLevels = ss_lvl;
-               smd.flags |= eSubsurfModifierFlag_SubsurfUv;
+               if (ss_lvl > 0) {
+                       smd.levels = smd.renderLevels = ss_lvl;
+                       smd.flags |= eSubsurfModifierFlag_SubsurfUv;
 
-               if (bkr->simple)
-                       smd.subdivType = ME_SIMPLE_SUBSURF;
+                       if (bkr->simple)
+                               smd.subdivType = ME_SIMPLE_SUBSURF;
 
-               height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, NULL, 0);
+                       height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, NULL, 0);
+               }
        }
 
        height_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);