From: Carlos Lopez Date: Sun, 4 Jul 2010 17:32:28 +0000 (+0200) Subject: Documentation for Waypoint class X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=34a8bf728692717b3cecff0779624e1b5bea95ad;p=synfig.git Documentation for Waypoint class --- diff --git a/synfig-core/src/synfig/waypoint.cpp b/synfig-core/src/synfig/waypoint.cpp index 1befa6f..e716dc3 100644 --- a/synfig-core/src/synfig/waypoint.cpp +++ b/synfig-core/src/synfig/waypoint.cpp @@ -59,6 +59,7 @@ Waypoint::Waypoint(ValueBase value, Time time): bias(0), time_tension(0.0f) { + //!Writeme if(value.get_type()==ValueBase::TYPE_ANGLE) after=before=INTERPOLATION_LINEAR; } @@ -92,6 +93,8 @@ Waypoint::Waypoint(): void Waypoint::set_value(const ValueBase &x) { + //! If the value node is not set and we are seting the value + //! of an angle, then set both interpolation to linear... why? if(!value_node && x.get_type()==ValueBase::TYPE_ANGLE) after=before=INTERPOLATION_LINEAR; @@ -101,6 +104,8 @@ Waypoint::set_value(const ValueBase &x) void Waypoint::set_value_node(const etl::handle &x) { + //! If the value node is not set and we are seting the value + //! of an angle, then set both interpolation to linear... why? if(!value_node && x->get_type()==ValueBase::TYPE_ANGLE) after=before=INTERPOLATION_LINEAR; diff --git a/synfig-core/src/synfig/waypoint.h b/synfig-core/src/synfig/waypoint.h index d94cf21..01b465d 100644 --- a/synfig-core/src/synfig/waypoint.h +++ b/synfig-core/src/synfig/waypoint.h @@ -1,6 +1,6 @@ /* === S Y N F I G ========================================================= */ /*! \file waypoint.h -** \brief Template Header +** \brief Waypoint class header. ** ** $Id$ ** @@ -32,7 +32,6 @@ #include "time.h" #include "real.h" #include "value.h" -//#include "valuenode.h" #include "uniqueid.h" #include #include "guid.h" @@ -51,7 +50,12 @@ class GUID; /*! \class Waypoint -** \brief \writeme +** \brief Waypoint is used to handle variations along the time of the ValueNodes +* +* The Waypoint is a child of a ValueNode (or any of inherited) and it describes the +* Interpolation type (before and after), the ValueNode (usually waypoints are constant +* but in fact they can be animated) and the time where the waypoint is. +* \see Waypoint::get_value(), Waypoint::get_value(const Time &t) */ class Waypoint : public UniqueID { @@ -63,6 +67,12 @@ public: typedef synfig::Interpolation Interpolation; +/*! \class Waypoint::Model + * \brief Waypoint::Model is a Waypoint model. It is used to store and + * retrieve the values of the waypoint that is going to be modified. Once + * the model is completely modifed then it can be applied to the waypoint + * itself by using the \apply_model() member + */ class Model { friend class Waypoint; @@ -91,27 +101,36 @@ public: bias_flag(false), temporal_tension_flag(false) { } + //! Gets before Interpolation Interpolation get_before()const { return before; } + //! Sets before Interpolation void set_before(Interpolation x) { before=x; before_flag=true;} - + //! Gets after Interpolation Interpolation get_after()const { return after; } + //! Sets after Interpolation void set_after(Interpolation x) { after=x; after_flag=true;} - + //! Gets tension const Real &get_tension()const { return tension; } + //! Sets tension void set_tension(const Real &x) { tension=x; tension_flag=true;} - + //! Gets continuity const Real &get_continuity()const { return continuity; } + //! Sets continuity void set_continuity(const Real &x) { continuity=x; continuity_flag=true;} - + //! Gets bias const Real &get_bias()const { return bias; } + //! Sets bias void set_bias(const Real &x) { bias=x; bias_flag=true;} - + //! Gets temporal tension const Real &get_temporal_tension()const { return temporal_tension; } + //! Sets temporal tension void set_temporal_tension(const Real &x) { temporal_tension=x; temporal_tension_flag=true;} - + //! Gets priority int get_priority()const { return priority; } + //! Sets priority void set_priority(int x) { priority=x; priority_flag=true;} + //! Get & Set members for the flags #define FLAG_MACRO(x) bool get_##x##_flag()const { return x##_flag; } void set_##x##_flag(bool y) { x##_flag=y; } FLAG_MACRO(priority) FLAG_MACRO(before) @@ -122,6 +141,7 @@ public: FLAG_MACRO(temporal_tension) #undef FLAG_MACRO + //! Converts the Model in trivial: None of its values will be applied void reset() { priority_flag=false; @@ -133,6 +153,9 @@ public: temporal_tension_flag=false; } + //! Checks if none of the Model information is relevant for the Waypoint + //! If all the flags are off, the Model doesn't apply wnything to the + //! waypoint. \see apply_model(const Model &x) bool is_trivial()const { return !( @@ -160,24 +183,28 @@ public: private: + //! Writeme int priority_; + //! Usually Animated Value Nodes are parents of waypoints + //! \see class ValueNode_Animated etl::loose_handle parent_; - + //! The two Interpolations before and after Interpolation before, after; - + //! The value node that is hold by the waypoint etl::rhandle value_node; - + //! The time of the waypoint Time time; - // The following are for the INTERPOLATION_TCB type + //! The following are for the INTERPOLATION_TCB type Real tension; Real continuity; Real bias; - // The following are for the INTERPOLATION_MANUAL type + //! The following are for the INTERPOLATION_MANUAL type + //! Seems to be not used ValueBase cpoint_before,cpoint_after; - + //! Shouldn't be Real? float time_tension; /* @@ -186,9 +213,13 @@ private: public: + //! Constructor for constant Waypoint Waypoint(ValueBase value, Time time); + //! Constructor for animated Waypoint + //! Is is called anytime? Waypoint(etl::handle value_node, Time time); + //! Default constructor. Leaves unset the Value Node Waypoint(); /* @@ -197,64 +228,92 @@ public: public: + //! Applies the content of the Model to the Waypoint. It doesn't alter + //! the Value Node hold or the time. void apply_model(const Model &x); + //! Gets the before Interpolation Interpolation get_before()const { return before; } + //! Sets the before Interpolation void set_before(Interpolation x) { before=x; } - + //! Gets the after Interpolation Interpolation get_after()const { return after; } + //! Sets the after Interpolation void set_after(Interpolation x) { after=x; } - + //! Gets the value hold by the Waypoint ValueBase get_value()const; + //!Gets the value hold by the Waypoint at time \t when it is animated ValueBase get_value(const Time &t)const; + //!Sets the value of the Waypoint. + //!Maybe it would be posible to define set_value(const ValueBase &x, Time &t) ? void set_value(const ValueBase &x); - + //! Returns the handle to the value node const etl::rhandle &get_value_node()const { return value_node; } + //! Sets the value node by handle void set_value_node(const etl::handle &x); + //! Gets tension const Real &get_tension()const { return tension; } + //! Sets tension void set_tension(const Real &x) { tension=x; } - + //! Gets continuity const Real &get_continuity()const { return continuity; } + //! Sets continuity void set_continuity(const Real &x) { continuity=x; } - + //! Gets bias const Real &get_bias()const { return bias; } + //! Sets bias void set_bias(const Real &x) { bias=x; } + //! Gets the time of the waypoint const Time &get_time()const { return time; } + //! Sets the time of the waypoint void set_time(const Time &x); int get_priority()const { return priority_; } void set_priority(int x) { priority_=x; } + //! Gets parent Value Node const etl::loose_handle &get_parent_value_node()const { return parent_; } + //! Sets parent Value Node void set_parent_value_node(const etl::loose_handle &x) { parent_=x; } + //! \true if the Value Node is constant, not null and not exported bool is_static()const; + //!! Gets temporal tension float get_temporal_tension()const { return time_tension; } + //!! Sets temporal tension void set_temporal_tension(const float& x) { time_tension=x; } + //! True if the current waypoint's time is earlier than the compared waypoint's time bool operator<(const Waypoint &rhs)const { return time(const Time &rhs)const { return time.is_more_than(rhs); } - + //! True if the waypoint's time is the same than the given time bool operator==(const Time &rhs)const { return time.is_equal(rhs); } + //! True if the waypoint's time is different than the given time bool operator!=(const Time &rhs)const { return !time.is_equal(rhs); } + //! True if the Waypoint's Unique Id is the same than the argument's Unique ID bool operator==(const UniqueID &rhs)const { return get_uid()==rhs.get_uid(); } + //! True if the Waypoint's Unique Id is different than the argument's Unique ID bool operator!=(const UniqueID &rhs)const { return get_uid()!=rhs.get_uid(); } + //! Clones the Value Node if it is not exported and returns a Waypoint + //! with no parent. Waypoint clone(const GUID& deriv_guid=GUID())const; + //! Returns a hack GUID using the UniqueID's value GUID get_guid()const; }; // END of class Waypoint