Slate Samples
Unreal editor ui framework인 slate에 대한 예제이다.
SButton
#include "Widgets/Input/SButton.h"
TSharedPtr<SWidget> FMyPluginModule::Create()
{
return SNew(SButton)
.Text(WidgetText)
.OnClicked(FOnClicked::CreateRaw(this, &FMyPluginModule::OnClickButton));
}
FReply FMyPluginModule::OnClickButton()
{
UE_LOG(LogTemp, Warning, TEXT("OnClickButton"));
return FReply::Handled();
}
SAssetSearchBox
// "EditorWidgets" Module
#include "SAssetSearchBox.h"
TSharedPtr<SWidget> FMyPluginModule::Create()
{
return SNew(SAssetSearchBox)
.OnTextChanged(FOnTextChanged::CreateRaw(this, &FMyPluginModule::OnSearchBoxChanged))
.OnTextCommitted(FOnTextCommitted::CreateRaw(this, &FMyPluginModule::OnSearchBoxCommitted))
.DelayChangeNotificationsWhileTyping(true)
.HintText(LOCTEXT("SearchHint", "Search..."));
}
// searchbox 내부 텍스트 변경 시 호출
void FMyPluginModule::OnSearchBoxChanged(const FText& InSearchText)
{
UE_LOG(LogTemp, Warning, TEXT("OnSearchBoxChanged %s"), *InSearchText.ToString());
}
// searchbox 내부 텍스트 커밋 시 호출
void FMyPluginModule::OnSearchBoxCommitted(const FText& InSearchText, ETextCommit::Type CommitInfo)
{
UE_LOG(LogTemp, Warning, TEXT("OnSearchBoxCommitted %s"), *InSearchText.ToString());
}
AssetSelector
// "AssetManagerEditor" Module
#include "AssetManagerEditorModule.h"
TSharedPtr<SWidget> FMyPluginModule::Create()
{
return IAssetManagerEditorModule::MakePrimaryAssetTypeSelector(
FOnGetPrimaryAssetDisplayText::CreateRaw(this, &FMyPluginModule::GetDisplayText),
FOnSetPrimaryAssetType::CreateRaw(this, &FMyPluginModule::OnTypeSelected));
}
FText FMyPluginModule::GetDisplayText() const
{
return FText::FromString(FString(TEXT("ABCDEFG!!")));
}
void FMyPluginModule::OnIdSelected(FPrimaryAssetId AssetId)
{
UE_LOG(LogTemp, Warning, TEXT("OnIdSelected !!!!!!!!!!!!!!!!!!!!!!! %s"), *AssetId.ToString());
}
Notification Popup
void FMyPluginModule::OnConsoleCommand2()
{
const FText NotificationErrorText = LOCTEXT("MyNotification", "write some text here.");
FNotificationInfo Info(NotificationErrorText);
Info.ExpireDuration = 5.0f;
FSlateNotificationManager::Get().AddNotification(Info);
}
Message Dialog
...
FMessageDialog::Open(EAppMsgType::Ok, FText::FromString(TEXT("message here!")));
...
'게임 엔진 > Unreal' 카테고리의 다른 글
[Unreal] [Editor] Slate를 이용한 에셋 경로 설정 다이얼로그 제작 (0) | 2020.06.24 |
---|---|
[Unreal] [Editor] [Example] Slate 예제 1 (0) | 2020.06.22 |
[Unreal] [Editor] Unreal Plugin 제작 방법 (0) | 2020.06.16 |
[Unreal] Animation Notify를 이용한 충돌처리 (AnimNotify, Collision) (0) | 2020.06.14 |
[Unreal] Physics Body의 기하 정보를 이용한 충돌처리 (0) | 2020.06.13 |