X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-core%2Fsrc%2Fsynfig%2Fvaluenode_anglestring.cpp;h=0be9ff53cfd24b45ff3287e1d88d83991a856379;hb=8eed22b9657ac7cb1881eab5c7b5c3d1f0c69468;hp=978b8b8cf11169b0f6c7d8929606cf70650e63cd;hpb=adfc80c126f482d7ea2bac38001a2c4a7c7df88c;p=synfig.git diff --git a/synfig-core/src/synfig/valuenode_anglestring.cpp b/synfig-core/src/synfig/valuenode_anglestring.cpp index 978b8b8..0be9ff5 100644 --- a/synfig-core/src/synfig/valuenode_anglestring.cpp +++ b/synfig-core/src/synfig/valuenode_anglestring.cpp @@ -65,8 +65,6 @@ ValueNode_AngleString::ValueNode_AngleString(const ValueBase &value): default: throw Exception::BadType(ValueBase::type_local_name(value.get_type())); } - - DCAST_HACK_ENABLE(); } LinkableValueNode* @@ -97,13 +95,14 @@ ValueNode_AngleString::operator()(Time t)const int precision((*precision_)(t).get(int())); int zero_pad((*zero_pad_)(t).get(bool())); + if(precision<0) precision=0; switch (get_type()) { case ValueBase::TYPE_STRING: return strprintf(strprintf("%%%s%d.%df", zero_pad ? "0" : "", width, - precision).c_str(), angle); + precision).c_str(), angle)+"°"; default: break; } @@ -208,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; +}