[Slate] How to create a FilePicker-Widget

Hi UE-Devs,

i wanted to recreate a file-picker widget for a editor-plugin.

339198-filepicker-widget-ue.jpg

I used the Widget Reflector to search for an existing widget inside the Unreal-source.

But the problem is that the source is developed so universal, that i couldn´t dive deep enough to find the code snippet i need.

I don´t want to recreate all the Interfaces and BaseClasses, just to create a “file-picker-widget”.

Is it really needable to create all the SWidgets from scratch to achieve this ? I started to do this but in my naive mindset i thought that there have to be an existing struct or something.

This:

looks like this:

The deepest class i digged into is “SDetailSingItemRow.cpp” but i could not use this directly due missing parameters.

I googled now the fourth day in a row, but could not find an satisfying answer.

Can anybody help me ?

Thanks,

Simon

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

Hi ,

thanx for the detailed answer. Appreciate it. And yes it really felt like a torture XD . And thats the point. How do you know this? I searched the internet for days and could not find the “correct way / best practices” . Did i miss something crucial ? In the epic documentation i also could not find these “shortcuts” how to make my own Settings, maybe because i didn´t know that i can use the Settingsmodule.

I will get back asap.

Ahhh maybe my explanation of the problem was a bit misleading.

I don´t want to specify custom settings.

I want to create a tool which i can excute in the editor (as a plugin) and which performs certain 2D - stuff. This i need to improve and speed-up the workflow.

For this i need widgets like a file-picker, whereby i can select a PNG-spritesheet from the local disk, then press a button and this automatize some 2D workflows.

But maybe i can also use custom EditorSettings for this

Hi,

the workflow with the settings is really a huge time saver :slight_smile: . But how can i find the appropriate UProperty - objects for the custom Settings-class ?

Now i know i searched via the widget reflector too deep. Now i know i can look for Settings. But i want for example a simple Button (like this one from the crypto section)

What is a good workflow to search and find the appr. location in the source-code of ue ?


My current state:

With

and

we have this:

Thanks,