int layers_to_create()const
{
return
+ get_layer_star_flag() +
get_layer_region_flag() +
get_layer_outline_flag() +
get_layer_curve_gradient_flag() +
checkbutton_layer_outline(_("Create Outline BLine")),
checkbutton_layer_curve_gradient(_("Create Curve Gradient BLine")),
checkbutton_layer_plant(_("Create Plant BLine")),
- checkbutton_layer_link_origins(_("Link BLine Origins"))
+ checkbutton_layer_link_origins(_("Link Origins"))
{
egress_on_selection_change=true;
Angle::deg offset(get_angle_offset());
bool regular(get_regular_polygon());
Angle::deg angle(360.0/points);
- Real x(p1[0]), y(p1[1]);
std::vector<BLinePoint> new_list;
int point(0);
{
new_list.push_back(*(new BLinePoint));
new_list[point].set_width(outer_width);
- new_list[point].set_vertex(Point(radius1*Angle::cos(angle*i + offset).get() + x,
- radius1*Angle::sin(angle*i + offset).get() + y));
+ new_list[point].set_vertex(Point(radius1*Angle::cos(angle*i + offset).get(),
+ radius1*Angle::sin(angle*i + offset).get()));
new_list[point++].set_tangent(Point(-Angle::sin(angle*i + offset).get(),
Angle::cos(angle*i + offset).get()) * outer_tangent);
{
new_list.push_back(*(new BLinePoint));
new_list[point].set_width(inner_width);
- new_list[point].set_vertex(Point(radius2*Angle::cos(angle*i + angle/2 + offset).get() + x,
- radius2*Angle::sin(angle*i + angle/2 + offset).get() + y));
+ new_list[point].set_vertex(Point(radius2*Angle::cos(angle*i + angle/2 + offset).get(),
+ radius2*Angle::sin(angle*i + angle/2 + offset).get()));
new_list[point++].set_tangent(Point(-Angle::sin(angle*i + angle/2 + offset).get(),
Angle::cos(angle*i + angle/2 + offset).get()) * inner_tangent);
}
ValueNode_BLine::Handle value_node_bline(ValueNode_BLine::create(new_list));
assert(value_node_bline);
- ValueNode_Const::Handle value_node_origin(ValueNode_Const::create(Vector()));
+ ValueNode_Const::Handle value_node_origin(ValueNode_Const::create(p1));
assert(value_node_origin);
// Set the looping flag
layer->set_param("color",synfigapp::Main::get_background_color());
get_canvas_interface()->signal_layer_param_changed()(layer,"color");
}
+
+ // only link the star's origin parameter if the option is selected and we're creating more than one layer
+ if (get_layer_link_origins_flag() && layers_to_create > 1)
+ {
+ synfigapp::Action::Handle action(synfigapp::Action::create("layer_param_connect"));
+ assert(action);
+
+ action->set_param("canvas",get_canvas());
+ action->set_param("canvas_interface",get_canvas_interface());
+ action->set_param("layer",layer);
+ if(!action->set_param("param",String("origin")))
+ synfig::error("LayerParamConnect didn't like \"param\"");
+ if(!action->set_param("value_node",ValueNode::Handle(value_node_origin)))
+ synfig::error("LayerParamConnect didn't like \"value_node\"");
+
+ if(!get_canvas_interface()->get_instance()->perform_action(action))
+ {
+ //get_canvas_view()->get_ui_interface()->error(_("Unable to create Star layer"));
+ group.cancel();
+ throw String(_("Unable to create Star layer"));
+ return;
+ }
+ }
+ else
+ {
+ layer->set_param("origin",p1);
+ get_canvas_interface()->signal_layer_param_changed()(layer,"origin");
+ }
}
///////////////////////////////////////////////////////////////////////////
return;
}
}
+ else
+ {
+ layer->set_param("origin",p1);
+ get_canvas_interface()->signal_layer_param_changed()(layer,"origin");
+ }
}
///////////////////////////////////////////////////////////////////////////
return;
}
}
+ else
+ {
+ layer->set_param("origin",p1);
+ get_canvas_interface()->signal_layer_param_changed()(layer,"origin");
+ }
}
///////////////////////////////////////////////////////////////////////////
return;
}
}
+ else
+ {
+ layer->set_param("origin",p1);
+ get_canvas_interface()->signal_layer_param_changed()(layer,"origin");
+ }
}
///////////////////////////////////////////////////////////////////////////
return;
}
}
+ else
+ {
+ layer->set_param("origin",p1);
+ get_canvas_interface()->signal_layer_param_changed()(layer,"origin");
+ }
}
egress_on_selection_change=false;