Exemple #1
0
bool
Action::LayerMove::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
	{

		layer=param.get_layer();

		return true;
	}

	if(name=="new_index" && param.get_type()==Param::TYPE_INTEGER)
	{
		new_index=param.get_integer();

		return true;
	}

	if(name=="dest_canvas" && param.get_type()==Param::TYPE_CANVAS)
	{
		dest_canvas=param.get_canvas();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
bool
Action::TimepointsMove::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="addlayer" && param.get_type()==Param::TYPE_LAYER)
	{
		//add a layer to the list
		sel_layers.push_back(param.get_layer());
		//synfig::info("action got layer");

		return true;
	}

	if(name=="addcanvas" && param.get_type()==Param::TYPE_CANVAS)
	{
		//add a layer to the list
		sel_canvases.push_back(param.get_canvas());
		//synfig::info("action got canvas");

		return true;
	}

	if(name=="addvaluedesc" && param.get_type()==Param::TYPE_VALUEDESC)
	{
		//add a layer to the list
		sel_values.push_back(param.get_value_desc());
		//synfig::info("action got valuedesc");

		return true;
	}

	if(name=="addtime" && param.get_type()==Param::TYPE_TIME)
	{
		//add a layer to the list
		sel_times.insert(param.get_time());
		//synfig::info("action got time");

		return true;
	}

	if(name=="deltatime" && param.get_type()==Param::TYPE_TIME)
	{
		timemove = param.get_time();
		//synfig::info("action got time to move");

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
bool
Action::ValueDescConnect::set_param(const synfig::String& name, const Action::Param &param)
{
    if(name=="dest" && param.get_type()==Param::TYPE_VALUEDESC)
    {
        value_desc=param.get_value_desc();

        return true;
    }

    if(name=="src" && param.get_type()==Param::TYPE_VALUENODE)
    {
        value_node=param.get_value_node();

        return true;
    }

    if(!value_node_name.empty() && !value_node && name=="canvas" && param.get_type()==Param::TYPE_CANVAS)
    {
        value_node=param.get_canvas()->find_value_node(value_node_name, false);
    }

    if(name=="src_name" && param.get_type()==Param::TYPE_STRING)
    {
        value_node_name=param.get_string();

        if(get_canvas())
        {
            value_node=get_canvas()->find_value_node(value_node_name, false);
            if(!value_node)
                return false;
        }

        return true;
    }

    return Action::CanvasSpecific::set_param(name,param);
}