Пример #1
0
bool
Action::ValueNodeRename::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
	{
		value_node=param.get_value_node();

		if(value_node && !value_node->is_exported())
		{
			synfig::error("Action::ValueNodeRename::set_param(): ValueBase node not exported!");
			value_node=0;
		}

		return (bool)value_node;
	}

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

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Пример #2
0
bool
Action::WaypointAdd::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
	{
		value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());
		if(time_set)
			calc_waypoint();

		return static_cast<bool>(value_node);
	}
	if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT && !time_set)
	{
		waypoint=param.get_waypoint();

		return true;
	}
	if(name=="time" && param.get_type()==Param::TYPE_TIME && waypoint.get_time()==Time::begin()-1)
	{
		waypoint.set_time(param.get_time());
		time_set=true;

		if(value_node)
			calc_waypoint();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
bool
Action::ValueNodeConstUnSetStatic::set_param(const synfig::String& name, const Action::Param &param)
{
	if(!value_node && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
	{
		ValueDesc value_desc(param.get_value_desc());
		if(!value_desc.parent_is_value_node())
			return false;

		value_node=ValueNode_Const::Handle::cast_dynamic(value_desc.get_value_node());

		if(!value_node)
			return false;

		return true;
	}

	if(!value_node && name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
	{
		value_node=ValueNode_Const::Handle::cast_dynamic(param.get_value_node());

		if(!value_node)
			return false;

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
bool
Action::ValueNodeLinkDisconnect::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="parent_value_node" && param.get_type()==Param::TYPE_VALUENODE)
	{
		parent_value_node=LinkableValueNode::Handle::cast_dynamic(param.get_value_node());

		return static_cast<bool>(parent_value_node);
	}

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

		return true;
	}

	if(name=="time" && param.get_type()==Param::TYPE_TIME)
	{
		time=param.get_time();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Пример #5
0
bool
Action::ValueNodeReplace::set_param(const synfig::String& name, const Action::Param &param)
{
    if(name=="dest" && param.get_type()==Param::TYPE_VALUENODE)
    {
        dest_value_node=param.get_value_node();

        return true;
    }

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

        return true;
    }

    return Action::CanvasSpecific::set_param(name,param);
}
bool
Action::BLinePointTangentSplitAngle::set_param(const synfig::String& name, const Action::Param &param)
{
    if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
    {
        value_node=value_node.cast_dynamic(param.get_value_node());
        if(value_node && value_node->get_type()==ValueBase::TYPE_BLINEPOINT)
            return true;
        ValueNode_RadialComposite::Handle radial_value_node;
        radial_value_node=ValueNode_RadialComposite::Handle::cast_dynamic(param.get_value_node());
        if(radial_value_node && radial_value_node->get_type()==ValueBase::TYPE_VECTOR)
            // value_node is radial composite and vector (user rigth click on a tangent)
        {
            ValueNode_Composite::Handle blinepoint;
            std::set<Node*>::iterator iter;
            // now check if the parent of value_node is a blinepoint type
            for(iter=radial_value_node->parent_set.begin(); iter!=radial_value_node->parent_set.end(); ++iter)
            {
                blinepoint=ValueNode_Composite::Handle::cast_dynamic(*iter);
                if(blinepoint && blinepoint->get_type()==ValueBase::TYPE_BLINEPOINT)
                {
                    value_node=blinepoint;
                    return true;
                }
            }
            return false;
        }
        return false;
    }
    if(name=="time" && param.get_type()==Param::TYPE_TIME)
    {
        time=param.get_time();
        return true;
    }
    return Action::CanvasSpecific::set_param(name,param);
}
// called from two places - both set 'canvas' and 'canvasinterface', and then:
//
//		ValueNodeStaticListRotateOrder::prepare() sets "value_desc", "item"
//			action->set_param("item",child);									<- sets item=list_entry=child
//			action->set_param("value_desc",ValueDesc(value_node,0));			<- sets value_node=value_node, index=0, list_entry=item
//
//		ValueNodeStaticListInsertSmart::prepare() sets "time", "origin", "value_desc"
//			action->set_param("time",time);
//			action->set_param("origin",origin);
//			action->set_param("value_desc",ValueDesc(value_node,index));		<- sets value_node=value_node, index=index, list_entry=create_list_entry(...)
//
// all the perform() does is 	value_node->add(list_entry,index);
//
bool
Action::ValueNodeStaticListInsert::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
	{
		ValueDesc value_desc(param.get_value_desc());

		if(!value_desc.parent_is_value_node())
			return false;

		value_node=ValueNode_StaticList::Handle::cast_dynamic(value_desc.get_parent_value_node());

		if(!value_node)
			return false;

		index=value_desc.get_index();

		if(item)
			list_entry=item;
		else
			list_entry=value_node->create_list_entry(index,time,origin);

		return true;
	}
	if(name=="time" && param.get_type()==Param::TYPE_TIME)
	{
		time=param.get_time();

		return true;
	}
	if(name=="item" && param.get_type()==Param::TYPE_VALUENODE)
	{
		item=param.get_value_node();
		if(item)
			list_entry=item;

		return true;
	}
	if(name=="origin" && param.get_type()==Param::TYPE_REAL)
	{
		origin=param.get_real();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Пример #8
0
bool
Action::WaypointSet::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
	{
		value_node=ValueNode_Animated::Handle::cast_dynamic(param.get_value_node());

		return static_cast<bool>(value_node);
	}
	if(name=="waypoint" && param.get_type()==Param::TYPE_WAYPOINT)
	{
		//NOTE: at the moment there is no error checking for multiple sets!!!
		waypoints.push_back(param.get_waypoint());

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
bool
Action::ValueNodeConstSet::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="value_node" && param.get_type()==Param::TYPE_VALUENODE)
	{
		value_node=ValueNode_Const::Handle::cast_dynamic(param.get_value_node());

		return (bool)value_node;
	}

	if(name=="new_value" && param.get_type()==Param::TYPE_VALUE)
	{
		new_value=param.get_value();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Пример #10
0
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);
}