Exemple #1
0
void move_selected_keys_time_right( curve_t<K>& c, float offset, bool do_round = false)
{
	typedef typename curve_t<K>::reverse_iterator reverse_iterator;
	
	reverse_iterator it( c.rbegin()), prev( c.rbegin());
	float new_time;

	if( it->selected())
	{
		new_time = it->time() + offset;

		if( do_round)
			new_time = round( new_time);

		it->set_time( new_time);
	}
	
	++it;

	for( ; it != c.rend(); ++it, ++prev)
	{
		if( it->selected())
		{
			new_time = it->time() + offset;
			
			if( do_round)
				new_time = round( new_time);
			
			it->set_time( std::min( new_time, prev->time() - keyframe_t::time_tolerance()));
		}
	}
}
Exemple #2
0
void do_reverse_selected_keyframes( curve_t<K>& c)
{
	typedef typename curve_t<K>::iterator iterator;
	
	iterator start( c.begin());
	iterator end( c.end());

	iterator s_it = move_to_next_selected( start, end, end);	
	if( s_it == end)
		return;

	iterator e_it = move_to_prev_selected( end - 1, start, start);
	if( e_it == start)
		return;
	
	while( s_it != e_it)
	{
		s_it->swap_value( *e_it);

		++s_it;
		s_it = move_to_next_selected( s_it, e_it, end);
		
		if( s_it == end)
			return;

		--e_it;
		e_it = move_to_prev_selected( e_it, s_it, start);

		if( e_it == start)
			return;
	}
}
Exemple #3
0
void reverse_keyframes( curve_t<K>& c, bool selected_only)
{
	if( c.empty() || c.size() == 1)
		return;
	
	if( selected_only)
		detail::do_reverse_selected_keyframes( c);
	else
		detail::do_reverse_keyframes( c);
}
Exemple #4
0
inline
cvpoint_array_t make_cvPoint_array( const curve_t& curve )
{
   std::size_t curve_size = curve.size();

   cvpoint_array_t cvpoint_array( new CvPoint[ curve.size() ] );

   for( std::size_t i = 0; i < curve_size ; ++i )
   {
      cvpoint_array[i] = make_cvPoint( curve[i] );
   }

   return cvpoint_array;
}
Exemple #5
0
void do_reverse_keyframes( curve_t<K>& c)
{
	typedef typename curve_t<K>::iterator iterator;
	
	iterator s_it( c.begin());
	iterator e_it( c.end() - 1);

	while( s_it != e_it)
	{
		s_it->swap_value( *e_it);
		++s_it;
		--e_it;
	}
}