+ // Don't link the selected to itself (maybe it is redundant with the previous check)
+ if(value_desc.get_value_node() == link_value_node)
+ continue;
+ // If we found inverse means that all they are tangents and some are differnt scalar (different colors)
+ if(found_inverse)
+ {
+ //Check if the current value node has opposite scalar than the link
+ // value node to convert to scale -1.0 before connect.
+ // Check also if the link value node is NOT also a scale -1
+ if( (value_desc.get_scalar()*link_scalar<0) && (link_is_scaled==false) )
+ {
+ //Let's create a Scale Value Node
+ synfig::ValueNode::Handle scale_value_node=synfig::LinkableValueNode::create("scale",iter->get_value(time));
+ if(!scale_value_node)
+ throw Error(Error::TYPE_BUG);
+ scale_value_node->set_parent_canvas(get_canvas());
+ //Let's connect the new Scale Value Node to the value node
+ Action::Handle action1(Action::create("ValueDescConnect"));
+ if(!action1)
+ throw Error(Error::TYPE_CRITICAL);
+ action1->set_param("canvas",get_canvas());
+ action1->set_param("canvas_interface",get_canvas_interface());
+ action1->set_param("dest",value_desc);
+ action1->set_param("src",scale_value_node);
+ assert(action1->is_ready());
+ if(!action1->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+ add_action_front(action1);
+
+ //Let's Connect the link value node to the scale value node link subparam
+ Action::Handle action2(Action::create("ValueNodeLinkConnect"));
+ if(!action2)
+ throw Error(Error::TYPE_CRITICAL);
+
+ action2->set_param("canvas",get_canvas());
+ action2->set_param("canvas_interface",get_canvas_interface());
+ action2->set_param("parent_value_node",scale_value_node);
+ action2->set_param("index",0);
+ action2->set_param("value_node",link_value_node);
+ assert(action2->is_ready());
+ if(!action2->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+ add_action_front(action2);
+
+ //Let's Set the scale to -1
+ Action::Handle action3(Action::create("ValueNodeConstSet"));
+ if(!action3)
+ throw Error(Error::TYPE_CRITICAL);
+
+ action3->set_param("canvas",get_canvas());
+ action3->set_param("canvas_interface",get_canvas_interface());
+ action3->set_param("value_node",synfig::LinkableValueNode::Handle::cast_dynamic(scale_value_node)->get_link(1));
+ action3->set_param("new_value",synfig::ValueBase(Real(-1.0)));
+ assert(action3->is_ready());
+ if(!action3->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+ add_action_front(action3);
+ }
+ else if((iter->get_scalar()*link_scalar<0) && (link_is_scaled==true) )
+ {
+ //Let's connect the link value node -> link to the value node
+ // There is not needed conversion to scale of the value node
+ // because the link value node is already a scale -1
+ Action::Handle action4(Action::create("ValueDescConnect"));
+ if(!action4)
+ throw Error(Error::TYPE_CRITICAL);
+ action4->set_param("canvas",get_canvas());
+ action4->set_param("canvas_interface",get_canvas_interface());
+ action4->set_param("dest",value_desc);
+ action4->set_param("src",synfig::ValueNode_Scale::Handle::cast_dynamic(link_value_node)->get_link(0));
+ assert(action4->is_ready());
+ if(!action4->is_ready())
+ throw Error(Error::TYPE_NOTREADY);
+ add_action_front(action4);
+ }
+ else
+ {
+ //Let's connect the link value node to the value node
+ Action::Handle action(Action::create("ValueDescConnect"));