Files
UnrealEngineUWP/Engine/Source/Editor/DetailCustomizations/Private/KeyStructCustomization.cpp
jules blok fafe22eea5 Deprecate MotionController keys
- Allow keys to be flagged as "bindable in blueprints" and "bindable to actions" separately
- Mark all keys intended for XR projects as not bindable in blueprints
- Mark MotionController keys as not bindable to actions as well
- Replace the SteamVRController module with SteamVRInput based on the marketplace plugin

#rb keli.hlodversson
#jira UE-78930

#ROBOMERGE-SOURCE: CL 9960925 in //UE4/Release-4.24/...
#ROBOMERGE-BOT: RELEASE (Release-4.24 -> Main) (v558-9892490)

[CL 9960926 by jules blok in Main branch]
2019-11-01 15:43:44 -04:00

77 lines
2.0 KiB
C++

// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
#include "KeyStructCustomization.h"
#include "DetailWidgetRow.h"
#include "SKeySelector.h"
#include "UObject/UnrealType.h"
#define LOCTEXT_NAMESPACE "FKeyStructCustomization"
/* FKeyStructCustomization static interface
*****************************************************************************/
TSharedRef<IPropertyTypeCustomization> FKeyStructCustomization::MakeInstance( )
{
return MakeShareable(new FKeyStructCustomization);
}
/* IPropertyTypeCustomization interface
*****************************************************************************/
void FKeyStructCustomization::CustomizeHeader( TSharedRef<class IPropertyHandle> StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils )
{
PropertyHandle = StructPropertyHandle;
// create struct header
HeaderRow.NameContent()
[
StructPropertyHandle->CreatePropertyNameWidget()
]
.ValueContent()
.MinDesiredWidth(125.0f)
.MaxDesiredWidth(325.0f)
[
SNew(SKeySelector)
.CurrentKey(this, &FKeyStructCustomization::GetCurrentKey)
.OnKeyChanged(this, &FKeyStructCustomization::OnKeyChanged)
.Font(StructCustomizationUtils.GetRegularFont())
.AllowClear(!StructPropertyHandle->GetProperty()->HasAnyPropertyFlags(CPF_NoClear))
.FilterBlueprintBindable(false)
];
}
TOptional<FKey> FKeyStructCustomization::GetCurrentKey() const
{
TArray<void*> StructPtrs;
PropertyHandle->AccessRawData(StructPtrs);
if (StructPtrs.Num() > 0)
{
FKey* SelectedKey = (FKey*)StructPtrs[0];
if (SelectedKey)
{
for(int32 StructPtrIndex = 1; StructPtrIndex < StructPtrs.Num(); ++StructPtrIndex)
{
if (*(FKey*)StructPtrs[StructPtrIndex] != *SelectedKey)
{
return TOptional<FKey>();
}
}
return *SelectedKey;
}
}
return FKey();
}
void FKeyStructCustomization::OnKeyChanged(TSharedPtr<FKey> SelectedKey)
{
PropertyHandle->SetValueFromFormattedString(SelectedKey->ToString());
}
#undef LOCTEXT_NAMESPACE