I don’t know why you torturing yourself making your own settings widget, everything you see in editor mostly can be reused ;]
For starters, i don’t know if you are aware but you can easily extend editor and project settings. All settings in editor are in reality normal property editor (yes same oyu see in details) that edits settings object defaults. Make a settings class with properties, make sure to add config
specifier to UPROPERTYs and defaultconfig
in UCLASS. Then on module start up get settings module:
ISettingsModule* SettingsModule = FModuleManager::GetModulePtr<ISettingsModule>("Settings"))
Then you register settings:
SettingsModule->RegisterSettings("Project", "Category", "Section",
LOCTEXT("SettingsTitle", "Title"),
LOCTEXT("SettingsDescription", "Description"),
GetMutableDefault<UYourSettingsClass>());
If you put Project in first argument it will place in project settings while if you place Editor it will place it in Editor… or you can make your own Settings window one and use ShowViewer function in SettingsModule to display it
And there you go, then you read settings class defaults (CDO) by UYourSettingsClass::StaticClass()->GetDefaultObject<UYourSettingsClass>()
Whole system use config system so read about it:
But if you really want to make fancier custom settings menu… just use property editor widget that details, it displays properties of object or a struct and has more options then that too, first get property editor module:
FPropertyEditorModule& PropertyModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
and from there just use CreateDetailView function to generate property editor widget (function returns it)
and then call SetObject function on widget to set object that properties will be viewed:
And there you go. And yes you dont need to use this settings oyu can use this on practically anything, editor reuse property editor everywhere and saves time on UI creation since UE4 reflection system has all data needed to generate widgets.
As you may figure out (and this includes Settings extention method too, since editor settings property editor widget too) the property editor follows same specifiers on UPROPERTY of object that it views same as you do that in blueprints and actors properties on level, so to view property you need to to place EditAnywhere, also all meta specifiers will work and such same as you do that in actors classes.
The file things you trying to do it how FFilePath
and FDirectoryPath
type is displayed in property editor and you can use that with FilePathFilter="FileType"
meta specifier to filter specific type.
If im not mistaken you might also find single property display in property editor module, you might try to seek that too inf you want