Files
UnrealEngineUWP/Engine/Source/Editor/SkeletonEditor/Private/SkeletonTreeVirtualBoneItem.h
jose villarroel 262e9e63d3 Added virtual bone support to blend profiles
#jira none
[at]Louise.Rasmussen, [at]Thomas.Sarkanen
[FYI] Ray.Arnett, Aaron.Cox
#preflight 61b1084a5c61dba07bfe212c

#ROBOMERGE-AUTHOR: jose.villarroel
#ROBOMERGE-SOURCE: CL 18421025 in //UE5/Release-5.0/... via CL 18422624
#ROBOMERGE-BOT: STARSHIP (Release-Engine-Staging -> Release-Engine-Test) (v897-18405271)

[CL 18422907 by jose villarroel in ue5-release-engine-test branch]
2021-12-09 14:52:34 -05:00

113 lines
4.2 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Styling/SlateColor.h"
#include "Layout/Visibility.h"
#include "Widgets/SWidget.h"
#include "Fonts/SlateFontInfo.h"
#include "Widgets/Views/STableViewBase.h"
#include "Widgets/Views/STableRow.h"
#include "ISkeletonTreeItem.h"
#include "SkeletonTreeItem.h"
#include "IEditableSkeleton.h"
#include "BoneProxy.h"
#include "UObject/GCObject.h"
class SInlineEditableTextBlock;
class FSkeletonTreeVirtualBoneItem : public FSkeletonTreeItem, public FGCObject
{
public:
SKELETON_TREE_ITEM_TYPE(FSkeletonTreeVirtualBoneItem, FSkeletonTreeItem)
FSkeletonTreeVirtualBoneItem(const FName& InBoneName, const TSharedRef<class ISkeletonTree>& InSkeletonTree);
/** Builds the table row widget to display this info */
virtual void GenerateWidgetForNameColumn(TSharedPtr< SHorizontalBox > Box, const TAttribute<FText>& FilterText, FIsSelected InIsSelected) override;
virtual TSharedRef< SWidget > GenerateWidgetForDataColumn(const FName& DataColumnName, FIsSelected InIsSelected) override;
virtual FName GetRowItemName() const override { return BoneName; }
virtual bool CanRenameItem() const override { return true; }
virtual void RequestRename() override;
virtual void OnItemDoubleClicked() override;
virtual UObject* GetObject() const override { return BoneProxy; }
/** FGCObject interface */
virtual void AddReferencedObjects( FReferenceCollector& Collector ) override;
virtual FString GetReferencerName() const override
{
return TEXT("FSkeletonTreeVirtualBoneItem");
}
/** Return socket name as FText for display in skeleton tree */
FText GetVirtualBoneNameAsText() const { return FText::FromName(BoneName); }
/** Enable and disable the bone proxy ticking */
void EnableBoneProxyTick(bool bEnable);
private:
/** Callback from a slider widget if the text entry or slider movement is used */
void OnBlendSliderCommitted(float NewValue, ETextCommit::Type CommitType);
/** Set Translation Retargeting Mode for this bone. */
void SetBoneTranslationRetargetingMode(EBoneTranslationRetargetingMode::Type NewRetargetingMode);
/** Set current Blend Scale for this bone */
void SetBoneBlendProfileScale(float NewScale, bool bRecurse);
/** Get the current Blend Scale for this bone */
float GetBoneBlendProfileScale() const;
/** Get the max slider value supported by the selected blend profile's mode*/
TOptional<float> GetBlendProfileMaxSliderValue() const;
/** Get the min slider value supported by the selected blend profile's mode*/
TOptional<float> GetBlendProfileMinSliderValue() const;
/** Used to hide the Bone Profile row widget if there is no current Blend Profile */
EVisibility GetBoneBlendProfileVisibility() const;
/** Called when we are about to rename a virtual bone */
void OnVirtualBoneNameEditing();
/** Called when user is renaming this bone to verify the name **/
bool OnVerifyBoneNameChanged(const FText& InText, FText& OutErrorMessage);
/** Called when user renames this bone **/
void OnCommitVirtualBoneName(const FText& InText, ETextCommit::Type CommitInfo);
/** Called to get the visibility of the Prefix label during rename*/
EVisibility GetVirtualBonePrefixVisibility() const;
/** Gets the font for displaying bone text in the skeletal tree */
FSlateFontInfo GetBoneTextFont() const;
/** Get the text color based on bone part of skeleton or part of mesh */
FSlateColor GetBoneTextColor(FIsSelected InIsSelected) const;
/** visibility of the icon */
EVisibility GetLODIconVisibility() const;
/** Function that returns the current tooltip for this bone, depending on how it's used by the mesh */
FText GetBoneToolTip();
/** The actual bone data that we create Slate widgets to display */
FName BoneName;
/** During rename we modify the name slightly (strip off the VB prefix) cache the original name here*/
FName CachedBoneNameForRename;
/** Box for the user to type in the name - stored here so that SSkeletonTree can set the keyboard focus in Slate */
//TSharedPtr<SEditableText> NameEntryBox;
TSharedPtr< SInlineEditableTextBlock > InlineWidget;
/** Delegate for when the context menu requests a rename */
DECLARE_DELEGATE(FOnRenameRequested);
FOnRenameRequested OnRenameRequested;
/** Bone proxy used for debug display */
UBoneProxy* BoneProxy;
};