From: Carlos Lopez Date: Fri, 10 Dec 2010 19:27:43 +0000 (+0100) Subject: Enable Parameter Description for Linkable Value Nodes using ParamDesc class. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=8eed22b9657ac7cb1881eab5c7b5c3d1f0c69468;p=synfig.git Enable Parameter Description for Linkable Value Nodes using ParamDesc class. --- diff --git a/synfig-core/src/modules/mod_noise/valuenode_random.cpp b/synfig-core/src/modules/mod_noise/valuenode_random.cpp index cf0ee25..70c9ecd 100644 --- a/synfig-core/src/modules/mod_noise/valuenode_random.cpp +++ b/synfig-core/src/modules/mod_noise/valuenode_random.cpp @@ -300,3 +300,47 @@ ValueNode_Random::randomize_seed() set_link(i, ValueNode_Const::create(seed)); } } + +LinkableValueNode::Vocab +ValueNode_Random::get_param_vocab()const +{ + LinkableValueNode::Vocab ret; + + ret.push_back(ParamDesc(ValueBase(),"link") + .set_local_name(_("Link")) + .set_description(_("The value node source that provides the central value")) + ); + + ret.push_back(ParamDesc(ValueBase(),"radius") + .set_local_name(_("Radius")) + .set_description(_("The value of the maximum random difference")) + ); + + ret.push_back(ParamDesc(ValueBase(),"seed") + .set_local_name(_("Seed")) + .set_description(_("Seeds the random number generator")) + ); + + ret.push_back(ParamDesc(ValueBase(),"speed") + .set_local_name(_("Speed")) + .set_description(_("Defines how often a new random value is chosen (in choices per second) ")) + ); + + ret.push_back(ParamDesc(ValueBase(),"smooth") + .set_local_name(_("Interpolation")) + .set_description(_("Determines how the value is interpolated from one random choice to the next")) + .set_hint("enum") + .add_enum_value(RandomNoise::SMOOTH_DEFAULT,"default",_("No interpolation")) + .add_enum_value(RandomNoise::SMOOTH_LINEAR,"linear",_("Linear")) + .add_enum_value(RandomNoise::SMOOTH_COSINE,"cosine",_("Cosine")) + .add_enum_value(RandomNoise::SMOOTH_SPLINE,"spline",_("Spline")) + .add_enum_value(RandomNoise::SMOOTH_CUBIC,"cubic",_("Cubic")) + ); + + + ret.push_back(ParamDesc(ValueBase(),"loop") + .set_local_name(_("Loop Time")) + .set_description(_("Makes the random value repeat after the given time")) + ); + return ret; +} diff --git a/synfig-core/src/modules/mod_noise/valuenode_random.h b/synfig-core/src/modules/mod_noise/valuenode_random.h index beafcf2..2732dc8 100644 --- a/synfig-core/src/modules/mod_noise/valuenode_random.h +++ b/synfig-core/src/modules/mod_noise/valuenode_random.h @@ -82,6 +82,7 @@ public: using synfig::LinkableValueNode::set_link_vfunc; static bool check_type(ValueBase::Type type); static ValueNode_Random* create(const ValueBase &x); + virtual Vocab get_param_vocab()const; }; // END of class ValueNode_Random }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode.cpp b/synfig-core/src/synfig/valuenode.cpp index 8f3cc9a..da9c45c 100644 --- a/synfig-core/src/synfig/valuenode.cpp +++ b/synfig-core/src/synfig/valuenode.cpp @@ -34,7 +34,6 @@ #include "valuenode.h" #include "general.h" #include "canvas.h" -#include "paramdesc.h" #include "releases.h" #include "valuenode_const.h" @@ -669,3 +668,12 @@ LinkableValueNode::get_description(int index, bool show_exported_name)const return description; } + +/* +int +LinkableValueNode::link_count()const +{ + Vocab ret(get_param_vocab()); + return ret.size(); +} +*/ diff --git a/synfig-core/src/synfig/valuenode.h b/synfig-core/src/synfig/valuenode.h index 379b3f0..d0daf78 100644 --- a/synfig-core/src/synfig/valuenode.h +++ b/synfig-core/src/synfig/valuenode.h @@ -39,6 +39,7 @@ #include #include "guid.h" #include +#include "paramdesc.h" #include "node.h" @@ -77,6 +78,7 @@ namespace synfig { class Canvas; class LinkableValueNode; class Layer; +class ParamVocab; /*! \class ValueNode ** \brief Base class for all Value Nodes @@ -335,6 +337,8 @@ public: */ typedef std::map Book; + typedef ParamVocab Vocab; + static Book& book(); //! Creates a Linkable Value Node based on the name and the returned @@ -389,6 +393,9 @@ public: //! Return a full description of the linked ValueNode given by the index String get_description(int index = -1, bool show_exported_name = true)const; + //! Gets the parameter vocabulary for linkable value nodes + virtual Vocab get_param_vocab()const=0; + protected: //! Sets the type of the ValueNode void set_type(ValueBase::Type t) { ValueNode::set_type(t); } diff --git a/synfig-core/src/synfig/valuenode_add.cpp b/synfig-core/src/synfig/valuenode_add.cpp index c67d74e..346357b 100644 --- a/synfig-core/src/synfig/valuenode_add.cpp +++ b/synfig-core/src/synfig/valuenode_add.cpp @@ -241,3 +241,26 @@ ValueNode_Add::check_type(ValueBase::Type type) || type==ValueBase::TYPE_TIME || type==ValueBase::TYPE_VECTOR; } + +LinkableValueNode::Vocab +ValueNode_Add::get_param_vocab() const +{ + LinkableValueNode::Vocab ret; + + ret.push_back(ParamDesc(ValueBase(),"lhs") + .set_local_name(_("LHS")) + .set_description(_("Left Hand Side of the add")) + ); + + ret.push_back(ParamDesc(ValueBase(),"rhs") + .set_local_name(_("RHS")) + .set_description(_("Right Hand Side of the add")) + ); + + ret.push_back(ParamDesc(ValueBase(),"scalar") + .set_local_name(_("Scalar")) + .set_description(_("Value that multiplies the add")) + ); + + return ret; +} diff --git a/synfig-core/src/synfig/valuenode_add.h b/synfig-core/src/synfig/valuenode_add.h index 15dfd7b..7b27e3c 100644 --- a/synfig-core/src/synfig/valuenode_add.h +++ b/synfig-core/src/synfig/valuenode_add.h @@ -63,6 +63,7 @@ public: virtual String get_name()const; virtual String get_local_name()const; static bool check_type(ValueBase::Type type); + virtual Vocab get_param_vocab()const; }; // END of class ValueNode_Add }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode_and.cpp b/synfig-core/src/synfig/valuenode_and.cpp index 974485c..101b9e8 100644 --- a/synfig-core/src/synfig/valuenode_and.cpp +++ b/synfig-core/src/synfig/valuenode_and.cpp @@ -166,3 +166,21 @@ ValueNode_And::check_type(ValueBase::Type type) { return type==ValueBase::TYPE_BOOL; } + +LinkableValueNode::Vocab +ValueNode_And::get_param_vocab() const +{ + LinkableValueNode::Vocab ret; + + ret.push_back(ParamDesc(ValueBase(),"link1") + .set_local_name(_("Link1")) + .set_description(_("First operand of the AND operation")) + ); + + ret.push_back(ParamDesc(ValueBase(),"link2") + .set_local_name(_("Link2")) + .set_description(_("Second operand of the AND operation")) + ); + + return ret; +} diff --git a/synfig-core/src/synfig/valuenode_and.h b/synfig-core/src/synfig/valuenode_and.h index 8a13014..9bca6ee 100644 --- a/synfig-core/src/synfig/valuenode_and.h +++ b/synfig-core/src/synfig/valuenode_and.h @@ -72,6 +72,7 @@ public: using synfig::LinkableValueNode::set_link_vfunc; static bool check_type(ValueBase::Type type); static ValueNode_And* create(const ValueBase &x); + virtual LinkableValueNode::Vocab get_param_vocab()const; }; // END of class ValueNode_And }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode_anglestring.cpp b/synfig-core/src/synfig/valuenode_anglestring.cpp index b64a42f..0be9ff5 100644 --- a/synfig-core/src/synfig/valuenode_anglestring.cpp +++ b/synfig-core/src/synfig/valuenode_anglestring.cpp @@ -207,3 +207,31 @@ ValueNode_AngleString::check_type(ValueBase::Type type) return type==ValueBase::TYPE_STRING; } + +LinkableValueNode::Vocab +ValueNode_AngleString::get_param_vocab()const +{ + LinkableValueNode::Vocab ret; + + ret.push_back(ParamDesc(ValueBase(),"angle") + .set_local_name(_("Angle")) + .set_description(_("Value to convert to string")) + ); + + ret.push_back(ParamDesc(ValueBase(),"width") + .set_local_name(_("Width")) + .set_description(_("Width of the string")) + ); + + ret.push_back(ParamDesc(ValueBase(),"precision") + .set_local_name(_("Precision")) + .set_description(_("Number of decimal places")) + ); + + ret.push_back(ParamDesc(ValueBase(),"zero_pad") + .set_local_name(_("Zero Padded")) + .set_description(_("When checked, the string is left filled with zeros to match the width")) + ); + + return ret; +} diff --git a/synfig-core/src/synfig/valuenode_anglestring.h b/synfig-core/src/synfig/valuenode_anglestring.h index 3dcd142..9faaec1 100644 --- a/synfig-core/src/synfig/valuenode_anglestring.h +++ b/synfig-core/src/synfig/valuenode_anglestring.h @@ -76,6 +76,7 @@ public: using synfig::LinkableValueNode::set_link_vfunc; static bool check_type(ValueBase::Type type); static ValueNode_AngleString* create(const ValueBase &x); + virtual Vocab get_param_vocab()const; }; // END of class ValueNode_AngleString }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode_atan2.cpp b/synfig-core/src/synfig/valuenode_atan2.cpp index 89bedc2..844fbad 100644 --- a/synfig-core/src/synfig/valuenode_atan2.cpp +++ b/synfig-core/src/synfig/valuenode_atan2.cpp @@ -176,3 +176,21 @@ ValueNode_Atan2::get_link_index_from_name(const String &name)const throw Exception::BadLinkName(name); } + +LinkableValueNode::Vocab +ValueNode_Atan2::get_param_vocab()const +{ + LinkableValueNode::Vocab ret; + + ret.push_back(ParamDesc(ValueBase(),"x") + .set_local_name(_("X")) + .set_description(_("Cosine of the angle")) + ); + + ret.push_back(ParamDesc(ValueBase(),"y") + .set_local_name(_("Y")) + .set_description(_("Sine of the angle")) + ); + + return ret; +} diff --git a/synfig-core/src/synfig/valuenode_atan2.h b/synfig-core/src/synfig/valuenode_atan2.h index d9c1c7f..2bef724 100644 --- a/synfig-core/src/synfig/valuenode_atan2.h +++ b/synfig-core/src/synfig/valuenode_atan2.h @@ -74,6 +74,7 @@ public: using synfig::LinkableValueNode::set_link_vfunc; static bool check_type(ValueBase::Type type); static ValueNode_Atan2* create(const ValueBase &x); + virtual Vocab get_param_vocab()const; }; // END of class ValueNode_Atan2 }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode_bline.cpp b/synfig-core/src/synfig/valuenode_bline.cpp index 8f10689..2131bf5 100644 --- a/synfig-core/src/synfig/valuenode_bline.cpp +++ b/synfig-core/src/synfig/valuenode_bline.cpp @@ -843,3 +843,17 @@ ValueNode_BLine::check_type(ValueBase::Type type) { return type==ValueBase::TYPE_LIST; } + +LinkableValueNode::Vocab +ValueNode_BLine::get_param_vocab()const +{ + LinkableValueNode::Vocab ret; + for(unsigned int i=0; i RHS")) + ); + + ret.push_back(ParamDesc(ValueBase(),"equal") + .set_local_name(_("Equal")) + .set_description(_("When checked, returns true if LHS = RHS")) + ); + + ret.push_back(ParamDesc(ValueBase(),"less") + .set_local_name(_("Less")) + .set_description(_("When checked, returns true if LHS < RHS")) + ); + + return ret; +} diff --git a/synfig-core/src/synfig/valuenode_compare.h b/synfig-core/src/synfig/valuenode_compare.h index da156de..de1821d 100644 --- a/synfig-core/src/synfig/valuenode_compare.h +++ b/synfig-core/src/synfig/valuenode_compare.h @@ -76,6 +76,7 @@ public: using synfig::LinkableValueNode::set_link_vfunc; static bool check_type(ValueBase::Type type); static ValueNode_Compare* create(const ValueBase &x); + virtual Vocab get_param_vocab()const; }; // END of class ValueNode_Compare }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode_composite.cpp b/synfig-core/src/synfig/valuenode_composite.cpp index dfde2e9..1981a82 100644 --- a/synfig-core/src/synfig/valuenode_composite.cpp +++ b/synfig-core/src/synfig/valuenode_composite.cpp @@ -444,3 +444,89 @@ ValueNode_Composite::check_type(ValueBase::Type type) type==ValueBase::TYPE_COLOR || type==ValueBase::TYPE_BLINEPOINT; } + +LinkableValueNode::Vocab +ValueNode_Composite::get_param_vocab()const +{ + LinkableValueNode::Vocab ret; + + switch(get_type()) + { + case ValueBase::TYPE_COLOR: + ret.push_back(ParamDesc(ValueBase(),"red") + .set_local_name(_("Red")) + .set_description(_("The red component of the color")) + ); + ret.push_back(ParamDesc(ValueBase(),"green") + .set_local_name(_("Green")) + .set_description(_("The green component of the color")) + ); + ret.push_back(ParamDesc(ValueBase(),"blue") + .set_local_name(_("Blue")) + .set_description(_("The blue component of the color")) + ); + ret.push_back(ParamDesc(ValueBase(),"alpha") + .set_local_name(_("Alpha")) + .set_description(_("The alpha of the color")) + ); + return ret; + case ValueBase::TYPE_SEGMENT: + ret.push_back(ParamDesc(ValueBase(),"p1") + .set_local_name(_("Vertex 1")) + .set_description(_("The first vertex of the segment")) + ); + ret.push_back(ParamDesc(ValueBase(),"t1") + .set_local_name(_("Tangent 1")) + .set_description(_("The first tangent of the segment")) + ); + ret.push_back(ParamDesc(ValueBase(),"p2") + .set_local_name(_("Vertex 2")) + .set_description(_("The second vertex of the segment")) + ); + ret.push_back(ParamDesc(ValueBase(),"t2") + .set_local_name(_("Tangent 2")) + .set_description(_("The second tangent of the segment")) + ); + return ret; + case ValueBase::TYPE_VECTOR: + ret.push_back(ParamDesc(ValueBase(),"x") + .set_local_name(_("X-Axis")) + .set_description(_("The X-Axis component of the vector")) + ); + ret.push_back(ParamDesc(ValueBase(),"y") + .set_local_name(_("Y-Axis")) + .set_description(_("The Y-Axis component of the vector")) + ); + return ret; + case ValueBase::TYPE_BLINEPOINT: + ret.push_back(ParamDesc(ValueBase(),"point") + .set_local_name(_("Vertex")) + .set_description(_("The vertex of the BLine Point")) + ); + ret.push_back(ParamDesc(ValueBase(),"width") + .set_local_name(_("Width")) + .set_description(_("The width of the BLine Point")) + ); + ret.push_back(ParamDesc(ValueBase(),"origin") + .set_local_name(_("Origin")) + .set_description(_("Defines the Off and On position relative to neighbours")) + ); + ret.push_back(ParamDesc(ValueBase(),"split") + .set_local_name(_("Split")) + .set_description(_("When checked, tangents are independent")) + ); + ret.push_back(ParamDesc(ValueBase(),"t1") + .set_local_name(_("Tangent 1")) + .set_description(_("The first tangent of the BLine Point")) + ); + ret.push_back(ParamDesc(ValueBase(),"t2") + .set_local_name(_("Tangent 2")) + .set_description(_("The second tangent of the BLine Point")) + ); + return ret; + default: + break; + } + + return ret; +} diff --git a/synfig-core/src/synfig/valuenode_composite.h b/synfig-core/src/synfig/valuenode_composite.h index 6da5b2c..32cdf96 100644 --- a/synfig-core/src/synfig/valuenode_composite.h +++ b/synfig-core/src/synfig/valuenode_composite.h @@ -68,6 +68,7 @@ public: using synfig::LinkableValueNode::get_link_vfunc; static bool check_type(ValueBase::Type type); static ValueNode_Composite* create(const ValueBase &x); + virtual Vocab get_param_vocab()const; }; // END of class ValueNode_Composite }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode_cos.cpp b/synfig-core/src/synfig/valuenode_cos.cpp index 17d49d6..253d8e0 100644 --- a/synfig-core/src/synfig/valuenode_cos.cpp +++ b/synfig-core/src/synfig/valuenode_cos.cpp @@ -182,3 +182,21 @@ ValueNode_Cos::get_link_index_from_name(const String &name)const throw Exception::BadLinkName(name); } + +LinkableValueNode::Vocab +ValueNode_Cos::get_param_vocab()const +{ + LinkableValueNode::Vocab ret; + + ret.push_back(ParamDesc(ValueBase(),"angle") + .set_local_name(_("Angle")) + .set_description(_("Value to calculate the cosine")) + ); + + ret.push_back(ParamDesc(ValueBase(),"amp") + .set_local_name(_("Amplitude")) + .set_description(_("Multiplier of the resulting cosine")) + ); + + return ret; +} diff --git a/synfig-core/src/synfig/valuenode_cos.h b/synfig-core/src/synfig/valuenode_cos.h index a69cada..8321562 100644 --- a/synfig-core/src/synfig/valuenode_cos.h +++ b/synfig-core/src/synfig/valuenode_cos.h @@ -74,6 +74,7 @@ public: using synfig::LinkableValueNode::set_link_vfunc; static bool check_type(ValueBase::Type type); static ValueNode_Cos* create(const ValueBase &x); + virtual Vocab get_param_vocab()const; }; // END of class ValueNode_Cos }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode_dotproduct.cpp b/synfig-core/src/synfig/valuenode_dotproduct.cpp index 4748cc2..a90e99d 100644 --- a/synfig-core/src/synfig/valuenode_dotproduct.cpp +++ b/synfig-core/src/synfig/valuenode_dotproduct.cpp @@ -195,3 +195,21 @@ ValueNode_DotProduct::check_type(ValueBase::Type type) type==ValueBase::TYPE_ANGLE || type==ValueBase::TYPE_REAL; } + +LinkableValueNode::Vocab +ValueNode_DotProduct::get_param_vocab()const +{ + LinkableValueNode::Vocab ret; + + ret.push_back(ParamDesc(ValueBase(),"lhs") + .set_local_name(_("LHS")) + .set_description(_("The left side of the dot product")) + ); + + ret.push_back(ParamDesc(ValueBase(),"rhs") + .set_local_name(_("RHS")) + .set_description(_("The right side of the dot product")) + ); + + return ret; +} diff --git a/synfig-core/src/synfig/valuenode_dotproduct.h b/synfig-core/src/synfig/valuenode_dotproduct.h index 34cfb25..8e3cc2f 100644 --- a/synfig-core/src/synfig/valuenode_dotproduct.h +++ b/synfig-core/src/synfig/valuenode_dotproduct.h @@ -74,6 +74,7 @@ public: using synfig::LinkableValueNode::set_link_vfunc; static bool check_type(ValueBase::Type type); static ValueNode_DotProduct* create(const ValueBase &x); + virtual Vocab get_param_vocab()const; }; // END of class ValueNode_DotProduct }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode_duplicate.cpp b/synfig-core/src/synfig/valuenode_duplicate.cpp index 540c3a9..fdfc8b4 100644 --- a/synfig-core/src/synfig/valuenode_duplicate.cpp +++ b/synfig-core/src/synfig/valuenode_duplicate.cpp @@ -215,3 +215,26 @@ ValueNode_Duplicate::check_type(ValueBase::Type type __attribute__ ((unused))) // never offer this as a choice. it's used automatically by the 'Duplicate' layer. return false; } + +LinkableValueNode::Vocab +ValueNode_Duplicate::get_param_vocab()const +{ + LinkableValueNode::Vocab ret; + + ret.push_back(ParamDesc(ValueBase(),"from") + .set_local_name(_("From")) + .set_description(_("Initial value of the index ")) + ); + + ret.push_back(ParamDesc(ValueBase(),"to") + .set_local_name(_("To")) + .set_description(_("Final value of the index")) + ); + + ret.push_back(ParamDesc(ValueBase(),"step") + .set_local_name(_("Step")) + .set_description(_("Amount increment of the index")) + ); + + return ret; +} diff --git a/synfig-core/src/synfig/valuenode_duplicate.h b/synfig-core/src/synfig/valuenode_duplicate.h index b9d2429..bc58454 100644 --- a/synfig-core/src/synfig/valuenode_duplicate.h +++ b/synfig-core/src/synfig/valuenode_duplicate.h @@ -78,6 +78,7 @@ public: using synfig::LinkableValueNode::set_link_vfunc; static bool check_type(ValueBase::Type type); static ValueNode_Duplicate* create(const ValueBase &x); + virtual Vocab get_param_vocab()const; }; // END of class ValueNode_Duplicate }; // END of namespace synfig diff --git a/synfig-core/src/synfig/valuenode_dynamiclist.cpp b/synfig-core/src/synfig/valuenode_dynamiclist.cpp index 6791cc4..01fec8b 100644 --- a/synfig-core/src/synfig/valuenode_dynamiclist.cpp +++ b/synfig-core/src/synfig/valuenode_dynamiclist.cpp @@ -906,3 +906,17 @@ ValueNode_DynamicList::insert_time(const Time& location, const Time& delta) } changed(); } + +LinkableValueNode::Vocab +ValueNode_DynamicList::get_param_vocab()const +{ + LinkableValueNode::Vocab ret; + for(unsigned int i=0; i