+}
+
+
+void SketcherPoint::update_parameter(SketcherPoint *prev, SketcherPoint *src)
+{
+ if( prev->arc != src->arc ) arc = src->arc;
+ if( prev->x != src->x ) x = src->x;
+ if( prev->y != src->y ) y = src->y;
+}
+
+void SketcherCurve::update_parameter(SketcherCurve *prev, SketcherCurve *src)
+{
+ if( prev->pen != src->pen ) pen = src->pen;
+ if( prev->width != src->width ) width = src->width;
+ if( prev->color != src->color ) color = src->color;
+ int prev_points = prev->points.size();
+ int src_points = src->points.size();
+ int dst_points = this->points.size();
+ int npoints = bmin(prev_points, bmin(src_points, dst_points));
+ for( int i=0; i<npoints; ++i ) {
+ SketcherPoint *prev_point = prev->points[i];
+ SketcherPoint *src_point = src->points[i];
+ SketcherPoint *dst_point = this->points[i];
+ dst_point->update_parameter(prev_point, src_point);
+ }
+}
+
+void Sketcher::span_keyframes(KeyFrame *src, int64_t start, int64_t end)
+{
+ SketcherConfig src_config;
+ src_config.read_data(src);
+ KeyFrames *keyframes = (KeyFrames *)src->autos;
+ KeyFrame *prev = keyframes->get_prev_keyframe(start, PLAY_FORWARD);
+ SketcherConfig prev_config;
+ prev_config.read_data(prev);
+// Always update the first one
+ update_parameter(prev_config, src_config, prev);
+ KeyFrame *curr = (KeyFrame*)prev->next;
+ while( curr && curr->position < end ) {
+ update_parameter(prev_config, src_config, curr);
+ curr = (KeyFrame*)curr->next;
+ }
+}
+
+void Sketcher::update_parameter(SketcherConfig &prev_config, SketcherConfig &src_config,
+ KeyFrame *keyframe)
+{
+ SketcherConfig dst_config;
+ dst_config.read_data(keyframe);
+ if( prev_config.drag != src_config.drag )
+ dst_config.drag = src_config.drag;
+ if( prev_config.aliasing != src_config.aliasing )
+ dst_config.aliasing = src_config.aliasing;
+ if( prev_config.cv_selected != src_config.cv_selected )
+ dst_config.cv_selected = src_config.cv_selected;
+ if( prev_config.pt_selected != src_config.pt_selected )
+ dst_config.pt_selected = src_config.pt_selected;
+ int src_curves = src_config.curves.size();
+ int dst_curves = dst_config.curves.size();
+ int prev_curves = prev_config.curves.size();
+ int ncurves = bmin(prev_curves, bmin(src_curves, dst_curves));
+ for( int i=0; i<ncurves; ++i ) {
+ SketcherCurve *prev_curve = prev_config.curves[i];
+ SketcherCurve *src_curve = src_config.curves[i];
+ SketcherCurve *dst_curve = dst_config.curves[i];
+ dst_curve->update_parameter(prev_curve, src_curve);
+ }
+ dst_config.save_data(keyframe);