#slate
1 messages ยท Page 28 of 1
speaking of stepping, how does one debug in UE4 projects?
this whole time i've been launching the standalone game from the editor
also, ill try both methods, thanke
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)
You can attach to the process (probably) from VS, though. Just an unneeded extra step!
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 ๐
About that, OnGenerateWidget is whats called each time the widget is drawn in my plugin window right?
Ah so in the sense, if I select an option, that option will appear as the selected one only if I utilize the OnGeneratedWidget function, making it a necessity
Hot damn
What a fool I've been
OnGeneratedWidget is what generate a line in the box for a given entry
you have to divorce the idea of the provided options from how an unspecified option is visually represented
Does anyone know why an SListView's scrollbar shrinks when scrolling down?
It probably hasn't calculated the space used for the elements not in view?
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?
Shrug
Hey guys, do you know what class generate this kind of tables on the engine?
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.
I'm actually trying to work through a similar problem. You can try calling InvalidateLayout
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
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?
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 :)
Thanks a ton! I've added those to the list. I appreciate it ๐
Wow I just started watching a video tutorial on it and....oh man this is cool.
It's painful at first.
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?
never mind got it
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
What was the problem? For everyone else ๐
anyone knows if theres a way to create custom versions of these ?
You want to add your own buttons to that list?
Or make your own list somewhere else with a similar style?
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
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.
i see, so i have to use C++ for this?
Yes
cool, thanks!
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?
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
declare the variable in the scope you need it.
Then assign to the var with SAssignNew
Yeah at first I was using SNew because I didn't think I would need to access the combo box outside of that scope. But I needed to access the SetSelectedItem function so I chose SAssignNew instead
And declared it outside
You have to declare the variable before assigning it anyway... Why is this even a question? ๐ฆ
I saw some examples where devs created the combobox inline within the SNew itself with no prior declaration
If thats a thing
Sure, you can just assign callbacks during initialisation.
Gotcha!
I'm going to specifically ignore that because you reposted it everywhere.
how do you play a video in slate
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));
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?
Top menu edit, undo history
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 ?
Nvm. Probably had to do ChildSlot->GetChildren or something because of the wrapped SScrollPanel
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.
does anyone know what the deal with SDockableTab not being in UE5 is?
Have you tried SDockTab?
I saw that but I wasn't sure if it was what I was supposed to use. I couldn't find anything about it
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
Ah fair enough. I don't know a single shit ahout slate
Nor me, @grave hatch is that slate guide thing pinned ?
Might find it useful
Check that out @celest locust
Might help in the future
wtf has happened to slots in 5.0? The code is so obfuscated now it's impossible to read or make sense of :/
What are you trying to do?
Slots were actually made easier to access because GetSlotAt on FChildren was made public
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
Heh
I mean, I'm looking at 5.x ConstraintCanvas and there isn't all that much complexity to it...
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
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.
Lol
Thank god for source code I guess
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?
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.
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
Brilliant thanks ๐ appreciate the reply
When using IDetailCategoryBuilder::AddCustomRow(), is there a way to force the row to appear at the top of the category?
How can I see which UMG widget owns the Slate widget?
Might want to look at the UWidget* FindWidgetFromSlate(SWidget* SWidget, UWidget* Parent) method in Steve's UE Helpers for inspiration.
You might have to look at the parent's children/ordering for that
I more meant during runtime debugging
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.
You could register a pass-through input processor that maintains a set of pressed keys.
Thanks, will look into it.
Thanks! I'll have to check into trying that for other keys. Thankfully for my needs, there was this. Since all I care about right now were modifiers.
FSlateApplication::Get().GetPlatformApplication()->GetModifierKeys();
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.
So it overrides each property in the section and puts its new one in the right place in the order?
Oooh, I see.
Yeah.
Sorry, I thought you were trying to add a new property in a specific place.
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
Slate is both the low-level layer beneath UMG, and the editor toolset
It's generally not meant for direct game use
Ah good to know, thanks!
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?
The Outliner is pretty poop. Just putting that out there.
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?
The property editor module has a method to create a display for a single property
You could try that?
unfortunately, that accepts a uobject not struct
Is there a recommended "getting started" with slate?
Mccoms hmmm.
See the pinned messages for a qt to slate guide.
Or search in this channel for it.
found it thanks!
is there really no way to get a property's default widget?
Not sure if it helps but IDefailLayoutBuilder has EditDefaultProperty() which returns an IDetailPropertyRow which has GetDefaultWidgets() methods (as well as CustomWidget() if you just want to override the default entirely).
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
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
mccoms: https://docs.unrealengine.com/5.0/en-US/API/Editor/PropertyEditor/FPropertyEditorModule/CreateStructureDetailView/ is this not useful for you?
Also UE4 or UE5?
Global Invalidation has broken a lot of things in UE5, so wouldn't be shocked if some stuff is borked
we have global invalidation enabled in our UE4 project
my only problem at the moment is really just the scroll thing
Global invalidation?
Mmm it stabilized quite a bit in 4.27
It's more likely the widget just isn't computing the right desired size during prepass
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)
how can i make sure that this happens correctly?
im using SBox, SHorizontalBox, SVerticalBox, CreatePropertyNameWidget, CreatePropertyValueWidget, GetDefaultWidgets, STextBlock, SButton
maybe it's HeightOverride in SBox? should I change to desired height?
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?
I will temporary make header visible until I find a solution.
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
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
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.
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
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
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.
Yeah that will probably be it. I mean Height Override will force a pre-set height, so it's strange that it's getting larger once widgets scroll into view.
If the parent's visibility is SelfHitTestInvisible, would that mean all children that are Visible will also not be hit?
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.
perhaps I should try setting the z-index then (to get hit events)
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?
currently trying to figure out how in the widget reflector (if even possible)
I don't think you can. Is it not your code?
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.
There's a log to see what's consuming events iirc?
I just ran "Pick Hit-Testable Widgets" in the Widget Reflector
I may be wrong here. ๐
๐๐ป Z-order for the win!
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.
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?
Isn't there a widget that has an aspect ratio lock?
SBox is a sizebox and has a Set Max/Min aspect ratio but id still have to set the height for it wouldnt I
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.
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
It should do, but it won't allow you to set height relative to width or vice versa.
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
I discovered the magic of overriding OnArrangeChildren on Canvas last night.
Maybe you should look into it ๐
Oh wow, this worked perfectly. Feels kinda weird extending SBox just to center its children when its parameters are private but this works nicely. Thanks a bunch for all your help, really appreciate it
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!
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
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.
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?
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.
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
Just build it for whatever res your screen is.. assuming you test in full screen.
Ye I'll try that, thanks again
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
You should use FAppStyle::Get() now
Official Epic style guide!
Also you probalby need to link the module FEditorStyle is in.
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
That's a good question!
;__;
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
You can replace this with whatever you like.
As long as the object has a valid method to use.
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?
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
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)
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)
Do you want that window to stop you tabbing back to the game/engine?
i dont really understand what you mean but im going to go with no? i mean this as an in-game window made with slate/umg. not sure what other name/s it goes by but its just a box with a title bar with a close button and a content area
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.
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.
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.
I see, it's hard ...
It was helpful. thank you!
I'm having an issue with input key selectors, I'm using blueprints to set the text style of a input key selector but it seems to do nothing, looked it up seems like others have the same issue, anyone know if this is a bug or is there something I'm doing wrong? i'm on 4.26.2 https://forums.unrealengine.com/t/how-to-change-text-color-of-input-key-selector/461235
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
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
๐
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?
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
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.
Sorry, are you saying that I can do the binding if I either make my own slate widget derived from SButton, or make my own widget that has an SButton internally?
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.
You could do this on tick if you really wanted to. Don't.
Ye I don't want to. But wait don't bindings basically use tick?
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
Is there any demo or learning source that uses Common UI plugins input routing system?
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
Not by default.
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.
Have you looked into UGameViewportClient and SViewport?
Custom windows are a mix of viewports, viewport clients and sviewports. It's all a bit messy.
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.
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.
Alright I'll look into that, thanks.
Look into CalcSceneView on the viewport client
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?
Probably, yes.
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
Does the Mesh widget render a mesh onto a render target and stick it in a widget?
negative
What does it do?
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
Hey, I'm wondering if anyone here knows more about this selection menu in user widgets
Specifically where the UI behavior of this struct is defined https://forums.unrealengine.com/t/why-is-fwidgetnavigationdata-displayed-with-a-custom-widget-in-the-umg-designer/562812
User widgets have a tab called โNavigationโ that displays the UWidgetNavigation member of the widget. UWidgetNavigation consists of 6 FWidgetNavigationData members. When editing these in the UMG designer they show multiple dropdown menus on the same line, and update which ones are shown based on the input of the first. When I add my own FWidg...
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
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?
Thx! That should give me some more clues as to where to look :)
Hadn't heard of detail panel customizers before
IDetailCustomization IDetailLayoutBuilder useful classes to look for
Found it ๐ FWidgetNavigationCustomization thanks!
It does actually, I probably only checked the runtime folders
There's exactly one reference to it in the editor folders and that was the one
@fading valeCan you pin that here too?
Nice
no, only if the duck asks :p
Thanks!
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
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)
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
I don't know of an engine class that does it, but I've talked to an Epic employee who suggested this method.
ok I' m gonna search how to it works !
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
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 ?
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 :?
Show the code that is errroring and the error from your output log.
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;
Take out :_ButtonArgs()
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
Well, you don't have a Text argument on SLATE_BEGIN_ARGS(SDarkProjectDesciptorButton)
you'd need to do
Yeup that where my issue is I want to keep the parents args from SButton which contain the text args
.ButtonArgs(SButton::FArguments().Text((FText::FromString((InItem->bIsAShot == true) ? "Select Shot" : "Select Sequence"))))
oh ok
OR
Use this code and make your Construct function do this:
SButton::Construct(SButton::FArguments().Text(InArgs._Text))
And remove the ButtonArgs attribute
The ButtonArgs variable is just more flexible.
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
Show your header
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;
};
And your Construct function?
I don't have the construct function because the construct is not virtual and can't be implemented in my child class
Construct doens't need to be virtual
You need to implement it in your class...
void Construct(FArguments InArgs);
That's when I think I missed some stuff what's the role of my construct in that case ?
(Found in SButton.cpp)
OnHovered = InArgs._OnHovered;
Those line create the args ?
No.
Those lines take the args and assign them to class members.
SLATE_ATTRIBUTE/ARGUMENT create arguments
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)
First off, create your construct method and see if it compiles.
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)
{
}
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)
{
}
const FArguments& InArgs
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 );
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;
};
erm
My poor class is so empty but also so broken at the same time 
{
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
ok it's compiling it's crashing when creating those buttons !
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
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
I'm trying to get the SVerticalBox from a UVerticalBox
MakeShareable(static_cast<SVerticalBox*>(WidgetLeftNodeBox->GetCachedWidget().Get()));
But this returns null
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.
Is slate for editor only stuff or is it meant for game stuff too?
Both
You can do almost everything though in UMG, since itโs basically just a wrapper for slate
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!
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.
My advise? Put a 1 pixel spacer around the edge and blur everything inside it ๐ฆ
Hi pal....Did you achieve it??
If yes, would you please tell me how??
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
never figured it out. likely answer is you gotta use slate
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
I needed to do it like this to be able to use nodes like (SpawnAIFromClass, SetTimerByFunctionName), because the GetLevel() didn't work and threw a Warning UWorld* UWorldObject::GetWorld() const { // CDO objects do not belong to a world // If the actors outer is destroyed or unreachable we are shutting down and the world should be nullptr...
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?
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
Teh pinned message about qt to slate is quite helpful
hello how can i add the functionality to alt click a line made with FSlateDrawElement::MakeLines to cut it? exactly what happens in BPs
Or HTML/CSS interpreter for Slate
I mean, there's a web client built in. You can just use that and literally write your UI in html.
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
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
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
@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
- never use the errors window, use the output window instead.
- 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
@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
Raw binds aren't great. If you reload your module and the button isn't destroyed and recreated, your editor will crash.
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
What you can do is declare the child widgets before delcaring the parent
Oh great
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)
Ok thanks !
You want it to create a new bp asset and open it?
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
Creating bp assts isn't really a slate question
As for the other thing, implement sort OnClick method for the button.
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
So any class that derives from ACharacter
yea
You could try getting all the uclasses and checking them individually.
TObjecIterator<UClass>
That's more of a c++ question, though, not slate
how do i go about making a popupwindow
a small window that contains a list of characters that when clicked directs you to that character
So like a mini content browser?
in slate? what about the popup window
with the window that opens up when i press on the plugin tab
ill see if i can figure something out, thanks
Use FText::Join
What would be the delimiter
"\n" ?
And I answered your question.
ok
interesting its not displaying anything on my tab
@grave hatch is it because the list is too big
So add a scrollbox wrapper
i just started using slate last night so how would that work
SNew(Scrollbox wrapper)
?
SScrollBox can scroll through an arbitrary number of widgets.
Same as putting something inside any other widget
SNew(SScrollBox) [ your text stuff ]
You probably don't need the vertical box
You could have just replaced that with the scrollbox
I have no idea what that is.
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
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.
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?
Don't think there is a actual formatted list that is meant to be readable.
But you can search the source for the ClassThumbnail.MPlayerOP term and it should lead you to the rest of them. They might be spread across multiple styles though
I'm hoping there is a "ClassColor" or something
@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
The background color of the asset in the asset browser. Right now I have to create an asset type action just for the color
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.
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
nevermind, had to rebuild the project and it fixed it
nvm figured it out
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
There is not. If you want that, use UMG.
Yeah I thought that would be the case. Is there a way to use the slate classes in UMG then?
is that as simple as making my own class of a slate class? Or is there more to it?
Either extending UUserWidget or check out the classes like UButton to see what they do.
Do they automatically show up in UMG's palette if they're UUserWidgets?
Ah. Thanks for the help though!
Np
Yes, and they should show up too if they're wrapped slate widgets like UButton. You can override the GetPaletteCategory function to make sure though.
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.
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
are you constructing your slate in RebuildWidget()?
Well unless it's added to screen or viewport, nothing will be constructed
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.
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
Thereโs actually an experimental Viewport UMG widget if you didnโt already find it
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
Creating the world that it lives in it a lot more involved than displaying it to the user.
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?
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?!
I got answer of that in another channel but what i'm talking about is auto scale feature. When you resize a window it's content resizes to it's percentage
It works with different screen resolutions too
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)
Gonna answer myself in case anyone else needs it.
This can be achieved by pushing and popping FSlateClippingZone to FSlateWindowElementList. I get FSlateWindowElementList from NativePaint in UUserWidget.
E.g. this example clips stuff to the widget screen space
// Draw Stuff
OutDrawElements.PopClip();
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++?
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.
Some things are hard or impossible to do in UMG. For example creating a totally custom widget with new paint functions would need going into Slate.
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.)
Not that I know of, but you can always be the first to document it!
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
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
ScaleBox?
Or a WrapPanel... I forget what those are called
WrapBox?!
Something with wrap in it.
Oh nevermind, I'm an idiot
I was calling AddToViewport instead of AddToPlayerScreen
The latter takes care of the actual view rect geometry
doh
anyone knows how I can get a pointer to a SConstraintCanvas's FSlot?
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?
When you add a slot it returns a reference to said slot
through AddSlot()?
You need to be extremely careful doing this because the lifetime of the slot is controlled by the panel
it returns SConstraintCanvas::FSlot::FSlotArguments to me
i know, I am not doing anything without the parent widget
Why can you not just use GetChildren and get the slot from there?
because I wish to have multiple slots and dont want to keep track of their indexes when creating and destroyign them
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
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
yeah, there wont be anything else other than my custom widget adding and removing slots
thanks its working sweet
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
Because reasons.
There's no way to disable pixel snapping at the slate level is there?
Dying for this PR https://github.com/EpicGames/UnrealEngine/pull/8570
Nick Darnell replied so hopefully there's some movement
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
Are you intentionally trying to mix slate and umg?
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
Nothing pure-slate should have anything U-whatever in it, as far as I know!
while the other doesnt
Yes i understand, there are few resources out there and i was trying to learn about both
so can i display the combobox string on the window?
instead of the reg combobox
which way would be more efficent
Shrug
So with options source is that all
because combobox requires brackets
Ashame there are hardly any resources on slate
Honestly, I would look up the uses of combo boxes in the engine.
The engine is the resource.
how, i peaked the class and looked at it
Not the class, but how it is used in the engine.
Search for the class in the rest of the code.
where at in the code
That's why I say "search"
so search solution explorer
Why would you search the solution explorer?!
ctrl+shift+f, make sure "entire solution" is selected and put the combo box class in the search box
Hit enter
this window is ok
?
interesting
That's the search result window, yes.
why does it use a shared ptr
Then that's where you should start.
i know what a pointer is
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.
there are hardly any slate tutorials though
i followed through a couple good ones ]
but thats all i could find
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.
@grave hatch yaw lighthouse?
Shrug read them all.
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
You check how that type is used elsewhere in the engine.
Other than that, tutorials, reading the source code and trial and error
So if im looking at the 3 bind delegate and the functions that go along with them. what should i do. these functions are protected so i cant access them
wait nvm thats not important
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++.
or just put the logic in C++ leveraging BindWidget and then use the benefits of having an actual WYSIWYG editor
That too.
Hi!
If I created a SCompoundWidget child in C++, how could I make it usable inside widget blueprint?
Does anyone know how to add items to a combobox
You need to use the Source (or whatever it's called) attribute
.optionsSource(&Source)
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
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?
Tracked it down - ULyraUIManagerSubsystem::SyncRootLayoutVisibilityToShowHUD handles it
Hey, can someone help we what slate render to target means in the UE4 GPU Profiler. Is it just the UI I'm rendering?
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;
}
Pro tip: you can inherit from FDragDropOperation :)
I tried that as well, but I don't see how to properly attach things to it the way the UDragDropOperation works. I created a derived class of it in the header, but that's as far as I went.
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
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
Ah you are talking about the visual representation?
Then go with FDecoratedDragDropOp instead
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.
I've always found this class a bit useless if you actually want a custom decoration.
How so? Iirc it has a virtual function to override to specify your own widget when you inherit from it
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
Aye I think that was the function I was thinking of, but it's pretty much the same doing both
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?
Power
7
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?
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.
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?
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.
Nice
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
Maybe!
Whats a good option for displaying a list of names, while being able to select between them
SListView
It has selection built in.
It's a bit confusing to initially set up if you haven't used it before.
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
Huh?
does slate have a way to "copy" a brush? im trying to get the Graph.Node.ColorSpill brush but flip the image horizontally
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?
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!
Simply don't create the brushes until they are needed?
That's ok, but there are too many images directly set their brush in details view. Modifying them seems a hard work = =
Then don't do whatever it is you're doing?
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~
Np.
Is there advantage to using SLATE instead of UMG?
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.
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?
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).
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?
Do you mean that the tick could be disabled/optimised ? Or if I have enabled tick manually I should not (I haven't) ? Nameplates are UserWidget on the character directly set on it's component tree and "moved" at the 3d position when the camera/actor moves.
Well those 43 microseconds are inside the actor component tick function, so....
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.
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
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.
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:
- 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).
- 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?
That is done via Slate Insights, right?
I'd assume so.
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
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.
Thanks for that, @simple delta !
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
You should be looking into UMG not Slate
This is great! I haven't gotten to go that deep into the tick information yet for the compendium so do you mind if I add this information to it?
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.
Yeah the invalidation you're talking about may be from the global invalidation system they added and is being used universally through UE. And volatile will skip over that handling.
Yeah Im glad you're aware of both code paths have their pros and cons, its mainly up to profiling as you go and being aware of these changes ๐
Hey guys, I'm trying to add the gameplaytag selector to a slate element any idea?
It should something like SGameplayTagWidget
SComboBox ?
STreeView?
You'll find, probably, that that conglomeration of widgets is private in a module somewhere.
that's what I'm looking for ๐
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)
]
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.
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)
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.
@grave hatch @split laurel thanks a lot. I will give it a try.
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!
I tried but didn't get what I was looking for. Anyway, Today is my first day using Slate.
Will give it a go something later this week.
Thanks again!
Are there any templates/samples of a standalone app using slate?
ha ha
ing you)