#slate

1 messages ยท Page 28 of 1

split laurel
#

Taking a shot in the dark here but try deferring the focus setting for a frame via timer. Alternatively, you can use the widget reflector's event debugging tools to see what takes up your input, or just step into the set focus function to see what's going wrong

twilit halo
#

this whole time i've been launching the standalone game from the editor

twilit halo
split laurel
#

Run the project via visual studio (or another ide like rider) with the debugger and hit play in PIE (not standalone as that's a different process)

grave hatch
#

You can attach to the process (probably) from VS, though. Just an unneeded extra step!

keen halo
#

Why does my combobox always say No content provided in red when there clearly is some content each time I drop down the list?

#

I'm afraid I've involuntarily thrown myself into a pickle ๐Ÿ™‚

quaint zealot
#

Show the code

#

Sounds like you haven't bound OnGenerateWidget though

keen halo
quaint zealot
#

No, each time you update the list

#

(Or re-create the widget)

keen halo
#

Hot damn

#

What a fool I've been

quaint zealot
#

OnGeneratedWidget is what generate a line in the box for a given entry

split laurel
#

you have to divorce the idea of the provided options from how an unspecified option is visually represented

mellow imp
#

Does anyone know why an SListView's scrollbar shrinks when scrolling down?

grave hatch
#

It probably hasn't calculated the space used for the elements not in view?

mellow imp
#

Yes... looks like this. Actually each row has a list view inside and I think that is the problem.
Is there any way to calculate the space and set it to the scrollbar?

grave hatch
#

Shrug

gleaming gull
#

Hey guys, do you know what class generate this kind of tables on the engine?

grave hatch
#

Looks like a combination of SExpandableArea and STreeView probably.

#

Check out the PropertyEditor module if you want the actual slate classes.

#

If you want to know how to produce your own details panel view? Same place.

royal vale
grave hatch
#

I don't think that's going to cause it to recalculate everything it can't see if it isn't doing it already, though

raw falcon
#

Hey, I was wanting to get into slate, are there any good resources for learning it presuming I'm ok with UMG and decent with C++?

#

If anyone's got like a channel or a tutorial site or anything?

mellow imp
# raw falcon If anyone's got like a channel or a tutorial site or anything?

I saw this in this server a while ago. It's good even if you don't know about Qt
https://minimaleffort.tech/qt-to-slate-transition-guide/
For UI benui's tutorials are very helpful and with real examples.
https://benui.ca/
The last thing is just practice and investigating the source code.

Specially if you are doing some editor related things
I find very useful the Test Suite tab. It shows a variety of widgets and the source code of it can be found easily.
On UE5 is at: Tools > Debug > DebugTools > Test Suite

Also im kinda new to UE and Slate/UMG, in case someone finds some more interesting resources they want to share too :)

raw falcon
raw falcon
#

Wow I just started watching a video tutorial on it and....oh man this is cool.

grave hatch
#

It's painful at first.

steady dawn
#

Hello there guys! Let me tell you, I have been trying for a few hours to call a UFunction from the SWebBrowser executing some javascript, but for some reason by function seems to not be binded, any help please?

steady dawn
#

never mind got it

polar olive
#

Hi guys im trying to use the movie player to set up a simple loading screen using FLoadingScreenAttributes, however whenever it actually gets setup, it only appears for a split second then turns black.

#

void UMultiplayer5GameInstance::BeginLoadingScreen(const FString& InMapName)
{
static TSharedRef<SLoadingScreen> SLoadingWidget = SNew(SLoadingScreen);
if (!IsRunningDedicatedServer())
{
FLoadingScreenAttributes LoadingScreen;
LoadingScreen.bAutoCompleteWhenLoadingCompletes = false;
LoadingScreen.WidgetLoadingScreen = SLoadingWidget;
LoadingScreen.MinimumLoadingScreenDisplayTime = 10.0f;

    GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
}

}

#

this is what gets called on preloadMap

#

any help is appreciated

grave hatch
paper bluff
#

anyone knows if theres a way to create custom versions of these ?

grave hatch
#

You want to add your own buttons to that list?

#

Or make your own list somewhere else with a similar style?

paper bluff
#

add my own to this list

#

all the actor specific stuff that i need, for easy access

#

i thought it would be similar to catagories, but looking at variables in the blueprint editor i cant see anything that would refernce "Sections", thats what the view settings in the details panel reffered to them

grave hatch
#

You can add sections via the PropertyEditor module

#

They're called Sections

#

And they only filter for which categories are visible in each section.

#

You can add whatever categories you like and even change the sections already available to add or remove categories.

paper bluff
#

i see, so i have to use C++ for this?

grave hatch
#

Yes

paper bluff
#

cool, thanks!

verbal dock
#

Anyone have any suggestions for displaying a set of USTRUCTs in a UListView? Any adaptors or API shims that can avoid having to have UObjects?

keen halo
#

Is it advisable to declare the combobox before actually calling it in SAssignNew?

#

I mean, since it gives access to the combobox and its functions outside the scope of the SAssignNew branch

grave hatch
#

declare the variable in the scope you need it.

#

Then assign to the var with SAssignNew

keen halo
#

And declared it outside

grave hatch
keen halo
#

If thats a thing

grave hatch
#

Sure, you can just assign callbacks during initialisation.

half lily
grave hatch
#

I'm going to specifically ignore that because you reposted it everywhere.

polar olive
#

how do you play a video in slate

tame granite
#

How do we replace this Visibility.Bind call in UE5?

#

there is GetVisibility and SetVisibility only now, the thing from GetVisibility doesn't have the bind call

#

setvisibility takes an attribute thing though and not just EVisibility, so I'm assuming we have to construct that and set the bind?

#

ah I think it's SetVisibility( TAttribute<EVisibility>(this, &SShooterMenuWidget::GetSlateVisibility));

mild oracle
#

I heard there's a debug tool to view the Transactions that are being set up in the Editor, does anyone know how to do this?

robust forum
#

Hi, I created a window with SWindow and I would like to use SetOnWindowMoved function with it. Purpose is, when I move my window it should be more transparent than default. So I need a delegate for it. I have my opacity function.

My function is

    if (InWidgetWindow->IsValidLowLevel() == true)
    {
        if (InWidgetWindow->WindowPtr.IsValid() == true)
        {
            const FOnWindowMoved NotificationDelegate;
            //InWidgetWindow->WindowPtr.ToSharedRef().Get().SetOnWindowMoved(NotificationDelegate); Also I used this.
                          InWidgetWindow->WindowPtr.Get()->SetOnWindowMoved(NotificationDelegate);

            if (NotificationDelegate.IsBound() == true)
            {
                DelegateWinMovement.Execute(true);
            }
        }
    }

InWidgetWindow is an UObject for exposing TSharedPtr<SWindow> to blueprints.
WindowPtr is TSharedPtr<SWindow>

DelegateWinMovement comes from

UDELEGATE(BlueprintAuthorityOnly)
DECLARE_DYNAMIC_DELEGATE_OneParam(FDelegateWinMovement, bool, IsSuccessfull);

But nothing happens. Is there any suggestion for that ?

grave hatch
#

Oh that's fun.

#

SScrollBox doesn't implement GetChildren() :/

grave hatch
#

Nvm. Probably had to do ChildSlot->GetChildren or something because of the wrapped SScrollPanel

hot notch
#

I'm wondering if it's possible to modify the default TextBlock to wrap itself based on parent's hierarchy. Basically I have a Grid with textblocks in it. These take up their space. But I also have a much longer text line outside of this grid that I'd like to wrap. The grid's size is based on it's children which change dynamically.

#

Basically this image. If Blue were the textblock I want to wrap based on other widgets, Yellow were some other content that defines parent's width, and the textblock would use that defined width for wrapping.

celest locust
#

does anyone know what the deal with SDockableTab not being in UE5 is?

grave hatch
#

Have you tried SDockTab?

celest locust
grave hatch
#

The tab workflow is pretty badly documented.

#

We use it extensively.

#

Application modes, TabFactories and SDockTab

#

Though we don't use SDockTab directly, it's just returned from like FindLiveTab etc

celest locust
#

Ah fair enough. I don't know a single shit ahout slate

keen halo
#

Might find it useful

#

Check that out @celest locust

#

Might help in the future

craggy holly
#

wtf has happened to slots in 5.0? The code is so obfuscated now it's impossible to read or make sense of :/

grave hatch
#

What are you trying to do?

#

Slots were actually made easier to access because GetSlotAt on FChildren was made public

craggy holly
#

Just create a custom widget with slots. Now you have to add a whole lot of extra boilerplate

#

The difference in complexity for e.g. between SConstraintCanvas in 4.27 vs 5.0 is insanity

grave hatch
#

Heh

#

I mean, I'm looking at 5.x ConstraintCanvas and there isn't all that much complexity to it...

quaint zealot
#

The new slot syntax is a mixed bag

#

I think it's meant to behave a lot more like other arguments

#

And I supposes there's a memory/lifetime thing at work there too

#

It's also very unwieldy now

craggy holly
#

Well there's loads of code duplication now as well, like how the slots are being sorted in three places in SConstraintCanvas for e.g, but all in subtlety different ways.

grave hatch
#

Lol

craggy holly
#

Thank god for source code I guess

true scaffold
#

Completely new to Slate/custom editor stuff . Is it possible to create a window resembling something like this, where the information is populated by data on the blueprint?

So for example you fill out all the details on the blueprint and you can let's say right click on the blueprint file and select "view character sheet" then a window will pop up with those details filled in dynamically?

grave hatch
#

I'm not sure about the "right click and select view character sheet", but, yes, you can definitely create something like that and have it be populated from blueprint data.

keen halo
#

All my slate combobox and button functions don't work unless I use the _Raw version. Why is that?

#

It's working fine now but I was just wondering why, there is a mention of a StaticCastSharedRef: no matching overloaded function found I keep seeing each time

grave hatch
#

The default one is for shared pointers

#

I guess

keen halo
#

Makes more sense now

true scaffold
spring crescent
#

When using IDetailCategoryBuilder::AddCustomRow(), is there a way to force the row to appear at the top of the category?

cold quarry
#

How can I see which UMG widget owns the Slate widget?

spring crescent
#

Might want to look at the UWidget* FindWidgetFromSlate(SWidget* SWidget, UWidget* Parent) method in Steve's UE Helpers for inspiration.

grave hatch
cold quarry
hot notch
#

Does Slate have it's own IsKeyDown check like PlayerController? Would like to do some functionality in a widget's click events, but need to see if a keyboard button is pressed.

#

Would prefer to check globally instead of having the widgets themselves update that state for the check.

spring crescent
spring crescent
hot notch
spring crescent
# grave hatch You might have to look at the parent's children/ordering for that

Okay, so what one can do instead is define the properties in order and then replace the desired one as in LandscapeProxyUIDetails.cpp:

TSharedRef<IPropertyHandle> CreateVolumePropertyHandle = DetailBuilder.GetProperty(TEXT("bSetCreateRuntimeVirtualTextureVolumes"));
DetailBuilder.EditDefaultProperty(CreateVolumePropertyHandle)->CustomWidget()
.NameContent()
// Etc.
grave hatch
#

So it overrides each property in the section and puts its new one in the right place in the order?

spring crescent
#

Well, it overrides the one you provide the handle to.

#

Keeping it in-place.

grave hatch
#

Oooh, I see.

#

Yeah.

#

Sorry, I thought you were trying to add a new property in a specific place.

last comet
#

Is slate primarily for tooling? Im looking to expand my knowledge in that direction but not sure if slate is a better option or to use something like an editor widget

quaint zealot
#

It's generally not meant for direct game use

last comet
#

Ah good to know, thanks!

woven totem
#

Im not sure if its a good place , but its Under UI tab so i reckon i could ask here

#

Is there any shortcut/keybind for placing Actors in a Folder (in Outliner) so i dont have to grab them and scroll to the very top to my folders?

grave hatch
#

The Outliner is pretty poop. Just putting that out there.

olive trellis
#

how do you put a property view into a widget

#

making a property type customization on a struct

#

and ive been able to do a lot with it so far

#

but blocked by a few child properties in the struct

#

for one, there are edit inline (instanced) properties

#

and two, there are properties with their own customizations (FComponentReference)

#

ive seen that edit inline heavily relies on detail tree view to display property rows on expansion

#

but even if i manually loop over the child properties of the edit inline property, it doesnt display any of the instanced object properties

#

and as i understand it, the property rows are basically queued with AddProperty and then batch rendered based on scroll visibility in the detail tree view

#

so i cant really access or create these property rows on my own

#

but surely, there is a way to manually create what is needed for these properties?

grave hatch
#

The property editor module has a method to create a display for a single property

#

You could try that?

olive trellis
#

unfortunately, that accepts a uobject not struct

upbeat orchid
#

Is there a recommended "getting started" with slate?

grave hatch
#

Mccoms hmmm.

#

See the pinned messages for a qt to slate guide.

#

Or search in this channel for it.

upbeat orchid
#

found it thanks!

olive trellis
#

is there really no way to get a property's default widget?

spring crescent
olive trellis
#

get default widget didnt work, it doesnt show children

#

so i ended up looping through recursively with 1000000 different conditionals to handle each type :/

#

and its still not working for container types because theyre special displays so gotta write even more duplicate code

olive trellis
#

anyone have any idea why my details panel scroll bar is kinda broken?

#

it's as if it's not computing the heights of some custom elements unless they are visible on screen

#

it causes me to not be able to scroll down to the bottom in some cases

#

since the total computed height of the details panel is incorrect and too short, i have already reached the "end"

#

i assume it's because i have a pretty long custom row

#

but i really need that, since i am using the custom row to contain a tab pane and then within the tab pane i am adding things

#

i guess i can just segment the tab pane and add a visibility attribute for each row but i would rather not do that

#

i really just want to be out of here as soon as possible

#

slate is just really good and really bad at the same time

grave hatch
#

Define "doesn't work"

#

And show screenshots

craggy holly
#

Also UE4 or UE5?

#

Global Invalidation has broken a lot of things in UE5, so wouldn't be shocked if some stuff is borked

olive trellis
#

we have global invalidation enabled in our UE4 project

#

my only problem at the moment is really just the scroll thing

grave hatch
#

Global invalidation?

rocky abyss
#

Mmm it stabilized quite a bit in 4.27

craggy holly
#

It's more likely the widget just isn't computing the right desired size during prepass

tulip bane
#

anyone happens to know how to make an unreal Slate SDetailsView stack the properties of 2+ different objects?
kinda the opposite of how selecting 2+ actors in the outliner only shows the properties that they share (so you can edit them at once)

olive trellis
#

im using SBox, SHorizontalBox, SVerticalBox, CreatePropertyNameWidget, CreatePropertyValueWidget, GetDefaultWidgets, STextBlock, SButton

#

maybe it's HeightOverride in SBox? should I change to desired height?

gusty stirrup
#

Hey people, I upgraded my project to UE5 and I realized my structures which customised with PropertyTypeCustomization cannot be edited in the editor. Is there something changed? I removed the customization and they became editable. Is there something I need to change?

gusty stirrup
#

I will temporary make header visible until I find a solution.

granite perch
#

there a gd way to redraw a gameplay tag container @ editor, it doesnt enjoy updating visually even when the delegates are called except when it's manually interacted w

warm vault
#

How are you all constraining ultrawidescreen UI to the center? Using an SBox with SetMaxAspectRatio(16.f/9.f) for example works but how do I center the SBox? I can't Fill and Center I have to pick either Fill or Center so I'm a little confused trying to get both

grave hatch
#

Add a constraint canvas

#

They usually do a pretty good job.

#

Or a scalebox or sizebox whatever they're called. There's something with a fixed ratio.

warm vault
#

SBox is a sizebox. The weird thing is I can get it to work perfectly fine in selected viewport mode but if I use play in new window the UI downscales and doesnt fit the full screen, must be something else thats messing with it even tho its a brand new project

warm vault
#

This is what I have in a brand new project:

ChildSlot
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
[
    SAssignNew(EntireUIContainer, SBox)
    .WidthOverride(InArgs._SizeX)
    .HeightOverride(InArgs._SizeY)
    [
        SNew(SImage)
    ]
];```
adding this on window resize: `GEngine->GameViewport->Viewport->ViewportResizedEvent.AddUObject(this, &AMainHUD::OnWindowResize);`
and just taking the viewport height and multiplying it by the aspect ratio I set to get the width, in this case 16/9 just to get a test in:
```cpp
EntireUIContainer->SetWidthOverride(FinalUISize.X);
EntireUIContainer->SetHeightOverride(FinalUISize.Y);

for some reason this only works when the viewport height is higher than a certain number of pixels, usually like 1080+ which doesnt make sense cause im forcing the sizebox height to always be the same height as the viewport, so the image should always be as tall as the window, right?

FVector2D ViewportSize{0};
GEngine->GameViewport->GetViewportSize(ViewportSize);

FIntPoint ViewportSizeInt = ViewPort->GetSizeXY();

I've tried both of these and they give the same results basically
I'm using this to add my SCompoundWidget to the viewport:
GEngine->GameViewport->AddViewportWidgetContent(SNew(SWeakWidget).PossiblyNullContent(MyEntireUIContainer.ToSharedRef()), 50);
Why would the sizebox not take up the entire windows height? Anyone have any idea? Screenshot to show what I get

grave hatch
# warm vault

I've found that the viewport size thing to be... unreliable.

#

The event anyway.

#

I ended up overriding the Draw Method on a custom viewport client and extracting the viewport size there.

#

...and then triggering my own event if it had changed.

#

You could also use a full screen widget in the background that you get the TickSpaceGeometry from as another option.

craggy holly
loud rune
#

If the parent's visibility is SelfHitTestInvisible, would that mean all children that are Visible will also not be hit?

grave hatch
#

Isn't there a setting that affects children too?

#

Maybe?

#

And no, I don't think that applies. I think it only applies to the widget itself.

loud rune
#

perhaps I should try setting the z-index then (to get hit events)

grave hatch
#

There's something that affects all children when you change visibility. Somewhere.

#

Though I don't think this is relevant to your issue ๐Ÿ˜›

#

Have you tried turning self hit test invisible off for that widget to test?

loud rune
#

currently trying to figure out how in the widget reflector (if even possible)

grave hatch
#

I don't think you can. Is it not your code?

loud rune
#

no, I'm trying to help someone enable mouse hover events; the mouse shows up as expected, and I know the logic is correct because I can get it to work in a simple sandbox project, so I figured something was intercepting those events. According to the Widget Reflector, this seems to in fact be the case.

grave hatch
#

There's a log to see what's consuming events iirc?

loud rune
#

I just ran "Pick Hit-Testable Widgets" in the Widget Reflector

grave hatch
loud rune
#

๐Ÿ™Œ๐Ÿป Z-order for the win!

grave hatch
#

I'm pretty sure, though, that SelfHitTestInvisibile and HitTestInvisible is to do with children

#

I can confirm SelfhittestInvisible doesn't sotp children being interacted with.

warm vault
# grave hatch You could also use a full screen widget in the background that you get the TickS...

Hmm you're right and I'm even more confused now. So I created a simple SBox with HAlign and VAlign set to Fill and added that to the viewport first.
Here's an exact test case of what happened, I print screened my window and measured it exactly in photoshop. I ignored borders and only checked viewport size and I got 1800 x 743
The GEngine->GameViewport->GetViewportSize gives me exactly those numbers.
THe FViewport* I get from the window ViewportResizedEvent gives me the exact same numbers as well. However using your GetTickSpaceGeometry like you mentioned for the simple SBox I created gives me somethign else

FVector2D TestAbsoluteSize{TestBox->GetTickSpaceGeometry().GetAbsoluteSize()};
FVector2D TestLocalSize{TestBox->GetTickSpaceGeometry().GetLocalSize()};

AbsoluteSize gives me 1792.999986 x 741.999982 so pretty close
but LocalSize gives me 2615.672607 x 1082.447876

Now I'm not sure why local size is so massive and significantly bigger than the entire window even, but using the local size to set the width and height of my EntireUIContainer ends up working exactly the way I want it to as you can see in the picture below which is what I used to measure the viewport in photoshop as well. But why? That means its not pixel perfect and setting the width and height override that unreal is using some kind of DPI scale or something I don't understand to downscale it into the viewport, but why and how does that work? Any ideas on what I should be looking into or if theres an explaination I can understand for this so I can understand how to size my UI and everything better?

grave hatch
#

Isn't there a widget that has an aspect ratio lock?

warm vault
#

SBox is a sizebox and has a Set Max/Min aspect ratio but id still have to set the height for it wouldnt I

grave hatch
#

I imagine the AbsoluteSize is the size without the window borders and title bar, btw.

#

You shouldn't have to, if it's the root widget, it should fill the screen.

warm vault
#

Ive used that method and it does work perfectly as well, with just SetMaxAspectRatio(16/9) or whatever the method is, but it wasnt centered to the screen anymore since I had to use HAlign_Fill instead of HAlign_Center

#

I havent tried a better container tho, maybe the SConstraintCanvas like you said could allow me to anchor it to the middle, will give that a try

grave hatch
#

It should do, but it won't allow you to set height relative to width or vice versa.

warm vault
#

I'm not at my PC but just realized that it wouldn't work. Canvas doesn't allow children with Fill afaik, you have to set the size. So even if I could set the sizebox to be centered I wouldnt be able to use Fill, I'd still have to manually set the width and height so it'd be the exact same solution as before. I do prefer the SetMaxAspectRatio no the sizebox with fill cause it just works, but no idea how to center it

grave hatch
#

I discovered the magic of overriding OnArrangeChildren on Canvas last night.

#

Maybe you should look into it ๐Ÿ˜„

warm vault
grave hatch
#

Np!

#

I used to to fix wrapbox (it doesn't work how I want it to).

#

Reimplementing the code for it took about 5m and worked perfectly with canvas!

warm vault
#

Good point, might end up using this myself further down the road if I want to arrange the content in my own way. Makes this even better to know now so thanks again, really saved me there was going crazy to do somethign so simple

warm vault
#

Has anyone exposed SSplitter so it can be used in Editor Utility Widget from the palate window? or is there a work around to create my own? I want to have the ability to resize my rows, similar to UE's functionality.

warm vault
#

If I create an Image that's 250x250 when I hit play it gets downscaled because of the DPI scaling rules, which is fine but I'm trying to figure out and possibly change the initial screen size it scales from. Right now it seems to be 1920x1080. In Project Settings under Engine -> User Interface there's an option for Scale To Fit Rule -> Design Screen Size that's 1920x1080 but if I change it to 1280x720 it still doesn't make my 250x250 image be 250x250 in game. Am I missing some other option or what am I doing wrong?

grave hatch
#

I'm not even sure you can do that. UI Scaling is there because people want their UI to be bigger. Is there some reason it has to be 250x250? instead of, say, 500x500 because somebody is using a small 4k monitor?

#

You could override SImage and ComputerDesiredSize, dividing your image size by the layout scale multiplier.

warm vault
#

The scaling is fine, the only reason why I wanted it to be 250x250 is so I can create my base UI and know how it'd look but right now if I'm setting an image to be 250x250 and it's returning it as 164x164 I can't really trust the numbers I input if that makes sense and it makes it harder to build the rest of the UI. I guess instead of building it for 1280x720 as a base I can just build it for 1920x1080 since they are the same aspect ratio

grave hatch
#

Just build it for whatever res your screen is.. assuming you test in full screen.

warm vault
#

Ye I'll try that, thanks again

abstract spindle
#

any idea why a plugin wouldn't be able to find
.ButtonStyle(FEditorStyle::Get(), "FlatButton.Light")
I can see niagara is using the same style and doesn't throw warnings

grave hatch
#

You should use FAppStyle::Get() now

#

Official Epic style guide!

#

Also you probalby need to link the module FEditorStyle is in.

small marsh
#

is there a way to dynamically pick the SWidget being constructed in slate?

#

SNew seems a macro that needs the class specified at compile time

grave hatch
#

That's a good question!

small marsh
#

;__;

#

any workaround to the problem?

#

I'm trying to have SListView be provided a widget class dynamically

#

can i pass maybe a factory lambda?

#

i'm looking in the editor code but all there is for OnGenerateRow is "this"

#

.OnGenerateRow(CurveEditorTree.Get(), &SCurveEditorTree::GenerateRow)
ok a regex found me this

#

but that still doesn't look very dynamic to me

grave hatch
#

You can replace this with whatever you like.

#

As long as the object has a valid method to use.

small marsh
#

yes, but will inheritance work on that call?
I mean, if i have a child of SCurveEditorTree with a overridden GenerateRow, won't that code still fetch the parent GenerateRow instead of the child's?

grave hatch
#

No, it will run the child's method.

#

If you don't trust it, don't override GenerateRow, but still use it as the function pointer, and have it call a second function which you do override.

#

But you really don't need to...

#

@small marsh

small marsh
#

uuhm, thanks

#

i did make it work in another way, though

#

if anybody is searching and finding this, what you're looking for is in SCompElementsView

#

SLATE_EVENT(FOnGenerateRow, OnGenerateRow)
this is a normal delegate that can even be assigned directly to a lambda (OnGenerateRow_Lambda)

celest locust
#

am i able to have a "window" widget (ie a box with a titlebar with a close button) but set the box as a "add children here" type thing? unity has this, so if i add a child at 0, 0 it will be in the top left of the box (give or take padding)

grave hatch
#

Do you want that window to stop you tabbing back to the game/engine?

celest locust
grave hatch
#

I don't think that exists as is. Just create a widget for yourself with an SBox in the middle you can add widgets to.

heavy sorrel
#

Hello!
I want to use Blueprint or C ++ and enter text in the search box. (For example, Content Browser search box) Is this possible?
Is there any document that can be used as a reference?
I'm sorry if the place to ask a question is wrong.

grave hatch
#

Your first challenge will be getting a reference to the search box.

#

You can do it by navigating the slate hierarchy, but, yeah, it's gonna be shit.

#

I wouldn't.

heavy sorrel
#

I see, it's hard ...
It was helpful. thank you!

spare bane
warm vault
#

Totally random question but SCompoundWidget doesn't have an OnInitialize override method in any way right? I went through the hierarchy twice and couldnt find anything but just wanted to make sure since you guys know better. From what I read Construct can be called multiple times throughout it's lifetime so was double checking if you guys knew anything, cheers

spring frost
#

How would I find out if an SWidget is a UserWidget?

#

Im guessing a Static Cast to <SObjectWidget> would be sufficient?

#

Seems that would be ok, as TakeWidget ultimately ensures the UWidget::MyGCWidget is filled with an SObjectWidget that wraps the UUserWidget

#

๐Ÿ‘

celest locust
#

So I'm wanting to create a binding for the background color of a button but I can't do that in umg (or can't figure out how to if it's possible). Would slate allow me to do this? Or is there a way I can build my own button with a custom binding for the background color?

grave hatch
#

You can't.

#

You can change the style, though. It just can't be bound.

celest locust
# grave hatch You can change the style, though. It just can't be bound.

Even if I was to make my own button type? I'm not sure how binding works in slate but I assume if I make my own widget I can also make my own bindings for stuff in it. I know I can change the style but I can't bind it afaik which means I need to have an external function that tells my widget to update the style

grave hatch
#

Sure you can. But your custom widget would only be updating the button style in the background - if you used SButton as your button type internally.

#

You can override SButton and override methods to update the style.

celest locust
grave hatch
#

You can't bind the style/background on an SButton.

#

You can create your own binding, but it won't automatically update the button.

#

If you create your own binding, you still need to add the logic which tells the button when to change its style.

#

You'd just fetch the current value from the binding each time.

grave hatch
celest locust
grave hatch
#

Yes.

#

That's why they're bad.

celest locust
#

Guess I'll just use the external function then

#

I'm not making a final production ready ui but it also seems like more work to do a binding lmao

pulsar remnant
#

Is there any demo or learning source that uses Common UI plugins input routing system?

chrome root
#

Is it possible to have a widget animate layout changes?

#

Similar to CSS' transition: width; for example

#

it's a border where the size of the inner element can change, and i don't want it to propagate instant to the outer border, but interpolate smoothly

grave hatch
#

Not by default.

tulip pollen
#

Anyone know how you might create separate game window through slate?
I've tried scenecapture + SWindow but I can't figure out how to hook up the inputs properly past that without modifying the engine.
I have access to a version that kind of works using a SWindow and SceneViewport among other things but its extremely disorganized and I can't place why it works after various attempts.

grave hatch
#

Have you looked into UGameViewportClient and SViewport?

#

Custom windows are a mix of viewports, viewport clients and sviewports. It's all a bit messy.

tulip pollen
#

Yea the version I have access to has those all in there too.
On attempts to isolate it so I can clean it up and bug fix the issues with it, it instead shows a blurry duplicate of the main window.

grave hatch
#

You'll need some way of specifying a custom location for the rendering. It can just be a lcoation and rotation, you don't need to use a scene capture.

#

If it's blurry, it's probably rendering at too low of a resolution and upscaling.

tulip pollen
#

Alright I'll look into that, thanks.

grave hatch
#

Look into CalcSceneView on the viewport client

lean wing
#

How can I add a custom category and button to the window dropdown? https://gyazo.com/9adf19c98352016771929aca775edd0d I found UToolMenus::Get()->ExtendMenu("LevelEditor.MainMenu.Window")->AddSection("WindowMySection", LOCTEXT("WindowName", "My Window") which I thought would do the job but doesnt seem to do anything. Does it need a button to be added under it to show up?

grave hatch
#

Probably, yes.

craggy holly
#

Anybody having issues with SMeshWidget stability in UE5?

#

Getting a lot of crashes in the Slate Rendering thread when trying to synchronise properties etc.

#

Almost like a shared resource is being killed

grave hatch
#

Does the Mesh widget render a mesh onto a render target and stick it in a widget?

craggy holly
#

negative

grave hatch
#

What does it do?

craggy holly
#

Just allows you to draw a huge amount of instances of custom geometry to slate, and you get a bit of custom data per instance as well

#

They draw in a single batch but the limitation is how much per-item data you can have, which you need to unpack in the material. Paragon used it for health bars, the spots on the map overlay etc.

#

And those funky UI-particle systems it had

agile briar
#

Hey, I'm wondering if anyone here knows more about this selection menu in user widgets

#
grave hatch
#

Check for all references to FWidgetNavigationData - there will be a customsation somewhere.

#

OR it'll be defined specifically for UUserWidget and that property name

#

Either way it should still mention the struct name

agile briar
#

That's the first thing I tried, but I couldn't find anything

#

I also checked the UWidgetBlueprint

#

Where would these things normally be defined?

grave hatch
#

They'd be defined in an details panel customiser

#

...which can be anywhere.

agile briar
#

Thx! That should give me some more clues as to where to look :)

#

Hadn't heard of detail panel customizers before

grave hatch
#

IDetailCustomization IDetailLayoutBuilder useful classes to look for

agile briar
#

Found it ๐Ÿ™Œ FWidgetNavigationCustomization thanks!

grave hatch
#

Np

#

What lead you to it? Does that class not mention the original struct?!

agile briar
#

It does actually, I probably only checked the runtime folders

grave hatch
agile briar
#

There's exactly one reference to it in the editor folders and that was the one

grave hatch
#

@fading valeCan you pin that here too?

fading vale
#

no, only if the duck asks :p

grave hatch
#

Thanks!

unkempt swallow
#

Is it possible to create a child class from a SButton or any SCompound Widgets without losing all the SLATE_ARGS ?
When I create a child SButton Widgets I loose all of the custom args or I can't add Slate args to it

grave hatch
#

What you can do is add an argument to your own widget that is of the type of the parent class's args

#

E.g. SButton::FArguments

#

Then pass that to the sbutton constructor like SButton::Construct(InArgs._ButtonArgs)

unkempt swallow
#

Hey thanks for the respond do you have a quick exemple or where this things is does in the engine to have a reference ? Here's what I have

#

My FDarkProjectDescriptorButton is a subclass of SButton

grave hatch
#

I don't know of an engine class that does it, but I've talked to an Epic employee who suggested this method.

unkempt swallow
#

ok I' m gonna search how to it works !

grave hatch
#

SLATE_ATTRIBUTE(SButton:FArguments, ButtonArgs)

#

if (InArgs._ButtonArgs.IsSet()) SButton::Construct(InArgs._ButtonArgs);

#

Then to set your button args do .ButtonArgs(SButton::FAguments().Property1(5).Property2(3)) etc

unkempt swallow
#

Hum I' m lacking of some experience with slate the SLATE_ATTRIBUTE will be in my custom Button and the if section will be in the construct of my custom SButton ?

grave hatch
#

Yes

#

Should probably be the first line of your Construct

unkempt swallow
#

The issue I have is when I put the SLATE_BEGIN_ARGS(SDarkProjectDescriptorButton) the parents args broke and If I set it to Button all new Attribute is not compiling :?

grave hatch
#

Show the code that is errroring and the error from your output log.

unkempt swallow
#

ok

#

Here's my .h

class GAMEUTILITYEDITOR_API SDarkProjectDesciptorButton : public SButton
{
    
public:


        SLATE_BEGIN_ARGS(SDarkProjectDesciptorButton)
            :_ButtonArgs()
        {}
        /** The text to display in this button, if no custom content is specified */
        SLATE_ATTRIBUTE(SButton::FArguments, ButtonArgs)
        SLATE_END_ARGS()
    FText NewTextARGS;
grave hatch
#

Take out :_ButtonArgs()

unkempt swallow
#

here's the cpp without the _ButtonArgs()

+ SHorizontalBox::Slot()
        .VAlign(VAlign_Center)
        .HAlign(HAlign_Right)
        [
            SNew(SDarkProjectDesciptorButton)
            .Text((FText::FromString((InItem->bIsAShot == true) ? "Select Shot" : "Select Sequence")))
        ]
#

DarkProjectDesciptorTreeView.cpp(45): [C2039] 'Text': is not a member of 'SDarkProjectDesciptorButton::FArguments' and the error

grave hatch
#

Well, you don't have a Text argument on SLATE_BEGIN_ARGS(SDarkProjectDesciptorButton)

#

you'd need to do

unkempt swallow
#

Yeup that where my issue is I want to keep the parents args from SButton which contain the text args

grave hatch
#

.ButtonArgs(SButton::FArguments().Text((FText::FromString((InItem->bIsAShot == true) ? "Select Shot" : "Select Sequence"))))

unkempt swallow
#

oh ok

grave hatch
#

OR

grave hatch
#

SButton::Construct(SButton::FArguments().Text(InArgs._Text))

#

And remove the ButtonArgs attribute

#

The ButtonArgs variable is just more flexible.

unkempt swallow
# grave hatch `.ButtonArgs(SButton::FArguments().Text((FText::FromString((InItem->bIsAShot == ...

this method is throwing me this error :

DeclarativeSyntaxSupport.h(863): [C2664] 'void SButton::Construct(const SButton::FArguments &)': cannot convert argument 1 from 'const SDarkProjectDesciptorButton::FArguments' to 'const SButton::FArguments &'

SNew(SDarkProjectDesciptorButton)
            //.Text((FText::FromString((InItem->bIsAShot == true) ? "Select Shot" : "Select Sequence")))
            .ButtonArgs(SButton::FArguments().Text(FText::FromString("Test ARGS")))
#

thanks for your precious answers

grave hatch
#

Show your header

unkempt swallow
#
class GAMEUTILITYEDITOR_API SDarkProjectDesciptorButton : public SButton
{
    
public:

        SLATE_BEGIN_ARGS(SDarkProjectDesciptorButton)
        {}
        /** The text to display in this button, if no custom content is specified */
        SLATE_ATTRIBUTE(SButton::FArguments, ButtonArgs)
        SLATE_END_ARGS()

    virtual void Press() override;

    
};
grave hatch
#

And your Construct function?

unkempt swallow
#

I don't have the construct function because the construct is not virtual and can't be implemented in my child class

grave hatch
#

Construct doens't need to be virtual

#

You need to implement it in your class...

#

void Construct(FArguments InArgs);

unkempt swallow
#

That's when I think I missed some stuff what's the role of my construct in that case ?

grave hatch
#

To process your arguments

#

Also to stop your compile error

unkempt swallow
#

(Found in SButton.cpp)

OnHovered = InArgs._OnHovered;
#

Those line create the args ?

grave hatch
#

No.

#

Those lines take the args and assign them to class members.

#

SLATE_ATTRIBUTE/ARGUMENT create arguments

unkempt swallow
#

ok and so what do I need to add in my construct to create new args over the parents one ? (sorry for the dumb question I tried to do my best)

grave hatch
#

First off, create your construct method and see if it compiles.

unkempt swallow
#

ok here's the error with this construct Method :

#

DarkProjectDesciptorTreeView.cpp(65): [C2511] 'void SDarkProjectDesciptorButton::Construct(const SDarkProjectDesciptorButton::FArguments &)': overloaded member function not found in 'SDarkProjectDesciptorButton'

void SDarkProjectDesciptorButton::Construct(const SButton::FArguments& InArgs)
{
    
}
grave hatch
#

No no

#

I didn't say SButton::FArguments

#

just FArguments in that method params

unkempt swallow
#

Yeup I tried with this param and I got this :
DarkProjectDesciptorTreeView.cpp(65): [C2511] 'void SDarkProjectDesciptorButton::Construct(SDarkProjectDesciptorButton::FArguments &)': overloaded member function not found in 'SDarkProjectDesciptorButton'
I tried with or without const as I saw on engine SWidgets files

void SDarkProjectDesciptorButton::Construct(FArguments& InArgs)
{
    
}
grave hatch
#

const FArguments& InArgs

unkempt swallow
#

Yeup same
DarkProjectDesciptorTreeView.cpp(65): [C2511] 'void SDarkProjectDesciptorButton::Construct(const SDarkProjectDesciptorButton::FArguments &)': overloaded member function not found in 'SDarkProjectDesciptorButton'

void SDarkProjectDesciptorButton::Construct(const FArguments& InArgs)
{
    
}

header

void Construct(const FArguments& InArgs );
grave hatch
#

Overloaded huh

#

What's your complete header?

unkempt swallow
#
class GAMEUTILITYEDITOR_API SDarkProjectDesciptorButton : public SButton
{
    
public:

    void Construct(const FArguments& InArgs );
    
        SLATE_BEGIN_ARGS(SDarkProjectDesciptorButton)
        {}
        /** The text to display in this button, if no custom content is specified */
        SLATE_ATTRIBUTE(SButton::FArguments, ButtonArgs)
        SLATE_END_ARGS()
    FText NewTextARGS;
    SButton::FArguments ButtonArgs;

    virtual void Press() override;

    
};
grave hatch
#

erm

unkempt swallow
#

My poor class is so empty but also so broken at the same time simBLJ

grave hatch
#
{
    
public:
    
    SLATE_BEGIN_ARGS(SDarkProjectDesciptorButton)
    {}
    /** The text to display in this button, if no custom content is specified */
    SLATE_ATTRIBUTE(SButton::FArguments, ButtonArgs)
    SLATE_END_ARGS()

    void Construct(const FArguments& InArgs );

    virtual void Press() override;
    
};
``` Try that
unkempt swallow
#

ok it's compiling it's crashing when creating those buttons !

grave hatch
#

And the crash is?

#
  • Show me the cpp file
#

And how you create the button

unkempt swallow
#

The crash

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000080

UE4Editor_Slate
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_DarkUtilityEditor!SListView<TSharedPtr<FDarkProjectDescriptorListStruct,0> >::GenerateWidgetForItem() [C:\Program Files\Epic Games\UE_4.27\Engine\Source\Runtime\Slate\Public\Widgets\Views\SListView.h:1308]
UE4Editor_DarkUtilityEditor!SListView<TSharedPtr<FDarkProjectDescriptorListStruct,0> >::ReGenerateItems() [C:\Program Files\Epic Games\UE_4.27\Engine\Source\Runtime\Slate\Public\Widgets\Views\SListView.h:1192]
UE4Editor_Slate
UE4Editor_DarkUtilityEditor!STreeView<TSharedPtr<FDarkProjectDescriptorListStruct,0> >::Tick() [C:\Program Files\Epic Games\UE_4.27\Engine\Source\Runtime\Slate\Public\Widgets\Views\STreeView.h:579]
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_PropertyEditor
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_SlateCore
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
UE4Editor_Slate
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
UE4Editor
kernel32
ntdll

How I create my button in my list view on the Generate Row

TSharedRef<ITableRow> SDarkProjectDesciptorTreeView::GenerateRow(TSharedPtr<FDarkProjectDescriptorListStruct> InItem, const TSharedRef<STableViewBase>& OwnerTable)
{
    return SNew(STableRow<TSharedPtr<FString>>, OwnerTable)
    [
        SNew(SHorizontalBox)
        + SHorizontalBox::Slot()
        .VAlign(VAlign_Fill)
        [
            SNew(STextBlock)
            .Text(FText::FromString(*InItem->SequenceName))
        ]
        + SHorizontalBox::Slot()
        .VAlign(VAlign_Center)
        .HAlign(HAlign_Right)
        [
            SNew(SDarkProjectDesciptorButton)
            .ButtonArgs(SButton::FArguments().Text(FText::FromString("lol")))
        ]
    ];
    
}

The cpp of my Custom Button

void SDarkProjectDesciptorButton::Construct(const FArguments& InArgs)
{
    
}

And the Header of my custom button

class GAMEUTILITYEDITOR_API SDarkProjectDesciptorButton : public SButton
{
    
public:

    
    
        SLATE_BEGIN_ARGS(SDarkProjectDesciptorButton)
        {}
        /** The text to display in this button, if no custom content is specified */
        SLATE_ATTRIBUTE(SButton::FArguments, ButtonArgs)
        SLATE_END_ARGS()
    
    void Construct(const FArguments& InArgs );
    
    virtual void Press() override;

    
};
#

And the crash is happening only with my custom button

grave hatch
#

Install the engine debug symbols.

#

I can't debug list views I'm afraid!

unkempt swallow
#

Yeup I' ll continue on the debug big thanks to you for answering all my questions !

#

Slate is tough to get on and to understand all it's aspect etc

forest bough
#

I'm trying to get the SVerticalBox from a UVerticalBox

MakeShareable(static_cast<SVerticalBox*>(WidgetLeftNodeBox->GetCachedWidget().Get()));

But this returns null

agile briar
#

TakeWidget() ?

#

Returns the slate widget from a uwidget

unkempt moss
#

Hi everyone. I have a SComboBox with four options, but when I change the option, the selected item doesn't change. What can I do? Thanks.

dapper dawn
#

Is slate for editor only stuff or is it meant for game stuff too?

thick pasture
#

You can do almost everything though in UMG, since itโ€™s basically just a wrapper for slate

grave hatch
#

Slate isn't really good for companies to use, it has no designer interface for artists, etc.

#

For games, that is.

#

Someone should really make a slate editor, like the umg one.

#

Or just a UMG Slate exporter!

hot notch
#

Looking for some potential help with SBackgroundBlur. I'm using the UWidget wrapped version, but I'm fairly sure this is an issue with the slate's OnPaint. I can't quite understand where this white is coming from. I have a fullscreen widget. Basically the Hierarchy would be as follows.

Scalebox in some other widgets
Overlay, set to fill
BlackBorder, set to fill
BackgroundBlur, set to fill, strength at 80.0

Depending on screen resolution, this weird white is either on the left and right or top and bottom of the screen. I'm fairly sure this has something to do with screen edge detection as I can repro it in editor by moving the widget to the edges of the editor in viewport.

#

In editor it's easier to show. This is the widget fully in screen. And then nudged slightly to the left.

grave hatch
#

My advise? Put a 1 pixel spacer around the edge and blur everything inside it ๐Ÿ˜ฆ

steel flume
#

Hi pal....Did you achieve it??
If yes, would you please tell me how??

feral arch
#

Hitting some issues getting stuff refreshing with slate. I have made a table UObject class backed by a Slate table class. It so far works fine when it comes to constructing any kind of slate objects that I want in the cells, but I am hitting a large roadblock when it comes to adding rows. In my AddRow() function in the slate class, I add the new slate widgets to a array and have been calling Invalidate(EInvalidateWidget::Paint);. The issue is that the constructor never runs again after the initial construction (so I am unable to edit the ChildSlot). Is there some trick to forcing the slate object to regenerate, or is there another standard way to change the slate visuals?

#

Basically I can get all the information into the right locations, but just can't get the slate/uobject to reprocess the new information

abstract spindle
cyan moth
#

How to pass world context/player controller/anything to slate things like URichTextBlockDecorator?

For similar situation with Drag and Drop, I could pass player controller to drag and drop payload and it was fine, but here I don't see any parameters exposed

Is this safe (post by Brolock)? https://forums.unrealengine.com/t/can-you-use-a-blueprint-function-library-in-an-object-class/350918/21

cyan moth
#

Someone says that calling GetOuter()->GetWorld() is not allowed (even though it works), but what's an alternative? How to pass world on construction so that I can safely return it from there?

faint timber
#

Howdy, I just created a base plugin for and Editor Standalone Window. I was wondering if anyone had a tutorial reference to jumpstart my knowledge of adding elements to this custom tab

grave hatch
#

Teh pinned message about qt to slate is quite helpful

supple hinge
#

hello how can i add the functionality to alt click a line made with FSlateDrawElement::MakeLines to cut it? exactly what happens in BPs

broken beacon
grave hatch
#

I mean, there's a web client built in. You can just use that and literally write your UI in html.

broken beacon
#

Kinda like Source Panorama
That way web dev kids won't have to use the dreaded CEF / Web Browser widget

#

The CEF in the engine is so outdated

grave hatch
#

It's updated in 5.1 I think

#

At least I saw some new binaries be uploaded to p4

river ibex
#

Hey All trying to make a plugin and im using slate but the format is not going well only a single box appears and im trying to have a menu appear

grave hatch
#

Use the widget reflector to find out why.

#

Pay close attention to desired size and actual size

#

A lot of widgets, if they don't get their minimum desired size, just won't render at all and will have their actual size set to 0

river ibex
#

@grave hatch that was what was wrong

#

I made a couple of on clicked functions and getting an error when I call them. Any help would be appreciated

grave hatch
#
  1. never use the errors window, use the output window instead.
#
  1. copy+paste the entire log surrounded by ```
#

The issue there, though, is that you haven't declared your plug module as a subclass of TSharedFromThis

#

The solution, change the class to include: , public TSharedFromThis<yourclassname> on the end of the line that starts with class FACS...

#

Goes to bed

river ibex
#

@grave hatch Class FACS?

#

oh wait nvm

#

@grave hatch also i think .OnClicked_Raw(this, &FACSConversationPluginModule::OnCharacterTagClicked)

#

should work as well

#
(this, &FACSConversationPluginModule::
OnCharacterTagClicked)

#

dang still not used to this format

#

thankyou

#

@grave hatch apologies for the @ but that didnt solve the problem entirely. I had to add .OnClicked (FOnClicked:: CreateRaw(this, &FACSConversationPluginModule:: OnACSGraphClicked))

#

forgot the error but it was a sharred ptr error that occured when i clicked the plugin

grave hatch
#

Raw binds aren't great. If you reload your module and the button isn't destroyed and recreated, your editor will crash.

unkempt swallow
#

Is it possible to add some if statement inside of slate construction struct ?

#

Because right now I'm doing this kind of stuff

#
if(ShotData.Num() <= 0)
    {
        ChildSlot [
        SNew(SHorizontalBox)
        +SHorizontalBox::Slot()
        .HAlign(HAlign_Fill)
        .VAlign(VAlign_Fill)
        [
            SNew(SButton)
            .Text(FText::FromString(ButtonText))
            .HAlign(HAlign_Center)
            .VAlign(VAlign_Center)
        ]
        ];
    }
    else
    {
        ChildSlot [
        SNew(SHorizontalBox)
        +SHorizontalBox::Slot()
        .HAlign(HAlign_Fill)
        .VAlign(VAlign_Fill)
        [
            SNew(SButton)
            .Text(FText::FromString(ButtonText))
            .HAlign(HAlign_Center)
            .VAlign(VAlign_Center)
        ]
        +SHorizontalBox::Slot()
        .HAlign(HAlign_Fill)
        .VAlign(VAlign_Fill)
        [
            SNew(SComboBox<TSharedPtr<FTakesData>>)
            .OptionsSource(&ShotData)
            .OnGenerateWidget(this, &SDarkButton::MakeWidgetForOption)
            .OnSelectionChanged(this, &SDarkButton::OnSelectionChanged)
            .InitiallySelectedItem(0)
                [
                    SNew(STextBlock)
                    .Text(this, &SDarkButton::GetCurrentItemLabel)
                ]
        ]
        
        ];
#

And I was wondering if it was possible to include if statement inside to avoid copy and pasting the construct ui code

grave hatch
#

What you can do is declare the child widgets before delcaring the parent

unkempt swallow
#

Oh great

grave hatch
#

TSharedPtr<SWidget> MyChildWidget;

#

if (a) { MyChildWidget = blah; }

#

etc

#

Then do ChildSlot[ MyChildWidget.ToSharedRef() ];

#

Or however you want to do it

#

Or use the SAssignNew(MyChildWidget, SBlah) instead of = SNew(SBlah)

unkempt swallow
#

Ok thanks !

river ibex
#

Question, how do i make a button when pressed open up a blueprint

#

and create one

grave hatch
#

You want it to create a new bp asset and open it?

river ibex
#

yea

#

by pressing a button in the plugin window

#

or how do i make a list of characters that appear when i press the button

grave hatch
#

Creating bp assts isn't really a slate question

#

As for the other thing, implement sort OnClick method for the button.

river ibex
#

when i press the button that was designed in slate how to make a tab/dropdown list of all characters

#

i already have the on clicked functionality created and ready to go

#

when i click the button i want a small window to appear with a list of characters

grave hatch
#

"list of charcaters" ?

#

A, B, C, D, E?

river ibex
#

no

#

like npcs etc

#

anything that derives from a character

grave hatch
#

So any class that derives from ACharacter

river ibex
#

yea

grave hatch
#

You could try getting all the uclasses and checking them individually.

#

TObjecIterator<UClass>

#

That's more of a c++ question, though, not slate

river ibex
#

how do i go about making a popupwindow

grave hatch
#

Depends on the type of window.

#

Honestly, I'm not sure.

river ibex
#

a small window that contains a list of characters that when clicked directs you to that character

grave hatch
#

So like a mini content browser?

river ibex
#

well i want it to resemble the get all actors of class list

#

similar to that

grave hatch
#

Then use GetAllActorsOfClass

#

Or whatever it is.

river ibex
#

in slate? what about the popup window

grave hatch
#

Look at the code behind that function and see what it does.

#

Copy+paste

river ibex
#

with the window that opens up when i press on the plugin tab

#

ill see if i can figure something out, thanks

river ibex
#

how can i display a Tarray<FText> using slate

#

i tried .Text but that didnt work

grave hatch
#

Use FText::Join

river ibex
grave hatch
#

"\n" ?

river ibex
#

its a parameter for the join function

#

used to separate the contents

grave hatch
#

And I answered your question.

river ibex
#

ok

#

interesting its not displaying anything on my tab

#

@grave hatch is it because the list is too big

grave hatch
#

So add a scrollbox wrapper

river ibex
#

i just started using slate last night so how would that work

#

SNew(Scrollbox wrapper)

#

?

grave hatch
river ibex
#

thankyou

#

@grave hatch What would the syntax look like apologies im a little tired

grave hatch
#

Same as putting something inside any other widget

#

SNew(SScrollBox) [ your text stuff ]

river ibex
#

hmm i tried that before and it didnt allow it

#

maybe because i didnt include it

grave hatch
#

You probably don't need the vertical box

#

You could have just replaced that with the scrollbox

river ibex
#

ok

#

its not liking the brackets

grave hatch
#

Probably

#

Maybe you need a .Content? Search the engine source to see how it's used.

river ibex
#

ok

#

@grave hatch slate reflector?

#

the folder

grave hatch
#

I have no idea what that is.

river ibex
#

its in engine/source

#

@grave hatch nvm i got the .h file

#

so im still not sure

#

i believe it doesnt take[]

#

@grave hatch well this works but the text doesnt appear

#

when i uncomment the other text it appears

#

so is something wrong with the function

hot notch
#

I have an SGridPanel in a UserWidget. Populates fine, etc etc. But I'd like to reference a text widget in the grid to set some text. So. Problem is that I need to do this via slot numbers, as the grid's rows relate to an array used to populate them in RebuildWidget. So the only way I see to access children or slots in the grid is through it's FChildren. This has ForEachWidget and GetSlotAt. Neither of these work, as SWidget has no ability to get it's slot, and GetSlotAt returns an FSlotBase& which has no information on the grid slot's rows or columns. SGridPanel uses an FSlot. And I'm not sure if I can somehow get FSlot's data from the FSlotBase& or if there is some other method of simply getting an SGridPanel's chidlren by row/column that I might have missed.

agile briar
#

I just learned how to use slate styles to customize the editor using

StyleSet->Set("ClassThumbnail.MPlayerOP", brush);

Which other style set property names are there to customize (like "ClassThumbnail"). Is there a list somewhere?

low bluff
agile briar
#

I'm hoping there is a "ClassColor" or something

low bluff
#

@agile briar what to do want to change?

#

And I don't mean the property name, but rather what is the actual thing in the editor you want to change that you need this for

agile briar
#

The background color of the asset in the asset browser. Right now I have to create an asset type action just for the color

blissful gate
#

Hi, I've been playing with slate code and have been trying to assign an SEditableTextBox reference to a TSharedPtr in the following way:

// in .h
private:
TSharedPtr<SEditableTextBox> AssetNameEditableTextBox;
// in .cpp
[
  SAssignNew(AssetNameEditableTextBox, SEditableTextBox)
  .HintText(FText::FromString("e.g. BP_Character.uasset"))
]

The code in .cpp is ran inside a custom editor module class at the OnSpawnPluginTab() function
When I open my module window, the editor crashes, outputting EXCEPTION_ACCESS_VIOLATION, pointing at the line with SAssignNew (actually it points to the top of the whole slate structure)
Was I supposed to initialize the pointers beforehand is some way? I looked through this channel but couldn't find any cases like this. Thanks for any help.

burnt verge
#

i want to extend SButton to automatically create a STextBlock inside, providing an additional argument .ButtonText so that in the construct function I can add the textblock. I have trouble understanding the SLATE_BEGIN_ARGS macro, can someone point to me how I can inherit all the args that SButton already has?

#

i have no luck googling

blissful gate
burnt verge
#

nvm figured it out

lyric chasm
#

Probably sounds silly but is there any WYSIWYG editor for slate? I've followed some C++ tutorials for it and got so lost with errors that didn't make any sense to me. Or if not an editor for slate, then is there a way to use slate widgets in UMG? Like SMenuEntryButtons and such? I've had to make this kind of stuff from scratch in UMG so even just exposing it to UMG without much hassle from C++ would work fine

grave hatch
#

There is not. If you want that, use UMG.

lyric chasm
#

Yeah I thought that would be the case. Is there a way to use the slate classes in UMG then?

grave hatch
#

no

#

Not directly.

#

You have to use the UMG wrappers - or write your own.

lyric chasm
#

is that as simple as making my own class of a slate class? Or is there more to it?

grave hatch
#

Either extending UUserWidget or check out the classes like UButton to see what they do.

lyric chasm
#

Do they automatically show up in UMG's palette if they're UUserWidgets?

grave hatch
#

I honestly have no idea.

#

I don't use UMG!

lyric chasm
#

Ah. Thanks for the help though!

grave hatch
#

Np

agile briar
simple delta
#

Assuming you have a world map with 200 static icons, would it be better to use SMeshWidget for it? As far as I know it can create multiple textures in a single batch instance.

potent thistle
#

is there any case in which Slate components wrapped inside UMG would never be constructed? I'm trying to test a UMG widget but some events are never triggered, because the underlying Slate objects are all null

#

while the widget works in PIE without any problem

weary egret
#

are you constructing your slate in RebuildWidget()?

craggy holly
#

Well unless it's added to screen or viewport, nothing will be constructed

lost merlin
#

Question: I have this SpinBox but it's height is a little low and the text clips:
What is the reason for that? What can I do about that?

#

Nevermind, I fixed it.

zenith fulcrum
#

Looking to learn to write some custom editor with a view port, rendering a component, example could be a skeletal mesh component instance, I was wondering if there is any example work or somewhere simple in the editor I could look to learn from

jade hornet
jade hornet
# zenith fulcrum oh?

Yeah, not sure where it lives now, iirc it used to be under experimental under the editor preferences to enable the menu that let you use it, they might have put it in a seperate plugin now as I can't see it, but it litterally just lets you drag drop a viewport into UMG editor p much

grave hatch
# zenith fulcrum oh?

Creating the world that it lives in it a lot more involved than displaying it to the user.

warm vault
#

Hi everyone, I have a custom DataTable in my project that automatically changes its structure. A table row with name "NewRow_X" will automatically be removed and re-added with a generated name based on the row's content when the native "OnDataTableChanged()" event is fired.Problem is the DataTableEditor doesn't properly recognize such changes. It shows the row properly, but I cannot select it until closing and opening the tab for the asset again. I assume I have to refresh the view or something. Not sure if this is slate related, but I hope it is, any ideas how I could refresh the DataTableEditor?

grave hatch
#

Can you even do that in UMG? I mean, you can create a widget and give it a "screen size", but does that actually do anything?

#

Does it scale the widget based on the difference between the design-time screen size and the actaul one?!

pulsar remnant
#

It works with different screen resolutions too

grave hatch
#

Ah.

#

Neat.

#

I don't use UMG really!

sand frigate
#

I am drawing virtual textures using FSlateDrawElement::MakeRotatedBox in NativePaint, is there a way I can cull part of the texture if it goes beyond the widget it's drawn on or beyond certain screen/viewport space threshold?

E.g. the darkish square in background is area of the main widget, I'd like to cull the drawn textures past this area (marked as 1)

sand frigate
dreamy schooner
#

I have a question out of curiosity. Why use slate, if you can e.g. make widgets in blueprint widget editor and then call function, manage logic etc. in c++?

grave hatch
#

Not everything is exposed to UMG.

#

There's no real point using Slate for a game, though. It's mostly for editor extensions. You can use it for a game if you want, though. It's just not designer friendly.

mild oracle
craggy holly
#

Is there a good description anywhere (preferably with diagrams) of the various "spaces" used in Slate? I seem to be dealing with at least five of them at once (view, screen, absolute, viewport, local etc.)

grave hatch
#

Not really.

#

Trial and error? ๐Ÿ˜ฆ

mild oracle
craggy holly
#

Maybe if I can wrap my head around it ๐Ÿ˜„ Already finding that Paint vs Tick-space geometry are in two different spaces despite both being described as "Absolute"

#

The rules seem to be flexible.

#

Also, does anybody know of an existing widget container that restricts it's contents to the view rectangle of the viewport it's part of?

#

I don't want to use the Game Layers

grave hatch
#

So it clips anything that goes beyond it?

#

Or arranges things so they fit?

craggy holly
#

Arranges things, I need the geometry of the children to be over the display area

#

I thought it would be a SafeZone, but that doesn't seem to be it

grave hatch
#

ScaleBox?

#

Or a WrapPanel... I forget what those are called

#

WrapBox?!

#

Something with wrap in it.

craggy holly
#

Oh nevermind, I'm an idiot

#

I was calling AddToViewport instead of AddToPlayerScreen

#

The latter takes care of the actual view rect geometry

#

doh

burnt verge
#

anyone knows how I can get a pointer to a SConstraintCanvas's FSlot?

craggy holly
#

SConstraintCanvas has many slots

#

You access them by getting it's Children

burnt verge
#

i want to retain a way to access the slot directly when creating it

#

so I can move the slot around in the canvas

#

how can I do that?

craggy holly
#

When you add a slot it returns a reference to said slot

burnt verge
#

through AddSlot()?

craggy holly
#

You need to be extremely careful doing this because the lifetime of the slot is controlled by the panel

burnt verge
#

it returns SConstraintCanvas::FSlot::FSlotArguments to me

#

i know, I am not doing anything without the parent widget

craggy holly
#

Why can you not just use GetChildren and get the slot from there?

burnt verge
#

because I wish to have multiple slots and dont want to keep track of their indexes when creating and destroyign them

craggy holly
#

It looks like they removed the ability to expose slots in UE5 probably for this reason, it's unsafe to access them directly outside the panel containing them

#

It's very unsafe to store them

#

You don't really have an option but to store the index elsewhere, or find the slot based on it's content

burnt verge
#

i guess i'll just do the latter then

#

thanks

craggy holly
#

You can do it the same way UCanvasPanelSlot does it of course

#

But you need to ensure the slot pointer remains valid and/or is cleared when the panel removes it

#

When you add the slot you call Expose(MySlotPtr)

#

So long as you're careful and understand the lifetimes you should be fine

burnt verge
#

yeah, there wont be anything else other than my custom widget adding and removing slots

burnt verge
#

thanks its working sweet

craggy holly
#

Anybody know why on Earth Tick-Space geometry is different to Paint-Space?

#

TickSpace includes the window position, paint does not

#

And you can't get the allotted Paint-Space geometry during tick, because it's a frame behind

grave hatch
#

Because reasons.

craggy holly
#

There's no way to disable pixel snapping at the slate level is there?

wide plaza
#

Nick Darnell replied so hopefully there's some movement

river ibex
#

How to display a combobox with items in it, i have a UComboboxString called list of characters but not sure how to actually display the list

grave hatch
#

Are you intentionally trying to mix slate and umg?

river ibex
#

no

#

just trying to display a combobox with a list of characters in it with slate @grave hatch

#

I know UComboBoxString is not a slate class

#

but it has add option in it

grave hatch
#

Nothing pure-slate should have anything U-whatever in it, as far as I know!

river ibex
#

while the other doesnt

river ibex
grave hatch
#

You need to use the .OptionsSource property on the combo box

#

I think.

river ibex
#

so can i display the combobox string on the window?

#

instead of the reg combobox

#

which way would be more efficent

grave hatch
#

Shrug

river ibex
#

because combobox requires brackets

grave hatch
river ibex
#

Ashame there are hardly any resources on slate

grave hatch
#

Honestly, I would look up the uses of combo boxes in the engine.

#

The engine is the resource.

river ibex
#

how, i peaked the class and looked at it

grave hatch
#

Not the class, but how it is used in the engine.

#

Search for the class in the rest of the code.

river ibex
grave hatch
#

That's why I say "search"

river ibex
#

so search solution explorer

grave hatch
#

Why would you search the solution explorer?!

river ibex
#

idk im new at this whole using the engine to learn process

#

how do i start

grave hatch
#

ctrl+shift+f, make sure "entire solution" is selected and put the combo box class in the search box

#

Hit enter

river ibex
#

this window is ok

#

?

#

interesting

grave hatch
#

That's the search result window, yes.

river ibex
#

why does it use a shared ptr

grave hatch
#

Have you done any slate tutorials?

#

Do you know what sharedptr is?

river ibex
#

not really

#

and no

grave hatch
#

Then that's where you should start.

river ibex
#

i know what a pointer is

grave hatch
#

Slate is a very advanced part of the engine.

#

Go make a game first.

river ibex
#

i made game

#

multiple

grave hatch
#

Okay... go do some c++ tutorials, learn about the non-uboject side of the engine and slate tutorials?!

#

See the links in the pinned messages in here.

river ibex
#

there are hardly any slate tutorials though

#

i followed through a couple good ones ]

#

but thats all i could find

grave hatch
#

If you did and you don't know why they used a shared ptr, they were very bad tutorials.

#

See the pinned messages in this channel.

river ibex
#

@grave hatch yaw lighthouse?

grave hatch
#

Shrug read them all.

river ibex
#

oh wow

#

@grave hatch Thankyou

#

quick question, there are obviously many different types of data and they get passed as parameters, when reading the type how do you know what data to populate that type with? @grave hatch

grave hatch
#

You check how that type is used elsewhere in the engine.

#

Other than that, tutorials, reading the source code and trial and error

river ibex
#

ok thankyou

#

i found the file

river ibex
#

wait nvm thats not important

grave hatch
#

You can use UMG in c++, sure, but it's just a wrapper for Slate. If you're using c++ anyway, just use Slate.

#

All the classes are basically the same, just you have more options in c++.

wide plaza
#

or just put the logic in C++ leveraging BindWidget and then use the benefits of having an actual WYSIWYG editor

grave hatch
#

That too.

lethal spear
#

Hi!
If I created a SCompoundWidget child in C++, how could I make it usable inside widget blueprint?

river ibex
#

Does anyone know how to add items to a combobox

grave hatch
#

You need to use the Source (or whatever it's called) attribute

river ibex
#

i got that but when i try to click on the button nothing appears

#

im trying to create a widget

#

but looking at implementations and they have a parameter being passed in

#

while being called from a function

#

this is what i am looking at

#

this is what i have so far

#

but i get an error

#

i have a button that i click that opens up a tab where the combobox is displayed and it crashes when i click the button

#

if i comment out the generate widget the window opens up but when i click on the combobox it crashes

verbal dock
#

I'm trying to using the console command 'showhud' to hide my UI for some debugging purposes. I've noticed that works as intended in Lyra, but not in my game. I assume you have to associate the widget to the AHUD actor somehow. I'm having trouble tracking down where Lyra is doing this. Anyone have any insight?

verbal dock
vital halo
#

Hey, can someone help we what slate render to target means in the UE4 GPU Profiler. Is it just the UI I'm rendering?

wicked elk
#

I'm feeling pretty stuck running up against what I think is some Slate code... was wondering if anyone might be able to give me a suggestion. Basically what I want to do is detect a mouse button down on a widget, and immediately call BeginDragDrop with a payload. I hate how there is a hard-coded drag speed threshold when using DetectDrag.

The problem is that BeginDragDrop only accepts a type of FDragDropOperation, and I cannot figure out how to properly attach any kind of payload to this thing. It appears to be purely a Slate class, whereas before I was calling DetectDrag, which would then call the UMG UUserWidget function OnDragDetected, which lets you work with a UDragDropOperation, which seems significantly easier to use.

#

I have this in my UUserWidget function for now, but since the operation has nothing loaded into it, it does nothing as you'd expect. This is for being able to drag items out of an inventory panel...

FReply UInventoryItemSlot::NativeOnMouseButtonDown(const FGeometry& InGeometry, const FPointerEvent& InMouseEvent)
{
   FReply Reply = Super::NativeOnMouseButtonDown(InGeometry, InMouseEvent);
   if (InMouseEvent.GetEffectingButton() == EKeys::LeftMouseButton)
   {
      TSharedRef<FDragDropOperation> DragItemOperation = MakeShareable(new FDragDropOperation);
      return Reply.Handled().BeginDragDrop(DragItemOperation);
   }
   return Reply;
}
split laurel
wicked elk
split laurel
#

Well, if you have a subclass you can give it any data you like

#

You can check other drag drop op classes for how they are implemented and used

wicked elk
#

I guess it just feels like a massive effort, if I want to attach a small graphic to the mouse the same way the DefaultDragVisual member works in UDragDropOperation. That one has it all done for you, you just set that to a widget. I have no idea how to go about recreating that in the FDragDropOperation

split laurel
#

Ah you are talking about the visual representation?

#

Then go with FDecoratedDragDropOp instead

wicked elk
#

Setting the item data coming out of the inventory probably wouldn't be so bad. But yes, I was hoping to be able to set the visual representation on the mouse as well.

#

Ah cool, didn't know that was a thing. I'll look into it.

grave hatch
split laurel
grave hatch
#

It has some presuppositions that just don't gel with what I want to do with it. Extending from the FDragDropOperation is 100x simpler.

#

Run Construct() somewhere and override GetDefaultDecoratior() -> done

split laurel
#

Aye I think that was the function I was thinking of, but it's pretty much the same doing both

grave hatch
#

Honestly I just don't see the need to use the decorated one unless you want to specifically use its type of decorator. I think it's just text or something?

unique spear
#

Power

grave hatch
#

7

simple delta
#

I put a widget into an invalidation box and the slate component that I created still calls "OnPaint" function every tick, is that intended and the "caching" is handled somewhere else (i.e. it doesn't have to recompute it and is therefore faster)? Or should the OnPaint method not be called every frame if put into invalidation box?

wicked elk
# grave hatch It has some presuppositions that just don't gel with what I want to do with it. ...

I feel like I got into a bad rabbit hole with what I was trying to do. From my understanding, I was trying to use some very Slate-specific code in some very UMG-specific code, and the conversion between the two was just horrible to try to figure out. I ended up realizing through researching this that I wasn't properly handling and returning my Reply in the OnMouseButtonDown... once I fixed that the drag detection seemed more snappy, for some reason.

Still would like to see an implementation where on mouse click a DragDropOperation initiates immediately, but it seems impossible to find online.

grave hatch
#

Btw, when I do DnD, I do a return FReply::Handled().DetectDragAndDrop(something) and then do the actual dragndrop op with OnDragDetected

#

It looked like you weren't doing that?

wicked elk
#

Right, I didn't know you could format the return that way and I think I was only doing return Reply. Once I changed it to what you wrote, it seems to detect the drag quicker.

grave hatch
#

Nice

wicked elk
#

Yeah I changed it to:
return Reply.Handled().DetectDrag(TakeWidget(), EKeys::LeftMouseButton);

#

I guess what I'm wanting is not a drag & drop, but to left click a single time and have the clicked widget "attach" to the mouse in the same way a UDragDropOperation DragVisual does, then be able to move the mouse around without holding the buttons, and click again on another widget to perform the Drop operation

#

Might have been going down the wrong path the whole time

grave hatch
#

Maybe!

zenith fulcrum
#

Whats a good option for displaying a list of names, while being able to select between them

grave hatch
#

SListView

#

It has selection built in.

#

It's a bit confusing to initially set up if you haven't used it before.

zenith fulcrum
#

Ah oki ty

#

Can't wait to fight SListView

#

lmao

#

Can you pass a set of slate code around like a modular piece? or would you have to wrap it in macro's

grave hatch
#

Huh?

celest locust
#

does slate have a way to "copy" a brush? im trying to get the Graph.Node.ColorSpill brush but flip the image horizontally

grave hatch
#

A brush is just a sort of go between for Slate and an actual asset.

#

If the brush itself doesn't have the option to flip it, you'll probably need to make a new asset?

#

Or a Material / MaterialBrush that flips the texture horizontally?

gloomy sun
#

Why FSlateBrush uses a hard link to its ResourceObject instead of soft pointer? It seems that all textures referenced will be load once I load a widget, even if some images are never set to visible. Is this designed? I'm finding a way to reduce the load time of some large userwidgets, thank you for help!

grave hatch
#

Simply don't create the brushes until they are needed?

gloomy sun
#

That's ok, but there are too many images directly set their brush in details view. Modifying them seems a hard work = =

grave hatch
#

Then don't do whatever it is you're doing?

gloomy sun
#

I'm using a self-compiled version of ue, I'd rather modifying engine source code than the project. I tried on it and the change seems works, but yet don't know if there's any risk.

#

Thank you for your help anyway~

grave hatch
#

Np.

rapid fulcrum
#

Is there advantage to using SLATE instead of UMG?

grave hatch
#

More low level access to stuff.

#

There's plenty more advantages to using UMG over Slate.

#

Depends on your requirements.

#

A combination of the two can be quite effective.

sage bramble
#

What could be done to increase render perforamance of actor "nameplates" ? (name and information displayed on top of the actor using stale UI). This has a big impact on perf when having ~50+ actors on screen.

#

Is there some kind of tweaking, or should I not-use stale for this purpose?

grave hatch
#

Seems like it's taking 43 microseconds.

#

That's 0.000043s.

sage bramble
#

43 * 0,001 * 50 = 2.15ms if you have 50 actors. This is non negligable on a 10ms frame (maybe I'm wrong and this is not the issue).

grave hatch
#

Is 43 us with just 1 actor?

#

Have you tried with 50 actors to see if it is, indeed, just over 2 ms?

#

I don't think you need to tick the component just to display a nameplate, do you?

sage bramble
grave hatch
#

Well those 43 microseconds are inside the actor component tick function, so....

stuck jewel
#

43 microseconds is a huge time operation, that makes no sense

#

that smells more like recreating new labels every frame or something abnormal - spawning entire new actors typically takes a couple hundred microseconds. updating a slate label should be nothing in comparison.

#

@sage bramble (also i just realized i am in #slate and i never go in #slate and this conversation is hours old so i'm ping ing you)

dull patrol
#

Hey guys, is there an 'easy' way of displaying an Editor tab in VR Runtime?
I would like to edit static meshes properties in VR during runtime using the details tab

grave hatch
#

Using editor modules at runtime is strictly forbidden.

#

I believe the only exception is for inhouse stuff not released to the public? Something like that.

simple delta
#

Hello, performance question, let's assume you created a custom slate component that needs to constantly repaint itself in a tick but only for a set amount of time and then it can just freeze itself until it needs to do that again (e.g. crosshair -> spread is changing on tick when shooting, when idle it is not doing anything though). Is it better to:

  1. Have the slate component in an invalidation box and toggle volatility based on whether it should be updating the spread or not (that means it will cache itself when volatility is turned off if it doesn't have to update).
  2. Have it in an invalidation box and invalidate the widget on spread change manually (spread change is broadcasted on a tick so basically calling Invalidate every tick until it can be frozen again).

I was under the assumption that recaching a widget every tick costs more than just setting it as volatile to repaint itself next frame. And you should only cache a widget when it is not about to be changed next tick. That would mean that the first option would be more performant. Correct?

grave hatch
#

...probably?

#

Try profiling them.

simple delta
#

That is done via Slate Insights, right?

grave hatch
#

I'd assume so.

narrow terrace
# simple delta Hello, performance question, let's assume you created a custom slate component t...

Thats what invalidation is for, if you change a value and cause it to repaint or recalculate its desired size or its layout or its position, then that gets recalculated. Every frame its repainted but if you wrap it with an invalidation box then when the widget changes, it changes normally. But if you're not changing it then the invalidation box will cache its painted inactive state and not repaint until its been changed

#

Setting the widget to volatile can actually be more expensive depending on what you're doing because volatile in UMG/Slate means NOTHING is cached every frame, the layout is recalculated, the size is recalculated, repainted, etc. Its helpful if you're needing something that's changing every frame to always be up to date and they setup a code path for volatile widgets to make it a little bit easier but its still not recommended to turn that on unless you absolutely understand why you're turning it on

simple delta
#

So, just to share the results regarding the performance with you, they are wilder than I thought actually!

I created two identical custom slate widgets (crosshairs) with the only difference being how they are refreshed. They are both at the same time in the scene.

Rules:

  • Both slate widgets are getting the current spread value from a Tick and update their offset (in other words, they are updated every tick when spread is changed).
  • After 5 seconds both slate widgets "freeze" themselves for 3 seconds (for this duration they are cached and are not repainting - tested) and after that they again start updating offset.
  • This takes 3 iterations and then it programatically shuts down (so that it's acurate).

First widget WBP_Reticule_C

  • Every time the spread value is updated (that's every tick and assuming it's not currently frozen), the slate widget gets invalidated with a reason parameter "paint".

Second widget WBP_ReticuleVolatile_C

  • When the spread value is updated for the first time, set its volatility to true and invalidate the widget with a reason parameter "volatility".
  • When the spread value is not changing, set its volatility back to false (so that it can cache itself again and wait for another iteration).

The results are following:

WBP_Reticule_C is in the top part (first column is tick calls and second is OnPaint calls)

WBP_ReticuleVolatile_C is in the bottom part (the same as previous, first is tick, second is OnPaint).

#

So in conclusion, if you want to have a component that should update itself every tick (either all the time or on a timer basis and then cache itself), you should set volatility instead of invalidating every tick. Once you are done with updating the widget and want to cache the widget again until it has to do some work, you set the volatility back to false and wait until you want to start updating values again.

#

So re-caching by invalidating the widget every tick is quite expensive.

#

Obviously if you want to update the widget like once per 5 seconds or even more it's better to use invalidation.

grave hatch
#

Thanks for that, @simple delta !

dusty rampart
#

Hi guys, how can I get some learning materials or resources to make interactive ui main screen for the game, where can show players character, maps, assets etc like cod, apex legends game etc. Any suggestions please

mild oracle
narrow terrace
simple delta
#

I don't mind at all, go ahead!

One more think that may be the case that I was thinking about is that there may be a point where even if slate is invalidating itself irregularly (not every tick, but maybe every second) it may be faster to have volatility set to true even then.

I am sure a graph could be created that would show when setting volatility is actually a performance increase instead of invalidating based on frequency but I haven't got that deep into it yet, that may be tested by someone else ๐Ÿ˜„

In the same vein there would be a point where invalidation and setting volatility have equal performance cost.

narrow terrace
cold solar
#

Hey guys, I'm trying to add the gameplaytag selector to a slate element any idea?
It should something like SGameplayTagWidget

grave hatch
#

SComboBox ?

cold solar
#

I mean this element ๐Ÿ™‚

#

but outsite a detail panel

grave hatch
#

STreeView?

#

You'll find, probably, that that conglomeration of widgets is private in a module somewhere.

cold solar
#

that's what I'm looking for ๐Ÿ™‚

zenith fulcrum
#

If you SNew in a block of slate code, how can you keep a ref to an item in there?

#

example

#

somestuff
[
MySharedPtr = SNew(SomeThing)
]

grave hatch
#

SAssignNew(varname, class)

#

Works for class members as well, of course.

zenith fulcrum
#

Ahh

#

tyty

tranquil crag
#

Hey,

Anyone knows the Widget we can use to expand these buttons across the whole available area.

#

Currently, I'm using a SWrapBox and it doesn't do that well.

SNew(SWrapBox)
            .Orientation(EOrientation::Orient_Vertical)
            +SWrapBox::Slot().Padding(5, 2)
            [
                SNew(SButton)
                .Text(LOCTEXT("InvalidateButton", "Invalidate"))
                .OnClicked_Raw(this, &FLandscapeClipDetails::OnClickInvalidate)
            ]
            +SWrapBox::Slot().Padding(5, 2)
            [
                SNew(SButton)
                .Text(LOCTEXT("MatchLandscapeSizeButton", "Match Landscape Size"))
                .OnClicked_Raw(this, &FLandscapeClipDetails::OnClickMatchLandscapeSize)
            ]
#

Thanks.

grave hatch
#

By default, any widget will fill it's container. If it isn't, use an SBox wrapper and set halign to fill

#

If you want a vertical list of widgets filling their h-space, use an sverticalbox

#

again with halign set to fill (and autoheight() is generally good)

split laurel
#

I think wrapbox in particular has a "useallottedsize" attribute you can set to true. I think it's an exception to what Daekesh has said above.

tranquil crag
#

@grave hatch @split laurel thanks a lot. I will give it a try.

grave hatch
#

You could also try a gridpanel with the fillwidth set to 0.5 if you want a 2x vertical display

#

I guess wrapbox is what you weant, though!

tranquil crag
#

Thanks again!

warm bronze
#

Are there any templates/samples of a standalone app using slate?

grave hatch
#

Samples of Slate? Are you mad?!

#

๐Ÿ˜›

tranquil crag
#

ha ha