Files
UnrealEngineUWP/Engine/Source/Editor/AnimationModifiers/Private/AnimationModifierHelpers.h
phillip kavan 1b6914ca4b Extends the class viewer module to support multiple custom class filters along with an optional associated view option flag.
Additional changes:
- Deprecates the previous method for specifying a singular custom class viewer filter and updates all existing occurrences of this pattern in engine code.
- Extends the property editor utilities interface to expose custom class filter(s) that can be applied to the class picker widget used for editing class property values.
- Adds an implementation of this interface to SDetailsView such that additional class filter(s) can now be configured to be applied to all underlying class property nodes.

#jira UE-108316
#rb Lauren.Barnes
#preflight 60c2102e8ae8960001110d50

#ROBOMERGE-OWNER: phillip.kavan
#ROBOMERGE-AUTHOR: phillip.kavan
#ROBOMERGE-SOURCE: CL 16623084 in //UE5/Main/...
#ROBOMERGE-BOT: STARSHIP (Main -> Release-Engine-Test) (v831-16623017)
#ROBOMERGE-CONFLICT from-shelf

[CL 16623246 by phillip kavan in ue5-release-engine-test branch]
2021-06-10 10:40:50 -04:00

63 lines
2.1 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#pragma once
#include "ClassViewerModule.h"
#include "Widgets/SWidget.h"
#include "Widgets/Layout/SBox.h"
#include "Widgets/SBoxPanel.h"
#include "Modules/ModuleManager.h"
#include "Templates/SharedPointer.h"
#include "ClassViewerFilter.h"
#include "AnimationModifier.h"
class FAnimationModifierHelpers
{
public:
/** ClassViewerFilter for Animation Modifier classes */
class FModifierClassFilter : public IClassViewerFilter
{
public:
bool IsClassAllowed(const FClassViewerInitializationOptions& InInitOptions, const UClass* InClass, TSharedRef< FClassViewerFilterFuncs > InFilterFuncs) override
{
return InClass->IsChildOf(UAnimationModifier::StaticClass());
}
virtual bool IsUnloadedClassAllowed(const FClassViewerInitializationOptions& InInitOptions, const TSharedRef< const IUnloadedBlueprintData > InClass, TSharedRef< FClassViewerFilterFuncs > InFilterFuncs) override
{
return InClass->IsChildOf(UAnimationModifier::StaticClass());
}
};
static TSharedRef<SWidget> GetModifierPicker(const FOnClassPicked& OnClassPicked)
{
FClassViewerInitializationOptions Options;
Options.bShowUnloadedBlueprints = true;
Options.bShowNoneOption = false;
TSharedRef<FModifierClassFilter> ClassFilter = MakeShared<FModifierClassFilter>();
Options.ClassFilters.Add(ClassFilter);
return SNew(SBox)
.WidthOverride(280)
[
SNew(SVerticalBox)
+ SVerticalBox::Slot()
.AutoHeight()
.MaxHeight(500)
[
FModuleManager::LoadModuleChecked<FClassViewerModule>("ClassViewer").CreateClassViewer(Options, OnClassPicked)
]
];
}
/** Creates a new Modifier instance to store with the current asset */
static UAnimationModifier* CreateModifierInstance(UObject* Outer, UClass* InClass, UObject* Template = nullptr)
{
checkf(Outer, TEXT("Invalid outer value for modifier instantiation"));
UAnimationModifier* ProcessorInstance = NewObject<UAnimationModifier>(Outer, InClass, NAME_None, RF_NoFlags, Template);
checkf(ProcessorInstance, TEXT("Unable to instantiate modifier class"));
ProcessorInstance->SetFlags(RF_Transactional);
return ProcessorInstance;
}
};