UInterpGroup* FAssetTypeActions_CameraAnim::CreateInterpGroup(UCameraAnim* InCameraAnim, FCameraPreviewInfo& PreviewInfo)
{
	check(InCameraAnim);

	CreatePreviewPawn(InCameraAnim, PreviewInfo.PawnClass, PreviewInfo.Location, PreviewInfo.Rotation);

	PreviewInfo.PawnInst = PreviewPawn.Get();

	if (PreviewInfo.PawnInst)
	{
		// create InterpGroup so that we can play animation to this pawn
		check(PreviewMatineeActor.Get()->MatineeData);
		UInterpGroup* NewGroup = ConstructObject<UInterpGroup>(UInterpGroup::StaticClass(), PreviewMatineeActor.Get()->MatineeData, NAME_None, RF_Transient);
		NewGroup->GroupName = FName(TEXT("Preview Pawn"));
		NewGroup->EnsureUniqueName();

		PreviewMatineeActor.Get()->MatineeData->InterpGroups.Add(NewGroup);

		// now add group inst
		UInterpGroupInst* NewGroupInst = ConstructObject<UInterpGroupInst>(UInterpGroupInst::StaticClass(), PreviewMatineeActor.Get(), NAME_None, RF_Transient);
		// Initialise group instance, saving ref to actor it works on.
		NewGroupInst->InitGroupInst(NewGroup, PreviewInfo.PawnInst);
		const int32 NewGroupInstIndex = PreviewMatineeActor.Get()->GroupInst.Add(NewGroupInst);

		//Link group with actor
		PreviewMatineeActor.Get()->InitGroupActorForGroup(NewGroup, PreviewInfo.PawnInst);

		// Now time to add AnimTrack so that we can play animation
		int32 AnimTrackIndex = INDEX_NONE;
		// add anim track but do not use addtotrack function that does too many things 
		// Construct track and track instance objects.
		UInterpTrackAnimControl* AnimTrack = ConstructObject<UInterpTrackAnimControl>( UInterpTrackAnimControl::StaticClass(), NewGroup, NAME_None, RF_Transient );
		check(AnimTrack);

		NewGroup->InterpTracks.Add(AnimTrack);
		
		// use config anim slot
		AnimTrack->SlotName = FName(*GConfig->GetStr(TEXT("MatineePreview"), TEXT("DefaultAnimSlotName"), GEditorIni));
		UInterpTrackInst* NewTrackInst = ConstructObject<UInterpTrackInst>( AnimTrack->TrackInstClass, NewGroupInst, NAME_None, RF_Transient );
		check(NewTrackInst);

		NewGroupInst->TrackInst.Add(NewTrackInst);

		// Initialize track, giving selected object.
		NewTrackInst->InitTrackInst(AnimTrack);

		// Save state into new track before doing anything else (because we didn't do it on ed mode change).
		NewTrackInst->SaveActorState(AnimTrack);
		check(NewGroupInst->TrackInst.Num() > 0);

		// add default anim curve weights to be 1
		int32 KeyIndex = AnimTrack->CreateNewKey(0.0f);
		AnimTrack->SetKeyOut(0, KeyIndex, 1.0f);

		if(PreviewInfo.AnimSeq != NULL)
		{
			KeyIndex = AnimTrack->AddKeyframe(0.0f, NewGroupInst->TrackInst[0], CIM_Linear);
			FAnimControlTrackKey& NewSeqKey = AnimTrack->AnimSeqs[KeyIndex];
			NewSeqKey.AnimSeq = PreviewInfo.AnimSeq;	
		}

		PreviewPawn = PreviewInfo.PawnInst;

		return NewGroup;
	}
	return NULL;
}