// Can return null
const FPaperFlipbookKeyFrame* SFlipbookKeyframeWidget::GetKeyFrameData() const
{
	UPaperFlipbook* Flipbook = FlipbookBeingEdited.Get();
	if ((Flipbook != nullptr) && Flipbook->IsValidKeyFrameIndex(FrameIndex))
	{
		return &(Flipbook->GetKeyFrameChecked(FrameIndex));
	}

	return nullptr;
}
Exemplo n.º 2
0
FOptionalSize SFlipbookKeyframeWidget::GetFrameWidth() const
{
	UPaperFlipbook* Flipbook = FlipbookBeingEdited.Get();
	if (Flipbook && Flipbook->IsValidKeyFrameIndex(FrameIndex))
	{
		const FPaperFlipbookKeyFrame& KeyFrame = Flipbook->GetKeyFrameChecked(FrameIndex);
		return FMath::Max<float>(0, KeyFrame.FrameRun * SlateUnitsPerFrame.Get() - FFlipbookUIConstants::HandleWidth);
	}
	else
	{
		return 1;
	}
}
Exemplo n.º 3
0
FText SFlipbookKeyframeWidget::GetKeyframeTooltip() const
{
	UPaperFlipbook* Flipbook = FlipbookBeingEdited.Get();
	if ((Flipbook != nullptr) && Flipbook->IsValidKeyFrameIndex(FrameIndex))
	{
		const FPaperFlipbookKeyFrame& KeyFrame = Flipbook->GetKeyFrameChecked(FrameIndex);

		FText SpriteLine = (KeyFrame.Sprite != nullptr) ? FText::FromString(KeyFrame.Sprite->GetName()) : LOCTEXT("NoSprite", "(none)");

		return FText::Format(LOCTEXT("KeyFrameTooltip", "Sprite: {0}\nIndex: {1}\nDuration: {2} frame(s)"),
			SpriteLine,
			FText::AsNumber(FrameIndex),
			FText::AsNumber(KeyFrame.FrameRun));
	}
	else
	{
		return LOCTEXT("KeyFrameTooltip_Invalid", "Invalid key frame index");
	}
}