/****************************************************************************************************

		NLAInterfaces.h
		Copyright: (c) 2002 Eovia Corp. All rights reserved.

		Author:	Pierre
		Date:	8/16/2006

****************************************************************************************************/

#ifndef __NLAInterfaces__
#define __NLAInterfaces__

#if CP_PRAGMA_ONCE
#pragma once
#endif

#include "MCCompObj.h"
#include "APITypes.h"
#include "BitArray.h"


struct I3DShMasterClip;
struct I3DShAttributesSet;
struct I3DShAttributesSetControler;
struct ISceneDocument;
struct IShAction;
template<class T> class TMCPtrArray;
class TMCRGBColor;
class TMCPoint;


enum ENLASelectedObjectKind
{
	kSelNLAClipInstance	= 'NLAc',
	kSelNLATrack		= 'NLAt',
};


MCDEFINE_GUID_H(IID_IClipInstance);
MCDEFINE_GUID_H(IID_INLATrack);
MCDEFINE_GUID_H(IID_IClipTrack);
MCDEFINE_GUID_H(IID_ITrackGroup);
MCDEFINE_GUID_H(IID_INLAAttributesSetControler);
MCDEFINE_GUID_H(IID_IPoseClip);
MCDEFINE_GUID_H(IID_IMasterClipInstance);
MCDEFINE_GUID_H(IID_IKeyframeClip);


struct IClipTrack;
struct ITrackGroup;
struct IClipInstance;
struct INLAAttributesSetControler;
struct I3DShClip;
struct I3DShAttributesSet;
struct I3DShParamInfo;
struct I3DShParamTimeLine;
class TParamHolder;
class TAttributePath;


struct IClipInstanceCopy : public IMCUnknown
{
	virtual IClipInstance*		MCCOMAPI AddToTrack(IClipTrack* track, boolean duplicate, boolean undo, I3DShMasterClip** addedMasterClip = NULL, uint32 uniqueId = (uint32)-1) = 0;
};


struct IClipInstance : public IMCUnknown
{
	virtual void				MCCOMAPI Initialize() = 0;

	virtual void				MCCOMAPI GetName(TMCString& name) = 0;
	virtual IClipTrack*			MCCOMAPI GetTrack() const = 0;
	virtual I3DShMasterClip*	MCCOMAPI GetMasterClip() const = 0;
	virtual void				MCCOMAPI SetTimeRange(MicroTick start, MicroTick end) = 0;
	virtual void				MCCOMAPI SetBlendStartTime(MicroTick start) = 0;
	virtual void				MCCOMAPI SetBlendEndTime(MicroTick end) = 0;
	virtual void				MCCOMAPI TranslateClip(MicroTick offset) = 0;
	virtual MicroTick			MCCOMAPI GetStartTime() const = 0;
	virtual MicroTick			MCCOMAPI GetEndTime() const = 0;
	virtual MicroTick			MCCOMAPI GetStartBlendTime() const = 0;
	virtual MicroTick			MCCOMAPI GetEndBlendTime() const = 0;
	virtual real32				MCCOMAPI GetClipSpeed() const = 0;
	virtual void				MCCOMAPI SetClipSpeed(real32 speed) = 0;
	virtual MicroTick			MCCOMAPI GetClipReference() const = 0;
	virtual void				MCCOMAPI SetClipReference(MicroTick offset) = 0;
	virtual boolean				MCCOMAPI IsClipReferenceLocked() const = 0;
	virtual boolean				MCCOMAPI GetClipReverse() const = 0;
	virtual void				MCCOMAPI SetClipReverse(boolean reverse) = 0;
	virtual boolean				MCCOMAPI HasBlendHandle(boolean leftOrRight) const = 0;
	virtual void				MCCOMAPI SetExtraSmoothBlend(boolean enable) = 0;
	virtual MicroTick			MCCOMAPI GetDuration() const = 0;
	virtual TMCRGBColor			MCCOMAPI GetColor() const = 0;
	virtual boolean				MCCOMAPI Loop() const = 0;
	virtual uint32				MCCOMAPI GetUniqueId() = 0;
	virtual MicroTick			MCCOMAPI GetLoopSectionDuration() const = 0;
	virtual boolean				MCCOMAPI IsInEditMode() const = 0;
	virtual void				MCCOMAPI ApplyChanges(boolean finished) = 0;
	virtual void				MCCOMAPI RemoveFromTrack() = 0;
	virtual void				MCCOMAPI ChangeTrack(IClipTrack* track) = 0;
	virtual IClipInstance*		MCCOMAPI GetPrevious() = 0;
	virtual IClipInstance*		MCCOMAPI GetNext() = 0;
	virtual void				MCCOMAPI CloneClipInstance(IClipInstanceCopy** copy) = 0;

	virtual boolean				MCCOMAPI PostEditModeAction(boolean enterEditMode) = 0;
	virtual boolean				MCCOMAPI GetEditModeAction(IShAction** action, boolean enterEditMode) = 0;
};

struct INLATrack : public IMCUnknown
{
	virtual void				MCCOMAPI GetName(TMCString& name) = 0;
	virtual void				MCCOMAPI SetName(const TMCString& name) = 0;
	virtual INLAAttributesSetControler*	MCCOMAPI GetControler() const = 0;
	virtual uint32				MCCOMAPI GetUniqueId() = 0;
	virtual ITrackGroup*		MCCOMAPI GetParent() = 0;
	virtual MicroTick			MCCOMAPI GetMinTime() = 0;
	virtual MicroTick			MCCOMAPI GetMaxTime() = 0;
};

struct IClipTrack : public IMCUnknown
{
	virtual INLATrack*			MCCOMAPI GetNLATrack() = 0;

	virtual int32				MCCOMAPI GetClipInstanceCount() const = 0;
	virtual IClipInstance*		MCCOMAPI GetClipInstance(int32 index) const = 0;
	virtual IClipInstance*		MCCOMAPI FindClipInstance(uint32 uniqueId) const = 0;
	virtual void				MCCOMAPI AddClipInstance(IClipInstance* clip) = 0;
	virtual void				MCCOMAPI SortClipInstances() = 0;
	virtual void				MCCOMAPI GetClipValidRange(IClipInstance* clip, MicroTick& startMin, MicroTick& startMax, MicroTick& endMin, MicroTick& endMax) = 0;
	virtual void				MCCOMAPI GetClipValidHoldRange(IClipInstance* clip, MicroTick& startMin, MicroTick& startMax, MicroTick& endMin, MicroTick& endMax) = 0;
	virtual void				MCCOMAPI ValidateMovedClipInstances(const TMCPtrArray<IClipInstance>& clips) = 0;
	virtual boolean				MCCOMAPI IsActive() = 0;
	virtual void				MCCOMAPI SetActive(boolean active) = 0;
	virtual void				MCCOMAPI SetBlendMode(boolean blend) = 0;
	virtual void				MCCOMAPI PostCreateEditableClipAction(MicroTick time) = 0;
};

struct ITrackGroup : public IMCUnknown
{
	virtual INLATrack*			MCCOMAPI GetNLATrack() = 0;

	virtual int32				MCCOMAPI GetTrackCount() const = 0;
	virtual INLATrack*			MCCOMAPI GetTrack(int32 index) const = 0;
	virtual INLATrack*			MCCOMAPI FindTrack(uint32 uniqueId) const = 0;
	virtual int32				MCCOMAPI GetTrackIndex(INLATrack* track) = 0;
	virtual void				MCCOMAPI InsertTrack(INLATrack* track, int32 index = -1) = 0;
	virtual void				MCCOMAPI RemoveTrack(int32 index) = 0;
	virtual void				MCCOMAPI RemoveTrack(INLATrack* track) = 0;
	virtual IClipTrack*			MCCOMAPI InsertClipTrack(int32 index = -1) = 0;
	virtual ITrackGroup*		MCCOMAPI InsertTrackGroup(int32 index = -1) = 0;
	virtual boolean				MCCOMAPI IsExpanded() = 0;
	virtual void				MCCOMAPI SetExpanded(boolean expanded) = 0;
};

struct INLAUndoRedo : public IMCUnknown
{
	virtual void				MCCOMAPI Undo() = 0;
	virtual void				MCCOMAPI Redo() = 0;
};

struct INLAAttributesSetControler : public IMCUnknown
{
	virtual ITrackGroup*		MCCOMAPI GetRootTrack() = 0;

	virtual void				MCCOMAPI CreateClipInstance(IClipInstance** instance, I3DShMasterClip* clip) = 0;
	virtual I3DShAttributesSet*	MCCOMAPI GetAttributesSet() = 0;
	virtual I3DShAttributesSetControler*	MCCOMAPI GetShControler() = 0;

	virtual void				MCCOMAPI BeginUndoableSequence(ISceneDocument* sceneDocument) = 0;
	virtual void				MCCOMAPI EndUndoableSequence(INLAUndoRedo** undoRedo) = 0;

	virtual void				MCCOMAPI BeginClipPoseCreation() = 0;
	virtual void				MCCOMAPI EndClipPoseCreation() = 0;
	virtual void				MCCOMAPI EndClipCreation(I3DShMasterClip** clip, const TMCString& name, I3DShTreeElement* refTree, MicroTick startTime, MicroTick endTime, const TBitArray& parameters=TBitArray()) = 0;
	virtual void				MCCOMAPI EndPoseCreation(I3DShMasterClip** clip, const TMCString& name, const TBitArray& parameters=TBitArray()) = 0;

	virtual void				MCCOMAPI PostAddTrackAction(ITrackGroup* group, int32 index, boolean groupTrack) = 0;
	virtual void				MCCOMAPI PostCreateClipAction() = 0;
	virtual void				MCCOMAPI PostCreatePoseAction() = 0;

	virtual boolean				MCCOMAPI IsExpanded() const = 0;
	virtual void				MCCOMAPI SetExpanded(boolean expanded) = 0;
	virtual void				MCCOMAPI SetDrawPosition(const TMCPoint& position) = 0;
	virtual const TMCPoint&		MCCOMAPI GetDrawPosition() const = 0;

	virtual void				MCCOMAPI CreatePoseWithCurrentValues(I3DShClip** outPose, TMCCountedPtrArray<I3DShParamInfo> * paramInfoArray = NULL) = 0;
};


struct IPoseClip : public IMCUnknown
{
	virtual void		Clear() = 0;
	virtual void		SetAttributeValue(int32 paramIndex, const TParamHolder& value) = 0;
	virtual boolean		AddParam(I3DShAttributesSet* root, I3DShParamInfo* param) = 0;
	virtual boolean		AddParam(const TAttributePath & path, const TParamHolder& value) = 0;
};

struct IKeyframeClip : public IMCUnknown
{
	virtual void		Clear() = 0;
	virtual void		AddParamWithTimeLine(I3DShAttributesSet* root, I3DShParamInfo* param, I3DShParamTimeLine* timeLine, MicroTick timeOffset) = 0;
	virtual void		SetDuration(MicroTick duration) = 0;
	virtual void		ComputeLoopOffset(I3DShTreeElement* root, I3DShTreeElement* reference, MicroTick startTime) = 0;
	virtual void		SetAttributeTimeLine(int32 index, I3DShParamTimeLine* timeLine) = 0;
};

struct IMasterClipInstance : public IMCUnknown
{
	virtual void		SetMasterClip(I3DShMasterClip* masterClip, boolean initLoopOffset) = 0;
};


#endif
