/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#ifndef	__NAUTOMATIONSOURCEGROUP__
#define	__NAUTOMATIONSOURCEGROUP__


		#include "automation/automation_source.h"


namespace GS {
	namespace Automation {

/*!
	@short	Automation source group.

	This is the structure holding automation sources created when starting
	automations on a group of items like a hierarchy, a scene or a group of
	items.

	@author	Emmanuel Julien (ejulien@gsworks.fr)
*/
struct	SourceGroup
{
		NPLACEMENT_NEW(AnimationSource)

		SharedList <Source *> source_list;

		/*!
			@short	Blend group sources weight to 0 then dispose of them.
			@note	The group can be deleted before the sources are disposed of.
		*/
		void		Dispose(float blend = Units::Sec(1));

		void		SetLoopMode(Curve::LoopMode = Curve::Reset);
		void		SetLoop(const Time &loop_start = Time::Inf, const Time &loop_end = Time::Inf);

		void		SetTime(const Time &t);
		void		SetTimeScale(float scale = 1);

		void		SetWeight(float weight, float blend = Units::Sec(0.1));
		void		SetRelative(bool relative);

		bool		IsDone() const;

		/*!
			@short	Get time.

			Get group time using the root source.
			Returns 0 if there is no source in the group.
		*/
		Time		GetTime() const;
};

	} // Automation
} // GS


#endif	// __NAUTOMATIONSOURCEGROUP__
