Still not ideal, but should be as good as it was originally.
void
Duck::update(const synfig::Time &time)
{
- if((get_type() == Duck::TYPE_TANGENT || get_type() == Duck::TYPE_WIDTH) && origin_duck)
+ if((get_type() == Duck::TYPE_TANGENT || get_type() == Duck::TYPE_WIDTH || get_type() == Duck::TYPE_ANGLE) && origin_duck)
{
ValueNode_BLineCalcVertex::Handle bline_vertex;
ValueNode_Composite::Handle composite;
{
Angle angle((*bline_tangent)(time, amount).get(Angle()));
set_point(Point(Angle::cos(angle).get(), Angle::sin(angle).get()));
+ rotations=synfig::Angle::deg(0); //hack: rotations are a relative value
break;
}
case ValueBase::TYPE_REAL:
// then patch up the tangents for the vertices we've moved
DuckList duck_list(duckmatic->get_duck_list());
- for (iter=duck_list.begin(); iter!=duck_list.end(); ++iter)
+ for (iter=selected_ducks.begin(); iter!=selected_ducks.end(); ++iter)
{
- if ((*iter)->get_type() == Duck::TYPE_TANGENT || (*iter)->get_type() == Duck::TYPE_WIDTH)
+ etl::handle<Duck> duck(*iter);
+ if (duck->get_type() == Duck::TYPE_VERTEX || duck->get_type() == Duck::TYPE_POSITION)
{
- (*iter)->update(time);
+ ValueNode_Composite::Handle composite;
+
+ if ((ValueNode_BLineCalcVertex::Handle::cast_dynamic(duck->get_value_desc().get_value_node())) ||
+ ((composite = ValueNode_Composite::Handle::cast_dynamic(duck->get_value_desc().get_value_node())) &&
+ composite->get_type() == ValueBase::TYPE_BLINEPOINT &&
+ (ValueNode_BLineCalcVertex::Handle::cast_dynamic(composite->get_link("point")))))
+ {
+ //! \todo update() will call dynamic cast again, see if we can avoid that
+ DuckList::iterator iter;
+ for (iter=duck_list.begin(); iter!=duck_list.end(); iter++)
+ if ((*iter)->get_origin_duck()==duck
+ && std::find(selected_ducks.begin(),
+ selected_ducks.end(), *iter) == selected_ducks.end() )
+ (*iter)->update(time);
+ }
}
}
if (axis==AXIS_X) p[0] = -(p[0]-center[0]) + center[0];
else if (axis==AXIS_Y) p[1] = -(p[1]-center[1]) + center[1];
- (*iter)->set_trans_point(p, time);
+ (*iter)->set_trans_point(p);
}
// then do the other ducks
if (axis==AXIS_X) p[0] = -(p[0]-center[0]) + center[0];
else if (axis==AXIS_Y) p[1] = -(p[1]-center[1]) + center[1];
- (*iter)->set_trans_point(p, time);
+ (*iter)->set_trans_point(p);
}
}
#include <gtkmm/entry.h>
#include <synfig/valuenode_animated.h>
+#include <synfig/valuenode_blinecalcvertex.h>
#include <synfig/valuenode_composite.h>
#include <synfig/valuenode_const.h>
#include <synfig/valuenode_dynamiclist.h>
if((*iter)->get_type()!=Duck::TYPE_VERTEX&&(*iter)->get_type()!=Duck::TYPE_POSITION)
(*iter)->set_trans_point(positions[i]+vect, time);
}
- DuckList duck_list(duckmatic->get_duck_list());
- for (iter=duck_list.begin(); iter!=duck_list.end(); ++iter)
- {
- if ((*iter)->get_type() == Duck::TYPE_TANGENT || (*iter)->get_type() == Duck::TYPE_WIDTH)
- {
- (*iter)->update(time);
- }
- }
- return;
}
if (rotate)
(*iter)->set_trans_point(p, time);
}
}
+
+ // then patch up the tangents for the vertices we've moved
+ DuckList duck_list(duckmatic->get_duck_list());
+ for (iter=selected_ducks.begin(); iter!=selected_ducks.end(); ++iter)
+ {
+ etl::handle<Duck> duck(*iter);
+ if (duck->get_type() == Duck::TYPE_VERTEX || duck->get_type() == Duck::TYPE_POSITION)
+ {
+ ValueNode_Composite::Handle composite;
+
+ if ((ValueNode_BLineCalcVertex::Handle::cast_dynamic(duck->get_value_desc().get_value_node())) ||
+ ((composite = ValueNode_Composite::Handle::cast_dynamic(duck->get_value_desc().get_value_node())) &&
+ composite->get_type() == ValueBase::TYPE_BLINEPOINT &&
+ (ValueNode_BLineCalcVertex::Handle::cast_dynamic(composite->get_link("point")))))
+ {
+ //! \todo update() will call dynamic cast again, see if we can avoid that
+ DuckList::iterator iter;
+ for (iter=duck_list.begin(); iter!=duck_list.end(); iter++)
+ if ((*iter)->get_origin_duck()==duck
+ && std::find(selected_ducks.begin(),
+ selected_ducks.end(), *iter) == selected_ducks.end())
+ (*iter)->update(time);
+ }
+ }
+ }
+
last_move=vect;
}
#include <gtkmm/dialog.h>
#include <gtkmm/entry.h>
+#include <synfig/valuenode_blinecalcvertex.h>
+#include <synfig/valuenode_composite.h>
#include <synfig/valuenode_dynamiclist.h>
#include <synfigapp/action_system.h>
(*iter)->set_trans_point(p+last_[i], time);
}
+ // then patch up the tangents for the vertices we've moved
+ DuckList duck_list(duckmatic->get_duck_list());
+ for (iter=selected_ducks.begin(); iter!=selected_ducks.end(); ++iter)
+ {
+ etl::handle<Duck> duck(*iter);
+ if (duck->get_type() == Duck::TYPE_VERTEX || duck->get_type() == Duck::TYPE_POSITION)
+ {
+ ValueNode_Composite::Handle composite;
+
+ if ((ValueNode_BLineCalcVertex::Handle::cast_dynamic(duck->get_value_desc().get_value_node())) ||
+ ((composite = ValueNode_Composite::Handle::cast_dynamic(duck->get_value_desc().get_value_node())) &&
+ composite->get_type() == ValueBase::TYPE_BLINEPOINT &&
+ (ValueNode_BLineCalcVertex::Handle::cast_dynamic(composite->get_link("point")))))
+ {
+ //! \todo update() will call dynamic cast again, see if we can avoid that
+ DuckList::iterator iter;
+ for (iter=duck_list.begin(); iter!=duck_list.end(); iter++)
+ if ((*iter)->get_origin_duck()==duck
+ && std::find(selected_ducks.begin(),
+ selected_ducks.end(), *iter) == selected_ducks.end() )
+ (*iter)->update(time);
+ }
+ }
+ }
+
last_translate_=vect;
//snap=Vector(0,0);
}
for(i=0,iter=selected_ducks.begin();iter!=selected_ducks.end();++iter,i++)
{
if(last_[i].mag()>0.0001)
- if(!(*iter)->signal_edited()((*iter)->get_point()))
{
- throw String("Bad Move");
+ if ((*iter)->get_type() == Duck::TYPE_ANGLE)
+ {
+ if(!(*iter)->signal_edited_angle()((*iter)->get_rotations()))
+ {
+ throw String("Bad edit");
+ }
+ }
+ else if (App::restrict_radius_ducks &&
+ (*iter)->is_radius())
+ {
+ Point point((*iter)->get_point());
+ bool changed = false;
+
+ if (point[0] < 0)
+ {
+ point[0] = 0;
+ changed = true;
+ }
+ if (point[1] < 0)
+ {
+ point[1] = 0;
+ changed = true;
+ }
+
+ if (changed) (*iter)->set_point(point);
+
+ if(!(*iter)->signal_edited()(point))
+ {
+ throw String("Bad edit");
+ }
+ }
+ else
+ {
+ if(!(*iter)->signal_edited()((*iter)->get_point()))
+ {
+ throw String("Bad edit");
+ }
+ }
}
}
//duckmatic->get_selected_ducks()=new_set;