Ejemplo n.º 1
0
bool
Action::ValueDescSkeletonLink::set_param(const synfig::String& name, const Action::Param &param)
{
	if (name == "value_desc" && param.get_type() == Param::TYPE_VALUEDESC
	 && param.get_value_desc().parent_is_value_node()
	 && ValueNode_Bone::Handle::cast_dynamic(param.get_value_desc().get_parent_value_node())
	 && param.get_value_desc().get_parent_desc().parent_is_value_node()
	 && ValueNode_StaticList::Handle::cast_dynamic(param.get_value_desc().get_parent_desc().get_parent_value_node()) )
	{
		value_desc = param.get_value_desc();
		return true;
	}

	if (name == "selected_value_desc" && param.get_type() == Param::TYPE_VALUEDESC)
	{
		value_desc_list.push_back(param.get_value_desc());
		return true;
	}

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

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 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::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);
}
Ejemplo n.º 4
0
bool
Action::LayerParamUnSetStatic::set_param(const synfig::String& name, const Action::Param &param)
{

	if(!layer && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
	{
		ValueDesc value_desc(param.get_value_desc());
		if(!value_desc.parent_is_layer_param())
			return false;

		layer=Layer::Handle::cast_dynamic(value_desc.get_layer());

		if(!layer)
			return false;
	}


	if(param_name.empty() && name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
	{
		ValueDesc value_desc(param.get_value_desc());

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

		param_name=value_desc.get_param_name();

		if(param_name.empty())
			return false;

	}

	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);
}
Ejemplo n.º 6
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);
}
Ejemplo n.º 7
0
bool
Action::ActivepointSimpleAdd::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_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());

		if(!value_node)
			return false;

		index=value_desc.get_index();

		return true;
	}
	if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT)
	{
		activepoint = param.get_activepoint();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 8
0
bool
Action::ValueDescSet::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
	{
		value_desc=param.get_value_desc();
		return true;
	}
	if(name=="new_value" && param.get_type()==Param::TYPE_VALUE)
	{
		value=param.get_value();
		return true;
	}
	if(name=="time" && param.get_type()==Param::TYPE_TIME)
	{
		time=param.get_time();
		return true;
	}
	if(name=="recursive" && param.get_type()==Param::TYPE_BOOL)
	{
		recursive=param.get_bool();
		return true;
	}
	if(name=="animate" && param.get_type()==Param::TYPE_BOOL)
	{
		animate=param.get_bool();
		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 9
0
bool
Action::ValueDescBLineLink::set_param(const synfig::String& name, const Action::Param &param)
{
    if (name == "time" && param.get_type() == Param::TYPE_TIME)
    {
        time = param.get_time();
        return true;
    }

    if (name == "value_desc" && param.get_type() == Param::TYPE_VALUEDESC)
    {
        value_desc = param.get_value_desc();
        index = value_desc.get_index();
        return true;
    }

    if (name == "selected_value_desc" && param.get_type() == Param::TYPE_VALUEDESC)
    {
        ValueDesc value_desc(param.get_value_desc());
        value_desc_list.push_back(value_desc);
        return true;
    }

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

    return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 10
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);
}
Ejemplo n.º 11
0
bool
Action::KeyframeDuplicate::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
	{
		keyframe=param.get_keyframe();
		new_keyframe.set_description(keyframe.get_description()+_(" (Duplicate)"));

		//! TODO add and use keyframe::operator=

		//! Copy the kf's Waypoint::model is exist
		if(keyframe.has_model())
		    new_keyframe.apply_model(keyframe.get_waypoint_model());
		//! Copy the active status
		new_keyframe.set_active(keyframe.active());

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

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 12
0
bool
Action::ColorSet::set_param(const synfig::String& name, const Action::Param &param)
{
	if (name == "value_desc" && param.get_type() == Param::TYPE_VALUEDESC)
	{
		// Grab the value_desc
		ValueDesc value_desc = param.get_value_desc();
		if (value_desc.get_value_type() != type_color)
			return false;

		value_desc_list.push_back(value_desc);

		// Grab the current outline or fill color
		if (use_outline_color)
			color = synfigapp::Main::get_outline_color();
		else
			color = synfigapp::Main::get_fill_color();

		return true;
	}

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

		return true;
	}

	return Action::CanvasSpecific::set_param(name, param);
}
bool
Action::ValueNodeDynamicListRemoveSmart::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_DynamicList::Handle::cast_dynamic(value_desc.get_parent_value_node());
		if(!value_node)
		{
			ValueNode::Handle compo(ValueNode_Composite::Handle::cast_dynamic(value_desc.get_parent_value_node()));
			if(compo)
			{
				ValueNode_DynamicList::Handle parent_list=NULL;
				std::set<Node*>::iterator iter;
				// now check if the composite's parent is a dynamic list type
				for(iter=compo->parent_set.begin();iter!=compo->parent_set.end();++iter)
					{
						parent_list=ValueNode_DynamicList::Handle::cast_dynamic(*iter);
						if(parent_list)
						{
							value_node=parent_list;
							// Now we need to find the index of this composite item
							// on the dynamic list
							int i;
							for(i=0;i<value_node->link_count();i++)
								if(compo->get_guid()==value_node->get_link(i)->get_guid())
									break;
							if(i<value_node->link_count())
								value_desc=synfigapp::ValueDesc(value_node, i);
							else
								return false;
							break;
						}
					}
				if(!value_node)
					return false;
			}
			else
				return false;
			if(!value_node)
				return false;
		}
		index=value_desc.get_index();
		return true;
	}
	if(name=="time" && param.get_type()==Param::TYPE_TIME)
	{
		time=param.get_time();
		return true;
	}
	if(name=="origin" && param.get_type()==Param::TYPE_REAL)
	{
		origin=param.get_real();
		return true;
	}
	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 14
0
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::KeyframeSetDelta::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
	{
		keyframe=param.get_keyframe();
		return true;
	}
	if(name=="delta" && param.get_type()==Param::TYPE_TIME)
	{
		delta=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);
}
Ejemplo n.º 17
0
bool
Action::KeyframeWaypointSet::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
	{
		keyframe=param.get_keyframe();

		return true;
	}
	if(name=="model" && param.get_type()==Param::TYPE_WAYPOINTMODEL)
	{
		waypoint_model=param.get_waypoint_model();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 18
0
bool
Action::ValueDescSetInterpolation::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
	{
		value_desc=param.get_value_desc();

		return true;
	}

	if(name=="new_value" && param.get_type()==Param::TYPE_INTERPOLATION)
	{
		value=param.get_interpolation();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 19
0
bool
Action::ValueDescCreateChildBone::set_param(const synfig::String& name, const Action::Param &param)
{
	if (name == "value_desc" && param.get_type() == Param::TYPE_VALUEDESC
	 && param.get_value_desc().parent_is_value_node()
	 && ValueNode_Bone::Handle::cast_dynamic(param.get_value_desc().get_parent_value_node()) )
	{
		value_desc = param.get_value_desc();
		return true;
	}

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

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 20
0
bool
Action::LayerSetDesc::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_description" && param.get_type()==Param::TYPE_STRING)
	{
		new_description=param.get_string();

		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);
}
Ejemplo n.º 22
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);
}
Ejemplo n.º 23
0
bool
Action::ValueDescDisconnect::set_param(const synfig::String& name, const Action::Param &param)
{
    if(name=="value_desc" && param.get_type()==Param::TYPE_VALUEDESC)
    {
        value_desc=param.get_value_desc();

        return true;
    }

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

        return true;
    }

    return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 24
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);
}
Ejemplo n.º 25
0
bool
Action::LayerResetPose::set_param(const synfig::String& name, const Action::Param &param)
{
	if (name=="layer"
	 && param.get_type()==Param::TYPE_LAYER
	 && param.get_layer()->get_name() == "skeleton_deformation" )
	{
		layers.push_back(param.get_layer());
		return true;
	}

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

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

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

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

		if(!value_node)
			return false;

		index=value_desc.get_index();

		if(time_set)
			calc_activepoint();

		return true;
	}
	if(name=="activepoint" && param.get_type()==Param::TYPE_ACTIVEPOINT && !time_set)
	{
		activepoint=param.get_activepoint();

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

		if(value_node)
			calc_activepoint();

		return true;
	}

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

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 27
0
bool
Action::KeyframeToggl::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="keyframe" && param.get_type()==Param::TYPE_KEYFRAME)
	{
		keyframe=param.get_keyframe();

		return true;
	}

	if(name=="new_status" && param.get_type()==Param::TYPE_BOOL)
	{
		new_status=param.get_bool();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 28
0
bool
Action::LayerMakeBLine::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;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 29
0
bool
Action::CanvasNameSet::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="name" && param.get_type()==Param::TYPE_STRING)
	{
		new_name=param.get_string();

		return true;
	}

	return Action::CanvasSpecific::set_param(name,param);
}
Ejemplo n.º 30
0
bool
Action::LayerAddFrame::set_param(const synfig::String& name, const Action::Param &param)
{
	if(name=="layer" && param.get_type()==Param::TYPE_LAYER)
	{
		layer_switch = etl::handle<Layer_Switch>::cast_dynamic(param.get_layer());
		if (layer_switch)
		{
			layer_base = layer_switch->get_current_layer();
			if (!layer_base) layer_switch = NULL;
		}
		return layer_switch;
	}
	if(name=="time" && param.get_type()==Param::TYPE_TIME)
	{
		time=param.get_time();
		return true;
	}

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