From 82e842447ea3effc0a57ec6d2ed088f7e882e44c Mon Sep 17 00:00:00 2001 From: dooglus Date: Mon, 22 Oct 2007 01:02:44 +0000 Subject: [PATCH] Before this fix, PasteCanvas' "time offset" values were being reflected in the position of the waypoints in the timeline of parent PasteCanvases, but not in the PasteCanvas itself. This fix adds a preprocessor macro ADJUST_WAYPOINTS_FOR_TIME_OFFSET (to node.h) which enables the offsetting of waypoints for all PasteCanvases when defined. It's undefined though, because offsetting waypoints doesn't yet work fully; see the TODO at the end of layer_pastecanvas.cpp for details. git-svn-id: http://svn.voria.com/code@944 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/layer_pastecanvas.cpp | 6 +++++- synfig-core/trunk/src/synfig/node.h | 5 +++++ .../trunk/src/gtkmm/cellrenderer_timetrack.cpp | 24 ++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp index f8308a7..e156fc7 100644 --- a/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp +++ b/synfig-core/trunk/src/synfig/layer_pastecanvas.cpp @@ -417,7 +417,11 @@ void Layer_PasteCanvas::get_times_vfunc(Node::time_set &set) const //TODO: SOMETHING STILL HAS TO BE DONE WITH THE OTHER DIRECTION // (recursing down the tree needs to take this into account too...) for(; i != end; ++i) - set.insert(*i - time_offset); + set.insert(*i +#ifdef ADJUST_WAYPOINTS_FOR_TIME_OFFSET // see node.h + - time_offset +#endif + ); Layer::get_times_vfunc(set); } diff --git a/synfig-core/trunk/src/synfig/node.h b/synfig-core/trunk/src/synfig/node.h index 1d52c7f..aeb5da1 100644 --- a/synfig-core/trunk/src/synfig/node.h +++ b/synfig-core/trunk/src/synfig/node.h @@ -37,6 +37,11 @@ /* === M A C R O S ========================================================= */ +// When a PasteCanvas layer has a non-zero 'time offset' parameter, should +// the waypoints shown for the canvas be adjusted? This currently only +// partially works - see the TODO at the end of layer_pastecanvas.cpp +// #define ADJUST_WAYPOINTS_FOR_TIME_OFFSET + /* === T Y P E D E F S ===================================================== */ /* === C L A S S E S & S T R U C T S ======================================= */ diff --git a/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp b/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp index 81529e7..56ec59d 100644 --- a/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp +++ b/synfig-studio/trunk/src/gtkmm/cellrenderer_timetrack.cpp @@ -133,7 +133,31 @@ const synfig::Node::time_set *get_times_from_vdesc(const synfigapp::ValueDesc &v if(canvasparam) { +#ifdef ADJUST_WAYPOINTS_FOR_TIME_OFFSET // see node.h + synfig::Time::value_type time_offset = 0; + if (v.parent_is_layer_param()) + { + synfig::Layer::Handle layer = v.get_layer(); + if (layer->get_name()=="PasteCanvas") + time_offset = layer->get_param("time_offset").get(Time()); + } + + const Node::time_set *times = &canvasparam->get_times(); + + if (time_offset) + { + //! \todo this is a memory leak - blame the 'kind of hack' above + Node::time_set *tmp = new Node::time_set; + Node::time_set::iterator i = times->begin(), end = times->end(); + for (; i != end; ++i) + tmp->insert(*i - time_offset); + return tmp; + } + + return times; +#else // ADJUST_WAYPOINTS_FOR_TIME_OFFSET return &canvasparam->get_times(); +#endif } } -- 2.7.4