You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
#jira UE-114826 #rb na Changing Control Rig plugin directory from Engine/Plugins/Experimental/ControlRig to Engine/Plugins/Animation/ControlRig [CL 16658308 by Helge Mathee in ue5-main branch]
222 lines
7.7 KiB
C++
222 lines
7.7 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "IDetailCustomization.h"
|
|
#include "IPropertyTypeCustomization.h"
|
|
#include "Rigs/RigHierarchyDefines.h"
|
|
#include "Rigs/RigHierarchy.h"
|
|
#include "ControlRig.h"
|
|
#include "ControlRigBlueprint.h"
|
|
#include "Graph/ControlRigGraph.h"
|
|
#include "Graph/SControlRigGraphPinNameListValueWidget.h"
|
|
#include "Styling/SlateTypes.h"
|
|
#include "IPropertyUtilities.h"
|
|
#include "SSearchableComboBox.h"
|
|
|
|
class IPropertyHandle;
|
|
|
|
class FRigElementKeyDetails : public IPropertyTypeCustomization
|
|
{
|
|
public:
|
|
|
|
static TSharedRef<IPropertyTypeCustomization> MakeInstance()
|
|
{
|
|
return MakeShareable(new FRigElementKeyDetails);
|
|
}
|
|
|
|
/** IPropertyTypeCustomization interface */
|
|
virtual void CustomizeHeader(TSharedRef<class IPropertyHandle> InStructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
|
|
virtual void CustomizeChildren(TSharedRef<class IPropertyHandle> InStructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
|
|
|
|
protected:
|
|
|
|
ERigElementType GetElementType() const;
|
|
FString GetElementName() const;
|
|
void SetElementName(FString InName);
|
|
void UpdateElementNameList();
|
|
void OnElementNameChanged(TSharedPtr<FString> InItem, ESelectInfo::Type InSelectionInfo);
|
|
TSharedRef<SWidget> OnGetElementNameWidget(TSharedPtr<FString> InItem);
|
|
FText GetElementNameAsText() const;
|
|
|
|
/** Helper buttons. */
|
|
TSharedPtr<SButton> UseSelectedButton;
|
|
TSharedPtr<SButton> SelectElementButton;
|
|
FSlateColor OnGetWidgetForeground(const TSharedPtr<SButton> Button) const;
|
|
FSlateColor OnGetWidgetBackground(const TSharedPtr<SButton> Button) const;
|
|
FReply OnGetSelectedClicked();
|
|
FReply OnSelectInHierarchyClicked();
|
|
|
|
TSharedPtr<IPropertyHandle> TypeHandle;
|
|
TSharedPtr<IPropertyHandle> NameHandle;
|
|
TArray<TSharedPtr<FString>> ElementNameList;
|
|
UControlRigBlueprint* BlueprintBeingCustomized;
|
|
TSharedPtr<SSearchableComboBox> SearchableComboBox;
|
|
};
|
|
|
|
class FRigUnitDetails : public IDetailCustomization
|
|
{
|
|
public:
|
|
|
|
static TSharedRef<IDetailCustomization> MakeInstance()
|
|
{
|
|
return MakeShareable(new FRigUnitDetails);
|
|
}
|
|
|
|
/** IDetailCustomization interface */
|
|
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
|
|
|
|
protected:
|
|
|
|
TSharedRef<SWidget> MakeNameListItemWidget(TSharedPtr<FString> InItem);
|
|
FText GetNameListText(TSharedPtr<FStructOnScope> InStructOnScope, FNameProperty* InProperty) const;
|
|
TSharedPtr<FString> GetCurrentlySelectedItem(TSharedPtr<FStructOnScope> InStructOnScope, FNameProperty* InProperty, const TArray<TSharedPtr<FString>>* InNameList) const;
|
|
void SetNameListText(const FText& NewTypeInValue, ETextCommit::Type /*CommitInfo*/, TSharedPtr<FStructOnScope> InStructOnScope, FNameProperty* InProperty, TSharedRef<IPropertyUtilities> PropertyUtilities);
|
|
void OnNameListChanged(TSharedPtr<FString> NewSelection, ESelectInfo::Type SelectInfo, TSharedPtr<FStructOnScope> InStructOnScope, FNameProperty* InProperty, TSharedRef<IPropertyUtilities> PropertyUtilities);
|
|
void OnNameListComboBox(TSharedPtr<FStructOnScope> InStructOnScope, FNameProperty* InProperty, const TArray<TSharedPtr<FString>>* InNameList);
|
|
void OnStructContentsChanged(FProperty* InProperty, const TSharedRef<IPropertyUtilities> PropertyUtilities);
|
|
|
|
UControlRigBlueprint* BlueprintBeingCustomized;
|
|
UControlRigGraph* GraphBeingCustomized;
|
|
TMap<FName, TSharedPtr<SControlRigGraphPinNameListValueWidget>> NameListWidgets;
|
|
};
|
|
|
|
UENUM()
|
|
enum class ERigElementDetailsTransformComponent : uint8
|
|
{
|
|
TranslationX,
|
|
TranslationY,
|
|
TranslationZ,
|
|
RotationRoll,
|
|
RotationPitch,
|
|
RotationYaw,
|
|
ScaleX,
|
|
ScaleY,
|
|
ScaleZ
|
|
};
|
|
|
|
class FRigComputedTransformDetails : public IPropertyTypeCustomization
|
|
{
|
|
public:
|
|
|
|
static TSharedRef<IPropertyTypeCustomization> MakeInstance()
|
|
{
|
|
return MakeShareable(new FRigComputedTransformDetails);
|
|
}
|
|
|
|
/** IPropertyTypeCustomization interface */
|
|
virtual void CustomizeHeader(TSharedRef<class IPropertyHandle> InStructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
|
|
virtual void CustomizeChildren(TSharedRef<class IPropertyHandle> InStructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override;
|
|
|
|
protected:
|
|
|
|
TSharedPtr<IPropertyHandle> TransformHandle;
|
|
FEditPropertyChain PropertyChain;
|
|
UControlRigBlueprint* BlueprintBeingCustomized;
|
|
|
|
void OnTransformChanged(FEditPropertyChain* InPropertyChain);
|
|
};
|
|
|
|
class FRigBaseElementDetails : public IDetailCustomization
|
|
{
|
|
public:
|
|
|
|
/** IDetailCustomization interface */
|
|
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
|
|
|
|
FRigElementKey GetElementKey() const { return ElementKeyBeingCustomized; }
|
|
URigHierarchy* GetHierarchy() const { return HierarchyBeingCustomized; }
|
|
FText GetName() const { return FText::FromName(GetElementKey().Name); }
|
|
void SetName(const FText& InNewText, ETextCommit::Type InCommitType);
|
|
|
|
void OnStructContentsChanged(FProperty* InProperty, const TSharedRef<IPropertyUtilities> PropertyUtilities);
|
|
bool IsSetupModeEnabled() const;
|
|
|
|
protected:
|
|
|
|
FRigElementKey ElementKeyBeingCustomized;
|
|
UControlRigBlueprint* BlueprintBeingCustomized;
|
|
URigHierarchy* HierarchyBeingCustomized;
|
|
};
|
|
|
|
class FRigTransformElementDetails : public FRigBaseElementDetails
|
|
{
|
|
public:
|
|
|
|
/** IDetailCustomization interface */
|
|
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
|
|
|
|
protected:
|
|
static void OnTransformChanged(FEditPropertyChain* InPropertyChain, UControlRigBlueprint* InBlueprint);
|
|
|
|
FEditPropertyChain PoseInitialGlobal;
|
|
FEditPropertyChain PoseInitialLocal;
|
|
FEditPropertyChain PoseCurrentGlobal;
|
|
FEditPropertyChain PoseCurrentLocal;
|
|
};
|
|
|
|
class FRigBoneElementDetails : public FRigTransformElementDetails
|
|
{
|
|
public:
|
|
|
|
/** Makes a new instance of this detail layout class for a specific detail view requesting it */
|
|
static TSharedRef<IDetailCustomization> MakeInstance()
|
|
{
|
|
return MakeShareable(new FRigBoneElementDetails);
|
|
}
|
|
|
|
/** IDetailCustomization interface */
|
|
virtual void CustomizeDetails( IDetailLayoutBuilder& DetailBuilder ) override;
|
|
|
|
private:
|
|
|
|
TSharedPtr<FRigInfluenceEntryModifier> InfluenceModifier;
|
|
TSharedPtr<FStructOnScope> InfluenceModifierStruct;
|
|
};
|
|
|
|
class FRigControlElementDetails : public FRigTransformElementDetails
|
|
{
|
|
public:
|
|
|
|
/** Makes a new instance of this detail layout class for a specific detail view requesting it */
|
|
static TSharedRef<IDetailCustomization> MakeInstance()
|
|
{
|
|
return MakeShareable(new FRigControlElementDetails);
|
|
}
|
|
|
|
/** IDetailCustomization interface */
|
|
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
|
|
|
|
FText GetDisplayName() const;
|
|
void SetDisplayName(const FText& InNewText, ETextCommit::Type InCommitType, const TSharedRef<IPropertyUtilities> PropertyUtilities);
|
|
bool IsGizmoEnabled() const;
|
|
bool IsEnabled(ERigControlValueType InValueType) const;
|
|
|
|
const TArray<TSharedPtr<FString>>& GetGizmoNameList() const;
|
|
const TArray<TSharedPtr<FString>>& GetControlTypeList() const;
|
|
|
|
private:
|
|
TArray<TSharedPtr<FString>> GizmoNameList;
|
|
static TArray<TSharedPtr<FString>> ControlTypeList;
|
|
TSharedPtr<FRigInfluenceEntryModifier> InfluenceModifier;
|
|
TSharedPtr<FStructOnScope> InfluenceModifierStruct;
|
|
FEditPropertyChain PoseCurrentChain;
|
|
FEditPropertyChain OffsetPropertyChain;
|
|
FEditPropertyChain GizmoPropertyChain;
|
|
};
|
|
|
|
class FRigNullElementDetails : public FRigTransformElementDetails
|
|
{
|
|
public:
|
|
|
|
/** Makes a new instance of this detail layout class for a specific detail view requesting it */
|
|
static TSharedRef<IDetailCustomization> MakeInstance()
|
|
{
|
|
return MakeShareable(new FRigNullElementDetails);
|
|
}
|
|
|
|
/** IDetailCustomization interface */
|
|
virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;
|
|
};
|