}
// ------------------------------------------------------------------------
+ if (size == 1)
+ {
+ const synfigapp::ValueDesc value_desc(synfig::ValueNode_Animated::Handle::cast_reinterpret(waypoint.get_parent_value_node()), time);
+ get_instance()->make_param_menu(waypoint_menu,canvas_interface()->get_canvas(),value_desc,0.5f);
+
+ // ------------------------------------------------------------------------
+ waypoint_menu->items().push_back(Gtk::Menu_Helpers::SeparatorElem());
+ }
+
+ // ------------------------------------------------------------------------
waypoint_menu->items().push_back(Gtk::Menu_Helpers::MenuElem(_("_Jump To"),
sigc::bind(sigc::mem_fun(*canvas_interface(), &synfigapp::CanvasInterface::set_time), time)));
WAYPOINT_ACTION_HH = \
actions/waypointadd.h actions/waypointremove.h actions/waypointset.h actions/waypointsetsmart.h \
- actions/waypointsimpleadd.h
+ actions/waypointsimpleadd.h actions/waypointconnect.h actions/waypointdisconnect.h
WAYPOINT_ACTION_CC = \
actions/waypointadd.cpp actions/waypointremove.cpp actions/waypointset.cpp actions/waypointsetsmart.cpp \
- actions/waypointsimpleadd.cpp
+ actions/waypointsimpleadd.cpp actions/waypointconnect.cpp actions/waypointdisconnect.cpp
TIMEPOINT_ACTION_HH = \
actions/timepointscopy.h actions/timepointsdelete.h actions/timepointsmove.h timegather.h
#endif
#include "layerparamconnect.h"
+#include "waypointconnect.h"
#include "valuenodelinkconnect.h"
#include "valuenodereplace.h"
return;
}
else
+ if(value_desc.parent_is_waypoint())
+ {
+ Action::Handle action(WaypointConnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("parent_value_node",value_desc.get_parent_value_node());
+ action->set_param("value_node", value_node);
+ action->set_param("waypoint_time",value_desc.get_waypoint_time());
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
if(value_desc.parent_is_linkable_value_node())
{
Action::Handle action(ValueNodeLinkConnect::create());
#endif
#include "layerparamdisconnect.h"
+#include "waypointdisconnect.h"
#include "valuenodelinkdisconnect.h"
#include "valuenodereplace.h"
return;
}
else
+ if(value_desc.parent_is_waypoint())
+ {
+ Action::Handle action(WaypointDisconnect::create());
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("parent_value_node",value_desc.get_parent_value_node());
+ action->set_param("waypoint_time",value_desc.get_waypoint_time());
+ action->set_param("time",time);
+
+ assert(action->is_ready());
+ if(!action->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+
+ add_action_front(action);
+ return;
+ }
+ else
if(value_desc.parent_is_linkable_value_node())
{
Action::Handle action(ValueNodeLinkDisconnect::create());
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointconnect.cpp
+** \brief Template File
+**
+** $Id$
+**
+** \legal
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2008 Chris Moore
+**
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "waypointconnect.h"
+#include <synfigapp/canvasinterface.h>
+
+#include <synfigapp/general.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::WaypointConnect);
+ACTION_SET_NAME(Action::WaypointConnect,"waypoint_connect");
+ACTION_SET_LOCAL_NAME(Action::WaypointConnect,N_("Connect Waypoint"));
+ACTION_SET_TASK(Action::WaypointConnect,"connect");
+ACTION_SET_CATEGORY(Action::WaypointConnect,Action::CATEGORY_WAYPOINT);
+ACTION_SET_PRIORITY(Action::WaypointConnect,0);
+ACTION_SET_VERSION(Action::WaypointConnect,"0.0");
+ACTION_SET_CVS_ID(Action::WaypointConnect,"$Id$");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::WaypointConnect::WaypointConnect():
+ waypoint_time_set(false)
+{
+}
+
+Action::ParamVocab
+Action::WaypointConnect::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("parent_value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("Parent ValueNode"))
+ );
+
+ ret.push_back(ParamDesc("waypoint_time",Param::TYPE_TIME)
+ .set_local_name(_("Waypoint Time"))
+ );
+
+ ret.push_back(ParamDesc("value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("ValueNode to be connected"))
+ );
+
+ return ret;
+}
+
+bool
+Action::WaypointConnect::is_candidate(const ParamList &x)
+{
+ return candidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::WaypointConnect::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="parent_value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ parent_value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
+
+ return static_cast<bool>(parent_value_node);
+ }
+
+ if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ new_value_node=param.get_value_node();
+
+ return true;
+ }
+
+ if(name=="waypoint_time" && param.get_type()==Param::TYPE_TIME)
+ {
+ waypoint_time=param.get_time();
+ waypoint_time_set=true;
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::WaypointConnect::is_ready()const
+{
+ if(!new_value_node || !parent_value_node || !waypoint_time_set)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::WaypointConnect::perform()
+{
+ ValueNode_Animated::WaypointList::iterator iter(parent_value_node->find(waypoint_time));
+
+ old_value_node=iter->get_value_node();
+ iter->set_value_node(new_value_node);
+
+ /*set_dirty(true);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(parent_value_node);
+ }*/
+}
+
+void
+Action::WaypointConnect::undo()
+{
+ ValueNode_Animated::WaypointList::iterator iter(parent_value_node->find(waypoint_time));
+
+ iter->set_value_node(old_value_node);
+
+ /*set_dirty(true);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(parent_value_node);
+ }*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file valuenodeconnect.h
+** \brief Template File
+**
+** $Id$
+**
+** \legal
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2008 Chris Moore
+**
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_WAYPOINTCONNECT_H
+#define __SYNFIG_APP_ACTION_WAYPOINTCONNECT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/valuenode.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class WaypointConnect :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_Animated::Handle parent_value_node;
+ synfig::ValueNode::Handle new_value_node;
+ synfig::ValueNode::Handle old_value_node;
+ synfig::Time waypoint_time;
+ bool waypoint_time_set;
+
+public:
+
+ WaypointConnect();
+
+ static ParamVocab get_param_vocab();
+ static bool is_candidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointdisconnect.cpp
+** \brief Template File
+**
+** $Id$
+**
+** \legal
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2008 Chris Moore
+**
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === H E A D E R S ======================================================= */
+
+#ifdef USING_PCH
+# include "pch.h"
+#else
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "waypointdisconnect.h"
+#include <synfigapp/canvasinterface.h>
+#include <synfig/valuenode_const.h>
+
+#include <synfigapp/general.h>
+
+#endif
+
+using namespace std;
+using namespace etl;
+using namespace synfig;
+using namespace synfigapp;
+using namespace Action;
+
+/* === M A C R O S ========================================================= */
+
+ACTION_INIT(Action::WaypointDisconnect);
+ACTION_SET_NAME(Action::WaypointDisconnect,"waypoint_disconnect");
+ACTION_SET_LOCAL_NAME(Action::WaypointDisconnect,N_("Disconnect Waypoint"));
+ACTION_SET_TASK(Action::WaypointDisconnect,"disconnect");
+ACTION_SET_CATEGORY(Action::WaypointDisconnect,Action::CATEGORY_WAYPOINT);
+ACTION_SET_PRIORITY(Action::WaypointDisconnect,0);
+ACTION_SET_VERSION(Action::WaypointDisconnect,"0.0");
+ACTION_SET_CVS_ID(Action::WaypointDisconnect,"$Id$");
+
+/* === G L O B A L S ======================================================= */
+
+/* === P R O C E D U R E S ================================================= */
+
+/* === M E T H O D S ======================================================= */
+
+Action::WaypointDisconnect::WaypointDisconnect():
+ waypoint_time_set(false),
+ time_set(false)
+{
+}
+
+Action::ParamVocab
+Action::WaypointDisconnect::get_param_vocab()
+{
+ ParamVocab ret(Action::CanvasSpecific::get_param_vocab());
+
+ ret.push_back(ParamDesc("parent_value_node",Param::TYPE_VALUENODE)
+ .set_local_name(_("Parent ValueNode"))
+ );
+
+ ret.push_back(ParamDesc("waypoint_time",Param::TYPE_TIME)
+ .set_local_name(_("Waypoint Time"))
+ );
+
+ ret.push_back(ParamDesc("time",Param::TYPE_TIME)
+ .set_local_name(_("Time"))
+ .set_optional()
+ );
+
+ return ret;
+}
+
+bool
+Action::WaypointDisconnect::is_candidate(const ParamList &x)
+{
+ return candidate_check(get_param_vocab(),x);
+}
+
+bool
+Action::WaypointDisconnect::set_param(const synfig::String& name, const Action::Param ¶m)
+{
+ if(name=="parent_value_node" && param.get_type()==Param::TYPE_VALUENODE)
+ {
+ parent_value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
+
+ return static_cast<bool>(parent_value_node);
+ }
+
+ if(name=="waypoint_time" && param.get_type()==Param::TYPE_TIME)
+ {
+ waypoint_time=param.get_time();
+ waypoint_time_set=true;
+
+ return true;
+ }
+
+ if(name=="time" && param.get_type()==Param::TYPE_TIME)
+ {
+ time=param.get_time();
+ time_set=true;
+
+ return true;
+ }
+
+ return Action::CanvasSpecific::set_param(name,param);
+}
+
+bool
+Action::WaypointDisconnect::is_ready()const
+{
+ if(!parent_value_node || !waypoint_time_set)
+ return false;
+ return Action::CanvasSpecific::is_ready();
+}
+
+void
+Action::WaypointDisconnect::perform()
+{
+ ValueNode_Animated::WaypointList::iterator iter(parent_value_node->find(waypoint_time));
+
+ old_value_node=iter->get_value_node();
+
+ iter->set_value_node(ValueNode_Const::create((*old_value_node)(time_set ? time : waypoint_time)));
+
+ /*
+ if(get_canvas()->get_time()!=time)
+ set_dirty(true);
+ else
+ set_dirty(false);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(parent_value_node);
+ }
+ */
+}
+
+void
+Action::WaypointDisconnect::undo()
+{
+ ValueNode_Animated::WaypointList::iterator iter(parent_value_node->find(waypoint_time));
+
+ iter->set_value_node(old_value_node);
+
+ /*if(get_canvas()->get_time()!=time)
+ set_dirty(true);
+ else
+ set_dirty(false);
+
+ if(get_canvas_interface())
+ {
+ get_canvas_interface()->signal_value_node_changed()(parent_value_node);
+ }*/
+}
--- /dev/null
+/* === S Y N F I G ========================================================= */
+/*! \file waypointdisconnect.h
+** \brief Template File
+**
+** $Id$
+**
+** \legal
+** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+** Copyright (c) 2008 Chris Moore
+**
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
+**
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
+** \endlegal
+*/
+/* ========================================================================= */
+
+/* === S T A R T =========================================================== */
+
+#ifndef __SYNFIG_APP_ACTION_WAYPOINTDISCONNECT_H
+#define __SYNFIG_APP_ACTION_WAYPOINTDISCONNECT_H
+
+/* === H E A D E R S ======================================================= */
+
+#include <synfig/valuenode.h>
+#include <synfigapp/action.h>
+
+/* === M A C R O S ========================================================= */
+
+/* === T Y P E D E F S ===================================================== */
+
+/* === C L A S S E S & S T R U C T S ======================================= */
+
+namespace synfigapp {
+
+class Instance;
+
+namespace Action {
+
+class WaypointDisconnect :
+ public Undoable,
+ public CanvasSpecific
+{
+private:
+
+ synfig::ValueNode_Animated::Handle parent_value_node;
+ synfig::ValueNode::Handle old_value_node;
+ synfig::Time waypoint_time;
+ synfig::Time time;
+ bool waypoint_time_set;
+ bool time_set;
+
+public:
+
+ WaypointDisconnect();
+
+ static ParamVocab get_param_vocab();
+ static bool is_candidate(const ParamList &x);
+
+ virtual bool set_param(const synfig::String& name, const Param &);
+ virtual bool is_ready()const;
+
+ virtual void perform();
+ virtual void undo();
+
+ ACTION_MODULE_EXT
+};
+
+}; // END of namespace action
+}; // END of namespace studio
+
+/* === E N D =============================================================== */
+
+#endif
description = strprintf("%s %s", _("Const ValueNode"),
value_node->get_description(show_exported_name).c_str());
}
+ else if (parent_is_waypoint())
+ description = _("Waypoint");
else
{
warning("%s:%d didn't expect to get here", __FILE__, __LINE__);
#include <synfig/string.h>
#include <synfig/layer.h>
#include <synfig/value.h>
+#include <synfig/valuenode_animated.h>
#include <synfig/valuenode_const.h>
#include <synfig/canvas.h>
// Info for ValueNode parent
synfig::ValueNode::Handle parent_value_node;
- int index;
+ int index; // -2 if it's a waypoint, -1 if it's const, >=0 if it's LinkableValueNode
+ synfig::Time waypoint_time;
// Info for exported ValueNode
synfig::Canvas::Handle canvas;
return false;
if((parent_value_node||rhs.parent_value_node) && parent_value_node!=rhs.parent_value_node)
return false;
- if((index>-1||rhs.index>-1) && index!=rhs.index)
+ if(index!=rhs.index)
return false;
return true;
}
// parent_value_node(parent_value_node),
// index(parent_value_node->get_link_index_from_name(param_name)) { }
+ ValueDesc(synfig::ValueNode_Animated::Handle parent_value_node,synfig::Time waypoint_time):
+ parent_value_node(parent_value_node),
+ index(-2),
+ waypoint_time(waypoint_time) { }
+
ValueDesc(synfig::Canvas::Handle canvas,const synfig::String& name):
name(name),
canvas(canvas) { }
bool parent_is_value_node()const { return (bool)parent_value_node; }
bool parent_is_linkable_value_node()const { return parent_is_value_node() && index>=0; }
bool parent_is_value_node_const()const { return parent_is_value_node() && index==-1; }
+ bool parent_is_waypoint()const { return parent_is_value_node() && index==-2; }
bool parent_is_canvas()const { return (bool)canvas; }
bool is_value_node()const { return parent_is_value_node() || parent_is_canvas() || (parent_is_layer_param() && (bool)layer->dynamic_param_list().count(name)); }
synfig::ValueNode::Handle get_parent_value_node()const { assert(parent_is_value_node()); return parent_value_node; }
int get_index()const { assert(parent_is_linkable_value_node()); return index; }
+ synfig::Time get_waypoint_time()const { assert(parent_is_waypoint()); return waypoint_time; }
const synfig::String& get_value_node_id()const { assert(parent_is_canvas()); return name; }
// return reinterpret_cast<synfig::LinkableValueNode*>(parent_value_node.get())->get_link(index);
if(parent_is_value_node_const())
return parent_value_node;
+ if(parent_is_waypoint())
+ return (synfig::ValueNode_Animated::Handle::cast_reinterpret(parent_value_node))->find(waypoint_time)->get_value_node();
return 0;
}