Made a new ACTION_INIT_NO_GET_LOCAL_NAME macro for actions which want to define their...
[synfig.git] / synfig-studio / trunk / src / synfigapp / actions / valuedescset.cpp
index 4ed9286..8796b6f 100644 (file)
@@ -53,11 +53,8 @@ using namespace synfigapp;
 using namespace Action;
 
 /* === M A C R O S ========================================================= */
-#define ACTION_INIT2(class) \
-       Action::Base* class::create() { return new class(); }   \
-       synfig::String class::get_name()const { return name__; }
 
-ACTION_INIT2(Action::ValueDescSet);
+ACTION_INIT_NO_GET_LOCAL_NAME(Action::ValueDescSet);
 ACTION_SET_NAME(Action::ValueDescSet,"value_desc_set");
 ACTION_SET_LOCAL_NAME(Action::ValueDescSet,N_("Set ValueDesc"));
 ACTION_SET_TASK(Action::ValueDescSet,"set");
@@ -294,7 +291,7 @@ Action::ValueDescSet::prepare()
                        break;
                }
                default:
-                       throw Error("Bad type for composite (%s)",ValueBase::type_name(value.get_type()).c_str());
+                       throw Error(_("Bad type for composite (%s)"),ValueBase::type_local_name(value.get_type()).c_str());
                        break;
                }
 
@@ -334,9 +331,14 @@ Action::ValueDescSet::prepare()
                {
                case ValueBase::TYPE_VECTOR:
                {
+                       Angle old_angle = (*(ValueNode_RadialComposite::Handle::cast_dynamic(
+                                                                        value_desc.get_value_node())->get_link_vfunc(1)))(time).get(Angle());
                        Vector vect(value.get(Vector()));
                        components[0]=vect.mag();
-                       components[1]=Angle(Angle::tan(vect[1],vect[0]));
+                       Angle change = Angle(Angle::tan(vect[1],vect[0])) - old_angle;
+                       while (change < Angle::deg(-180)) change += Angle::deg(360);
+                       while (change > Angle::deg(180)) change -= Angle::deg(360);
+                       components[1]=old_angle + change;
                        n_components=2;
                }
                        break;
@@ -348,7 +350,7 @@ Action::ValueDescSet::prepare()
                        n_components=4;
                        break;
                default:
-                       throw Error(_("Bad type for radial composite (%s)"),ValueBase::type_name(value.get_type()).c_str());
+                       throw Error(_("Bad type for radial composite (%s)"),ValueBase::type_local_name(value.get_type()).c_str());
                        break;
                }
                for(int i=0;i<n_components;i++)