Fix T66587: Can't bake second dynamic paint canvas to image sequence
authorSebastian Parborg <darkdefende@gmail.com>
Mon, 15 Jul 2019 08:46:36 +0000 (10:46 +0200)
committerSebastian Parborg <darkdefende@gmail.com>
Mon, 15 Jul 2019 08:47:49 +0000 (10:47 +0200)
The issue was the the copy data function didn't copy the active canvas number.
So it would always be 0 and thus use the first canvas when trying to bake.

Also fix not copying unused type data (unused canvas/brush settings).

Reviewed By: Brecht

Differential Revision: http://developer.blender.org/D5220

source/blender/blenkernel/intern/dynamicpaint.c

index ef5e5bb24a8676015092fe786c4d65a88ed85ba4..16ce62da57e14d0fb01dde1135cf844cc4ddbd36 100644 (file)
@@ -1216,9 +1216,11 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd,
 {
   /* Init modifier */
   tpmd->type = pmd->type;
-  if ((pmd->canvas && pmd->type == MOD_DYNAMICPAINT_TYPE_CANVAS) ||
-      (pmd->brush && pmd->type == MOD_DYNAMICPAINT_TYPE_BRUSH)) {
-    dynamicPaint_createType(tpmd, pmd->type, NULL);
+  if (pmd->canvas) {
+    dynamicPaint_createType(tpmd, MOD_DYNAMICPAINT_TYPE_CANVAS, NULL);
+  }
+  if (pmd->brush) {
+    dynamicPaint_createType(tpmd, MOD_DYNAMICPAINT_TYPE_BRUSH, NULL);
   }
 
   /* Copy data */
@@ -1230,6 +1232,8 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd,
       dynamicPaint_freeSurface(tpmd, tpmd->canvas->surfaces.first);
     }
 
+    tpmd->canvas->active_sur = pmd->canvas->active_sur;
+
     /* copy existing surfaces */
     for (surface = pmd->canvas->surfaces.first; surface; surface = surface->next) {
       DynamicPaintSurface *t_surface = dynamicPaint_createNewSurface(tpmd->canvas, NULL);
@@ -1296,7 +1300,7 @@ void dynamicPaint_Modifier_copy(const struct DynamicPaintModifierData *pmd,
       BLI_strncpy(t_surface->output_name2, surface->output_name2, sizeof(t_surface->output_name2));
     }
   }
-  else if (tpmd->brush) {
+  if (tpmd->brush) {
     DynamicPaintBrushSettings *brush = pmd->brush, *t_brush = tpmd->brush;
     t_brush->pmd = tpmd;