From ea034bdb2e7e75f32315ed7b818cac37ab048c50 Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 24 Sep 2007 23:24:53 +0000 Subject: [PATCH] Nearly fix 1800783. Don't freeze dynamic parameters of PasteCanvas layers if there's a MotionBlur level above them. Currently this only works if the MotionBlur is above the PasteCanvas in the layer order, but that can be affected by the zdepth parameters, so the patch needs more work. Still, it's better than it was. git-svn-id: http://svn.voria.com/code@747 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/canvas.cpp | 13 +++++++++++-- synfig-core/trunk/src/synfig/canvas.h | 4 ++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/synfig-core/trunk/src/synfig/canvas.cpp b/synfig-core/trunk/src/synfig/canvas.cpp index b607345..2464c42 100644 --- a/synfig-core/trunk/src/synfig/canvas.cpp +++ b/synfig-core/trunk/src/synfig/canvas.cpp @@ -1013,7 +1013,7 @@ Canvas::get_meta_data_keys()const } void -synfig::optimize_layers(Context context, Canvas::Handle op_canvas) +synfig::optimize_layers(Context context, Canvas::Handle op_canvas, bool seen_motion_blur) { Context iter; @@ -1035,13 +1035,16 @@ synfig::optimize_layers(Context context, Canvas::Handle op_canvas) if(value.get_type()==ValueBase::TYPE_REAL && value.get(Real())==0) continue; + if(layer->get_name()=="MotionBlur") + seen_motion_blur = true; + Layer_PasteCanvas* paste_canvas(static_cast(layer.get())); if(layer->get_name()=="PasteCanvas" && paste_canvas->get_time_offset()==0) { Canvas::Handle sub_canvas(Canvas::create_inline(op_canvas)); Canvas::Handle paste_sub_canvas = paste_canvas->get_sub_canvas(); if(paste_sub_canvas) - optimize_layers(paste_sub_canvas->get_context(),sub_canvas); + optimize_layers(paste_sub_canvas->get_context(),sub_canvas,seen_motion_blur); //#define SYNFIG_OPTIMIZE_PASTE_CANVAS 1 #ifdef SYNFIG_OPTIMIZE_PASTE_CANVAS @@ -1078,6 +1081,12 @@ synfig::optimize_layers(Context context, Canvas::Handle op_canvas) #endif Layer::Handle new_layer(Layer::create("PasteCanvas")); dynamic_cast(new_layer.get())->set_muck_with_time(false); + if (seen_motion_blur) + { + Layer::DynamicParamList dynamic_param_list(paste_canvas->dynamic_param_list()); + for(Layer::DynamicParamList::const_iterator iter(dynamic_param_list.begin()); iter != dynamic_param_list.end(); ++iter) + new_layer->connect_dynamic_param(iter->first, iter->second); + } Layer::ParamList param_list(paste_canvas->get_param_list()); //param_list.erase("canvas"); new_layer->set_param_list(param_list); diff --git a/synfig-core/trunk/src/synfig/canvas.h b/synfig-core/trunk/src/synfig/canvas.h index 7f9d662..22c1686 100644 --- a/synfig-core/trunk/src/synfig/canvas.h +++ b/synfig-core/trunk/src/synfig/canvas.h @@ -69,7 +69,7 @@ public: typedef std::list Children; - friend void synfig::optimize_layers(Context, Canvas::Handle); + friend void synfig::optimize_layers(Context, Canvas::Handle, bool seen_motion_blur); /* -- ** -- D A T A ------------------------------------------------------------- @@ -481,7 +481,7 @@ protected: virtual void get_times_vfunc(Node::time_set &set) const; }; // END of class Canvas -void optimize_layers(Context context, Canvas::Handle op_canvas); +void optimize_layers(Context context, Canvas::Handle op_canvas, bool seen_motion_blur=false); }; // END of namespace synfig -- 2.7.4