#slate
1 messages · Page 24 of 1
SRichTextBlock doesn't use data tables
Only the UMG variation does
And that data table is used by a custom decorator
I'm trying to do a UX improvement to a custom vertical drag & drop vertical box and I'm wracking my brain how to do it.
The issue is users often overshoot the top or bottom of the box, and they want dropping outside the top/bottom to be detected as dropping to be the first/last item in the list.
The problem is I'm not sure how to connect a live drag event to my vertical box. Currently I just use OnDragOver to show where the item would end up when dropped
I could change my VerticalBox to keep a ptr to any live drag & drop, and on tick use the Y position of the mouse to give a more generous "snapping" to the drop but it seems kind of gross, and wouldn't work well with dragging between multiple folders
I'll say this: most everything has this issue. Photoshop I struggle every time I try to get a layer to the very top or very bottom or between folders. I'd say a temporary visual of where it would be slotted would help prevent someone thinking they successfully placed it. That's assuming if the issue is someone overshoots the top and thinks they placed it correctly and release the mouse only to see it not move.
Or you could do a little color indicators like turn the drag item to have a color border and then color the top/bottom of the other one to show where it'd slot.
photoshop does this
something similar would be:
assuming the color tells you where it ends up
Yeah we have a color bar that shows where it will end up, the problem is it's done via hover
so in that screenshot, because you're not over the vertical box, it won't actually be dropped at the topmost slot
@rocky abyss to get it to drop at the topmost slot, you have to mouse-over the top half of Dismantle
can you extend the padding? and adjust via the layout?
in theory just put an extra 20px on top padding
I wonder if hover takes into account the padding
Hi, any ideas on how to go about making a DetailCustomization so that I can change the UI for making a Map(dictionary) from 2 text fields for Key and Value to 2 combobox (dropdowns)? I have made a Text input into a combobox for an Array using FDetailArrayBuilder but did not find anything similar for customizing a TMap
Since I want to make a way to customize setting a pair of values together, each pair is now a simple string and shows up in the FDetailArrayBuilder as a dropdown. The next part of the problem is when the selection changes in the dropdown how do I convert my pair from string back into its FPairStruct version using the PropertyHandle in OnSelectionChanged?
ChildHandle->SetValue only allows basic types like int,string,etc how do I set a struct type?
is there a way to draw just a square with a diagonal line by line in a slate widget (i want to add it to a detail customization
Are we expected to subclass FCoreStyle to support our own custom styles like this?
There is more than one way to use styles
This is how we used them : https://github.com/arbonagw/HeliumRain/tree/master/Source/HeliumRain/UI/Style
I pretty much went the same way as @quaint zealot
The trouble with what you're trying to do there, @mild oracle, is that you're requesting something from the style that hasn't been set in it
Unless you're inserting your FBYGButtonStyle into FCoreStyle elsewhere
I have created my own SWidget child (MyImageWidget) and I would like to change the behaviour of Paint(...) function inherited from SWidget. Sadly it is not virtual, but it feels like something that should be virtual. Except from editing the source, any ideas how to override it?
I find that SSlider is a good example for how OnPaint can be overridden
@quaint zealot Thanks, sadly it didn't do the trick. I wanted to change the ZOrder (LayerID) of my widget that is spawned in SGraphPanel and paint under all other widgets/nodes. Similar to the Comment Node, which is rendered beneath all other nodes.
The problem is that SGraphPanel has HARDCODED exception for Comments which positions them under everything
@gritty frigate Thank you too for the SSlider hint
👍
why am i getting unresolved symbol linker errors when i try to use SNumericEntryBox<float> for things like public: virtual class FReply __cdecl SSpinBox<float>::OnKeyDown i have sltae and slate core in my modules and i tried including the numeric entry box header in both my header and source files
What's the error
Module.HorizonVideoWallEditor.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FKey::~FKey(void)" (__imp_??1FKey@@QEAA@XZ) referenced in function "private: virtual class FReply __cdecl SNumericEntryBox<float>::OnKeyDown(struct FGeometry const &,struct FKeyEvent const &)" (?OnKeyDown@?$SNumericEntryBox@M@@EEAA?AVFReply@@AEBUFGeometry@@AEBUFKeyEvent@@@Z)
i have 11 of them
but they are all like that
That's quite weird because SNumericEntryBox is a template and so OnKeyDown is in header
lets see what regeneratign the files does
and yeah i have noticed a bunch of issue where stuff being included in headers doesn't actually matter
i'm halfway considering doing a stream and actually taking the time to learn and write up to date documentation on slate and customizations for the community wiki
ooooooh
kill me
well i got rid to 10 if them by including inputcore
and the last one by including editorstyle
sure glad there is an abundance of info there
Ah, that's my fault, I misread the log
unresolved external symbol "__declspec(dllimport) public: __cdecl FKey::~FKey(void)" (__imp_??1FKey@@QEAA@XZ
Googling "UE4 FKey" gives you the module to use
yeah i just ended up VAXing it
still would be nice to have real documention so i might spend some time working on that
anyone have advice for drawing graphs or a curve with a set of points in slate?
also is it possible to have a border with a dashed line?
you've got FSlateDrawElement::MakeLines you can use
I'm trying to get a pause/mission list widget to appear on top of all other widgets, but it seems like no matter what I do it always is created towards the back of the z-index. anyone know how to change this?
Well, how are you doing it ?
it's summoned with a keyboard input. Uses set input mode UI only.
How are you adding your widget to the screen
@quaint zealot I actually figured it out. Instead of just adding it to the viewport I'm now adding everything to a master HUD widget. but now I'm having some problems with other widgets not displaying as I want them to. Their width stays about the length of the original text block, rather than extending to the width of the canvas panel or to the width of the text that is fed into them. its always something haha
I mean this is kind of why Slate is deprecated for game UI
Anyway, you should be able to add widgets as they are to the game viewport using a fixed z index
@quaint zealot im not too big a fan of it. Is it like Matinee where they've begun phasing it out, or are we stuck with it in unreal?
Slate is not going anywhere
It's also not getting any feature
(Or documentation, or...)
Slate exists to be Slate, it just is
Greetings. I have a UMG related question. How to properly make Scrollbar BG image?
i've tried a variety of ways and all of them not scaling properly with a scrollbars
i'm having an issue where when i selected a new option in my scombobox it changes in game but not in the actual widgets display
uint8 ScreenDiagonalMeasurementUnitCurrentValue;
ScreenDiagonalMeasurementUnitPropertyHandle->GetValue(ScreenDiagonalMeasurementUnitCurrentValue);
ScreenDiagonalMeasurementUnitComboBox = SNew(SComboBox<ScreenMeasurementUnitPtr>)
.OptionsSource(&MeasurementUnitOptions)
.OnGenerateWidget(this, &FVideoWallScreenDetails::OnGenerateScreenDiagonalMeasurementUnitWidget)
.OnSelectionChanged(this, &FVideoWallScreenDetails::OnScreenDiagonalMeasurementUnitOptionSelected)
.InitiallySelectedItem(MeasurementUnitOptions[ScreenDiagonalMeasurementUnitCurrentValue])
[
SNew(STextBlock)
.Text(this, &FVideoWallScreenDetails::GetCurrentScreenDiagonalMeasurementUnitDisplayText)
];
it displays the correct options in the drop down and even has the correct on option selected behavior
it just doesn't actually ever change which value is displayed
Anyone know if there's some method for doing ListView pagination either via Slate or UMG? Eg. instead of scrolling, you'd only show as many items as fully fits within container, and then next page / prev page buttons
Been trying to look into this but haven't had much luck with google and looking through the code for how this could be achieved
Assuming the child items might take different amounts of space
@orchid nova you could call GetDisplayedItems to get the max it can show then use that length - 1 or -2 that becomes your offset (this is to try to clip left/right half visible objects), then when you want shift pages on some button press you can call ScrollIndexIntoView and give it currentIndex + offset to go ahead or currentIndex-offset to go back a page. Don't forget to check if you go below zero or above the length of the items. Don't know if this would work for items that take different amounts of space though. On the forums, this looks like want you want but he hasn't really described how he did it https://forums.unrealengine.com/community/community-content-tools-and-tutorials/1595437-listview-getting-started-in-bp?p=1751822#post1751822
I am creating this guide since I had trouble grasping the listview at first, seeing many have the same struggle and there not being any good information about them in a blueprint context.
The listview should be pretty straight forward to use once you got the basic grasp of it....
Hello. Is there a way to load a user widget without a world present? Trying to provide an option for custom user widgets during map transitions and startup. Right now my thinking is that if I can instatiate the widget without the world, it should be easy to pass off the root slate widget to moving loading screen property.
@thin briar thanks - it looks like in the forum post the items are all the same size, which is when you can just predefine how many items can be seen and you could just set that number of items and change them by page. It's where you have different sizes where it becomes problematic, I guess I'll have to see if there's some way of determining what the sizes of the individual children are and adjust based on that
Looks like it's not possible without an initial UUserWidget to construct via a WidgetTree
how to open and run .swf file in unreal engine
isn't that a flash file? There's no flash support in UE4
Yeah just noticed haha
may be you can play swf in web browser
How to get IDetailLayoutBuilder from FDetailWidgetRow?
What is a SlateUser?
If you are calling this function and want to get the user, how would you do that?
void FAnalogCursor::UpdateCursorPosition(FSlateApplication& SlateApp, TSharedRef<FSlateUser> SlateUser, const FVector2D& NewPosition, bool bForce)
Nevermind, I was misinterpreting the warning message.
Hi all. Interesting console command issue I'm having.
In 4.22, I used to use the SessionFrontend console to change tooltip timing. Slate.ToolTipDelay 1.25 for example.
I haven't used UE since then, but I've recently installed 4.25. I have a 4.25 instance of UE open, and also a 4.22 instance so I can refer to my past project.
So now in 4.25 I do the above slate console command, and it does change the tooltip delay ... ...
... ... in the 4.22 UE instance.
I tried closing both and just opening UE 4.25, and there's still no change in 4.25.
I have noticed that I can select different sessions from the Session Browser on the left. With that, I can select the session that is the UE4.22 instance and with that selected, change the tooltip timing from the console in either editor.
Ok so that makes sense.
But the same thing doesn't work if I select the 4.25 session in the Session Browser.
Mmm so maybe this session/4.22 business is just me confusing the problem. Maybe just the command has changed or something in 4.25?
Ah yeah, that was it 🙂 My entire knowledge of Slate is pretty much what I've written. But I found the dumpconsolecommands command and see they changed things a bit.
4.22 commands
Same commands in 4.25
Here's me completely confusing the issue with thinking I'm commanding the wrong editor. 😄
Hey guys, any ideas of how to do virtual joystick with buttons (with on pressed shooting event) ?
@tough badger funny story, Nick Darnell made a project for it and then Rama made it into a plugin that no longer gets support that I added more support to; https://github.com/Oldsiren/UE4GamepadUMG
So far it just has the stuff for being able to simulate the click, but the source code is there for you to look at and mess with
@narrow terrace Thx mate!
Hi, should I be using Slate to create a candlestick chart like this?
Hey guys,
I've been using a filepicker using slate in my app from this tutorial
https://www.orfeasel.com/creating-a-file-picker/
However it does not work when packed as shipping.
I see in the comments in that tutorial that you should just use UMG. Anyone else run into this problem?
I've worked around the issue by using a third party library to handle my filepicking
I'm looking to play a video in Slate, can anyone point me in the right direction? I found an old answer from 2015, but it didn't age well, those .cpp files don't even exist anymore. https://answers.unrealengine.com/questions/177550/movie-in-slate.html
I know the engine has a loading screen module, that basically plays video files by making an SImage and then setting the brush to that movie the same way you would in UMG
UI sound is not playing a sound component, when the game is pause, any idea why is it happening
Hi
I'm creating a plugin where i need a combo Box dropdown like how it is for setting or modules button
You should check the Source Code of them then
It's the easiest to get around that
Right now you have a button that opens a dialog I assume
Also you may want to enable those green text hooks to see where you are placing stuff
@low bluff yes and i tried looking for it . just not sure where the source code is location in the engine source
YourEditorCommands = MakeShareable(new FUICommandList);
// MAP ACTIONS TO YOUR COMMANDS
YourEditorCommands->MapAction(
FYourEditorCommands::Get().YourCommand,
FExecuteAction::CreateStatic(&FYourEditorCommands::OnClickedYourCommand),
FCanExecuteAction());
FLevelEditorModule& levelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");
TSharedPtr<FExtender> toolbarExtender = MakeShareable(new FExtender);
toolbarExtender->AddToolBarExtension("Game", EExtensionHook::After, YourEditorCommands,
FToolBarExtensionDelegate::CreateRaw(this, &FYourEditorModule::CreateYourEditorCommmandSettings));
levelEditorModule.GetToolBarExtensibilityManager()->AddExtender(toolbarExtender);
levelEditorModule.GetGlobalLevelEditorActions()->Append(YourEditorCommands.ToSharedRef());
void FYourEditorModule::CreateYourEditorCommmandSettings(FToolBarBuilder& Builder)
{
Builder.BeginSection(FName("YourSection"));
Builder.AddComboButton(
FUIAction(),
FOnGetContent::CreateRaw(this, &FYourEditorModule::CreateYourEditorCommmandWidget),
LOCTEXT("YourEditor_Title", "Some Title"),
LOCTEXT("YourEditor_Tooltip", "Some tooltip."),
FSlateIcon(FYourEditorStyle::GetStyleSetName(), "Your.Icon.Name"));
Builder.EndSection();
}
That should get you somewhat started
There is more code involved in TSharedRef<SWidget> CreateYourEditorCommmandWidget() to actually make entries
@low bluff thanks for the quick response will try this out
Ultimately, you need an FMenuBuilder
Hello Everyone !
I'm trying to add a New toolbar button to current Sprite Editor without Editing Engine Source(Is That Possible?).So far I've Managed to get a ref to an AssetEditorInstance but i don't know how can i get a pointer to SpriteEditor From there!
@low bluff can you help me?
Not without spending lots of time on this myself, sorry
@limpid fractal enable "show editor hooks" or whatever the option is called in the editor settings
And see if there's a hook for that specific toolbar
there was no option with that name.
Is there a Slate function for hiding the cursor directly?
FSlateApplication::Get().GetPlatformApplication().Get()->Cursor->Show(false);
TY 🙂
np 🙂
@dry geyser The widget reflector (Top Menu > Window > Developer Tools > Widget Reflector) can be useful when figuring out how to replicate stuff done in the editor GUI.
is there a way to set different bindings for button presses?
like instead of enter on the keyboard and A on the controller, use E
or something?
Hello, ppl. I wanted to add a slate element for selecting an actor from the scene. It turned out that this is in the private section of the "PropertyEditor" module and so the type is not exported. What can I do to be able to make a reference like this in mu custom details customization?
*my
you mean like GEditor->SelectActor ? Or did I misunderstand your question?
I mean to make a detail customization for a class that designers are supposed to use, and so I wanted to make a actor selection dropdown.
^
Just like marking an AActor* with the UPROPERT(EditAnywhere) decorator
This is what I was looking for:
SNew(SProperty, DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(UInstanceToolEditorUISetting, SnapOffset)))
This is the source if anybody else wonders: https://bebylon.dev/ue4guide/editor-extensions/detail-customization/detail-customization/
Gamedev Guide: Programming with Unreal Engine, Houdini, Math, & Graphics
Hi, I am trying to make a detail customization for the editor for a specific class and I am trying to expose an Actor variable that is a field in ANOTHER class. These OTHER classes are contained in an ARRAY inside the class instance for which I am making the customization. Has anybody meddled with such things here?
I am successfully getting an SProperty widget drawn with a IPropertyHandle. The problem is that when I pick an actor it is not "saved" in the field. I have tried the same thing with an actor that is immediately in the instace of the customized class and it works.
Okay, nailed it. I was overwriting my references with null objects on PostEditChangeProperty in my class (dull)
Ahh forgot about you. Since you said that you are doing a detail customization, you have a class which inherits from IDetailCustomization. There is a virtual function CustomizeDetails which has the IDetailLayoutBuilder. You can add rows to that which just uses slate code. You could add a combobox to the row to make the actor selectable.
nice
Thanks for turning in, anyway.
I am beginning to understand this. It has a bit of a slope-y learning curve to it, tho.
yeah slate is not that straight forward or rather editor customization and extension. And the pretty bad documentation doesn't help either. I usually look in the engine code to find out how certain things work.
Sure, I have to crawl the documentation more, I lack in this regard.
Anyone familiar with SBackgroundBlur flashing to white for a frame when the parent widget fades out ?
Fading the strength/radius of the blur while fading the parent widget seems to fix the issue.
@opal ledge you need to define SLATE_ARGS in the header
And then in Construct you’ll find them in InArgs
Most slate classes do this
Then you construct it like this:
SNew(SNinaLoadingScreen)
.MyString(SomeString);
yepe found it, ty!
You’re welcome 🙂
Hi, does anybody know how to create a FSlateBrush from a UTexture2DDynamic?
Have you tried calling SetResourceObject with the UTexture2DDynamic?
That's how I've done it with UMaterials in the past, but I believe that it supports various different types
Yes. If I use the normal FSlateBrush the image disappears after a short time
Not sure then I'm afraid
Garbage Collected, maybe?
Something needs to be keeping ImageTexture alive.
so what's the deal with slate global invalidation? it has been defective in every version since it was introduced
4.24: layouts are fucked
4.25: layouts are fucked
4.26: stack overflow on map transition
It seems like it was hacked together to help fortnite HUD performance but not a feature exposed well and supported. They did add a little article on it UDN in Aug? But I haven't looked into 4.26 with it
yeah it now almost seems to work, save for the crash on level transition
though my spin boxes are behaving strangely... the text doesn't change
they are probably missing some invalidation on changing the value
Hey guys What is slate 😇
it is underwear of UMG
it's even more. It's the framework which is used for every UI element in UE and the games it produces. UMG wraps that and make it more accessible.
Does anybody know how to create a custom copy/paste CopyAction for an Actor in slate? I have the following lines that bring up a "GetOuter()" access violation on line 2 during copy:
auto GoalValue = FJsonObjectConverter::UPropertyToJsonValue(Property_GoalTask_Goal, GoalTask->Goal, 0, 0);```
hey, trying to make a custom property in the editor using a Details Customization, and I'm trying to get the Reset to Default button to disappear. There's a bool for it in the "CreatePropertyNameWidget" function, but the arrow is still showing up
Can anybody explain to me how to use ShowVirtualKeyboard on https://docs.unrealengine.com/en-US/API/Runtime/Slate/Framework/Text/FGenericPlatformTextField/index.html
Maybe not what you are looking for but there is also a meta UPROPERTY tag for it. meta = (NoResetToDefault)
Having trouble justifying the text on my CheckBox
Its like its getting cut off ..
Its an VBox, with an Hbox and a SearchBar inside
The HBox has a ChecBox and a TextBox
I'll try it thank you!
didn't work, unfortnately. Still seeing the reset to default button after hitting compile even after adding that meta specifier to all relevant data.
This actually worked for me - I had to put the meta specifier in all of the variables, and headers related to the process (all variables and classes / structs within classes / structs) and it disappeared, thank you!
I'm making a hierarchy following the SHierarchyView and SHierarchyViewItem pair, but I don't see where's the logic for adding/removing an Item to/from the View. Anyone's familiar?
I don't have much experience with slate so if someone could help me that i would greatly appreciate it!
I would need some help with adding this combo box...
to this single property
Anyone know how to not get mouse events when using a windows touch screen? I get the long press pop up doing right clicks etc. and don't want it
Touch joystick controls work but send mouse events at the same time unless I press and hold somewhere else while using them (and then that place gets a mouse click)
All my stuff is working with pixel streaming, no mouse events like that for first touch finger through pixel streaming, but it is not working correctly when using a multitouch monitor natively and is adding on those mouse events
seems this may be the answer, haven't tested yet:
/**
* Hack to get around multiple mouse events being triggered for touch events.
* Enabling this will prevent pen tablets from working since until we switch to the windows 8 sdk (and can use WM_POINTER*) events we cannot detect the difference
*/
static int32 bPreventDuplicateMouseEventsForTouch = false;
FAutoConsoleVariableRef CVarPreventDuplicateMouseEventsForTouch(
TEXT("Slate.PreventDuplicateMouseEventsForTouchForWindows7"),
bPreventDuplicateMouseEventsForTouch,
TEXT("Hack to get around multiple mouse events being triggered for touch events on Windows 7 and lower. Enabling this will prevent pen tablets from working on windows 7 since until we switch to the windows 8 sdk (and can use WM_POINTER* events) we cannot detect the difference")
);```
Hmm, didn't seem to fix it
Is the documentation incorrect? This piece of code did not work for me. I had to do this.
GEngine->GameViewport->RemoveViewportWidgetContent(ObjectiveWidget.ToSharedRef());
Does anybody know if I can create a widget that is copy/paste-able. For example when I "AddCustomRow()" -> it is copy-pastable by default. However this is a special class designed to be a row in the detail view that is copy-pastable by default. Can I wrap an SWidget in some class that allows me to have a copy paste functionality, that allows me to bind a method to a delegate?
For example, when I add an SProperty of a class reference it is copy-paste-able in the editor but it does not expose any delegates inside of the SProperty class.
Hey, creating an Mode plugin, it initially comes with,
void FModeToolkit::Init(const TSharedPtr<IToolkitHost>& InitToolkitHost)
struct Locals
{
static bool IsWidgetEnabled()
{
return GEditor->GetSelectedActors()->Num() != 0;
}
...
SAssignNew(ToolkitWidget, SBorder)
.HAlign(HAlign_Center)
.Padding(10)
.IsEnabled_Static(&Locals::IsWidgetEnabled)
[
...
Now, I don't know what I am doing, so I of course went on to try and copy paste this behaviour, since I want either one of two outcomes to appear in the widget depending on an TArray has been initialised. But this would end up like
void FModeToolkit::Init(const TSharedPtr<IToolkitHost>& InitToolkitHost)
struct Locals
{
static bool IsEmpty(const TArray<uint8> Array)
{
return Array.Num() == 0U;
}
...
SAssignNew(ToolkitWidget, SBorder)
.HAlign(HAlign_Center)
.Padding(10.0f)
.Visibility_Static(&Locals::IsEmpty) // Need to pass in TArray somehow
[
How can I pass the function parameter in this case? And I suspect there is a better way of doing this in the first place
Does anyone know how to create graphs for plotting data in Slate? Or know of any tutorials anywhere to get me started
Your best bet is probably to override OnPaint yourself
You can call FSlateDrawElement::MakeLines() based on the data you're currently holding
Free plugin that does it:
https://www.unrealengine.com/marketplace/en-US/product/89bd18db011b4bd19606db2e31020f13
^ Or that 🙂
Hey guys! Do you know if it's possible to make a SlateBrush consisting of an image which will be centred into its container?
Basically a SlateBoxBrush, but without the center stretching (only the corners)
maybe try something like this:
{
return Array.Num() == 0;
})```
Thanks for the reply - Thats actually also what i ended up doing..!
Has anyone tried writing tests for Slate/UMG elements that require visual inspection? I'm trying to work out how to do it.
I want to create a window with some automatically-created widgets and check if they look right. Are there any examples of this in the codebase that anyone knows of?
I'm writing an editor plugin, and I want to embed a UWidget subclass in a SDockTab... am I out of luck? Is there any way to do it?
No
I'm not aware of that but an UUserWidget has a SlateWidget anywhere in it but I'm not sure if you can access it somehow to make it natively work inside a SDockTab.
I'd say if you have an use case where you need slate you can dig into it then, for the most use cases UMG are just fine. I'm not quite sure what's not present in UMG for what you would need slate, except if you want to write Unreal Editor plugins. Since the Editor uses Slate and not UMG you'd have to use Slate to write UI code for an editor plugin.
Actually you can use UMG for editor plugins
So you can use UMG to create Docktabs and stuff? Didn't know that
Has anyone tried the ActionRPG's LoadingScreen module on 4.26? (or any material loading on preloading screen phase?). on 4.24.3 i can succesfully load a material and initialize the FSlateDynamicImageBrush but now it doesn't work (when the module starts). It does works when called with the game loaded.
Uhh
I don't think my slate memory is clearing after PIE
Frames get lower and lower in the editor with each play session
Do you have your own Slate code?
Yes
But I destroy them when I stop play (to my knowledge, at least: they aren't on the screen anymore)
You're using TSharedPtr, right? If you have a circular reference (widget A has a TSharedPtr to widget B, and widget B has a TSharedPtr to widget A), then the memory won't be freed
is it generally safe to have two delegates with the same signature and assign one delegate variable with the other type?
I believe so
delegates are just typedefs
I’m using slate as it pertains to custom UMG widgets. My understanding is that the UMG class is suppose to point to the slate class
If you're using UMG there is no reason to suspect Slate mismanagement of memory
And that profiler log is weird
8ms draw for editor Slate isn't shocking
2.8ms exclusive time for the draw on the same line makes no sense
Hmm good point
Well whatever it is, it's killing the editor framerate like crazy
Wonder what the best plan to debug this would be. Guessing there is some sort of slate debug tool I can use?
Help! My ComboBox is showing weird. Items work, and items are selectable, but the actual display isn't the item.
I have onGenerateWidget_lambda
You also need a child widget
OnGenerateWidget is for the content in the drop-down
and the child widget is for what it looks like inside the combo box itself
Is there any way to draw UTexture2D screen space using Slate? As DrawLines is working screen space and DrawBox is working relative to panel UV :/
I'm trying to use AllottedGeometry.AbsoluteToLocal(IconLocation) Absolute To Local but it doesn't match the lines that I'm drawing
Does anyone know how can i modify colors of UnrealEd? I already found "%Engine%/Content/Editor/Slate" folder, where i can change different slate textures and assets of editor. I already changed some bars and panels. But i still didn't find where can i change bars like toolbar or content browser. What can i do with this?
(reposting from #cpp) Anyone have much experience with creating UUserWidgets in C++? Having a strange issue. Whenever I return a reference to a (fully constructed) SWidget in the overriden RebuildWidget(), which is also kept as a TSharedPtr variable in the UUserWidget, it causes a stack walk and dump when compiling a child blueprint of the widget for the first time after an editor restart:
Ensure condition failed: !PreviewSlateWidgetWeak.IsValid()
This does not occur if I simply return a shared reference to an SWidget that is not stored as a SharedPtr variable in the UUserWidget. Anyone have any idea what could be causing this?
(mulitple returns are just so I could put the notes about each case in the screencap)
I figured it out. WidgetBlueprintEditor checks to make sure the cached widget is destroyed after ReleaseSlateResources is called on the UserWidget.
I had to override ReleaseSlateResources in the UUserWidget and set the RootCanvas to nullptr
Hi there
I'm just getting into plugins
Could anyone please explain these few lines of code to me please?
#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define BOX_BRUSH( RelativePath, ... ) FSlateBoxBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define BORDER_BRUSH( RelativePath, ... ) FSlateBorderBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define TTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".ttf") ), __VA_ARGS__ )
#define OTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".otf") ), __VA_ARGS__ )
These are macros
I don't know where you found that but this isn't stuff you should use
Brushes and fonts should be fetched directly from assets, not png files
@quaint zealot That's weird, basically all slate stylesets in the editor use this method to load images
Yeah, and most of it is from 2013 or so
Assuming this is only for editor stuff that will never make its way into the game, feel free to keep doing that
@quaint zealot I'm writing a plugin now, and using this method. I guess I would have to change it to a plugin that allows content, import the icons to the plugin's Content folder and change the loading method?
Ah, yeah this is for editor-only icons so I guess it's ok
I don't know really, I haven't done that manual stuff since 5 or 6 years ago
I only use stylesets + style assets
Can you share how you load your style assets for editor stuff?
This is the default editor window plugin template
🤷♂️
I'm just trying to figure out what it does and how haha
This is my first time making a plugin
KaosSpectrum already helped me with what they do, however
@mild oracle Look for FSlateWidgetStyle in the engine source, you'll find a lot of plugins and engine stuff implementing custom style assets. Get the style assets from
Basically using a style set to centralize styling
And then getting style assets from content
@lucid dagger These macros simply create Slate assets directly, manually, from uncooked, non-uasset files on the hard drive
One for each type of resource
No, my method isn't simpler at all, but it uses uasset files that you can package with a game
If you just want to make an editor only plugin, stick to the method you found
so then there's no need to depend on packaged uassets
No there isn't indeed
This is editor customization question, but I'm not sure where else to ask it. I have an object that contains an array of other objects, and I'm trying to customize the editor so it doesn't show them with the little pop-out arrows.
I'm using AddExternalObjects currently get the children, but it always seems to add them with the arrow.
Anyone got any pointers?
Nvm I did it by using TFieldRange<FProperty>
Is there a way to tell Slate to not draw the UI layer?
Like, is there a way to hide the entire HUD from drawing (marketing wants to take video without any UI).
@spring frost sorry to bother you like 5 hours later, but what I've done is getting the game viewport client->GetWindow()->SetRenderOpacity or you can set the visibility to hidden. This is the slate widget that holds all the UMG Ui related stuff. If you wanna dig into places where this is implemented/messed with in the engine. Inside UnrealClient.h/.cpp & GameViewportClient.h/.cpp The FScreenshotRequest class and FViewportClient talk to each other regarding screenshots for showing it with or without Ui
Awesome, thanks, very helpful information. Ill see what I can find.
if(UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull))
{
World->GetGameViewport()->GetWindow()->SetRenderOpacity(bShowUi ? 1.0f : 0.0f);
}
👍
@spring frost As far as I know you have to implement that yourself with a shortcut to remove or hide your widgets
Hey everyone! Sorry if is a bit of a noob question, but im looking to add a TMap to a specific details panel. Ive got an array being added there just fine using the FArrayBuilder stuff - is there anywhere i can look for an example of how to add a TMap i a similar fashion?
apologies if this is a bit of a no-brainer - just getting started with Slate!
Hey there guys, you got any handy examples of widgets and the slate code constructing them? I just feel the need to have some stuff to look at so I can see how to do the stuff I wanna do
there's a lot of widgets to choose from as a base, it'd be nice to see how they're used by others alongside pictures of the resulting UI
I find that SSlider is a good example of using OnPaint
@midnight fjord SImage is pretty simple too
Thanks!
Also, look at anything that subclasses SCompoundWidget. That will show off how to combine other widgets into one
Hm, I'm having a little issue I hope it's nothing too obvious - I'm making new widgets inheriting from SBox and SCompoundWidget - but while I can instantiate both of these parent classes using SNew(), the resulting child class results in an error. Is there something I should be overriding, or is SNew meant to work exclusively with vanilla UE4 widgets?
void SPlayerHUDOverlayWidget::Construct(const FArguments& InArgs)
{
auto Canvas = SNew(SCanvas);
ChildSlot[Canvas];
auto& LookActionList = Canvas->AddSlot();
LookActionList.HAlign(EHorizontalAlignment::HAlign_Center);
LookActionList.VAlign(EVerticalAlignment::VAlign_Center);
LookActionList[SNew(SLookActionList).OwnerHUD(OwnerHUD)];
}
adding code block just in case
The error simply complains about the [] operator not taking the argument
no operator "[]" matches these operands
operand types are: SCanvas::FSlot [ TSharedRef<SLookActionList, ESPMode::NotThreadSafe> ]
The error occurs on the last line, where I'm trying to instantiate SLookActionList in a newly created slot
And just in case its needed, here's the header of SLookActionList: https://hatebin.com/fhdetgqfne
Is there a reason you're doing an in-game HUD in Slate btw and not using UMG? There's very little reason to use slate for game UI now, unless you want to make a new custom widget type
@craggy holly I want options for custom widget types when needed, yes, but I'm also a one-man team and dragging UMG and blueprint stuff around actually hurts my wrist. It's one of the big reasons why I avoid the editor as much as possible
Don't worry as soon as I'm past the growing pains with the Slate system I'll be out of your hair
I don't mean it as a slight, but using Slate for in-game UI is generally just not advised as it creates a lot of additional challenges.
For an example of a full game UI done in Slate, you can study Epics' ShooterGame sample from the launcher.
Thanks, I'll take a look
Quick question! I dropped in a couple SImage widgets as a test, and for some reason despite being set to being a solid color its checkered? What's up with that?
So images have a "Brush" which is either a texture or material etc. that defines how they look, I think if you don't give it an object to draw (e.g the tex or material) it just falls back to a default one
I suspect anyway. There is a "default" brush which is just a white square texture
@craggy holly gotcha! thanks
hi, I'm cross-posting a problem from the cpp channel, because Slate makes everything bad. Sorry if I don't speak fluent c++. Basically I have this delegate? function I want to attack to an IsEnabled ... thingy. Nothing fancy.
I want to try and simplify my Slate stuff because reasons, to turn the commented out bit into the function call shown
this is the function I want to call
and this happens (not exhaustive list)
I just want to pass a sodding pointer to my function basically
everything is defined within the same class (FRandomManagerEdModeToolkit)
I have spent 3 hours on this syntax problem and I hate everyone involved in the decision to make Slate but not document it properly
This isn't how you use function pointers in Slate
You can't use C style function pointers
AddButton needs to be passed the delegate type expected for the button callback
(Like FOnClicked or whatever variant)
You then create a binding by using e.g. FOnClicked::CreateSP(this, &class::method) and pass that to AddButton
Obviously this isn't exactly trivial if you're not familiar with C++, Slate is hell to people unexperienced with the language
Search in the editor source for examples
Thanks - I did, but actually all I find is the standard form
.Whatever (this, &myclass::function) and none of the creating binding stuff. This is just for building up multipart widgets for an edit mode tab
Maybe the .Whatever bit hides the binding
I thought i knew c++ but everything is indeed hell. I am spending weeks just dealing with magic made up c++ syntax that isn't documented at all
Perhaps i should apply for a Epic grant to pay someone to write this stuff up, because it's obviously beyond them
@past swallow Just follow the tips I gave you - FOnClicked parameter to your function (for OnClicked, whatever other callback type for others), and FOnClicked::CreateSP(this, &class::method) to build the parameter when calling.
I don't know if it works but finally it compiles. I think I understand why people don't bother doing this sort of thing. Commented code is what the function call replaces
part of the plan was to make everything more user-friendly to a non Slate expert (i.e. me). Back to the drawing board on that one!
sorry, my struggle continues and I would be grateful for any further help
I've pretty much copied this straight off the UE4 demo code, looking to make a listview. I've simplified it to just using TSharedPtr<FString> types
I've adapted the demo generate widget code to this
compiler chokes with this
I can't see any significant difference compared to the demo code
any ideas?
the demo code used a custom table row widget derived from SMultiColumnTableRow
here's the demo code I was copying
this is the slightly more involved code to generate a widget from the demo code
here's the SItemEditor custom widget definition
definition of GroupListView:
ultimately what I'd like to do is display this struct in the listview
I think I have to go the whole hog and make a new class derived from SMultiColumnTableRow? e.g.
: public SMultiColumnTableRow< FDisplayedRetargetSourceInfoPtr >```
Any good tutorials out there for learning the basics for Slate? From a starting point I think I can figure out the rest there, but hard to find a step one for dummies
nevermind found a good tutorial to get me going
Hey guys, any clue what "size to content" is in Slate? For SBorder and such
it will size that container to the size of content inside that container
@mental badge No, I meant like whats the equivalent of it in Slate? Cuz the Border widget in UMG has that, but I'm working with slate and I'm looking for the way to achieve the same effect
I tried using ComputeDesiredSize and applying it to the SCanvas slot containing the border, but I'm getting some inconsistent results that don't actually match the size of the widget I'm getting the size from.
Please excuse my stupid ass
This was a property of SConstraintCanvas, not SCanvas
I can see it now, in code
thanks a lot anyway 🙂
Hi all. I'm trying to use this: https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Editor/PropertyEditor/Public/PropertyCustomizationHelpers.h#L144 MakePropertyComboBox, but i'm having trouble trying to set up the delegate for this: FOnGetPropertyComboBoxStrings. it's a DECLARE_DELEGATE_ThreeParams. In other areas for delegates i've used FSimpleDelegate::CreateSP, however that doesn't work in this case. It just gives the message "No matching function for call to 'CreateSP'" which i'm pretty sure means the definition of the function having arguments is preventing working. I'm not sure what the other options are. Can anyone point me in the right direction?
oh... nevermind. it's technically already a delegate in the struct i'm putting together, i just need to bind my function to it
how do I add widgets to an arbitrary FViewportClient?
FViewport* viewport = GEditor->GetActiveViewport();
FEditorViewportClient* viewportClient = static_cast<FEditorViewportClient*>(viewport->GetClient());
SEditorViewport* slateViewport = viewportClient->GetEditorViewportWidget().Get();
this is what I have and I want to add a widget to it
UGameViewportClient exposes an AddViewportWidgetContent() but not FEditorViewportClient
alternatively, given an arbitrary viewport how do I find the first SOverlay type widget in it?
Hi, guys, where should i start leaning Slate? I need to draw some lines with specified thiccness, by points
Probably best to look at an engine class that uses OnPaint()
You can ignore the interactivity of it, but I found that SSlider was a good place to get my head around this from
Oh, great, thank you!
Hey, I dont know where to post this question, but I think it fits in here.
I accidentally closed the sub tab in my asset window. Now I dont know how to reopen it. o.O
this is the window now
Oh got it
under the window tab > details
WHAT. I had no idea that Slate had a Bootstrap-style grid.
Just had to share my shock.
@wide dragon whaaat colour me shocked too! How did you find it? How do you spawn that window?
Window -> Developers Tools -> Debug Tools, then click the "Test Suite" button. I found it in the docs later last night, and they say that it's experimental and could change or be removed.
Is there an SWidget that lets you set a slot like the UMG canvas? I would like to set something to have full width with no horizontal offsets, and a specific width. I've tried SCanvas and SConstraintCanvas but I can't them to work.
It looks like SConstraintCanvas can do anchors like the UMG canvas, but I can't set a specific size.
@wide dragon looking into how UCanvasPanel works is no help?
That didn't occur to me haha. I just found an example that achieves what I'm going for, but I don't know if it's a good idea (performance-wise). It binds the Size of an SCanvas::Slot to a function which calls GetCachedGeometry().
UCanvasPanel is an SConstraintCanvas internally
You can set a specific size, just need the right anchor setup
Setting the visibility of this widget on construction works. However, i'd like it so that I can toggle the visibility of this widget. I suppose I would have to setup some form of callback function for this. Any pointers as to how to achieve this? Basically, I have a dropdown widget, and based on its selection, i'd like to toggle the above.
@open mountain re: from #cpp
If your widget is for editor only, here at #slate is the way.
If your widget is for a game, after begin play, you should consider user widgets at #umg
Nevermind , I see some conversation going #cpp for your question 😄
how slate batches images with different textures ? one draw call per image or it use things like texture array, .. ?
and NumBatch in stat slate is number of draw call right ?
is 3ms total slate tick time normal( developer game build, without editor)? Or is that something that can be brought down lower? I'm using UMG mostly. 3ms seems a lot...
Depends how complex the UI is
I clocked 3ms for a relatively normal hud. But global invalidation I put it to like 1.5ms
I am trying to create a TextBlock that fades each character in one-at-a-time. I looked at the Slate Test Suite and found a sample that uses a Marshaller to style text wrapped in <TextStyle FontColor="(R=...,G=...,B=...,A=...)">...</> but I cannot get it to work with an SRichTextBlock, which has a Marshaller SLATE_ARGUMENT. Any ideas?
(I already have logic that wraps the last character of the desired Text in the TextStyle XML tag, with the proper alpha set each tick, but the XML tag displays verbatim in the UI, rather than applying the style).
^ Okay, I feel like I answer my own questions a lot shortly after asking them...usually I delete the question, but if anyone is curious, the run-time modification of TextStyles in that TestSuite example is all handled by a series of structs defined inside the TestSuite source; it isn't a built-in function of Marshallers and Decorators.
how to I make a transform from UUserWidget to SWidget?
This is what I have in .cpp file:
void UHelpfullyBPLibrary::SetTestNewWindow(const UUserWidget* Widget, const FString Title, const FVector2D Size,const bool TitleBar, const bool Minimize, const bool Maximize, const bool Close, const bool Transparency, const float TransparencyAmound)
{
TSharedPtr<SWindow> Window = SNew(SWindow)
.Title(FText::FromString(Title))
.ClientSize(Size)
.SupportsMaximize(Maximize)
.SupportsMinimize(Minimize)
.HasCloseButton(Close)
.CreateTitleBar(TitleBar)
.SupportsTransparency(Transparency ? EWindowTransparency::PerWindow : EWindowTransparency::None)
.InitialOpacity(TransparencyAmound);
FSlateApplication& SlateApp = FSlateApplication::Get();
SlateApp.AddWindow(Window.ToSharedRef(), true);
/* Here I stuck, I can't make a UserWidget to be set as window content. */
//TShareRef<SWidget> wr = TakeWidget(Widget);
TSharedPtr<class SWdget> wsp = Widget->TakeWidget();
Window->SetContent(wsp);
}
So all I try to do is on blueprint function to get and blueprint widget reference and to render it on new window.
this is teh resoul
this is how I try to create it, the only problem is with that Widget pin, what I can not figure out how to use it to set the content
All the examples I can find of programmatically showing brushes in Slate seem to create FSlateImageBrushes with a path to a .png, rather than to an imported UAsset.
Is there a way to easily load imported UAssets and use them instead?
@mild oracle Slate brushes can be created directly in the content browser
can you just walk through the children recursively?
check type with cpp SOverlay * CastedOverlayParent = OverlayParent->GetType() == FName(TEXT("SOverlay")) ? static_cast<SOverlay *>(OverlayParent) : nullptr;
you might have to go level order/breadth first search to find the overlay that is highest up the hierarchy
or just find all and store the depth of each in the tree and take the one with min depth
oh I've solved that days ago but thx
I have a question... I have a UE4 editor plugin I'm making. I have an SListView-derived class in an SVerticalBox inside an SBorder. Layout is a mess but you can see two listviews in this picture
example of my listview slate code
// list of groups SListView
+ SVerticalBox::Slot()
.HAlign(HAlign_Left)
//.AutoHeight()
.MaxHeight(200.0f)
.FillHeight(1.0f) // This is required to make the scrollbar work, as content overflows Slate containers by default
[
SAssignNew(GroupListView, SListView<FGroupListType>)
//.ExternalScrollbar(ExternalScrollbar1)
.ItemHeight(22.0f)
.ListItemsSource(&GroupList)
.OnGenerateRow(this, &FRandomManagerEdModeToolkit::OnGenerateGroupListRow)
.SelectionMode(ESelectionMode::Single)
.IsEnabled(this, &FRandomManagerEdModeToolkit::IsGroupListViewEnabled)
//.OnContextMenuOpening(this, &STableViewTesting::GetListContextMenu)
.OnSelectionChanged(this, &FRandomManagerEdModeToolkit::OnGroupListSelectionChanged)
.HeaderRow
(
SNew(SHeaderRow)
+ SHeaderRow::Column("Group").DefaultLabel(LOCTEXT("GroupColumn", "Group"))
+ SHeaderRow::Column("GroupID").DefaultLabel(LOCTEXT("GroupIDColumn", "GroupID"))
+ SHeaderRow::Column("ParentGroupID").DefaultLabel(LOCTEXT("ParentGroupIDColumn", "ParentGroupID"))
+ SHeaderRow::Column("Weight").DefaultLabel(LOCTEXT("WeightColumn", "Weight"))
+ SHeaderRow::Column("CustomTags").DefaultLabel(LOCTEXT("CustomTagColumn", "CustomTags"))
)
]
```
the listviews scale appropriately when the window is compressed
but they won't expand beyond a certain point to fill the available width. So my question is: what do I have to change, where, to get that happening? Thanks in advance
the lower listview also seems to scale headings differently to top one. I would be happy at least with the column headings being fully readable
When we set an Image to "HAlign_Fill" which part of the code makes it stretch? I would assume the new scale is determined by the parent slot but I can't find that code anywhere.
Reason I'm asking is because I made a custom slate widget loosely based on the image and mine isn't stretching.
Look up SImage::OnPaint
It simply paints a box over the entire available geometry (== parent slot)
Most widgets don't stretch visually because they do things like "draw text 30 pixels right from edge"
@quaint zealot
It calls
FSlateDrawElement::MakeBox(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), ImageBrush, DrawEffects, FinalColorAndOpacity);
but that call in itself doesn't stretch the image. I have the same call in my custom slate widget and it doesn't stretch the ImageBrush content
The AllottedGeometry has correct local size (already adjusted for HAlign_Filll)
Is it the same image brush ?
Nope. It depends on the brush?
Not 100% sure but brushes do have drawing logic associated with them
So try with the same brush first
SImage does almost nothing really, it calls MakeBox over the allotted geometry and gives a desired size for when it's not filling
@quaint zealot thanks, it worked. It seems it won't stretch if I add an offset but at least I know what to investigate now 🙂
Alright here's the issue, hope you can see it well enough: https://www.youtube.com/watch?v=dvdubaCafdo&ab_channel=candletube
The canvas inside an SBox does not seem to properly clip off the content of its slots - and as a result the SButtons which I use to make up the grid are getting layered over the UI elements of the window itself
I was wondering if there was a way to force the SButton hitboxes to get clipped off to the size of the SConstraintCanvas that contains them
@midnight fjord did you use the widget reflector to confirm your suspicion? To me it seems as if some element is stealing your input but it's not clear which.
As for clipping, you can debug each element and see how clipping behaves. Start with the OnPaint event and follow it down the rabbit hole until you're certain that you're even fixing the right problem.
for posterity, setting HAlign(HAlign_Fill) seemed to fix it (was HAlign(HAlign_Left) )
obvious in hindsight I guess
@desert cedar Thanks for the response! I definitely tracked it down to the SConstraintCanvas failing to properly clip the hitboxes of its slots
Inside the window, there's an SBox that contains the canvas, which I expected to be clipped along with its children when the sbox is resized. All the widgets inside of it are set to always clip, too
used the reflector, and thats definitely where the problem is coming from. Graphically they're being clipped but they're still grabbing events
I made them volatile just in case, still the same issue
Then it's a bug in the engine and you should probably report it :/
dang :/
Slate is riddled with bugs. You can even crash a widget by puting two retainer or two invalidation boxes in parent->child relationships
resizing textures makes adjusting sprites impossible, it still causes caching errors
Just to be absolutely sure that it's not been fixed in the latest version I'm going to upgrade to 4.26 before reporting
I'm 4.25 rn
Thanks for the help, getting a definitive answer that it's a bug at least made me feel a little less frustrated
they had several input area clipping bugs in the past. We've had to manually inject certain changesets from Epic. One clipping fix in particular was solved back in 4.24 but still isn't merged into 4.26. It's absolute chaos.
I don't wanna be an angry pissy guy and complain and throw a fit but I do wish some things in UE4 were a little less overengineered or at least more standardized. And I don't mean to act like I know the best, but having CSS for UI instead of the current system would probably be pretty nice
They do have a "CSS"-like system but it's for slate only
thats what I'm using 🙂
someone kindly posted their entire slate workflow on github
https://github.com/arbonagw/HeliumRain/tree/master/Source/HeliumRain/UI
Oh I by no means am a master with Slate but I definitely have become very comfortable
By saying I wish it used CSS I more meant using a standard system that has been tried and tested
this kinda bug that I'm having just kinda really blows my mind because you'd think it'd show up in many cases. It's just a canvas wiht buttons in an SBox
the more you stray from fortnite the more bugs it seems to have 😛
I was surprised with the blur widget. It only supports rectangle blur
lol that can be said for every system in UE except replace bugs with user friendliness and the amount of asspain you gotta put in to get it to work
2021 and still no user friendly compute shaders for things like voxels etc.
At least you can do blur and other postprocess by wrapping your widgets with a retainer
so you dont need to rely on the blur widget
yeah but you don't get the blurred background (game world) unless you do some heavy engine modifications.
(im talking about proper, mip-map based blur, not H + V passes)
Really? I was under the impression you could alter the category of your widget's postprocess material to allow you to modify the background as well
I might be wrong
Frankly I just wish unreal had more like, straight up coder shit
you can modify the background, but it's more expensive than with the blur widget
let me write my own shaders hands on without having to go into the source and mess with your macros
Unity does it
now that you mention it... i should probably try making my own blur slate widget...
The lack of actual shader support still blows my mind. Nodes are nice but damn so much spaghetti can be replaced with like three lines of code
And the compute shaders... Like I know we can use Unreal's systems for a lot of what normally is done with them, but its to the point where I can literally tell if a game was made in unreal by the canned particle systems that behave kinda samey
They're great, I just wish more control was readily available. And I know that source is available and i can technically write my own systems, but like... Unreal's guts are scary, man. I can never tell what's going on
alright I'm going on a rant now I'm gonna go ahead and stop
@desert cedar For what it's worth a lot of my code is a bit shitt yin that repo
wow... i can't believe I didn't connect the dots until now -.-
Thank you for your kind contribution. It steered me away from a full blown slate implementation 😄
UMG with C++ parents gives me satisfying flexibility and iteration time
with slate being reserved for special cases with procedural content
Yeah it's much easier
Hey does anyone know why my colors appear flat when using them like this?
I know it's probably something with sRGB conversion, but I'm not quite sure how to change it
@chrome root FLinearColor::FromSRGBColor(const FColor& Color);
Oh my god this is hilarious
they actually fixed it in UE 4.26
My UI is actually working right now
ooh wrong channel lol
I'm gettin close to rip my hair out point trying to figure out why my slate ui loading screen ported from Action RPG isn't displaying : /
anyone have any experience?
got the modules in place "Modules": [ { "Name": "MyProject", "Type": "Runtime", "LoadingPhase": "Default" }, { "Name": "MyProjectLoadingScreen", "Type": "ClientOnly", "LoadingPhase": "PreLoadingScreen" }
Did you upgrade engine versions recently?
Well to 4.26.1 a couple weeks ago
from 4.26
so not super recently
not sure where this project started.. maybe as 4.25
@long canyon what ya have in mind?
I upgraded my project and found that defining module dependencies changed
rn i'm just copying what ActionRPG example does "Modules": [ { "Name": "ActionRPG", "Type": "Runtime", "LoadingPhase": "Default" }, { "Name": "ActionRPGLoadingScreen", "Type": "ClientOnly", "LoadingPhase": "PreLoadingScreen" } ],
rly copied everything to the T and so sad i can't get that darn thing to display
new string[] {
"MoviePlayer",
"Slate",
"SlateCore",
"InputCore"
}```
HOLY SHIZ
Yeah I’m pretty sure action rpg was made for an older engine version
Did PieceImage() replace SetPieceImage() for SThrobber?
trying to change the dot image
how does one go about creating ruler guides like photoshop or illustrator in the UMG editor?
I simply want to drag a line down to help align UI elements
@shy dirge How familiar are you with Slate?
tbh not at all haha
Anybody got a few seconds to explain how the engine treats widgets that you set as mouse pointers? There's a setting in the engine to select the widget you want to use as the pointer, and I just wanted to know if there's a preset size, or if it abides by the desired size of the widget etc etc.
How is their position defined? OH and also most importantly, is the cursor widget tied to the game's framerate? Before I found out about this pointer widget thing, I tried making an overlay that simply drew a widget under the mouse position and that one visibly lagged just a little bit, but enough to be noticeable
@midnight fjord I think I tried the same and switched to the hardware cursor to avoid the lag. But you can't use widgets afaik, only images
@mild oracle oh, so the software cursor option in the project settings gives you the same lag?
@midnight fjord It's been a while since I tried, but I know we're using hardware cursors on our game, and I think that's why?
gotcha. The main reason I'm interested in using a software cursor is because I have UV distortion shaders on my UI and I need a way to keep the cursor aligned in the same distorted space
I suppose I'll just have to live with the lag and hope it doesnt bother the player too much
@midnight fjord Now I'm curious what your UV-distorted UI looks like 😄
@mild oracle Oh it's nothing much at the moment! 😄 I just wanted to account for it because later on I wanna add a parabolic distort kinda like Halo does it.
If I detach a widget from parent in slate, I can expect it to be garbage collected, right?
There's no manual destruction required?
Slate widgets aren’t garbage collected. They are smart pointers though, which means that the memory is automatically freed when nothing points to them any more
oh okay!
There are various types of automatic memory management. Garbage Collection is one (this is how UObjects work in UE) and Smart Pointers is another (which are used by Slate)
Smart pointers will free the memory as soon as it isn’t being referenced by anything (circular references can cause memory leaks)
GC will wait until a specific moment to look to see what can be freed
guys I am new to slate and could use some help. I want to make a simple loading screen and saw the livestream where he talked about how this runs on a separate thread. I get how a slate UI element could be drawn on screen but how do I bind it to the completion of level loads
If you already know the UI part but lack info on how to fetch environment data then this is probably the wrong place to ask?
I would imagine you would find that info somewhere in the world or gameinstance and then make the latest known progress percentage exposed so that the player hud (or whichever main UI entitiy you're using to show and hide other widgets) can access it.
That entity can then send that data to the loading progress widget
The important part to remember is that it has to be something that's available on the client (if you're making a MP game)
Or a specific controller in case of split screen MP dynamic loading
Alright this is getting a little rough for me, I'm on like day three of trying to get focusable windows working.
To elaborate, I need to detect at all times if a click has been performed within a particular area - but that area also contains other buttons.
The best solution seems to set up a button covering the entire area and simply allow the button to react to mouse clicks without blocking the buttons behind it from doing so. (in a way, I want to let the mouse click to "penetrate" the button its clicking so as to allow for two buttons to be clicked at once)
The question is - how? I'm not a master with Slate, I admit, but I'm not really seeing many options to customize the behavior.
I've been told that returning FReply::Unhandled() via the lambda bound to the button would allow a passthrough, but that does not seem to be the case:
Is it possible to achieve what I'm describing in Slate? The alternative is replacing the window background with a button, and appending OnFocusWindow to every single interactable in the frame, which is in my eyes a massive, annoying hack.
umg wont work as rendering freezes in VR wanna try doing this. I wanted to avoid using level streaming to do this as lighting is static and I am getting lightmap issues
This engineer-oriented talk about assets loading management for good performance and smooth transitions by Epic Games' Support Engineer Axel Riffard goes over different methods to craft beautiful and highly optimized loading pipelines for your game, be it single or multi player.
Learn more about Unreal Engine at http://www.unrealengine.com
FReply::Unhandled() should do the trick. You might be doing something wrong?
@desert cedar I could very well be doing something wrong, I'm 100% sure I am actually. Would it be ok if you wrote a sample of how you'd do it?
I'm implementing my functionality via a lambda, and then returning FReply::Unhandled, but that doesn't do the trick. I thought maybe the return gets ignored but no, the constructor for the event struct that the button takes actually requires an FReply return type for the lambda. In any case, I'd love to see how you would do it, I'm sure I'm doing something wrong
Please can anyone help me with the scrollbar in Details Customization?
void FTestDetailsCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
{
DetailBuilder.EditCategory(TEXT("Test"))
.AddCustomRow(LOCTEXT("TestDetailsRow", "Test Details"))
.NameContent()
[
SNew(STextBlock).Text(LOCTEXT("Test", "Test"))
]
.ValueContent()
[
SNew(SBox).HeightOverride(800.f)
[
SNew(STextBlock).Text(LOCTEXT("Value", "Value"))
]
];
}
Same with
DetailBuilder.EditCategory(TEXT("Test"))
.AddCustomRow(LOCTEXT("TestDetailsRow", "Test Details"))
.WholeRowContent()
[
SNew(STextBlock)
.Text(FText::FromString("Test\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\n" \
"Test\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\n" \
"Test\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\n"))
];
@desert cedar nevermind, it had to do with the SButton not dispatching an event correctly - replacing it with SImage solved the issue
I'm creating an asset picker and adding it to screen with
TSharedPtr<SWindow> Parent = FSlateApplication::Get().GetActiveTopLevelWindow();
FSlateApplication::Get().PushMenu(
Parent.ToSharedRef(),
FWidgetPath(),
Picker.ToSharedRef(),
FSlateApplication::Get().GetCursorPos(),
FPopupTransitionEffect(FPopupTransitionEffect::ContextMenu)
);
Does anyone know why it's turning into software gore?
Using MenuBuilder seems to fix it
FMenuBuilder MenuBuilder(true, NULL);
MenuBuilder.BeginSection("Select Asset");
MenuBuilder.AddWidget(Picker.ToSharedRef(), FText());
MenuBuilder.EndSection();
TSharedPtr<SWidget> MenuWidget = MenuBuilder.MakeWidget();
I am creating a IDetailCustomization and I have a STextComboBox and would like to know how to update the OptionsSource outside of the CustomizeDetails method
Hi guys, has anyone tried to use a custom SViewport class? I would like to create SMyViewport in MyGameViewportClient, but I found that SViewport in created in UGameEngine::CreateGameViewportWidget
well I have use a custom SViewport class and i follow the plugin UnrealThumbnailGenerator for guidance. In the module class there is a function OnSpawnPluginTab, they just create a new pointer to their custom SViewport and not using UGameEngine::CreateGameViewportWidget
https://github.com/CelPlays/UnrealThumbnailGenerator
Would someone be able to direct me to a guide for implementing UI with c++? I created a widget blueprint and designed the UI already but I'm not sure how to go about implementing now though. This is for a project so I have to use c++ instead of blueprints. I'm still new to unreal and this is my first time working in it, though I'm not new to c++.
I can’t help right now, but if you ping me on Monday I’ll be able to
I appreciate the help but I kinda need this much sooner, a guide would be great to follow at my own pace but still be able to work on it immediately
Sorry - I don’t have a guide - I kind of figured it out as I went
Look for subclasses of SCompoundWidget
I'll look into it, thanks
Hey there, does anyone know whether it's "easy" (as easy as slate can be) to replace the shape of the caret in a text box?
e.g. I wanna have a █ caret instead of a | caret 😛
CaretImage arg on SEditableText
Thanks, is the SEditableText also used on multi-line boxes?
it does not, but it uses the same FSlateEditableTextLayout where I could hack it in
Finally, a custom text cursor
I had to copy/paste UE4's SMUltiLineEditableTextBox, SMultiLineEditableText, FSlateEditableTextLayout, ISlateEditableTextWidget and FSlateCursorLineHighlighter into my project and adjust them all together so they still work together with all the UE4 systems
this could have been easier
Does anyone have a link to any docs on implementing Drag and Drop in Slate?
I've found some examples in the engine, but they are maybe more complicated than I want
My eventual goal is to be able to drag and drop items in a SScrollBox
I have a button in my row that returns FReply::Handled().BeginDragDrop()
I've also got this on each row, but none of these ever seem to be called
.OnDragDetected_Lambda( []( const FGeometry& Geometry, const FPointerEvent& Event )
{
UE_LOG( MyLogType, Log, TEXT( "TableRow::OnDragDetected" ) );
return FReply::Handled();
})
.OnDragEnter_Lambda( []( FDragDropEvent const& Event )
{
UE_LOG( MyLogType, Log, TEXT( "TableRow::OnDragEnter" ) );
})
.OnDragLeave_Lambda( []( FDragDropEvent const& Event )
{
UE_LOG( MyLogType, Log, TEXT( "TableRow::OnDragLeave" ) );
})
.OnDrop_Lambda( []( FDragDropEvent const& Event )
{
UE_LOG( MyLogType, Log, TEXT( "TableRow::OnDrop" ) );
return FReply::Handled();
})
Did you implement a custom drag op @gritty frigate ?
I have one, yeah
I haven't figured out what I need to override in it
class FConductorGraphicDragDropOp : public FDragDropOperation
{
public:
static TSharedRef<FConductorGraphicDragDropOp> New(
TSharedPtr<FConductorUIGraphic> ItemToDrag );
private:
FConductorGraphicDragDropOp( TSharedPtr<FConductorUIGraphic> InItemToDrag );
TSharedPtr<FConductorUIGraphic> ItemToDrag;
};```
Nothing I think
I'm calling FConductorGraphicDragDropOp::New() and passing that into BeginDragDrop()
Hi. I would like to create a slate widget window (+menu entry) for the editor. I was unable to find a resource on the internet. Should I go look into the source code or is there a good resource that I have missed? I have already created detail customization so I have an idea about slate syntax.
and in OnDrop you do smthg like
In my Op?
const TSharedPtr<FDragDropOperation> Operation = DragDropEvent.GetOperation();
if (Operation.IsValid() && Operation->IsOfType<YourDrop```
on your widget that can handle being dropped on
Source code is likely your best friend here yes 🙂
i'm working on a tree view and i'm getting the following error in my OnGenerateRow delegate
cannot convert argument 2 from 'TSharedPtr<ITableRow,ESPMode::NotThreadSafe>(SNeoscapeProjectAnalyzerWidget::FNPATreeItem,const TSharedRef<STableViewBase,ESPMode::NotThreadSafe> &)' to 'TSharedRef<ITableRow,ESPMode::NotThreadSafe>(ArgumentType,const TSharedRef<STableViewBase,ESPMode::NotThreadSafe> &)'
the issue as i see it is that it can't convert ArgumentType to FNPATreeItem
@royal geode I've got OnDrop implemented on each Row in the SScrollBox already, with a log line, which doesn't seem to ever be called
except argument type should be templated and the Tree is decalared as STreeView<FNPATreeItem>
cuz as far as I can tell what I said above is all we're doing hehe
Not slots, no - I'm trying to do this with separate rows in a SScrollBox
In OnGenerateWidgetForList() I create the new row widget, and that's where I'm doing it
Sorry... of course...
Everywhere I've mentioned SScrollBox, I was actually talking about SListView
I just have an SListView in the single slot in SScrollBox
SAssignNew( GraphicsListWidget, SListView<TSharedPtr<FConductorUIGraphic>> )
.SelectionMode( ESelectionMode::Single )
.ListItemsSource( &GraphicsList )
.OnGenerateRow( this, &SConductorGraphicsWidget::OnGenerateGraphicWidgetForList )
.OnSelectionChanged( this, &SConductorGraphicsWidget::OnGraphicSelectionChanged )
Looks like SListView doesn't forward OnDrop
Ahh
So I'd need OnDrop on the SListView itself...
STableRow::OnDrop is where the fun is
Also just stopped spotted OnCanAcceptDrop
Thanks @royal geode - I appreciate the pointers. I'm going to have to call it for the day now, but will see where I get to in the morning
Slate is fun 😄
i'm having an issue with STreeView I have declared the following in my header
typedef TSharedPtr<FTreeItem> FNPATreeItem;
typedef STreeView<FNPATreeItem> NPATree;
TSharedPtr<ITableRow> GenerateTreeRow(FNPATreeItem TreeItem, const TSharedRef<STableViewBase>& OwnerTable);
TSharedPtr<NPATree> TreeViewPtr;
and in source i have this as my tree constructor
SAssignNew(TreeViewPtr, NPATree)
.TreeItemsSource(&TreeRootNodes)
.OnGenerateRow(this, &SNeoscapeProjectAnalyzerWidget::GenerateTreeRow)
.ItemHeight(30)
.SelectionMode(ESelectionMode::Multi)
.OnGetChildren(this, &SNeoscapeProjectAnalyzerWidget::GetChildrenForTree)
.ClearSelectionOnClick(false)
.HighlightParentNodesForSelection(true);
however i have an issue in my OnGetChildren where the GenerateTree row can't convert from
TSharedPtr<ITableRow>(FNPATreeItem, const TSharedRef<STableViewBase>&)
to
TSharedPtr<ITableRow>(ArgumentType, const TSharedRef<STableViewBase>&)
what have i missed
i thought i did all of my typedefs correctly and i followed the format of creating the tree as well but it seems like it's not templating correctly
Hello. Is it possible to specify the width of an SCombobox?
You’d have to specify it in the combobox’s parent slot
Ah I see ok. Thanks @paper hamlet .
some extra info on my error the log file actually has this block in is as well
with
[
UserClass=SNeoscapeProjectAnalyzerWidget,
ArgumentType=SNeoscapeProjectAnalyzerWidget::FNPATreeItem
]
and
[
ArgumentType=SNeoscapeProjectAnalyzerWidget::FNPATreeItem
]
i'm not even sure why the UserClass is there or what's going on
as usual the slate errors were useless, it just needed to return TSharedRef instead of TSharedPtr
@royal geode For when you're online - I figured out what wasn't working...
I was returning my FReply::Handled().BeginDragDrop() from an OnClicked on a button that was on the row. If I changed it to return from my OnDragDetected on the row itself, it seems to work as it should. I do want to only allow the drag from a certain area of the row, but OnDragDetected passes in the geometry, so I'll probably use that.
anyone know if BeginCleanup will delete the pointer it's passed or not?
basically, I have a slate widget that does WidgetRenderer = new FWidgetRenderer() on construct, and does BeginCleanup(WidgetRenderer) on destruct and just want to check I'm not leaking stuff here
Does anyone know how to limit a slate SEditableTextBox to a desired size? It has a property for MinDesiredWidth but not a MaxDesiredWidth.
wrap it in SizeBox[ScaleBox[Text]]
Oh yes, I forgot about those.
While I'm here, and while my question remains unanswered on the forums, how can I remove a widget(Context Menu) once a button has been clicked? I've tried resetting the shared pointer, changing the visibility etc. When I change the visibility, it takes a double click to actually update the visibility.
As of now, the Context Menu is only removed when I click outside the widget.
you can just do widget->RemoveFromViewport()
I can't as the widget is a SWidget not UUserWidget. I've looked through some of the documentation/source to find the appropriate method, but have come up short(Didn't spend a great deal of time on this).
what context menu?
SListView.OnContextMenuOpening -> return a TSharedPtr<SWidget>
I use the SAssignNew and assign the widget to a shared ptr, which I can use to work on the SWidget, but I just can't figure out how to remove it.
it opens when you right click on the listview?
Correct, and the only way to get rid of it naturally, is to click outside of it.
try FSlateApplication::Get().DismissAllMenus()
That done the trick. Out of curiosity, how did you find that?
FSlateApplication is where it governs all the slate stuffs
slate uses FSlateApplication to interact with each other/gameplay
Oh I wish the api reference was more documented 😄
Somewhat rusty in using Slate, trying to figure out the proper way to change the text in a texblock?
Changing the text with SetText() does not update the text on the widget, SetText() only works initially when creating the shared-ref, but not later when used to try to set a new value., which I find a bit peculiar when other widget-types work as expected, like SButtons and SUniformGridPanels
That should work - I do it all the time in my code
@gritty frigate Ok then if it should work with textblocks but not in my case, then it means I must've made a mistake in the code somewhere and not noticed it
thanks for clarifying for me @gritty frigate
No worries
If you want to paste some code in here, I can see if anything jumps out at me
This is the important part
FString DefaultString = FString::FromInt(
ManagerShared->GetAttributes<FSysManager::NeighbourMines>(TileCoords));
auto TextBlock =
SNew(STextBlock).Text(FText::FromString(DefaultString))
.ColorAndOpacity(FLinearColor(0, 0, 0, 1));
auto Btn =
SNew(SButton).OnClicked_Static(
&FSLocal::OnTileClick,
TileCoords,
ManagerShared).ForegroundColor(FSlateColor::UseForeground())
[
SNew(SBorder).BorderImage(ManagerShared->BombBrush.Get())
[
TextBlock
]
];
// vector of TSharedRef<SButton>, Works as expected when called through ManagerShared
ManagerShared->SlateGrid.emplace_back(Btn);
// vector of TSharedRef<STextBlock>, Does not work when called through ManagerShared,
// Surprisignly does not produce any assertions, access-violations nor exceptions, just does not work
ManagerShared->TileDisplayGrid.emplace_back(TextBlock);
When I call them both, it's in succession of eachother. GetGridFSlot() and GetTileTextBlock does the same things , resolve a 2d coordinate to 1d vector,and then returns the element. They get pushed on to their respective vector at the same time (as shown above) , so there can't be a mismatch between text-blocks index and button index in their vectors
auto TileWidgetPtr = ManagerShared->GetGridFSlot(TileCoords);
TileWidgetPtr->SetEnabled(false);
FString ToString = FString::FromInt(ManagerShared->GetAttributes<FSysManager::NeighbourMines>(TileCoords));
ManagerShared->GetTileTextBlock(TileCoords)->SetText(FText::FromString(ToString));
@gritty frigate Anything jumping out at you?
Sorry - stepped away for a bit. Taking a look now
Nothing major. I tend to use TSharedPtr rather than TSharedRef for storing widgets myself
I do think I have an idea of what the problem is, I'm prettys sure it's the problem infact, but can't test it until in about 5 minutes.
The problem is likely that I disable the SButton just before I access the STextBlock, as the text-block is a child to the SButton,
Me not having engine source on this workstation is also complicating it a bit, because I can't dive into the code of StextBlock or SButton to see how they're implemented
Hmm - I’ve never tried changing the text after disabling a parent widget. It would be odd if it didn’t work when disabled though
Funny enough, it was the issue
haah works now, that were some wasted hours 
It's a bit slow tho sadly, well, that is the cost using atomic types I guess, I was thinking of moving the shared ref with std::move to get around some of the overhead that comes with atomic types, but I'd had to rewrite some of the code to accomodate moving the pointer like this, not sure if it is worth it for this use-case
When working with SListViews, can I, and more importantly, should I, instantiate the template with my runtime UObject, or create a structure and use that? Which is what I am currently doing.
Looking through SListView.h I can use a UObject as the template type(wrapped in a TSharedPtr). I am however experiencing an crash when shitting down the error. Weird.
UObject in a TSharedPtr is not possible
UObjects should only be used with raw pointers ; and since Slate doesn't work with the Unreal GC (not UObject) they don't take ownership - you have to ensure the UObject has a valid owner
So can a SListView be initialized with a derived UObject class, or does it specifically have to be a UObject, and do castings?
Derived classes are fine
Thanks for the Info. I'm assuming that UObjects wont work with Smart Pointers as they are wrapped in the Reflection System ?
UObjects cannot ever work with smart pointers because they have their own memory management
actually you should use TWeakObjectPtr<UYourObject> and not a raw pointer
using a raw pointer of UObject in slate widget is dangerous because the object can be garbage collected while widget is alive. with TWeakObjectPtr you can check that object is still alive or not.
its only safe to use raw UObject pointers when they are marked as UPROPERTY.
use TSharedPtr<SListView<TWeakObjectPtr<UObject>>>
Is there some way to get an event when a Slate widget like a SSpinBox is focused?
I'm trying to run some logic when a UMG widget gets focused, but none of that appears to actually exist on the UMG level, and I'm seeing a OnFocusReceived in the Slate level APIs but I'm not quite sure if/how that works 🤔
my software cursors seem to be offset wrong with dpi scaling, I added this as a fix but I'm not sure I understand it:
+++ b/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp
@@ -599,11 +599,11 @@ void FSlateUser::DrawCursor(const TSharedRef<SWindow>& WindowToDraw, FSlateWindo
CursorWidget->SlatePrepass(WindowRootScale);
FVector2D CursorInScreen = GetCursorPosition();
FVector2D CursorPosInWindowSpace = WindowToDraw->GetWindowGeometryInScreen().AbsoluteToLocal(CursorInScreen) * WindowRootScale;
CursorPosInWindowSpace += (CursorWidget->GetDesiredSize() * -0.5) * WindowRootScale;
- const FGeometry CursorGeometry = FGeometry::MakeRoot(CursorWidget->GetDesiredSize(), FSlateLayoutTransform(CursorPosInWindowSpace));
+ const FGeometry CursorGeometry = FGeometry::MakeRoot(CursorWidget->GetDesiredSize() * WindowRootScale, FSlateLayoutTransform(CursorPosInWindowSpace));
CursorWidget->Paint(
FPaintArgs(&WindowToDraw.Get(), WindowToDraw->GetHittestGrid(), WindowToDraw->GetPositionInScreen(), SlateApp.GetCurrentTime(), SlateApp.GetDeltaTime()),
CursorGeometry, WindowToDraw->GetClippingRectangleInWindow(),
WindowElementList,```
it seems adding in WindowRootScale there fixes it, but also removing WindowRootScale multiply from the line above fixes it too
I would expect that removing it from the above line would make the software cursor not scale with DPI when painted, but have the right offset to the center
and adding it where I did in the diff would make the curosr scale with DPI when painted, and have the right offset to center
does painting ignore the geometry scale that is passed in? neither change seemed to make the software cursor scale with DPI, but either change fixed the offset...
my cursor is a few 64x64 images in an overlay, and when I screenshot it with either change, it still takes up 64x64, when my desktop is at 1.5 DPI scaling (and WindowRootScale in the debugger shows 1.5)
it is a UMG cursor, if that is maybe making the difference
putting it in a scale box did make it scale, with the second fix
so it reports desired size of 64x64, then the 1.5 multiplier is applied and it is painted with 96x96 as the geometry
it was painted with that as the geometry before too, but because it didn't have a scale box it just drew the images into it at 64x64 (and I had them centered so the change fixed the click offset in that case too)
Hey everyone, need help to understand. I have FSlateDrawElement::MakeText with 3 options, but cannot really implement them. The problem comes when I include FString and FSlateFontInfo. My goal: create dynamic text inside Slate Class from some local variables (digits)
FString Hello = FString(TEXT("Hello")); const FString* MyHello = &Hello; const FSlateFontInfo* MyFont; FSlateDrawElement::MakeText(OutDrawElements,LayerId, AllottedGeometry.ToPaintGeometry(), MyHello, MyFont, DrawEffects,PlayerIconColorAndOpacity);
May be useful for explanation
the problem is on MakeText line
Why not use STextBlock directly in your widget ?
Other than MyFont being uninitialized the rest looks fine, assuming this is in OnPaint for a completely custom widget
I have completely custom widget
So what's the issue exactly
let me make you screenshot
so it is syntax problem
Error is "no matching call to "
So something is wrong with calling the function
I have followed the parameter calls, but when I reach MyHello, all of the options becomes wrong and colored in grey
Show the full output log when compiling
ok, need time to compile, will send you in 5-10 mins
Error C2665 : 'FSlateDrawElement::MakeText': none of the 3 overloads could convert all the argument types
The full log please
At least the full error for this particular file
0>D:\Works\Project\Source\Private\Game\UI\SText.cpp(89,0): Error C2665 : 'FSlateDrawElement::MakeText': none of the 3 overloads could convert all the argument types 0>D:\Works\Engine\Source\Runtime\SlateCore\Public\Rendering/DrawElements.h(144,0): Reference C2665 : could be 'void FSlateDrawElement::MakeText(FSlateWindowElementList &,uint32,const FPaintGeometry &,const FText &,const FSlateFontInfo &,ESlateDrawEffect,const FLinearColor &)' 0>D:\Works\Engine\Source\Runtime\SlateCore\Public\Rendering/DrawElements.h(142,0): Reference C2665 : or 'void FSlateDrawElement::MakeText(FSlateWindowElementList &,uint32,const FPaintGeometry &,const FString &,const FSlateFontInfo &,ESlateDrawEffect,const FLinearColor &)' 0>D:\Works\Engine\Source\Runtime\SlateCore\Public\Rendering/DrawElements.h(140,0): Reference C2665 : or 'void FSlateDrawElement::MakeText(FSlateWindowElementList &,uint32,const FPaintGeometry &,const FString &,const int32,const int32,const FSlateFontInfo &,ESlateDrawEffect,const FLinearColor &)' 0>D:\WorksProject\Source\Private\Game\UI\SText.cpp(89,0): Reference C2665 : while trying to match the argument list '(FSlateWindowElementList, int32, FPaintGeometry, const FString *, const FSlateFontInfo *, const ESlateDrawEffect, const FLinearColor)'
So you're trying to use
void FSlateDrawElement::MakeText(FSlateWindowElementList &,uint32,const FPaintGeometry &,const FString &,const FSlateFontInfo &,ESlateDrawEffect,const FLinearColor &)
but you passed
void FSlateDrawElement::MakeText(FSlateWindowElementList, int32, FPaintGeometry, const FString *, const FSlateFontInfo *, const ESlateDrawEffect, const FLinearColor)
Your error is using pointers for FString and FSlateFontInfo instead of const references
Thanks a lot, IDK why I did pointers there tbh.
Hello. I would like to set an SProperty of an Actor to show a list of / only accept actors that have a certain component. I am currently scavanging the engine source but would love some help on it. What is a good way to do it?
Hey @royal geode thank you for the response ❤️
note: while trying to match the argument list '(FCodekittenSelectionPluginModule *, FReply (__cdecl SSelectionWidget::* )(void))'
error C2664: 'void FUICommandList::MapAction(const TSharedPtr<const FUICommandInfo,0>,const FUIAction &)': cannot convert argument 2 from 'FCanExecuteAction' to 'FExecuteAction'
So I'm basically unsure how to have the delegate match. I believe it's because it's assumed that an executed action wants a void method, but I'm looking to call on the slate FReply method.
hey just letting you know he was kicking us out and saying to come here and polute this channel instead of hogging the cpp one. you can head back there
.... huh?
hehe okay so.
PluginCommands->MapAction(
FCodekittenSelectionPluginCommands::Get().OpenPluginWindow,
FExecuteAction::CreateSP(this, &SSelectionWidget::OnSelectByClassesClicked),
FCanExecuteAction());
Is what I have. Which calls on a hella simple FReply function on a Compound Widget.
yup that should work
I mean, yep. It's referring to Line 38.
4.25 🙂
yup so CreateSP is failing
and then, since it failed, MapAction is called without it
making it FCanExecuteAction() the second argument
Makes sense, 🙂
creating all kind of silly errors
always look at errors top to bottom hehe
how does OnSelectByClassesClicked look?
So.. hmm..
It's a pretty standard FReply for a button on a SCompoundWidget child class.
Nothing crazy.
yup that won't work
DECLARE_DELEGATE(FExecuteAction);
^ this is expecting a void function
FReply would have been DECLARE_DELEGATE_RetVal(FReply, FExecuteAction);
Delegate errors are a pain hehe
Absolutely. hehe :p
Okie dokie, so I just need to do some restructuring. Have my FReply call somewhere else to a void method and have my logic handled there.
I just wanted to UI_COMMAND it :p
hehe
Which like.. Idk, seems a little weird that you can't UI_COMMAND macro an FReply with the execute action delegate, when they're literally used to call on buttons and UI elements.
UI_COMMAND is just to declare a command right, not to bind it
For sure, it's Map Action and the CreateRaw/CreateSP that binds.
yup yup
It just seems... round-a-bout.
If I'm already setting up a button clicked method, it would make total sense to map and bind to that same method.
It's a standard SNew(SButton) I've just wrapped it in a TSharedRef function to template it.
e.g:
Utilized this way.
I would advise against making "create widget" helper functions
I used to do that, but it tends to be a lot messier than just creating a small wrapper widget
eg here you'd have a SFlatButton instead
This makes a lot of the syntax a lot nicer
Hmm...
For onclicked you'd just do .OnClicked(this, &SSelectionWidget::OnDeselect)
Or even
.OnClicked_Lambda([this]()
{
OnDeselect();
return FReply::Handled();
}```
assuming this is a parent widget making it safe to reference without a weak ptr
Have you any examples why creating a helper method like this would be potentially a problem for something simple like a button?
Like.. So, I can understand creating a new slate widget for an actual button class and handling the logic.
But this helper function is purely just for styling.
yup, even then I'd recommend a widget as it follows the general slate pattern IMO
Much easier to have optional arguments
can't mess up argument order
easy to bind additonal stuff if you somehow need to - eg Visibility stuff
Makes sense actually 🙂
Well, I've got some restructuring to do it seems! Thanks Phy, I appreciate it ❤️
Sure thing!
lmk if you have any more questions - Slate & editor customization is quite a beast 😄
It is indeed, and I'm already starting to regret teaching it. :p
hehehe
Though, I'm still learning - and I just really want to share resources on it. There's really not enough out there for it.
yup reading through the engine was a painful way to learn 😢
https://kantandev.com/ have you seen this already? Some useful articles on there
Kantan's been absolutely useful during my learning curve.
That meow reaction is my brain on slate.
😛
lol
Hi guys can anyone explain to me where the right spot is to open a full screen main menu on the game startup?
AHUD::BeginPlay() is not the right spot in my opinion because i want to use my AHUD Instance as a "menu manager" which shows and hide different menus in the game
So where is a good position to call AddViewportWidgetContent?
Thanks for help 🙂
AHUD::BeginPlay would have been my suggestion
yeah but this way on every map change the main menu will appear
Not if you do it conditionally
It doesn't have to be big, personally I use a custom world settings class and put a "main menu" option there
When the menu initializes it just reads that and goes "oh shit, main menu map"
Game mode works well enough for that too, since the main menu will always be single player
Just a simple bool variable, and the menu-initializing code reads that when the current role is authority, to see if the menu should open
You can also just use two different HUD classes, one for main menu, one for in-game.
Makes sense since you're most likely going to have a different "game mode" for the main menu as well.
I guess this is a better option
for now it will do the job i will use it
thanks
@quaint zealot is it possible that provide me your focus functions?
Not really because it's logic spread across multiple functions, but a combination of PlayerController::SetInputMode and FSlateApplication::Get().SetAllUserFocus(DesiredFocusWidget.ToSharedRef());
Depending on the mouse capture settings
bShowCursor completely changes the engine's input model
Mh something i do wrong
const FInputModeUIOnly InputMode;
OwningHUD->PlayerOwner->SetInputMode(InputMode);
FSlateApplication::Get().SetAllUserFocus(AsShared());
FSlateApplication::Get().GetPlatformApplication()->Cursor->Show(true);
FSlateApplication::Get().ReleaseAllPointerCapture();
FSlateApplication::Get().GetPlatformApplication()->SetCapture(nullptr);
is not working no cursor is visible
okay i changed my settings to settings in the screenshot
but its still not working i have no idea why
Did you set bShowCursor to false
i did not changed bShowCursor
Its default
This should work or?
Do i have to set bShowCursor = true and after this control visibility with FSlateApplication::Get().GetPlatformApplication()->Cursor->Show(true/false);?
You can try using bShowCursor, but like I said, it's not a small setting, it changes the entire input mode
Ok
But i guess it have to work with FSlateApplication::Get().GetPlatformApplication()->Cursor->Show
But i cant find any examples with a basic slate main menu which shows if the game is started
Slate is not meant for game use
So that's probably why
You can look at UMG examples and try to dive into the UMG implementation to check what it does with Slate
Do you know some good small UMG C++ examples? I dont want to use blueprints at all
Nah
If you absolutely want to make your UI in C++, you kind of need to accept that it's reverse-engineering all the time
Why are you avoiding blueprints? There is a lot that they are great for
Because of maintenance, Version Control and a lot of other reasons
If you're going to write your entire UI in C++, I don't know why you would need UMG. Just write Slate I guess?
But as Hugh said, UMG blueprints save a lot of time. I've worked on large projects and never hit version control or maintenance issues. We did optimization on some BP assets moving them to pure C++ but that's it.
(autocomplete changed Hugh to High... Sorry High)
To riff on what @mild oracle is saying, if you have a lot of your UI driven and fed data that is external to the UMG widgets, version control can be less of a headache too.
Edit: Sorry I feel like I didn't actually state where I'm coming from - UMG is design perspective, C++ is implementation, both work well together and you should use them together.
UMG Also assists designers greatly. Allowing them to quickly prototype and go from one widget/screen to the next before implementation is done.
A UI Designer who has experience in blueprints will find this super useful for an "functional" prototype that one of our programmers/TA's will go over and optimize if need be. Doing it entirely in C++ would hinder that process and force designers into 'graphics only' and having to repeat work.
Same with Ben, worked on larger projects - We use UMG extensively for designing our UI/shaders etc, and use blueprints in the Widget Blueprint graph for handling UI logic. Slate, and C++ are only used mostly to optimize larger widgets with a lot of logic - or alternatively, fixing hella weird problems like Unreal's focus issue with multiple peripherals.
Consequently, with Slate. Not everything can be done with UMG, and there are more widgets defined across the editor that have a much clearer layout process. These are great examples, and are easier to implement in C++ Slate, with properties exposed to Blueprint.
There is some also specific types of widgets or rather screen palcement of widgets (markers etc) that are much easier to handle in C++ when it comes to logic.
Oh and, to agree - never an issue with Version Control or maintenance. Behaves exactly like any other UAsset in terms of VC.
The most blueprints i have seen was just terrible and not easy to read = not easy to maintain = not easy to review
I mean Epic already raped the c++ standard so this enough to worry so i dont need the headaches from blueprints too
Wow, what a word to use to describe mishandling..
I mean u cant tell me that this spaghetti nodes over your entire screen (where u have to zoom and move) are easy to read vs clear structured code
In my opinion is this just a tool for guys who cant code and are to lazy to learn it
That wasn't what I was referring to, Phil.
"I mean Epic already...."
And to counter your argument. At least in larger teams, blueprint is largely prototype, it's then cleared up by a different member of the team and passed to programmers to define or decide which parts end up staying as blueprint or get promoted to C++ for optimization or reusability.
Maybe spend some time with the people you work with to teach them better practices. As for guys who can't code and are to lazy:
A) It's a programming language, deal with it. And B) Not everyone can code, I know plenty of developers who have issues with either Dyslexia or other problems where Visual Graphs have aided them because legibility is an issue.
Maybe its not the best word for it but this was the first word i had in mind after reading several hours ue4 c++ code
Oh and while I'm here - C ) You can have stupidly nested If statements, random classes and obfuscated code. How is that not the spaghetti equivalent of coding? Your argument is comparing spaghetti graphs to clear and structured code.
That is literally an Apple vs Oranges argument.
Why to prototype stuff if u have mockups
Because generally, a Mockup is a bit like this. You can plan it out for days, but you won't actually know what fails, how it's going to fail, or plan for failure if you don't implement first in a prototype.
i mean gui mockups
Same problem. You can make concept art, mockups, plan for how it should look. But until you implement and actually start working with it - how it works in engine from both a programmatic and UX perspective, you don't get the 'feel'.
I dont think so
If I do a mockup of a UI for an Inventory. How do you know which classes you need to implement, where does it interface? How is going to link in with existing systems.
Prototyping is super useful, because it is a 'bare bones' proof of concept of Mockup to implementation in the shortest time possible.
A prototype should be scrapped, and is not final. But what it does teach us is where, how and why it can fail, what classes or implementations we should be aware of and any use-case we hadn't thought of. It also gives a general idea of complexity.
I mean this conversation is kind of useless because i will stay with slate, i dont want to put this shitty blueprints nodes together and review stuff like that
Have fun, friend.
Maybe its my backend dev mindset idk
It's likely that. Not everything can be done in code, and more problems can be solved when you see the other side of the coin. It enables more people to incorporate and work.
At the end of the day friend, it's another tool.
"Not everything can be done in code" is absolutely not true, blueprints are code too in a weird way
My main argument is accessibility. There are people with vision and mobility problems. Blueprints for some people are fantastic for legibility, where code becomes a scrambled blurry mess for them.
Equally, it's entirely a matter of taste. Some people like apples, other like oranges. I just don't understand why you seem to viciously hate apples.
Some people can just follow graphs better, yo. That's pretty much it 😛
"My main argument is accessibility. There are people with vision and mobility problems." is this the reason too why everything should be done in blueprints?
I did not once in my argument state that everything should be done in blueprints.
Sorry I feel like I didn't actually state where I'm coming from - UMG is design perspective, C++ is implementation, both work well together and you should use them together.
Don't strawman me.
The half of the discussion was blueprint related and not to slate lmao
Perforce, Git and SVN. Depends on the project requirements.
Also, this isn't slate related. Go to #source-control and ask there.
Oh it is, i guess blueprints are binary files and binary files are terrible in git, create ur gui with slate results in text
In this point slate > umg (blueprints)
Mate. I am not trying to have an argument with you, believe in whatever you want.
It is literally another tool, and a tool is a tool is a tool - every tool has an idea of what is better. That's why we have many tools.
One thing is not better than the other, just as the thing isn't better than the other thing.
But I'm done getting riled from you because you wanna start a divisive chat.
Its ok, but if u dont want to discuss dont revive a topic which is done
For the record, Git is fine with binary data - you can use LFS which is dedicated to that, but even using default Git for small binary files is perfectly fine. I routinely use that for 50MB textures because I'm too lazy to use LFS.
Blueprint's version control problem is that you need UE4 to diff them, not that they mess with source control itself.
But this will compounded by the fact that any complex Slate UI will depend on dozens of binary assets - style assets, Slate brushes, materials, textures, fonts, sounds
And the more your game UI grows with animation, dynamic materials, post-processing effects... the more Slate will suck because it's not designed for game use.
Im using LFS the point is not repo size its is text vs non text
UMG is build on top of slate or? So its useable for games and i dont like the umg layer
https://github.com/arbonagw/HeliumRain this is the best example
I'm familiar with Helium Rain, I was the main developer
Oh yeah now i see the pictures are the same XD
I saw a reddit post (from u idk?) where one guy said slate was the way to go and not umg for complexity reasons?
Slate was the way to go because UMG did not exist when the project started, for the most part
So there's that
And u created a really nice ui and i can see the source in my browser without UE4
"Really nice" is debatable : it has no decent controller support, almost no animation, and is routinely referred to by players as "weird" or "confusing". It's also 40% of the entire code for the game because it's so verbose
Is it possible for you to accept my friend request in discord so i can write u a pm?
I think there's a big difference between "I don't like blueprints, so I'm going to do it all in C++" and "Blueprints are shitty", "In my opinion is this just a tool for guys who cant code and are to lazy to learn it"
As i said its my personal opinion and i pointed to enough points why it is
Looking nice and a good useability is a different thing, but u are right i forgot to say looking i never played it ^^
My opinion is that using Slate for your game is viable if
- your game is going to have exceedingly custom and complex widgets, like the project I'm doing now drawing hundreds of interconnected, animated 2D splines
- you are ready to develop and maintain your own UI framework on top of Slate
- you are ready to engineer the content support Slate doesn't have (like widgets having GC support for dynamic materials)
- you want your game to never have any UI animation
If one of these things doesn't hit the mark, go with UMG
U will say me there is no way to create animations in a slate based ui? (i guess this is a joke)
Well there is absolutely zero tool for it so a programmer has to do it entirely in C++, instead of a designer, and there's no preview - need to compile and test - and any animated widget is kind of going to need an absolute-positioned widget in an overlay and... it's just a terrible idea
Mh sounds true
There's a reason Helium Rain has about 2 man-years of UI work over about 40,000 lines of code and a total of one (1) animation
(which is a simple linear movement)
This are all good points, but every declarative gui language have the problem that it will go crazy
The biggest reason against UMG is again:
It is binary, u cant work togheter on a file, u cant view it without ue4 editor, u cant diff it, it will get huge even with lfs and u have to put nodes togheter which are connected by tiny lines
If you can tell me it is possible to do ALL logic in c++ and just the layout of buttons and stuff like that are in binary assets i would think about using it
Sure
Create your own UUserWidget class, and while IIRC you can't create one directly in content browser, you can create a regular Widget Blueprint and reparent it (or use the regular "new Blueprint" button)
Should be able to declare all your UMG elements and have the Blueprint do the positioning and animating
Basic example here : https://www.orfeasel.com/using-unreal-motion-graphics-umg-with-c/
mh hard decision
And of course C++ UMG widgets exist in the engine :https://github.com/EpicGames/UnrealEngine/blob/df84cb430f38ad08ad831f31267d8702b2fefc3e/Engine/Plugins/Experimental/VirtualProductionUtilities/Source/VPUtilitiesEditor/Private/VPCameraUIBase.h
U have a lot a lot more experience than me so your opinion have a heavy weight for me but i dont know if im able to handle this binary downside
I mean you need Blueprint in UE4 anyway ? All your content interface should be there at the very least.
What u mean with content interface
Asset references
I give umg a try
I'm just saying don't dismiss UMG entirely and see where you can draw the line
Spending a week on having the good framework for your UI is worth it
If you end up with Slate, fine !
Your issue has nothing to do with UMG fyi. Your argument is exactly against all UAsset binaries in UE4.
No it is not wtf
You'd have the same issue with blueprints right?
Yes
So it's not about UMG. It's about binaries 😉
Yesterday u said "But I'm done getting riled" do u want to get riled again?
And it would be possible for me to explain it too u again but this is time waste
x) dude. I just commented. relax.
Any idea on a editor modal Dialog box that is non blocking?
FSlateApplicatio0n::AddModalWindow Creates a blocking window. You can check bSlowTask=true, but that freezes the editor
@quaint zealot im confused by the example which you provided
He is doing his ui logic inside the blueprints, but i guess i can just implement the c++ function which he declared and im fine?
Sure ? You basically should be able to declare UPROPERTY UMG widgets that you need - your buttons etc - and write your game logic in C++
How to get widgeta from SListView?
.OnGenerateRow
which will generate the row widget for said row.
Where the function pointer returns a TSharedRef<STableViewBase> widget.
Does anyone know a good visual reference for what to call to create all the various possible parts of a Slate editor UI?
I'm having trouble knowing my Categories from my Groups from my other stuff
Also I swear I've seen categories within categories in some UIs but I can't for the life of me work out how they did it
Customizing stuff is such a pain, I want collapsable child categories like this, but they don't support icons or customizing the typeface
I think in the slate examples module it uses that sort of never ending sub categories framework
In the slate viewer app
@narrow terrace Slate examples module? 😮
Layout and widget complexities not demonstrated in the Slate Viewer Widget Gallery.
I am currently out and about, once I get back home I can get you the exact file name...
Oh My God the Slate Test Suite is amazing
It's INCREDIBLE
I can't even subclass SDetailCategoryTableRow because it's private in the PropertyEditor module
where is this example from btw?
This is a rich text library I'm making
im sorry i meant this slate test suite
https://twitter.com/_benui/status/1380582233577168896 this shows how to access it
ah neat, is there also an example of making a category like you wanted?
(without the custom text font)
unfortunately no. there a lot of other examples, but no. There's no way to add an icon to the category, or change the contents of the category's text area
what about just a simple category like the editor uses then?
cuz as far as im aware creating these categories that expand only work if you work on properties that have categories on them already
i was wondering if you could simulate this and mark a property to be under a category
or create your own category dynamically
does anyone know how to do this with details customization?
@toxic dove I can use the simple editor categories but it ends up being pretty hard to read with many nested properties, IMHO.
❓
(sorry I hit enter by accident)
what do you mean by simple editor categories?
are you able to insert categories on your own?
I'll show you what I have and how I'm doing it
wooo thanks
This is what I have currently. This is a BP of a Stylesheet class. A Stylesheet can contain many Styles, and each Style can have many Properties. Properties are stuff like Text Size, Text Color, Alignment etc.
I'm using CustomizeDetails( IDetailLayoutBuilider& Builder ) to customize how to show the stylesheet in the inspector
You can add custom categories with Builder.EditCategory
There are a lot of examples of that in the engine source
ah ok that seemed counter-intuitive for a name
so i didnt look at that
ok i understand now, thanks :)!
EditCategory seems to both edit any existing categories that might be created with UPROPERTY( Category=Blah ) settings, but also create new ones
yeah i read the source code, the comment block says "will create if it doesnt exist" as well
they should have renamed the function to something more intuitive
is it not possible to declare a delegate that uses a TMap as parameter?
DECLARE_DELEGATE_OneParam(FOnFiltersChanged, const TMap<bool, int32>&);
Doesn't seem to want to work
but typedef'ing the map and then passing that type in works

@split laurel Ah yeah its a parsing issue, I've had that before
the macro has trouble with the ,
ah okay, thank you
How are TAttribute meant to be forwarded across hierarchies ? I have this, it looks legit but the compiler won't take it :
{
SLATE_BEGIN_ARGS(SSomeWidget) {}
SLATE_ATTRIBUTE(FLinearColor, ColorAndOpacity)
SLATE_END_ARGS()
void Construct(const FArguments& InArgs)
{
SImage::Construct(SImage::FArguments().ColorAndOpacity(InArgs._ColorAndOpacity));
}```
> 2>D:\UE_4.26\Engine\Source\Runtime\Core\Public\Misc/Attribute.h(43): error C2440: 'type cast': cannot convert from 'const OtherType' to 'ObjectType'
> 2> with
> 2> [
> 2> OtherType=TAttribute<FLinearColor> *
> 2> ]
> 2> and
> 2> [
> 2> ObjectType=FSlateColor
> 2> ]
> 2> D:\UE_4.26\Engine\Source\Runtime\Core\Public\Misc/Attribute.h(43): note: No constructor could take the source type, or constructor overload resolution was ambiguous
> 2> D:\Source/UI/Widget/SSomeWidget .h(40): note: see reference to function template instantiation 'TAttribute<FSlateColor>::TAttribute<TAttribute<FLinearColor>*>(const OtherType &)' being compiled
> 2> with
> 2> [
> 2> OtherType=TAttribute<FLinearColor> *
> 2> ]
> 2> D:\Source/UI/Widget/SSomeWidget .h(40): note: see reference to function template instantiation 'TAttribute<FSlateColor>::TAttribute<TAttribute<FLinearColor>*>(const OtherType &)' being compiled
> 2> with
> 2> [
> 2> OtherType=TAttribute<FLinearColor> *
> 2> ]