Expand function for masks, so no masks could be properly linked
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 31 Jul 2012 20:54:27 +0000 (20:54 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 31 Jul 2012 20:54:27 +0000 (20:54 +0000)
in cases when they've got parenting to motion tracking data.

source/blender/blenloader/intern/readfile.c

index 7e7561d58af93f28fd73927038a1de1364ab38c8..dee882c67375e3e679fb83b9b70ee826206d41df 100644 (file)
@@ -8931,6 +8931,37 @@ static void expand_movieclip(FileData *fd, Main *mainvar, MovieClip *clip)
                expand_animdata(fd, mainvar, clip->adt);
 }
 
+static void expand_mask_parent(FileData *fd, Main *mainvar, MaskParent *parent)
+{
+       if (parent->id) {
+               expand_doit(fd, mainvar, parent->id);
+       }
+}
+
+static void expand_mask(FileData *fd, Main *mainvar, Mask *mask)
+{
+       MaskLayer *mask_layer;
+
+       if (mask->adt)
+               expand_animdata(fd, mainvar, mask->adt);
+
+       for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+               MaskSpline *spline;
+
+               for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+                       int i;
+
+                       for (i = 0; i < spline->tot_point; i++) {
+                               MaskSplinePoint *point = &spline->points[i];
+
+                               expand_mask_parent(fd, mainvar, &point->parent);
+                       }
+
+                       expand_mask_parent(fd, mainvar, &spline->parent);
+               }
+       }
+}
+
 static void expand_main(FileData *fd, Main *mainvar)
 {
        ListBase *lbarray[MAX_LIBARRAY];
@@ -9014,6 +9045,9 @@ static void expand_main(FileData *fd, Main *mainvar)
                                        case ID_MC:
                                                expand_movieclip(fd, mainvar, (MovieClip *)id);
                                                break;
+                                       case ID_MSK:
+                                               expand_mask(fd, mainvar, (Mask *)id);
+                                               break;
                                        }
                                        
                                        do_it = TRUE;