#slate

1 messages · Page 23 of 1

orchid nova
#

I think if I spent some more time digging into what DrawWidget does specifically, I might be able to find a better solution, but I spent so long on this already that I don't really feel like it right now lol

gritty frigate
#

Cool - thanks. I’ll see if I can replicate this tomorrow.

UDN is the Unreal Developer Network. A bit like AnswerHub but with more responses from Epic staff. You get access to if it you’re paying for the engine

orchid nova
#

Ahh I see

#

But yeah even with two DrawWidget calls in my usecase where I'm generating about 240 textures using this, with widgets that contain several textboxes and some images, it performs just fine which is pretty nice :)

gritty frigate
#

That’s not so bad. I’m going to be needing to do 1 per frame, maybe 2

split laurel
#

when it comes to detail customizations, is there a way to get property handles of child objects? With structs it's pretty straight forward, but I failed whenever I tried accessing properties of child objects.

royal geode
#

wdym child objects @split laurel

#

instanced?

split laurel
#

Possibly, but just any object ptrs inside.
Object A -> Object B and you are customizing A, and want to show properties of B directly (sort of how instanced works too)

#

@royal geode

royal geode
#

I think child objects don't have property handles

#

You'll have to create them

split laurel
#

Yeah that's what I'm wondering, either how to do that or how to access them

#

I've not been able to figure out how to create your own handles yet rather than just getting them from the layout builder

#

Or if it's feasible at all

royal geode
#

You might have to build an entire detail widget

#

inside a detail widget

split laurel
#

Thats not going to be fun because frankly I have one more layer of indirection lol

#

ObjectA -> ObjectB-> ObjectC -> childpropertyhandle I want to have for object A

sweet steppe
#

am i correct in thinking that slate runs on a separate threat? or is at least able to be run in a new thread with no interaction

quaint zealot
#

@sweet steppe Not threaded, not able to be so

sweet steppe
#

what could be a good way to go about smooth loading screens then if not slate?

quaint zealot
#

Loading screens work well when they are a separate engine module (process) running their own Slate stuff

#

Failing that you can investigate the DefaultMoviePlayer and fork it

#

IIRC it's threaded in a weird way

split laurel
#

@quaint zealot so lets say we have a search box and its super slow due to the amount of comparisons it has to perform, we cant multi thread the search?

quaint zealot
#

Sure you can !

#

You can multithread the search code or filtering code

#

Just not the Slate code

#

It's largely the same tick-based architecture as the game thread - you have a tick event, draw event, callbacks, all on game thread

#

Game UI code is usually 1) very fast and 2) very game-state-dependent so MT is not really an obvious idea

split laurel
#

ahh ok good, thank you :) I just tested the search box of our custom asset picker with a production ready project, with over 90.000 objects.. it's slow, very slow

quaint zealot
#

Yeah if the search part is the slow part, make that multithreaded and have yourt widget tick pick the latest results safely

frank delta
#

Anyone know how to make a slate widget for a property array that looks like all the stock ones in editor?

#

I've been making my own with an SListView but it seems like there should be a better way.

placid beacon
main hedge
#

how do you use global invalidation in the first place? I tried turning it on in packaged mode and the entire UI was ruined, all layouts broken.

placid beacon
#

I only toggle it on within a match itself. And leave it off when at menus

#

This is what Fortnite does as well

#

But yeah it's still buggy, even with 4.26 cherrypicks and is still being iterated on by Epic

livid gust
#

Hello all! This is my first post in this channel. 🥳

Late last night, Zeblote was helping me with a problem that I had posted in as general of a form as possible, in #umg:
https://discordapp.com/channels/187217643009212416/221799467689574410/744515507188924506

He was able to help me get the results I needed, but we both agreed that it was not optimal; he said that if I wanted to do it the "correct" way, I'd have to "create a custom slate view which takes a lot of effort".

Now, I don't mind a lot of effort. Ultimately, what I do mind, however, is not doing something correctly just because I never bothered to learn the correct way.

So, I was wondering if there is a tutorial video or series of articles that y'all can direct me to that would help best to learn slate. If there are any do-good-samaritan-angels out there, of course I'd be very appreciative if anyone would follow that link I posted and check out my problem statement, but that is not necessary. Just a little guide on a first step is all I'm really after.

Thank you!

#

P.S. @main hedge I hope you don't take that ^ as me not appreciating the help you gave me last night; I simply want to learn the correct way, since you mentioned there being one 🙂

livid gust
split laurel
#

hey my slate bois and gals, do you know where dock-ability for a tab is defined? Sequencer for example only lets me dock it in certain places in the main editor window, but not for example in my own asset editor toolkit that uses tabs

alpine marsh
#

Does anyone have any good resources for getting started with slate?
I've been watching this video: https://www.youtube.com/watch?v=jeK6DPB5weA
But I'm getting an rvalue type conversion error when trying to add a slate widget to the HUD.

Try my C++ Survival Game Course:
http://bit.ly/unrealsurvival

Discord:
https://discord.gg/meFRZfm

Today we're going to be using the Slate Framework to do pure C++ UI in Unreal. This gives you more features, and better performance.

▶ Play video
#

Is anyone familiar with how to solve this sort of error? Or perhaps have a better solution to adding a widget to the viewport/hud?

quaint zealot
#

Well, where is the error ?

alpine marsh
#

Its in the first screenshot, using this

quaint zealot
#

Ah, alright

#

@alpine marsh You need to use a curiously recurring template for shared ptr functionality, basically

#

class AMenuHud : public AHUD, public TSharedFromThis<AMenuHud >

#

It's a somewhat obscure C++ thing that allows quite interesting stuff

alpine marsh
#

I'm still getting the same error when I try that

#

MenuHud.cpp(15): [C2664] 'SMainMenuWidget::FArguments::WidgetArgsType &SMainMenuWidget::FArguments::OwningHUD(TWeakObjectPtr<AMenuHUD,FWeakObjectPtr>)': cannot convert argument 1 from 'AMenuHud *' to 'TWeakObjectPtr<AMenuHUD,FWeakObjectPtr>'

quaint zealot
#

Eheh

#

You messed up the case, @alpine marsh

#

Your forward decl' is uppercase HUD

#

So as far as C++ is concerned it's an entirely different type

alpine marsh
#

Yep thats it, I cant believe I didnt spot that

#

Thanks so much, its always the small errors that I miss

quaint zealot
#

For type related error you have to look very carefully into both types from the compiler log

#

It's always a technicality so every letter matters

alpine marsh
#

Mhm, Thanks for the advice. I'll be sure to look more carefully

alpine marsh
#

How do you use colors that aren't predefined?
More specifically, how can I set the value of FColor to a hexadecimal value?
Currently I'm doing: .ColorAndOpacity(FColor::Black) but I would much rather use a different color say, #2C3531.

mild oracle
#

Look at the signature of ColorAndOpacity, Visual Studio should autocomplete for you to show what's available

#

Or look at the docs

alpine marsh
#

The documents aren't quite clear for using Hex

#

The only thing I can find is using FColor::FromHex(); but I'm still unsure of how to actually pass a hexstring to that. Just doing FColor::FromHex(#2C3531) throws an error.

spring island
#

its quite easy, it takes RGBA uint8 as constructor parameter

#

FColor foo{255, 255, 255, 255};

#

oh nwm didnt read the hex part

#

FColor foo{FColor::FromHex(FString{"2C3531"})};

alpine marsh
#

Thanks ill try that out

#

well I'm no longer getting an error, but the color output looks like this ingame:

spring island
#

yeah that happends to me aswell when using Valign- fill and halign - fill. not sure whats causing it but coloring buttons etc works as expected

alpine marsh
#

hmm interesting, I figured it mightve been an opacity issue then

spring island
#

allso if youre following reubens tutorial wich i allso watched recently, theres some stupid stuff you can avoid

alpine marsh
#

How would you recommend going about making a colored background? (Takes up the entire screen)

#

Yeah I followed a bit of it, hes not very clear and just copy/pastes alot of stuff

spring island
#

you dont have to include Engine/Engine.h just #include "Engine/GameViewportClient.h"
#include "Engine/World.h" GetWorld()->GetGameViewport()-> will do the same as the global engine pointer

alpine marsh
#

Do you have any other resources you would recommend for getting started with slate?

spring island
#

and the MenuWidgetContainer is completely unnecesairy, not sure if he intended to do other fancy stuff with it later but you can do .ToSharedref() on the MenuWidget pointer to display it, much cleaner code

#

theres not many tutorials for slate sadly, engine source is the best you will find lol

alpine marsh
#

Gotcha, I was hoping that wasn't the case, the documentation isn't the greatest.

#

IIRC there's a plugin for CSS -> Slate, so I might give that a try as well and compare the results.

spring island
#

about making the whole viewport colored, i guess you could try displaying an actual image instead of a color

alpine marsh
#

I might try that

pastel phoenix
#

FColor foo{FColor::FromHex(FString{"2C3531"})};
FColor(0x31, 0x35, 0x2C, 0)

quaint zealot
#

By the way the grid is Slate's default brush

#

Doing a solid green brush in Slate would usually be done with a solid white brush tinted green directly in the brush

maiden talon
#

is there any way to preview slate in the editor?

quaint zealot
#

Maybe adding it to an UMG widget

#

Probably just as fast to rig a custom player controller that just shows that widget and use that in a dedicated test level, though

pastel phoenix
#

UMG have some special functions for preview

#
TSharedRef<SWidget> USimpleMpegViewerWidget::RebuildWidget()
{
    if (IsDesignTime())
    {
        return SNew(SBox)
            .HAlign(HAlign_Center)
            .VAlign(VAlign_Center)
            [
                SNew(STextBlock)
                .Text(LOCTEXT("Simple Mpeg Viewer", "Simple Mpeg Viewer"))
            ];
    }
    mSimpleMpegViewer = SNew(SSimpleMpegViewer);
    return mSimpleMpegViewer.ToSharedRef();
}

like this

livid gust
#

<-- Slate supernoob here

Can anyone give me their opinion of how you would qualify when you need to use Slate vs you can make it work using UMG?

#

I have this widget I want to build that is possible with UMG, but it requires a kind of "hacky" (in a bad way) solution that involves artificially pushing elements around using negative margins, etc.

Now, I'm not the greatest UMG wiz, either, so I'm sure there may be an even better way to do it in just UMG, but would this be a scenario where you'd normally use Slate (given that you can't find a better alternative in UMG)?

gritty frigate
#

Probably best to subclass SLeafWidget and use OnPaint to draw the elements yourself

#

take a look at SSlider as an example

#

Based on your description, at least

livid gust
#

Is there an SDelete that you have to call for every SNew in your code? I've heard that GC doesn't work for Slate, and you have to manage that manually, so I figure maybe there is an SDelete...

gritty frigate
#

No - SNew returns a TSharedRef

#

(also, be aware of SAssignNew)

#

Slate is very much based around TSharedRef/TSharedPtr

livid gust
#

I'm starting to notice

#

So, is there nothing that I need to do manually in order to clean up Slate stuff correctly? Don't need to put anything in the destructor, etc?

gritty frigate
#

nope - not if you're pure Slate

#

If you make a UMG widget that contains a Slate widget, then you need to do some cleanup

livid gust
#

okay, I see. What do you need to do in that scenario?

#

Nvm, don't answer that. That's hypothetical, I haven't gotten to that yet

weary eagle
#

Anyone know how to generate a USlateVectorArtData object from a static mesh? I'm having trouble making one that I can use with an SMeshWidget.

gritty frigate
#

It’s ReleaseSlateResources that you care about at that point

weary eagle
#

@humble gale Were you ever able to get your SMeshWidget implementation working?

tight comet
#

Hi, can I add material to SImage?

livid gust
#

I can't find the definition of the operator overload for the operator+() in Slate. The .PropertyName() are properties, I assume, but what does the + do?

#

add children?

spring island
#

it adds a slot

#

that one in SVerticalBox but all of the ones i found are the same

livid gust
#

ah ok

#

Do I need to #include "Widgets/..." for every type that I use with SNew(SWidgetType)?

#

k that's a yes I figured out

livid gust
#

I am just doing a test, and at a leaf node, I have this:

// ...
SNew(SButton)
.HAlign(HAlign_Fill).VAlign(VAlign_Fill)
.Content()
[
]
// ...
#

Compiler says it expects something inside the empty square brackets

#

Do I have to put something?

#

I don't really want anything there

spring frost
#

Just use SNullWidget::NullWidget

#

If you want a "stub" widget element.

livid gust
#

oh okay, thanks! 🙂

gritty frigate
#

Or don’t include the brackets at all. When you have content inside a widget, you don’t need to do Content() - the square brackets imply that.

Also, if you’re putting more widgets inside, I’d recommend subclassing SCompoundWidget instead of SLeafWidget

livid gust
#

It is a subclass of SCompoundWidget. I just said "leaf" like, in general. There may be, say, an image or text widget inside the button, but the button does act as like a functional leaf

#

in my use case, anyway

humble gale
#

@weary eagle hi man,
Glad to listen regarding the smeshwidget, I got it working.

#

I still need to make it a generic system. At the moment it works with my hard-coded settings.

livid gust
#

@gritty frigate so you're saying, this is equivalent to what I wrote above?

SNew(SButton)
.HAlign(HAlign_Fill).VAlign(Valign_Fill)
#

Note: I originally had a line with .Text(TEXT("BUTTON")) but that didn't compile, I erased it

gritty frigate
#

Yes. Also, Text() needs an FText, so you’ll need to use LOCTEXT or INVTEXT

#

It is a subclass of SCompoundWidget. I just said "leaf" like, in general. There may be, say, an image or text widget inside the button, but the button does act as like a functional leaf
@livid gust cool. SLeafWidget is a specific class, which is why I thought you meant that

#

Yes. Also, Text() needs an FText, so you’ll need to use LOCTEXT or INVTEXT
I’m now trying to remember if a button supports text like this? I think it does, but if not you’ll need to drop an STextBlock inside it. I created all my own button subclasses.

livid gust
#

I had another question for y'all:

I had been using this very nice beginner's Slate tutorial
http://students.ceid.upatras.gr/~vpapadatos/UE4cpp_slate_1.html
but there are two specific parts that I was a little surprised by, and I was wondering if this is standard practice or not with Slate code.

For the following example, we have a MyHUD subclass of AHUD and an SMyWidget subclass of SCompoundWidget (and, of course, anything irrelevant to the example is omitted):

// MyHUD.h
class SMyWidget;

class AMyHUD : public AHUD
{
public:
  void BeginPlay(); // <-- Question 1
  TSharedPtr<SMyWidget> MyWidget;
};

// MyHUD.cpp
#include "SMyWidget.h"

void AMyHUD::BeginPlay()
{
  MyWidget = SNew(SMyWidget).OwnerHUD(this);
  GEngine->GameViewport->AddViewportWidgetContent(
    SNew(SWeakWidget).PossiblyNullContent(MyWidget.ToSharedRef())
  );
  MyWidget->SetVisibility(EVisibility::Visible);
}

// SMyWidget.h
#include "MyHUD.h"

class SMyWidget : public SCompoundWidget
{
public:
  SLATE_BEGIN_ARGS(SMyWidget)
  {}
  SLATE_ARGUMENT(TWeakObjectPtr<AMyHUD>, OwnerHUD)
  SLATE_END_ARGS()

  void Construct(const FArguments& InArgs);
private:
  TWeakObjectPtr<AMyHUD> OwnerHUD;
};
  1. Why is AMyHUD::BeginPlay() not declared as virtual and override? Was that a typo or is that normal?
  2. Is it normal to include HUD.h into the widget class which it will contain? This seems backward. Why does a widget need a way to access its owning HUD?
gritty frigate
#
  1. yes, I believe that this is a typo. It doesn’t need both, though, as “override” implies “virtual”
livid gust
#

He doesn't actually do anything with the SMyWidget::OwnerHUD member yet in that tutorial, so I'm not sure what the plan is for question 2

gritty frigate
#
  1. this is so that the slate widget can call functions on the HUD, for example - when you click a button, you might want it to call something on your HUD that can then interact with something else in your game
livid gust
#

except to do this:

void SMyWidget::Construct(const FArguments& InArgs)
{
  OwnerHUD = InArgs._OwnerHUD;
  // ...
gritty frigate
#

You could do 2) instead with delegates that you pass in from the HUD, but both are options.

livid gust
#
  1. this is so that the slate widget can call functions on the HUD, for example - when you click a button, you might want it to call something on your HUD that can then interact with something else in your game
    @gritty frigate Okay. That clears up the issue pretty well, thank you.
#

Is that pretty standard?

gritty frigate
#

I couldn’t say. I know it’s how I do it, but I figured out a lot of my approach on my own

livid gust
#

That's how you do it?

gritty frigate
#

Yes

livid gust
#

okay. Thank you so much, Hugh.

gritty frigate
#

You’re welcome

livid gust
#

Oh, one last question

#

I know what a weak pointer is (at least what std::weak_ptr is). Is that standard as well? AFAIK, weak pointers are used to avoid a circular reference chain that would prevent the destructor from being called otherwise. Is it related to my previous questions as to the reason that is necessary? (because a child widget can reference the HUD can reference that same child widget can reference the HUD can ...)

#

And also (unrelated):

What is the equivalent of the "Draw As" property in a UMG WidgetBP Border widget's Appearance details panel, but in Slate?

gritty frigate
#

Weak object pointer is to a garbage collected uobject what weak pointer is to a shared pointer

#

It’s used here so that the hud widget can check if the hud is still alive or gas been garbage collected

livid gust
#

ah okay, I see. So it is standard to use that instead of TSharedPtr

#

thanks again Hugh

gritty frigate
#

Regarding Draw As, I’ll have to check my code. Give me an hour or so and I’ll let you know

livid gust
#

hehe okay, no rush

#

I appreciate it

gritty frigate
#

It’s standard to use weak object pointer when referring to uobjects from a class that doesn’t support UPROPERTY

livid gust
#

I don't see anything similar to it in SBorder.h except maybe the .BorderImage() property?

gritty frigate
#

Ah - it’s part of the brush

#

Not directly on the widget itself

livid gust
#

Does this get the brush being used?:

FCoreStyle::Get().GetBrush("Border")
#

that's what is passed into .BorderImage() by default

#

in SBorder.h

gritty frigate
#

Your can get it that way, yes. I created my own Style class that I could get styles from

livid gust
#

okay, cool, yeah that might be a better way to go about it

#

thanks x3 😎

gritty frigate
#

👍

#

In my Style struct, I would get a core style, modify it, then store in mine.

#

You can always change the style elements in place though - you don’t have to do it in a whole struct unless you want a unified style

livid gust
gritty frigate
#

Cool.

weary eagle
#

@humble gale Hey man! Thanks for replying! Basically, I'm trying to set up an SMeshWidget and can't figure out how to create a USlateVectorArtData object for my mesh. I created a new class that derives from USlateVectorArtData and made it Blueprintable so that I could set the mesh in BP, then I went to set it on my SMeshWidget and the dropdown won't populate anything. It doesn't recognize the one I made. None of the examples I found talk about how to create that object. What did you do for yours?

Is there something I need to do on the material side or something like that?

humble gale
weary eagle
#

@humble gale Right, so I saw this but it doesn't cover the actual creation of the USlateVectorArtData you're planning to use. Unless I'm missing something...

#

I also looked at the other thread linked there where @ruby scroll was setting something up with SMeshWidget, but the same issue where this step isn't talked about.

humble gale
#

Give me sometime, I will boot my PC and take a look on my implementation .

weary eagle
#

Thanks so much. 🙂

humble gale
#

Approx 20 mins

weary eagle
#

It's weird because I can create a class of type USlateVectorArtData but it doesn't show up in the dropdown when I go to set it on my Widget. 🤷‍♂️

humble gale
#

@weary eagle ```/**

  • Turn static mesh data into Slate's simple vector art format.
    */
    UCLASS()
    class UMG_API USlateVectorArtData : public UObject``` The class is not BlueprintType, so it won't show in Editor.
#

Since you have derived your own class you can make your derived class to be blueprintable

#

UCLASS(Blueprintable, BlueprintType, EditInlineNew)

#

I don't know how I got it working. But its weird that the state asset in not blueprintable

#

Ohh I remember now, i first cloned the project from above forum and made things working and then migrated the stuff to my main project.

#

so for me the USlateVectorArtData was already created

weary eagle
#

Hmm... ok. I tried adding BlueprintType and EditInlineNew to my UCLASS declaration, but no help. Weird that the dropdown on my Widget doesn't recognize the assets I've created.

humble gale
#

try to copy the slate asset from the example project

#

have you created the asset first?

#

import this file in your project

weary eagle
#

@crude badger What file extension should this have? UE4 won't let me import it as a .uasset

civic pasture
#

Get guys, basic question here. How do I stop my slate widget from scaling with the window?

odd hatch
#

There are some default scaling options in the project settings, but I dont know if that applies to slate as well as UMG

#

@civic pasture

civic pasture
#

@odd hatch Thanks for the suggestion. I don't quite see the option there. Maybe I'll try and find where the slate widget gallery code is located and reverse engineer that.

odd hatch
#

Search for 'scale' in project settings (or engine, but pretty sure it's in project) @civic pasture , you get a graph curve of resolution vs. Scale

civic pasture
#

@odd hatch Wow, that worked! Thank you!

coral schooner
#

We have a problem where a SMenuAnchor behaves different in shipped game compared to in editor. The SMenuAnchor is used in a WidgetComponent. The MenuAnchor requests the outer window to check if the popup would fit into the window to adjust the popup location. To do that the Anchor looks for the outer Window in its widget path. Here is the problem: In the shipping game, the Window returned is the GameWindow itself. In Editor the Window returned is a virtual window for the WidgetComponent (which is correct). Any ideas?

coral schooner
#

The problem has to do with using the FastWidgetPath

#

GSlateFastWidgetPath

#

console variable slate.EnableFastWidgetPath which is used in shipping but not in editor

split laurel
#

anyone know how to disable the drop shadow of a border? The border image I'm using has no actual border, yet a shadow shows up, so I believe it's default functionality

#

if that's not the issue then it's probably the SGraphNode... 👀

#

ok figured it out, it was a shadow brush in a parent of SGraphNode. 👌

scarlet ocean
#
InOnLiveLinkSourceCreated.ExecuteIfBound(MakeShared<FRtmsDollySource>(InEndpoint), InEndpoint.ToString());

New to slate. Can anyone please explain what this line does? InEndpoint is passed on the function.

main hedge
#

executes a delegate if it is bound

#

in a... not optimal way

scarlet ocean
#

why not optimal?

main hedge
#

seems to me like this could/should be replaced by just passing through whatever InEndpoint is

#

this is doing multiple allocations even if the delegate is unbound or the consumer doesn't need both of these

main isle
#

Hi can one of you guys help me out with a quick code? .n.

#

fixed it

tired palm
#

hi, is there anyone that could explain to my how to change the icon in the level editor toolbar from just being a small arrow pointing down to something custom.
I have successfully created a plugin that adds a MultiBox button to the toolbar , but I'm struggling to figure out how to modify the icon, I've looked through the engine source code where the toolbar icons are created but cant actually understand on what is going on.

#

This is where i get my icon - i assume that this is where something gets wrong, and I'm unsure if this is a correct way to get an icon from the style class

spice vessel
#

anyone with slate and details panel experience could help a poor man? XD

I want to add a debugging feature to the FRuntimeCurveFloat graph. I basically need to draw a debugging "dot" given a time value. That way I can see graphically in runtime where I am in the curve given a time value. For the debugging option to work I would have to select one only instance from the world outliner using the curve... a time value would be fed from the selected instance to the details pannel. That's what I would like to do, but... I have no clue how XD

split laurel
#

@tired palm
is your buttonstyle class registered and the resource name correct? If you don't require changing icons, you can also just remove the TAttribute and just put "FSlateIcon([stylename], &[functionname]) in there. TAttribute will poll the function each frame, so if that's not needed you can directly assign a FSlateIcon object

tired palm
#

Hello @split laurel is this where i set my resource name?

split laurel
#

yes, but you have to use the first name as identifier when you want to use it somewhere

tired palm
#

ok, so without ".PluginAction"

split laurel
#

so FSlateIcon(FMBT_Test_ButtonStyle::GetStyleSetName(), "MBT_Test_Button.PluginAction");

#

nope, with

#

you used "ButtonIcon_40x" when creating the FSlateIcon

tired palm
#

omg

#

Thank you

split laurel
#

a style takes a resource on disk like a png (ButtonIcon_40x.png), initializes it to a SlateBrush with the name you've given it, and in code you'll refer to the brush as that name. It's so you only have to change a name once in the style class if you want to swap out the png files

tired palm
#

can you please tell me where did you learn about this

split laurel
#

trial & error

#
  • engine code
tired palm
#

i guess it took a lot of trial and error

split laurel
#

whatever you want to do, it helps to look for sample code when learning a new part of the code base

#

yup it did

tired palm
#

i've seen a few blogs that cover the theme, but they just do the bare minimum

split laurel
#

but it's normal to forget stuff too, so I still have to regularly look things up. It's just that the methods become more efficient

tired palm
#

you really helped me a lot with this one, and i have a feeling that you know that because of all the trial and error 😄

split laurel
#

I actually forgot about it and looked it up in the plugin I'm working on lol
And if I didn't have a plugin I'd have looked for a sample of another combobutton in the level editor toolbar

#

and no problem

split laurel
tired palm
#

@split laurel Sorry i missed that, i was outside.
i will look at it as soon as possible, thank you.

warm vault
#

Hey uh. Question. So in fortnite. They have customized HUD with images. Like I’m going to have. I’m watching a tutorial on HP bar and such, and they are using a progress bar. Is there a way to make the progress bar with using my image?

quaint zealot
#

@warm vault Yes, using #umg with materials for the health bar brush, for example

scarlet ocean
#

How do I take two inputs from user in 2 separate boxes and have one ok button which will initiate a task using both the inputs? Right now I'm taking the inputs in a single box separated by :.
Please help!

warm vault
#
LogOutputDevice: Error: === Handled ensure: ===
LogOutputDevice: Error: Ensure condition failed: false [File:D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\SlateCore\Public\Brushes/SlateDynamicImageBrush.h] [Line: 119]
LogOutputDevice: Error: This hack usually results in a crash during loading screens in slate.  Please change any code that arrives here to not use FSlateDynamicImageBrush.  In the case of loading screens, you can use FDeferredCleanupSlateBrush.  Which correctly accounts for both GC lifetime, and the lifetime of the object through the slate rendering pipeline
 which may be several frames after you stop using it.
#

Trying to create an FSlateDynamicImageBrush in URichTextBlockDecorator::CreateDecorator()

warm vault
#

though it causes a crash, most likely from the simage

#

I am trying to load a texture there

#

not using an FRichImageRow datatable

#

so it says that the ResourceObject is valid but the ResourceHandle is not

#

not sure how to use ResourceHandle

warm vault
#

so this somehow seems to work, though I keep getting random nullpointer crashes and also the image is simply having no content

warm vault
#

check it out when I comment setting the margin out I get a null pointer crash, what the heck

wide plaza
#

defining a struct in the local scope and then assigning it to something of a much greater scope (this->Brush) is a recipe for disaster

warm vault
#

@wide plaza well Brush is a local var too

#

whatever I stopped trying to solve this, workaround will be making 160 entries in a data table

warm vault
#

@wide plaza well thanks for the help, I just moved the making of the brush into the widget constructor and there is no more nullptr crash though the image is still empty

#

alright making a member on the decorator works

zenith lotus
#

Is there any example available for how to create slate widget components?

#

and use in UMG

wide plaza
#

slate widget components? if you want to expose slate to UMG look at any of the in-built widgets

gritty frigate
#

@warm vault With your Brush issue, were you passing Brush (the pointer) into an SImage? If so, the SImage will be holding onto the pointer, and will be expecting the memory behind the pointer to stick around, which it wouldn't be if brush (the value) disappears at the end of the scope

warm vault
#

@gritty frigate yeah I thought when I define it locally and pass a pointer it will be kept in memory

gritty frigate
#

Nope, it won't do that

#

I would just make sure you keep it as a member variable, and don't worry about storing the pointer. If you need to pass it into an SImage, just pass in &brush

warm vault
#

that is what i did and it works

gritty frigate
#

Cool stuff

warm vault
#

well the thing is though, in the Construct function of the Slatewidget the pointer was valid

#

not sure how and where it failed tbh

gritty frigate
#

What function was your code above in?

#

And what do you mean by "valid"? As in it wasn't nullptr?

warm vault
#

URichTextBlockDecorator::CreateDecorator()

#

yeah+

#

well I think I didnt do an is valid check but I printed IsValid of members

#

like resourcehandle and something else

gritty frigate
#

If the underlying memory has been released (by the end of the scope for a local variable), the pointer won't be reset to nullptr

#

it will just point to potentially garbage

#

I think IsValid only works on UObject subclasses...

warm vault
#

yeah I mean != nullptr

#

though FSlateBrush has an IsValid for the resourcehandle

gritty frigate
#

If you do:

int* myIntPtr = nullptr;
{
  int myInt = 4;
  myIntPtr = &myInt;
}
if( myIntPtr )
{
  // This will get here, but the data will be invalid
}```
warm vault
#

aha interesting

gritty frigate
#

It's like an address to a building that's been destroyed

#

it still points there, but what's there is not what you were expecting

#

Just because you haven't updated your address book, doesn't mean that the person still lives there 🙂

warm vault
#

but I mean it's like this with the function I called:

int myInt = 1;
int* myIntPtr = &myInt;
myFunction(myIntPtr);
gritty frigate
#

But then myFunction() held onto the pointer? And when the function that you called it from finished, myInt was destroyed

warm vault
#

yeah I think something like this

#

so SImage was initialized with a valid pointer but as the local var gets destroyed the pointer becomes bad and then causes a crash? not sure if SImage keeps referencing the pointer on tick or something

gritty frigate
#

yeah - SImage will need to keep the pointer to hand

#

as the reason it takes a pointer is because it doesn't want to be copying data everywhjere

#

So if you have 5 SImages with the same image, they all want to be referring to the same data, not each having their own copies of it

#

I'm doing something very similar to you with a material in a SlateBrush

#

It's a dynamic material instance, so I'm changing it on the fly, so the SImage needs to be able to continually reference it

warm vault
#

Ah I see

#

do you put the member on the UWidget then?

gritty frigate
#

I have my brush as a non-pointer member on my SWidget

#

and then do:

SAssignNew( Image, SImage )
.Image( &ScreenMaterialImageBrush )
warm vault
#

well thank you very much for the lesson 🙂

gritty frigate
#

Glad to be able to help 🙂

#

And good luck - Slate is a bundle of fun... :/

cunning tusk
#

Any recommended beginner resources for learning Slate? I'm trying to create some reusable and resizable window widgets. for displaying content and info in

cunning tusk
#

I also looked into SWindow but it looks like that's not meant for runtime use at all

quaint zealot
#

@cunning tusk There really isn't a lot of Slate intro-level docs. UMG is what Epic considers the game API

#

For what it's worth you can re-implement pretty much any behaviour in UMG too

nocturne topaz
#

Is anyone here really confortable using Slate and specificly Tabs, Dockable Windows,... I need to someone to help me code Dockable windows. By that I mean I'm trying to create simple windows that can be next to each other, resized and the ones next to the one resized adapt themselves to fit the screen size, having tabs that you can close and open using the window menu on the top bar, moving these windows around in the scene, detach it to be a sesparate window by itself, and be able to redock it again, ... please ping me

deft wren
#

Hey! If I've a Slate text box, how do I access the contents? Until then I've been using static functions (onValueChanged and such) to synchronize it with some variable, but that doesn't seem like a good way to do this.

SNew(SHorizontalBox) +
SHorizontalBox::Slot()
.AutoWidth()
[
    SNew(SEditableTextBox)
    .MinDesiredWidth(100)
    .IsPassword(true)
]```

Essentially this is just a password field with a button next to it, and I'd like to check the field value when that button is clicked.
gritty frigate
#

Hey

#

So you want to assign it to a variable

#
TSharedPtr<SEditableTextBox> MyTextBox;

SNew(SHorizontalBox)
+SHorizontalBox::Slot()
.AutoWidth()
[
    SAssignNew(MyTextBox, SEditableTextBox)
    .MinDesiredWidth(100)
    .IsPassword(true)
]```
#

Then you've got MyTextBox->GetText() and MyTextBox->SetText(SomeText);

#

The other thing to note is that the UE style for this kind of thing is putting the + at the start of the line creating the slot
so:

+SHorizontalBox::Slot()```
deft wren
#

@gritty frigate Oh! perfect, thank you very much 🙂

#

I'll try to respect the styling

gritty frigate
#

cool stuff

deft wren
#

Hmm I'm struggling a bit, I've got
static TSharedPtr<SEditableTextBox> PasswordBox; in my headers and using SAssignNew(PasswordBox, SEditableTextBox) in the Slate "tree", and I'm making sure to declare "PasswordBox" in my cpp aswell TSharedPtr<SEditableTextBox> PasswordBox; since it's static, but I've got a linking error:

  C:\Users\Cafe\Documents\Unreal Projects\SecmaVRTemplate 4.25\Plugins\SecmaVR\Binaries\Win64\UE4Editor-SecmaVR-0004.dll : fatal error LNK1120: 1 unresolved externals```
#

I've made sure to import the relevant headers for SEditableTextBox too, so I'm not sure what I'm missing 🤔

gritty frigate
#

Why are you defining it as a static variable?

deft wren
#

Because the methods using it are static aswell

#

I'm not really carrying an instance of the EdModeToolKit (I'm pretty sure that's how the template was setup and I just kept the trend)

gritty frigate
#

Right - I've not used editor modes before...

#

If it's static, then it sounds like you've declared the static variable, but not defined it

#

In your .cpp you'll need to do:

TSharedPtr<SEditableTextBox> FSecmaVREdModeToolkit::PasswordBox;```
deft wren
#

Oh god damnit I forgot the FSecmaVREdModeToolkit namespace...

#

Thanks 😅

gritty frigate
#

Oh yes, I missed that you'd already put something in your .cpp

cunning tusk
#

@nocturne topaz this is something I've been wanting to do as well, unfortunately no leads myself yet surprisingly.

nocturne topaz
#

@cunning tusk 😦

main hedge
#

the editor has a window and tab framework

#

you could investigate how it's made

#

maybe it's even in a runtime module then you can just use it

nocturne topaz
#

@main hedge I'm not confortable enough with c++ to be able to see the code and uderstand it

main hedge
#

then you're not going to be making dockable windows with slate

#

it will be exclusively in c++ after all

nocturne topaz
#

yeah I know

#

But I'm trying to find someone who's conforatbale with slate to help me achieve that

cunning tusk
#

I’m alright with C++ but not Slate, it’s surprisingly difficult to find good resources about using it.

nocturne topaz
#

yeah that's really surprising

cunning tusk
#

Unreal's inexcusably bad documentation doesn't help either but eh

#

Guess I'll try a simpler system with UMG

nocturne topaz
#

I want to do it with UMG but apprently there's nothing for dockable/resizeable window, and alot of people told me that I have to use Slate because there's already functions that do that

cunning tusk
#

I think I came across your post on reddit from a month ago

nocturne topaz
#

yeah I asked the same thing on reddit but no help

cunning tusk
#

That approach sounds doable though

nocturne topaz
#

yeah but for the we need someone who's confortable at doing that so he could guide us step by step

cunning tusk
#

your best bet for that would be to pay someone like a consultant

#

Other than that, try to start learning stuff just head-on, like maybe follow a structured course YouTube or Udemy (when a sale is happening, never pay full price on Udemy) to actually learn the engine, and if you want to actually learn C++ then look up Cherno on YouTube for a full free series on just about almost everything C++.

zenith lotus
#

What's the performance difference between Slate and UMG?

pastel phoenix
#

only overhead of blueprints usage

zenith lotus
#

What's better choice to go with? As my whole project is C++ based, is it better to go with Slate or UMG.
I'm trying to go with options that costs me as lower performance cost as possible.

pastel phoenix
#

Slate, if you close with c++ the choice is Slate

#

but you should understand, what Slate have no visual editor

#

if you have designers in your team, make Slate widgets, cover them by UMG widgets, and then give to designers

gritty frigate
#

I'm going through the cycle of try a layout tweak that I think might work -> compile -> run -> realise it's not quite right -> repeat

craggy holly
#

UMG is always the better choice frankly

#

There's zero reason to use Slate for dev of the actual game

#

Unless there's something not exposed to UMG

#

And the performance cost difference is frankly negligible, next to the cost of the game itself

main hedge
#

there are only really two common uses for slate

  • you're making fancy custom editor stuff
  • you're making a new widget to expose to UMG
quaint zealot
#

Slate is very much not the default choice

#

UMG is perfectly fine for performance

#

Only use Slate if you intend to re-create every single widget to have some really specific behavior

#

Or if your game is going to have super complex menus with a lot of custom stuff

#

Even then you can use Slate only for the custom stuff and keep UMG for everything else

zenith lotus
#

Does anyone know how SMeshWidgets work?

#

bcoz lot of our UMG stuff runs on tick, which kind of gets really expansive, so was think to get something related to SMeshWidgets and switch to there

craggy holly
#

They're not easy to use

#

The long and short of it is you create a static mesh that determines the shape of the widget, apply special materials to it, then slate allows you to pass a few material parameters packed into remaining UV channels

#

So they're pretty limited on what you can do

#

It's more designed for drawing lots of very simple things to UI, not for replacing widgets

mild oracle
#

@zenith lotus regarding performance and UMG vs Slate it really depends on your use case. We have a large game using UMG and CPP and haven't hit too many perf issues. In the cases where we did hit them, they were solved by simplifying widgets, using pools. It's definitely not necessary to write your game only in Slate and avoid UMG just because you're using C++. I disagree with @pastel phoenix in this respect.

rain heron
#

is there a way to bend a image?

My ultimate target would be to create a spline which can repeatingly display a small image (like a curved road from above)

zenith lotus
#

@rain heron you can make a material out of an image and place it on a mesh, bcoz with spline you can bend a mesh

rain heron
#

Mesh? In slate?

#

@zenith lotus

zenith lotus
#

u can use that, in slate, but it'll get expansive
u will have to use SceneCapture
or you can try playing with translation

rain heron
#

damn... ok expensive stuff is not so good...

zenith lotus
#

or u can go with 3D widget

#

that's what I'd do to achive what u r trying to do

#

Create Slate, and then implement it in WidgetComponent into a blueprint

rain heron
#

I dont know if you fully understand me xD

I try to make a custom slate primitive which will badically show something like a "road map" which is dynamicaly generated... so i dont want to use any 3D stuff there... just slate it self to draw just the UI widget

#

@zenith lotus

zenith lotus
#

Ahhh I see.

#

is there a way to bend a image?

My ultimate target would be to create a spline which can repeatingly display a small image (like a curved road from above)
@rain heron
So for your question about bending image i don't think it's possible
you can make it feel like it's bent by playing around with translations.
or make a material with bending effect
there are only these 2 methods that I know

pastel phoenix
#

probably SViewport is for you

#

you can take dynamic texture and draw on it wherever you want

rain heron
#

thanks for the pointers i will check if it might help ^^

pastel phoenix
#

i tried drawing web pages and mpeg streams

solar cedar
gritty frigate
#

It’s probably nothing to do with Slate, and your issue is uninitialised memory somewhere in your code. Do you have a pointer somewhere that you aren’t initialising to nullptr or some valid value?

solar cedar
#

im sure i have initialized all variables

quaint zealot
#

@solar cedar Use the debugger to find out what happened

solar cedar
#

i am launching with VS, most of the time is a huge stack of slate calls, and now i was getting other stuff but like...80% was slate

quaint zealot
#

Looking at the code I'm not sure why you'd create a button that way

#

It's a button class that inherits the button class and creates a new button internally ?

gritty frigate
#

@quaint zealot having seen a crash like this before, the debugger was of no help

solar cedar
#

tbh, i just copied some sample code i found, but it's not even that, the editor crashes if i go straight to the gameplay and stop it it randomly crashes

gritty frigate
#

I was getting a seemingly slate-related crash, and I had no custom Slate code in my project

solar cedar
#

and with gameplay i mean a template i have migrated from unreal market (Action rpg)

#

and even before migrating it i was starting to get random crashes

#

thing is that, with my previous proyect that had the same classes, it never crashed like this

quaint zealot
#

Well, does it crash if you remove that code ?

solar cedar
#

haven't tried, but im not even calling anything with that code right now

#

it's never constructed

quaint zealot
#

So it's safe to say it's entirely unrelated

solar cedar
#

i have tried that code on my other proyect and had no issues whatsoever

quaint zealot
#

If you're not using that code in the first place it's not causing any crash

#

The scene outliner in the level editor is what crashes, btw

#

And it doesn't exactly seem relate to your game code

solar cedar
#

yeah, im totally lost

quaint zealot
#

Is this a binary launcher build of the engine ?

solar cedar
#

im not using source if that's the question

#

4.24.3

quaint zealot
#

Any particular plugins used ?

solar cedar
#

only the ones that the ActionRPG requires, SlateRemote and GameplayAbilities

#

i'll just assume that it's the demo that is not properly migrated

main hedge
#

getting mysterious crashes in slate is usually a sign that you got memory corruption elsewhere in your code

gritty frigate
#

^^

warm vault
solar cedar
#

thanks, that's a nice catch, im still doubting it's anything at all in that code because it crashes even without invocking that widget

quaint zealot
#

It's not that code.

solar cedar
#

but i will definitely add a nullcheck

zenith lotus
#

Can Slate Widgets be used directly in UMG?

craggy holly
#

You'll need to create a UWidget wrapper for it

#

That's essentially what all UMG widgets are

split laurel
#

@craggy holly Im using a lot of Slate but never used UWidgets. Is it more or less straight forward to do that or is there a lot of work going into making a widget UMG-compatible?

craggy holly
#

Not much to it. UOverlay is probably the simplest example, but ultimately the UWidget is then managing the lifetime and layout of the underlying slate widget.

split laurel
#

thanks, great to hear :)

nocturne topaz
#

Guys how did you learn SLate ?

pastel phoenix
#

we watched examples in the UE$ code

quaint zealot
#

Years of reverse engineering

tight comet
quaint zealot
#

Please don't multi-post here

tight comet
#

sorry, my bad

split laurel
#

https://gyazo.com/e0fb53c375de2ce1f970a137c8f81781
This widget of mine keeps on shaking when used from a graph pin. (the image in the middle is for testing purposes, to determine if the content was causing it, it's not)

I've been using the very same widget with the same configuration in details panels before and nothing ever shaked. Widget reflector also tells me it's the same size and position every time I tried to read the data

#

anybody got a clue what this could be?

split laurel
#

wow ok after hours of debugging this I found out it only happens on zoom level -1 which I was on the entire time lmao

split laurel
#

still no clue where or why this happens :d

split laurel
#

ooook for anyone who encounters a similar issue in the future, I could track it down to the SMenuContentWrapper's actual size is off by 1 pixel from the desired size in each direction. On all other zoom levels the size would be exactly the same or the difference would be < 1 pixel (which most likely doesn't affect rendering at all, so no flickering).

I couldn't find a 'good' way to fix it but I just did what Epic is doing and that is wrap their asset picker in a fixed size box. And that only works with specific numbers, like 300x300. 300x350 does not work, same issue as above. It just has 1 px too much in its actual size.

split laurel
#

OK some more updates:
Managed to track it down to SMenuAnchor (which is the parent of SComboButton) Tick. The window the menu resides in is continuously resized and repositioned on tick to find a good spot for the menu. And due to OS reasons they are 'speculating' some window values, which makes the thing flicker in some cases.

I fixed this by inheriting from SComboButton and overriding Tick. I mostly used the original Tick code, but changed the Window->Reshape(NewPosition, NewSize) to Window->MoveWindowTo(NewPosition)

Sorry for the spam but hope it helps someone lol

rain heron
#

how can is set the keyboard focus drectly after creation of the widget?
(it is a editabletextbox)

halcyon jetty
#

hello guys - I have this code:

    ChildSlot
    [
        SNew(SOverlay)
        + SOverlay::Slot().HAlign(HAlign_Fill).VAlign(VAlign_Fill)
        [
            SNew(SImage).ColorAndOpacity(FLinearColor(0.5f, 0.5f, 0.5f, 1.0f))
        ]
    ];

and I don't understand why this has transparency. This is how it looks:

#

In all tutorials similar code produces opaque background

gritty frigate
#

how can is set the keyboard focus drectly after creation of the widget?
(it is a editabletextbox)
@rain heron I don’t have the exact code to hand (I’m on my phone) but it’s something like FSlateApplication::Get().SetKeyboardFocus()

rain heron
#

jeah i tried that... didnt work

quaint zealot
#

Focus is incredibly hard to manage with Slate

wide plaza
#

@halcyon jetty well there's probably more to it than that, it will also depend on the opacity of the parent widget(s) too

halcyon jetty
somber root
#

I am trying to hilight the current player but it is displayed in a light grey:

SAssignNew(PlayerListWidget, SListView<TSharedPtr<FPlayerRow>>)
:
PlayerListWidget->SetItemSelection(PlayerRows[Idx], true, ESelectInfo::Type::OnMouseClick);

Any help is appreciated.

#
PlayerListWidget->SetItemHighlighted(PlayerRows[Idx], true);

SetItemHighlighted gives me the light grey color too. I am trying to get the yellow background color that appears when pressing with the mouse.

hexed plank
#

Any suggestions on how to plot a graph? Wondering if I should just draw a bunch of lines?

gritty frigate
#

Probably best way would be to draw lines in OnPaint on a custom widget

hexed plank
#

Will do that, thanks

#

Sad that there isn't some sort of built-in library for this

hexed plank
#

What's the best way to draw text in slate?

gritty frigate
#

It you take a look at STextBlock::OnPaint that's a good reference

#

You want to paint it directly? It's also easy enough to add a child widget that's an STextBlock

hexed plank
#

Interesting

#

FSlateDrawElement::MakeText() then?

#

Yeah I want to paint it directly I guess

#

Not super familiar with how to add it a as a child widget

gritty frigate
#

Yup - that sounds good

hexed plank
#

Although child widget might be better

gritty frigate
#

If you're doing your own painting, I don't think you can do child widgets too

#

I'm not certain that you can combine them both

#

I've got a widget where I wrote one that was a subclass of SLeafWidget and I did my own painting, and then another was a subclass of SCompoundWidget and used the painted one as a child

#

Actually, I lie - take a look at SBorder for an example of how to paint a background image and then have child widgets too

hexed plank
#

Yeah should be possible

#

Guess every STextBlock would need an FSlot to go into?

gritty frigate
#

yes

#

Are you wanting to do a graph with labels?

#

I'd probably do it all in OnPaint for that, as if you're doing child widgets, it can be more painful to position them

#

Alternatively, you can subclass SCompoundWidget, have OnPaint() draw your graph, and then have an SConstraintCanvas in ChildSlot to store your text blocks and be able to shift them around

hexed plank
#

Are you wanting to do a graph with labels?
Yup exactly what I'm going for

#

Got the graph part already up and running just fine

gritty frigate
#

I think you'll probably find it easier to use FSlateDrawElement::MakeText() in the right positions on your graph

#

I find SConstraintCanvas a pain when you want to position things accurately

#

The colour wheel and marker were done as an SLeafWidget, using OnPaint() to paint the wheel and the marker on it

#

Everything else was then put together in a separate SCompoundWidget subclass

hexed plank
#

Hmm I see

#

So a mix and match of both then

gritty frigate
#

That's what I did

#

Based on what you're after, I'd suggest doing it all in one

hexed plank
#

FSlateDrawElement::MakeText() for this function, where is the actual position of the text being set?

#

Well, I guess ToPaintGeometry() can take a layout transform

gritty frigate
#

Sorry - on a client call - can I get back to you on this in an hour?

hexed plank
#

Yeah no worries, thanks for all the help 🙂

hexed plank
#

Where is this in the FSlot?? Can't find it

gritty frigate
#

Let me dig through my code and remind myself

#

Oh, it’s the first two values of the Offset

#

Depending on your alignment, those 4 values have different names (PosX, PosY, SizeX, SizeY), but they are always the 4 values in the Offset

#

@hexed plank ^

hexed plank
#

Ah that worked great

#

Thanks @gritty frigate!!

gritty frigate
#

cool

mild oracle
#

@gritty frigate that colour picker is super cool! Is there a reason you did it in slate rather than UMG/UUserWidger BPs?

gritty frigate
#

The plugin I'm building is intended to be licensed out, and I'd like to protect as much as possible, so C++ is preferable over BP
Also, the back end of all of these UIs are C++, so I preferred having a direct connection over having C++ interfaces to BP UIs

#

The tool I'm building is modular, so all of this can be extended with either C++ or BP

#

I know it's generally considered a bad idea to not use UMG unless you have to use Slate, but I've quite enjoyed doing it this way

#

It means that simple modules for this tool are generally 5 files (a state.h, controller.h, controller.cpp, widget.h and widget.cpp)

mild oracle
#

Damn I wish I had more experience doing it that way. Although it does sound slower maybe?

#

Slower to implement I mean

quaint zealot
#

Slate isn't that bad at all, all things considered, UMG is just much more suited to game menus and content interaction.

gritty frigate
#

I've got pretty comfortable with Slate

mild oracle
#

@quaint zealot so making an entire city builder UI in it might not be a good idea?

gritty frigate
#

yeah, game UI stuff is definitely good for UMG

quaint zealot
#

A game UI should 100% consider and try UMG first and foremost

mild oracle
#

I get the idea I could get faster with it, set up reusable styles, spacing etc. But the idea of having to type eeeeverything out and wait for a complie to see it is kinda scary.

Although I guess there's hot reload

gritty frigate
#

eek!

#

Never!

#

Live Coding, sure

quaint zealot
#

The problem with Slate isn't really the slower iteration time, it's that customizing Slate widgets with content is quite painful and requires a really large amount of work beforehand

#

Adding an animated material to a Slate button is a lot harder than it has to be

gritty frigate
#

I've not tried that one yet!

#

When you say animated, do you mean a MaterialInstanceDynamic?

quaint zealot
#

Yeah

gritty frigate
#

I've not found that so difficult

quaint zealot
#

Well you do need to keep the material instance somewhere UObject related to avoid GC

#

And the entire Slate style thing isn't too easy to set up

gritty frigate
#

True

#

I've got a big FMySlateStyle class set up

#

Have you ever tried subclassing the slate widget from FGCObject?

quaint zealot
#

The only reason I'm doing Slate stuff is that I have 6 years of Slate code with a lot of boilerplate

#

So I don't have to solve these issues anymore

#

Starting out in Slate for game UI stuff - not a plugin, an editor tool etc - is just not a great idea

gritty frigate
#

Take a look at SObjectWidget for how to do Slate and UObject GC together

quaint zealot
#

Yeah I have that running

mild oracle
#

@gritty frigate Do you create a new MaterialInstanceDynamic for each button that uses the animated material? Or you just have a centralized instance in the style?

gritty frigate
#

In my case, it's not buttons, and each one is unique

#

because it has to be

mild oracle
#

ah

gritty frigate
#

If I were doing multiple buttons that were animated the same, then I'd have 1 MID

mild oracle
#

I ended up doing centralized styling by subclassing most common UMG widgets and setting up their style using a UPROPERTY() TSubclassOf<T> that had the style info in it

gritty frigate
#

right

#

I've got a lot of custom icons and other things, so they're all .png files that are referenced directly into SlateBrushs

frank delta
#

Whenever I make a tsharedptr to a member of a struct in my widget, I get an exception when the widget is destroyed, or when the member is emptied (its a tarray). This happens even if I immediately call reset on the tsharedptr after I make it. Does anyone know what I am missing?

summer jolt
#

I have made a simple button class in slate. Now how do i expose it to UMG

#

to use it there

gritty frigate
#

You'll need to create your own UMyButton class

#

Why are you making your own button in Slate, though?

#

There is very little reason to make a new button, as the current one is very customiseable

summer jolt
#

its UI based application. And the client feel that creating C++ button will optimise performance

#

I'm not sure if thats true

#

but thats what he wants

gritty frigate
#

There's already a C++ button in SButton

summer jolt
#

I'm new to slate actually

#

There's already a C++ button in SButton
@gritty frigate Thats my parent class

gritty frigate
#

okay, so you're adding new functionality to it?

summer jolt
#

Yes

gritty frigate
#

If you want a UMG version of yours, you can't subclass UButton, as it has an internal pointer to TSharedPtr<SButton>

#

I had to do this on a different class, and had to take a complete copy of the UMG class

summer jolt
#

I hope i'm going the right way😆

gritty frigate
#

It didn't feel nice to do it this way

summer jolt
#

what do you suggest?

#

the task is to create a button class derived from Sbutton

gritty frigate
#

Have you done the SButton subclass already?

summer jolt
#

and it has some BP calable function for scaling and changing the color

#

no not yet. I'm just figuring out a way for now

gritty frigate
#

You know that standard buttons can scale and set the color already?

#

It really sounds to me like you'd be better off convincing your clients that doing it in UMG is fine

summer jolt
#

thats not a option

gritty frigate
#

😦

#

Okay, so once you've got your SMyButton, I would grab UButton, and take a copy of it and rename to UMyButton, and adjust accordingly

#

I've not figured out the best way to subclass UButton to UMyButton for this kind of thing

blazing granite
#

Hi everyone, I'm trying to create an SObjectPropertyBox but I'm getting a construct error. I've implemented this class on other files and I've got 0 problems. Any idea why is this happening?

gritty frigate
#

Are you linking against PropertyEditor?

blazing granite
#

I've included the necessary file. Beside from that am I missing something to link it properly?

gritty frigate
#

I meant, have you set it as a dependency in your Build.cs?

#

That's what determines what modules are linked against

#

Any time you get a linker error saying something like "can't find symbol", it's either you're not linking against the right module, the class you're using isn't exported, or you've forgotten to define one of your functions

#

Oh, taking another look at SObjectPropertyEntryBox, it looks like your issue is the second one

#

it's not got PROPERTYEDITOR_API in the class definition

#

So you're out of luck, I'm afraid

#

Without that, you can't use it outside the module it's declared in

#

Unless you're rebuilding the entire engine?

blazing granite
#

We are building a plugin. And the idea is to create this SObjectPropertyEntryBox to filter some of our own data.

gritty frigate
#

unfortunately, then, you're out of luck

blazing granite
#

But they've used this class before in other places.

#

Thats the weird part.

gritty frigate
#

Do any of the functions in the PropertyCustomizationHelpers namespace help you out?

blazing granite
#

Let me find the example where they've used it.

gritty frigate
#

okay, this is odd. It looks like Construct() is exported, even though the whole class isn't

#

Did you check your Build.cs?

#

I may have been wrong about the reason earlier

blazing granite
#

They use it here. And it's an "outside" class. So I'm sure its linked because this works fins on the project.

#

Its implementes using AddCustomRow but i guess that is a Slate at the end so..

#

So the implementation should not be the problem imo.

#

But I'm not sure at all.

gritty frigate
#

Did you see my messages about being wrong about the exports?

#

Because Construct is exported individually, which is what your linker error was complaining about

#

check your Build.cs for dependencies

blazing granite
#

UE4Build.cs right?

gritty frigate
#

Your plugin's Build.cs

blazing granite
gritty frigate
#

You need to add PropertyEditor to either of the top 2 sections

blazing granite
#

Ok, it compiled lol. Thanks 😅 😂

#

But I don't understand why the other code works.

#

Tbh

gritty frigate
#

Is the other code in another module?

blazing granite
#

Yeah. now I've found it. Now I understand how all this works. Thanks @gritty frigate 😁

gritty frigate
#

awesome 🙂

split laurel
#

Im trying to get some custom context menu actions for my custom pin like shown in this picture https://gyazo.com/d22308773c09a43db15771ea89214631
But by default the bubbling doesn't reach my custom widget's "OnMouseButtonUp" function, it gets caught by the default pin actions. I'm not sure what causes it, since SGraphPinString looks pretty standard

#

I suspect it might have something to do with focus, but no proper clue so far

little basalt
#

Code that walks the SWidget tree upward, checking if the child is always in the parent's "Children" container.

#

Can anyone tell me if this code is crazy or making wrong assumptions about Slate? The goal is to suppress some widget behavior (responding to input events) when the widget is not visible because it's a descendent of an inactive child of a UWidgetSwitcher

#

I call the function from an input event handler in the widget that might be inactive because of where it lies in the widget tree

#

Can you all perhaps also suggest other properties I should check while traversing up the parent chain? I'm assuming I should look at the visibility / enabled properties as well, for my use-case

mild oracle
#

Has anyone tried 4K support with Slate/UMG?
For example if I have a 32x32px texture, and I create a Brush that's 16x16, it seems that even if it's rendered larger on-screen (e.g. 2x size), it's still only rendered using the 16x16 data...

#

I know it's common for web and smartphone dev to have 2 or even 3 sets of assets, for 1x, 2x, 4x DPI

narrow terrace
#

Yeah it will show it at 16x16 but its gonna load the 32x32 texture so your prob gonna need to setup multiple sets and switching per quality type that should be setup per device

summer jolt
#

Hi there. How to create a binding in a button (just like in BP) but in C++?

#

@gritty frigate

gritty frigate
#

please don't tag people directly - if someone is around (I am right now) they'll see and get back to you

#

What kind of binding do you want? Directly to a function, a lambda?

summer jolt
#

Sorry about that.
I want to update the color of the button from a variable from a game instance class . What could be the best solution to that

gritty frigate
#

Ah - I see

#

bindings are generally quite high-cost, as they are continuously called

#

Better to store a variable of your button and set it directly

summer jolt
#

Ah alright.

summer jolt
#

How do i add a Visual to the button? Because i wish to add text as well and button supports just one child in BP? and i believe should be same in CPP

gritty frigate
#

If you want to add multiple elements, you'll need to add a single widget that itself takes multiple children

#

SOverlay, for example

summer jolt
#

can i add a SOverlay in a class which is the child of UButton

gritty frigate
#

You can add an SOverlay as a child widget

mild oracle
#

@summer jolt are you talking about UPROPERTY(meta=(BindWidget))?
That lets you access BP defined widgets from C++

#

@summer jolt if you're using Blueprints, you're using UMG so it would be better to ask in that channel

gritty frigate
#

@mild oracle I think he wants to do the equivalent in C++ as binding a function to a value.
From our conversation the other day he isn’t allowed to do this button in UMG - it has to be Slate

little basalt
#

Anyone want to take a stab at my question from yesterday evening? Just a short scroll upward

mild oracle
#

@gritty frigate Ohh OK different kind of binding 🙂

split laurel
#

my question is still open as well:
Text widgets seem to properly receive events such a OnMouseButtonDown in a blueprint graph pin, but my custom widget does not. The buttons inside the custom widget however have actions assigned and do work. I think the custom widget just doesn't get considered to be pressed in the first place, and apparently I have to do more than just overwrite the OnMouseButton functions.
For reference I have looked at SEditableText, which works as well, but I cant anything in regards to making it properly eligible for receiving mouse events

junior nest
#

OK bear with me ... as I paste pictures with descriptions:

#

The Inventory Widget is a SizeBox with a set size. I tried putting it into a canvas, but it doesn't make a difference

#

Like I wrapped the size box in a canvas, and set it to size to content.

#

Is there some weird thing that adding a widget as a child of a panel, that would remove the sizing constraints of the sizebox somehow?

gritty frigate
#

@junior nest this sounds like a #umg thing

junior nest
#

ok

gritty frigate
#

Are you doing it in Slate?

junior nest
#

uh,

gritty frigate
#

If not, #umg may be able to help you better

junior nest
#

oh damn ya... ;s

gritty frigate
#

🙂

junior nest
#

clearing it out ;s

split laurel
#

okay made some progress... seems like the "OnMouseButtonXXX" functions are being blocked by SCompoundWidgets by default somehow. Just implemented a basic widget inheriting from SWidget and the functions are called properly

sinful narwhal
#

Hey, I'm trying to create a class filtering widget that functions similarly to the gameplay abilities tag widget. I want to be able to place the widget on a UI in UMG as well as have it be used in the details view for instances of a FClassFilter for example, but I'm confused on how I would supply the variable to write/read the data from in the case of placing it in the UMG UI.
For the UMG UI, would I wrap the Slate widget in a UMG widget and have the property on the UMG widget? Then I would just get a handle to the property and use a specific factory function to construct the Slate widget without the Property name slot? Similarly, I assume for the details customisation I would have a different factory function that handles creating the property name slot.

summer jolt
#

How do i add child widget in UButton class ? This my first time creating UI in C++

gritty frigate
#

You don't want to be doing that kind of thing in the UButton - the UMG classes should just be wrappers around the Slate classes

#

If you want to add child widgets, your SButton is where you'll want to do it

summer jolt
#

What i want is that i extend the button class(Which is visible and ready to drag and drop in BP) , Now my button should have 2 images and a text in it

gritty frigate
#

Have you already done a SButton subclass?

summer jolt
#

No. I'm still playing around the code. I have made a button class inherited from UButton class

gritty frigate
#

That's not going to work

#

The U* UMG widgets are all just UObject wrappers around Slate widgets

#

It's inadvisable to try to do anything other than wrap the Slate widgets in them

#

Hence my recommendation the other day that you subclass SButton and then take a copy of UButton to link to your SButton subclass

#

(well, after my recommendation to do all of this in UMG...)

summer jolt
#

If i create a SButton class. then will I be able to expose it BP?

gritty frigate
#

Not directly

#

That's what the UButton copy would be for

summer jolt
#

I'm sorry . I'm still learning UE CPP. What do you mean take copy of Ubutton and link to SButton?

gritty frigate
#

If you look at UButton, you'll notice that most of it just forwards things to a TSharedPtr<SButton> MyButton

summer jolt
#

Yes i does i saw that

#

it*

gritty frigate
#

First you subclass SButton to make SCustomButton

#

You set up everything you want to set up in there

#

And then you make new files CustomButton.cpp and CustomButton.h. You then copy the contents of Button.cpp and Button.h into those files, and change references from UButton to UCustomButton

#

Once you've done that, change TSharedPtr<SButton> MyButton to TSharedPtr<SCustomButton> MyButton

#

At that point, it should work, but with the UMG CustomButton only having the same functionality as the standard button (although it will look like your SCustomButton

#

And then you can go into UCustomButton and add extra functions and properties to reveal the extra functionality that you added

summer jolt
#

Ah. Got it.

#

Btw just a random question. If you work professionally. How much do you think something like this should cost?

#

of course it must be a easy job for you. But whats the normal rate

gritty frigate
#

I have no idea. It depends on the extra functionality that you're adding.

summer jolt
#

Alright. Thanks for the help

gritty frigate
#

👍

gritty frigate
#

Interesting!

split laurel
#

Intriguing

gritty frigate
#

It'll be nice to have some more insghts [sic] into Slate

summer jolt
#

Hi everyone. I wish to make my widgets entirely using c++ using the UUserwidget class. I wish to design as well as develop all the logics in C++ . What is the best approach?

zenith lotus
#

How to add child to SNew(SOverlay)
dynamically

wide plaza
#

you wouldn't really use UUserWidget for a purely C++ widget, probably use UWidget to expose it to the UMG editor

#

or if you're not using UMG at all, just use slate directly

summer jolt
#

How to design using uwidget? Any suggestions or tutorials?

quaint zealot
#

Look up UMG

gritty frigate
#

How to add child to SNew(SOverlay)
dynamically
@zenith lotus You'll need to assign it to a variable:

// Locally or as a member variable
TSharedPtr<SOverlay> MyOverlay;
// Where you're currently doing SNew(SOverlay)
SAssignNew(MyOverlay, SOverlay)
// Where you want to add new children
MyOverlay->AddSlot()
[
  // Slot contents here
];
#

How to design using uwidget? Any suggestions or tutorials?
@summer jolt I'm not sure how many ways I can say this... You don't want to do any kind of design inside a UWidget. You either want to do it all in UMG, or in an SWidget

summer jolt
#

haha. Got it now. I promise. Thanks

blazing granite
#

Hi guys, I'm using an SObjectPropertyEntryBox to show a data class I've created. Now it's showing all of them, but i would like to filter them is possible, only those ones that have a certain value for example. Is this possible? Thanks!

#

I've found inside the SObjectPropertyEntryBox a Slate argument that could be the solution but it's not working for me:

shell kettle
#

Hi everyone! I am building some UMG UI. I need to style a ListView scrollbar, but I think it exceeds UMG's possibilities.
Can I use Slate for it? And in that case, will the resulting widget will be very different from the UListWidget from UMG?

gritty frigate
#

In general, the Slate widgets and UMG widgets can absolutely use the same styling

#

And, in general, do

solar cedar
#

slate throwing me this breakpoint, any idea where or what to check?

desert cedar
#

it's just a warning telling you that some property is zero and is used to divide some other value with. You need to down the stack and try to determine which value it is.

south cobalt
#

Can anyone recommend a good collections of examples for Slate? I am working on integrating a small toolset into UE - and so far have been piecing it together from web/engine source.

coral schooner
#

@south cobalt I got into it by just looking at the Construct functions of existing slate widgets.

south cobalt
#

@coral schooner i see , thank you

#

i guess its just going the distance on this one

coral schooner
#

detect a widget in the editor you are interested in. Use the WidgetInspector tool to find the type of the widget and then see the Contructor of the widget to see how it was setup. That gives you a visual to code comparison

south cobalt
#

Yeah, i am doing that... creating a Details/SSplitter like list in a custom tab, just now learned its best done with SExpandableArea - would be good to have a guide on something like that.

coral schooner
#

When I started with it there was basically nothing out there as learning reasource. Still struggling with it, as I only use it every now and then. There was also a livestream for expanding the editor

south cobalt
#

That is a great stream

#

.BorderImage(FEditorStyle::GetBrush("ToolBar.Background")) is causing linker error, i've exhaustively included everything its referring to as well as "Slate", "SlateCore" in both plugin and project build files... what else could be causing it?

#

and the answer is: you have to add "EditorStyle", to the build also

somber root
#

For SListView I am able to select and hilight the row I want using the below:

PlayerListWidget->SetItemSelection(PlayerRows[Idx], true, ESelectInfo::Type::OnMouseClick);
FSlateApplication::Get().SetUserFocus(0, PlayerListWidget, EFocusCause::SetDirectly);

But the scroll into view isn't working:

PlayerListWidget->RequestScrollIntoView(PlayerRows[Idx]);

Is my setup correct?
Should this be working?
Any help is appreciated.

novel phoenix
#

I've got a Slate widget constructor:

ChildSlot[
SNew(SButton)
.OnHovered(Delegate1)
]

I want to bind another function to OnHovered, so I should probably go like:

FSimpleDelegate Delegate1 = FSimpleDelegate::Create...

But I can't get either CreateUObject, CreateLambda or CreateSP to work. Is it because it's done in a widget class? (public SCompoundWidget)

I searched this server for working examples, but none seem to compile for me. :(

gritty frigate
#

You can create your own lambda inline using:

SNew( SButton )
.OnHovered_Lambda( [this]
{
  // whatever
});
novel phoenix
#

it throws compiler error C4573, "the usage of (...) requires capture of "this", which is not allowed by the compiler"

gritty frigate
#

Let me check the signature of OnHovered...

#

Oh, you said it was a SimpleDelegate

novel phoenix
#

Yeah, OnHovered requires a SimpleDelegate

gritty frigate
#

This compiled fine for me:

SAssignNew( ButtonWidget, SButton )
.OnHovered_Lambda( [this]
{

})
novel phoenix
#

let me try

gritty frigate
#

You don't have a member variable called this, do you?

novel phoenix
#

no, no

#

ButtonWidget is supposed to be an existing pointer?

#

because the above just throws undeclared identifier

gritty frigate
#

Oh, yeah - replace the SAssignNew with your SNew

#

shouldn't make a difference to you

novel phoenix
#

This compiles fine:

ChildSlot
            [SNew(SButton)    .ButtonColorAndOpacity(FLinearColor(0,0,0,0))            .ContentPadding(FMargin(0,0, 0, 0))    .VAlign(VAlign_Center)            .OnHovered_Lambda([this]
        {

        })
#

This doesn't:

ChildSlot
            [SNew(SButton)    .ButtonColorAndOpacity(FLinearColor(0,0,0,0))            .ContentPadding(FMargin(0,0, 0, 0))    .VAlign(VAlign_Center)            .OnHovered_Lambda([this]
        {
ShowTooltip();
        })
#

oh ok, mismatched declarations

#

now, can I pass an argument to the function with this method?

#

or wait, maybe it won't be necessary

gritty frigate
#

You can capture additional variables

#

The lambda arguments are defined by the delegate type

novel phoenix
#

Alright, everything works now, thank you so much @gritty frigate :)

gritty frigate
#

cool stuff 🙂

novel phoenix
#

@gritty frigate is there a way to add OnHovered functionality to STextBlock?

gritty frigate
#

Not sure off the top of my head, but you could put it inside an SBorder which would do it

novel phoenix
#

What a clever trick, thank you again!

gritty frigate
#

You are welcome

vocal jacinth
#

I create a custom Widget.
I cannot build with #include "SMyWidget.h"
But can build with class SMyWidget;
Anyone know why?

quaint zealot
#

Can't say without more context and the actual build log

rain heron
#

what is the best way to wrap the gameviewport into an other widget by me (like a grid widget)?

I try to use something like this:

auto GameViewport = FSlateApplication::Get().GetGameViewport();
auto GameViewportContainer = StaticCastSharedPtr<SHorizontalBox>(GameViewport->GetParentWidget());
GameViewportContainer->RemoveSlot(GameViewport.ToSharedRef());
CustomWidget = SNew(SGridPanel)+SGridPanel::Slot(0,0)[GameViewport];
GameViewportContainer->AddSlot()[CustomWidget];

But the game crashes with something like

Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000178

SWidget::ConditionallyDetatchParentWidget() [engine\source\runtime\slatecore\private\widgets\swidget.cpp:576]
TSlotBase<SOverlay::FOverlaySlot>::operator[]() [engine\source\runtime\slatecore\public\slotbase.h:91]
SVerticalBox::FSlot::operator[]() [engine\source\runtime\slatecore\public\widgets\sboxpanel.h:181]
SWindow::SetContent() [engine\source\runtime\slatecore\private\widgets\swindow.cpp:1171]
UGameEngine::SwitchGameWindowToUseGameViewport() [engine\source\runtime\engine\private\gameengine.cpp:611]
gritty frigate
#

I tried that, and never managed to get it working

#

I actually changed my approach slightly

#

I ended up having that widget just be transparent, and then had a PostProcessMaterial that shifted the viewport image to fit inside the area that the widget covered

#

I passed a FramingMaterial to my widget, and then had to use Tick():

if( FramingMaterial && PreviousGeometry != AllottedGeometry )
{
    PreviousGeometry = AllottedGeometry;

    const FGeometry& ApplicationGeometry = GetApplicationWindow()->GetCachedGeometry();

    const FVector2D AbsoluteViewportTopLeft = AllottedGeometry.LocalToAbsolute( FVector2D::ZeroVector );
    const FVector2D AbsoluteViewportBottomRight = AllottedGeometry.LocalToAbsolute( AllottedGeometry.GetLocalSize() );

    const FVector2D ApplicationViewportTopLeft = ApplicationGeometry.AbsoluteToLocal( AbsoluteViewportTopLeft );
    const FVector2D ApplicationViewportBottomRight = ApplicationGeometry.AbsoluteToLocal( AbsoluteViewportBottomRight );

    FVector2D TopLeft = ApplicationViewportTopLeft / ApplicationGeometry.GetLocalSize();
    FVector2D BottomRight = ApplicationViewportBottomRight / ApplicationGeometry.GetLocalSize();

    const FVector2D size = BottomRight - TopLeft;

    if( size.X > size.Y )
    {
        ViewportClipping.X = 1.f;
        ViewportClipping.Y = size.Y / size.X;

        const float halfDiff = ( size.X - size.Y ) * .5f;
        TopLeft.Y -= halfDiff;
        BottomRight.Y += halfDiff;
    }
    else if( size.Y > size.X )
    {
        ViewportClipping.X = size.X / size.Y;
        ViewportClipping.Y = 1.f;

        const float halfDiff = ( size.Y - size.X ) * .5f;
        TopLeft.X -= halfDiff;
        BottomRight.X += halfDiff;
    }
    
    FramingMaterial->SetVectorParameterValue( FramingPositionParameterName, FLinearColor( TopLeft.X, TopLeft.Y, BottomRight.X, BottomRight.Y ) );
}```
rain heron
#

thx... i will check if archive it differently... will let you know if i come up with something ^^

gritty frigate
#

Please do let me know if you do manage it! I tried what you're trying, and I'd love to change mine to that

#

I wanted to ensure that it worked in PIE as well as -game (I'm not worried about full packaged game for my use)

rain heron
#

what I'm kinda confused though is that the structure in my case is like
SWindow->SOverlay->SHorizontalBox->SViewport
but the UGameEngine::SwitchGameWindowToUseGameViewport
checks for SWindow->SViewport and would then recreate the viewport if it is not content of SWindow 🤔
well thats just a first look though

novel phoenix
#

UUserWidget:

      CurrentTooltip->ForceLayoutPrepass();
      FGeometry geometry = CurrentTooltip->GetCachedGeometry();
      FVector2D localSize = geometry.GetLocalSize();
      FVector2D screenPosition = geometry.LocalToAbsolute(FVector2D(0, 0)); //TopLeft
      FVector2D screenSize = geometry.LocalToAbsolute(localSize) - screenPosition; // BotRight-TopLeft = real size

Is there a reason why all of them would always be equal to 0,0?

gritty frigate
#

Is that immediately after the widget has been created?

novel phoenix
#

no

#

it's well past NativeConstruct and all

gritty frigate
#

Has the game had a chance to tick at all since it was created?

novel phoenix
#

yes!

gritty frigate
#

then that's odd that it's all 0

novel phoenix
#

and it displays fine

#

the size (local) line goes from screenSize.X and screenSize.Y

split laurel
#

Im looking into making a parallax panel in slate, but all of my widgets so far have been compoundwidgets where I'd just string together different existing widgets. So I don't know a lot about arranging children and custom painting functions.

When looking into sample widgets like SOverlay, OnPaint just calls Paint on each individual widget, it doesn't seem like I can tweak the way they are rendered much. Can someone give some starting points at which functions or classes to look at?

gritty frigate
#

If you take a look at SSlider, that's good some good examples

#

that paints a handful of elements

split laurel
#

hmm that's a good suggestion, but I can't seem to wrap my head around the painting system. It seems like the SSlider::OnPaint just draws a box and passes on the draw elements. It's not modifiying any child objects there. I wonder if slate even supports changing the way children are rendered in more ways than just changing basic attributes like transform, visibility etc.

#

from the slate docs

"We begin at the top level windows and recur down the hierarchy, appending the draw elements of every widget to the draw list. Widgets tend to do two things during paint: they output actual draw elements or figure out where a child widget should exist and ask the child widget to paint itself."

This does't read to me like slate is designed with use cases like mine in mind 🤔 outputting draw elements means adding elements to the stack of widgets to draw, asking the child to paint itself means no modification

gritty frigate
#

You could probably do it without worrying about OnPaint by just modifying the render transforms of the elements

split laurel
#

I guess so. I take it I'd do that in the ArrangeChildren function?

gritty frigate
#

I’m not certain, I’m afraid

split laurel
#

guess I will try out some things :) thank you regardless

#

there's also the FSlateDrawElement::MakePostProcessPass function but it seems like you can't do much with it, or I'm misunderstanding its use

gritty frigate
#

How often are you wanting to change the render transforms?

#

You could always do it in Tick()

split laurel
#

I'd probably need to do it in tick for it to react live to mouse movement. And true, you do get the geometry as a parameter on tick.. 🤔 I'm gonna try that out soon, right now I'm reading up on ue4 graphics programming. I discovered the "MakeCustom" function (compared to MakeBox etc.) which lets you call graphics API calls directly

gritty frigate
#

Cool. I’ve only ever used OnPaint to draw slate brushes, so haven’t investigated the other options

split laurel
#

I'm just using the parallax panel for testing purposes here, I'm not planning on putting it into the articy importer

gritty frigate
#

Cool. If it’s definitely always linked to the mouse, then OnMouseMove is a smart idea, as it won’t be called more often than OnPaint or Tick

split laurel
#

downside is of course it wont move if the mouse is outside the widget, but I think it's fine

#

I could also give it a TAttribute<bool> to determine whether it should move or not and put that check on Tick, in most cases it wouldn't move then

rain heron
#

@gritty frigate so... i got something to work...
basically... i add my stuff as a grid panel to the overlay of the window...

auto GameViewport = FSlateApplication::Get().GetGameViewport();
auto GameViewportContainer = StaticCastSharedPtr<SHorizontalBox>(GameViewport->GetParentWidget());
auto GameOverlay = StaticCastSharedPtr<SOverlay>(GameViewportContainer->GetParentWidget());

Grid = SNew(SGrid)
    .FillColumn(1, 1)
    .FillRow(1, 1)
    +SGridPanel::Slot(1,1)[
        SAssignNew(GameSpacer, SSpacer).Size(FVector2D(200, 200))
    ];
GameOverlay->AddSlot()[ Grid ];

The GameSpacer is now basically the place holder for the game viewport.
After that i have in some tick function (like in a custom widget is used to contain the grid)
which then always updates the padding of the gameviewportcontainer in the overlay to fit exactly into the space occupied by the gamespacer

GameViewportContainer = StaticCastSharedPtr<SHorizontalBox>(GameWidget->GetParentWidget());
GameSpacer->GetCachedGeometry().GetAbsolutePositionAtCoordinates(FVector2D(0, 0));
Pos = GameViewportContainer->GetCachedGeometry().AbsoluteToLocal(FVector2D(0,0));
Pos2 = GameViewportContainer->GetCachedGeometry().AbsoluteToLocal(GameSpacer->GetCachedGeometry().GetAbsolutePositionAtCoordinates(FVector2D(1, 1)));
if (Pos != Pos2) {
    FVector2D Size = GameViewportContainer->GetCachedGeometry().GetLocalSize();
    FMargin Padding;
    Padding.Top = Pos.Y;
    Padding.Left = Pos.X;
    Padding.Bottom = Size.Y - Pos2.Y;
    Padding.Right = Size.X - Pos2.X;
    if (GameSlot) GameSlot->Padding(Padding);
}

GameSlot is a reference to the slot used by the gameviewportcontainer in the overlay, so i can actually change its padding...
to get access to it... i just removed the container and the readded it, then cached the reference... you could also do it by just iterating over the children list of the container ^^

so thats how i do it for now ^^

#

now i just need to find a way to allow switching keyboard focus between those two.. or generally that you can interact with one of them xD

rain heron
#

ok nope... due to interaction problems this is not ideal

rain heron
#

@gritty frigate OK forget it... i got a way better solution now... which also works in terms of interaction by making the viewport container (vertical box) directly part of the grid.... reduces the code quite a bit and i i think the best solution:

GameWidget = FSlateApplication::Get().GetGameViewport();
TSharedPtr<SHorizontalBox> GameViewportContainer = StaticCastSharedPtr<SHorizontalBox>(GameWidget->GetParentWidget());
TSharedPtr<SOverlay> GameOverlay = StaticCastSharedPtr<SOverlay>(GameViewportContainer->GetParentWidget());
GameOverlay->RemoveSlot(GameViewportContainer.ToSharedRef());

GameOverlay->AddSlot(SNew(SGridPanel)
    .FillColumn(1, 1)
    .FillRow(1, 1)
    +SGridPanel::Slot(1,1)[
        GameViewportContainer.ToSharedRef()
    ]
// Add your own widgets sorounding the viewport here
);

Apperently the game engine and the swidget only make sure that the viewport is part of the gameviewportcontainer (horizontal box)... my best guess is, that this is for split view...
either way... they store the slot and then just check that slot if it refers to the viewport...
but it doesnt check if the overly contains the horizontal box directly, which allows us to hook in... and insert the grid...

gritty frigate
#

Interesting to hear of your experiments! I haven't had a chance to read through yet, but that last one looks exactly like what would be needed for this

#

My concern is that the parent widget is different in PIE and game

#

That's what I hit upon before

rain heron
#

PIE?

gritty frigate
#

Play In Editor

rain heron
#

ah...

gritty frigate
#

What you've done which I haven't tried before is taken the parent widget of the GameViewport widget

rain heron
#

due to my environment is cant even run it in PIE xD

gritty frigate
#

I tried moving the GameViewport widget itself, which didn't work

#

ah

#

When I'm back on my dev machine, I'll have to take a look

rain heron
#

jeah... because the SWindow checks that the GameViewport is direct child of the horizonta box... but it doesnt do that with the Overlay and the Horizontal box

gritty frigate
#

interesting 🙂

#

clever

rain heron
#

lets just thank that UE4 is source available... otherwise i think i would have never figured that out xD

gritty frigate
#

totally

#

I remember writing plugins for a tool at the start of my career, and I just couldn't figure out how they'd done something with the UI, so just left it a bit of a mess

#

and then the tool was EOLd, and the source code was licensed to some customers (including us), so I finally got to see the internals

rain heron
#

^^

gritty frigate
#

The nice thing about UE is that we get to see the source code, and it's still being developed!

rain heron
#

jep

#

so thankful that some random guy in a forum reccomended me to have a look into UE4 instead of further learning Unity xD

gritty frigate
#

I've never touched Unity - is it much more painful to work with?

#

From everything I've heard, for things like 2D games, it's much more friendly

#

In my industry (not games), Unreal is the defacto real-time engine these days.

#

There's only one big company that's used Unity, as far as I'm aware

rain heron
#

Well I for me it helped a lot that i can code natively, have a look at the UI and still have the simplicity of BP and other tools...
Unity is more a cluster of multiple different things which dont work well with eachother...
and i dont like the C# backend
Jeah... i also think that the 2D support is realy bad (to non existent) here in unreal, and unity is way better in that regard... but i still would not use it even for 2D... there are i think better engines out there (like Godot)

gritty frigate
#

What I really like and appreciate about Unreal and Epic is that they have very deliberately gone after my industry (film VFX), including that their CTO comes from this industry rather than games

rain heron
#

Can's speak so much about that... since I'm just a hobby dev... but jeah... I saw how big UE got in that... and I guess it goes even bigger due to the virtual sets etc.

gritty frigate
#

Totally - that's what all of my current dev is around

rain heron
#

sounds interessting ^^

#

do you might know how i can tell the game viewport to "release" the mouse so it is visible again and so i can move it to different widgets?
I basically want to create a switch with the "tab" key which allows me to easily switch between user game interaction and sorounding widget interaction? @gritty frigate

gritty frigate
#

You've got SetInputMode_UIOnly and SetInputMode_GameOnly somewhere - let me have a look where

#

WidgetBlueprintLibrary

#

Ah - that first one is deprecated. Should have been SetInputMode_UIOnlyEx

#

All done with PlayerController->SetInputMode(InputMode);

rain heron
#

mhmhm... ok thanks

vocal jacinth
#

How can I make StructureDetailView to show instanced class? like detail panel in BP

#

Structure:
`USTRUCT(BlueprintType)
struct FMyStruct : public FTableRowBase
{
GENERATED_BODY()

public:
UPROPERTY(EditAnywhere, BlueprintReadOnly)
FString SomeString;

UPROPERTY(EditAnywhere, BlueprintReadWrite, Instanced)
class UWeaponType* WeaponType;

};`

#

Instanced class: WeaponType
`UCLASS(Blueprintable, BlueprintType, DefaultToInstanced, EditInlineNew)
class MYEDITORPLUGIN_API UWeaponType : public UObject
{
GENERATED_BODY()

public:

UPROPERTY(EditAnywhere, BlueprintReadOnly)
FName Name;

UPROPERTY(EditAnywhere, BlueprintReadOnly)
FText Description;

};`

low bluff
#

@vocal jacinth Should probably be a TSubclassOf<UWeaponType>

#

Otherwise there is not much to instance :D

#

But this is also not a slate related question tbh.

#

This would have given you more answers in #cpp

vocal jacinth
rain heron
#

So... does someone know why a numericentrybox doesnt want to show the number nor change the value when something is typed in and committed?
The Slider works just as it should...

severe swift
#

Hey all, I posted this in #gameplay-ai but it might also be appropriate here since the error has to do with DetailsView being null which is a Slate thing I believe.

Has anyone every seen the engine in a state where EQS is completely broken? I'm not sure how but currently if I create an EQS query and just click on the "Root" node it causes the engine to crash:

Assertion failed: IsValid() [File:D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Core\Public\Templates/SharedPointer.h] [Line: 890]

UE4Editor_Core!AssertFailedImplV() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:100]
UE4Editor_Core!FDebug::CheckVerifyFailedImpl() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:450]
UE4Editor_EnvironmentQueryEditor!FEnvironmentQueryEditor::OnSelectedNodesChanged() [D:\Build\++UE4+Licensee\Sync\Engine\Source\Editor\EnvironmentQueryEditor\Private\EnvironmentQueryEditor.cpp:313]
...

Running it in Debug mode and poking around, I was able to find that a DetailsView variable being null is what's causing the crash. The rest of the call stack has to do with Slate. I've tried clearing out the .vs, Intermediate, DerivedDataCache, Saved, and Binaries of both my project and all plugins being used. I've also tried disabling all my plugins. Not sure how to restore the project to working state.

split laurel
#

seems like an engine bug, so submit a bug report and give them all necesssary information. Also, if you can find out what exactly is happening you might also find a way to circumvent the issue for the time being

#

but if not thats just what it is. Broken

proud horizon
#

is it possible to render a texture in the details panel with slate?

gritty frigate
#

I don’t know what the details panel controls are specifically, but if you can do any kind of custom slate code, then yes, using an SImage

craggy holly
#

You can yeah

gritty frigate
#

👍

vocal jacinth
#

anyone how to set widget fill remain width? I want to the width is 100 + 100 + remain width of window, I tried fillWidth but it didnt works.
`SNew(SHorizontalBox)

  • SHorizontalBox::Slot()
    .MaxWidth(100.0f) [...]
  • SHorizontalBox::Slot()
    .MaxWidth(100.0f) [...]
  • SHorizontalBox::Slot()
    [...]`
gritty frigate
#
+SHorizontalBox::Slot()
.FillWidth( 1.f )
[
  SNew( SSpacer )
]
#

^ @vocal jacinth

rocky abyss
#

has anyone tried the FSlateApplication::Get().ToggleGlobalInvalidation(true) ?

#

I'm seeing a global invalidation cache and tick rate ms decrease with it but not much documentation on it

rain heron
#

how do you add a simple menu bar to a slate UI?

rain heron
#

Or is there a way to tell the game viewport to always let the input event bubble up to other widgets... because i basically have something like a small editor and i want to capture some input events so i can have some short cuts...
or lets say... how do i tell it to ignore most of the input events?

proud horizon
#

What are some good resources/examples on slate? Specifically about UI in the details panel.

split laurel
#

I found the color customization pretty useful

#

although that's for structs

royal geode
#

The widget reflector is very useful to find how the engine does stuff

mild oracle
#

I'm trying to work out if there's a way of doing responsive Slate/UMG elements. I'm imagining something like "If there's > X space, show widget in this way, otherwise show widget in another way"
Is this even feasible? I'm looking at ComputeDesiredSize but I guess I'd have to create a new kind of container like ResponsiveHorizontalBox?

mild oracle
#

When I set up my UI using UMG, I usually do it all from a subclass of AHUD using AddToViewport.
Is there a different way to do this for Slate-based elements?

#

Is TAttribute considered deprecated because it's basically the same as using Bind from the editor in that the getter would get executed every frame?

gritty frigate
#

This is what I use to add my main Slate widget:

UGameViewportClient *ViewportClient = World->GetGameViewport();
ViewportClient->AddViewportWidgetContent( ApplicationWindow.ToSharedRef(), 10 );

Where ApplicationWindow is a TSharedPtr<SWidget>

mild oracle
#

@gritty frigate you're a legend, thanks!

gritty frigate
#

👍

#

That's in a subclass of UVisual

#
void UApplicationWindow::ReleaseSlateResources( bool bReleaseChildren )
{
    ApplicationWindow.Reset();

    Super::ReleaseSlateResources( bReleaseChildren );
}```
#

I also have that

#

UApplicationWindow is a subclass of UVisual

mild oracle
#

oh UApplicationWindow is your custom class?

gritty frigate
#

yes

#

in fact, here's the full code:

#
SApplicationWindow *UApplicationWindow::CreateApplicationWindow( UWorld *World, AMyActor *Application, bool bErrorState )
{
    ApplicationWindow = SNew( SApplicationWindow )
        .Application( Application )
        .ErrorState( bErrorState );

    if( World && World->IsGameWorld() )
    {
        UGameViewportClient *ViewportClient = World->GetGameViewport();
        ViewportClient->AddViewportWidgetContent( ApplicationWindow.ToSharedRef(), 10 );
    }

    return ApplicationWindow.Get();
}

void UApplicationWindow::ReleaseSlateResources( bool bReleaseChildren )
{
    ApplicationWindow.Reset();

    Super::ReleaseSlateResources( bReleaseChildren );
}```

And in an actor in my level:
```cpp
void AMyActor::CreateApplicationUI( bool bErrorState )
{
    ApplicationWindowWrapper = NewObject<UApplicationWindow>();
    ApplicationWindow = ApplicationWindowWrapper->CreateApplicationWindow( GetWorld(), this, bErrorState );
}
#

UApplicationWindow is a UObject wrapper around SApplicationWindow

mild oracle
#

Thanks so much for sharing this!

gritty frigate
#

you're welcome

mild oracle
#

Is there a way to use SLATE_BEGIN_ARGS and include all the parent class's args?

gritty frigate
#

If you find out how, please let me know!

desert cedar
#

Does anyone know if it's possible to use fonts that use distance field alpha in slate?

#

Out of the box, I mean.

quaint zealot
#

IIRC there is built-in support for it in the font parameters somewhere

#

Haven't played with that in years though

desert cedar
#

Yes, I've created a font with Distance field alpha. The Font Cache needs to be in "Offline" mode and the "Use Distance Field Alpha" must be checked.
But what I'm asking is if I can use that font with slate?

#

To reiterate: does slate offer support for such fonts, or does it only support runtime cached fonts like UMG?

gritty frigate
#

UMG is pretty much a blueprint wrapper for Slate, so most likely it does

desert cedar
#

Well I didn't find any mention of that so I'd be happy to know what you know about it

#

(the fonts I mean, not the relationship between UMG and slate)

gritty frigate
#

I've only used standard fonts in Slate, but give me a mo and I'll have a dig

quaint zealot
#

UMG == Slate

#

It's the same thing

desert cedar
#

not quite

quaint zealot
#

UMG is UObject wrapping for Slate

#

Nothing more

desert cedar
#

To be completely honest, UMG is still missing many features of slate.

quaint zealot
#

Which are trivially added if you need them

#

UMG is just a bunch of UObjects that create Slate widgets internally

#

It's quite a small layer

desert cedar
#

Precisely. And it's very incomplete

gritty frigate
#

the font in UMG is passed directly through to Slate, so whatever UMG supports there, Slate will too

desert cedar
#

yes, but I'm telling you that UMG doesn't support something and I'm wondering if slate does

#

that something being DFA fonts

quaint zealot
#

If UMG doesn't support it neither does Slate

#

Though i'm thinking both dp

gritty frigate
#

Oh, I thought you said that UMG did support it, and you were wondering if Slate did too

#

To wit, anything that UMG can do, Slate can do

desert cedar
#

I know that

quaint zealot
#

That's not quite true either really, Slate can't interact meaningfully with content assets - hence UMG

gritty frigate
#

fair

desert cedar
#

it's trivial to wrap slate with UWidget

quaint zealot
#

Exactly

desert cedar
#

sigh I'm just gonna repeat my question. Maybe someone else knows:

Does anyone know if it's possible to use fonts that use distance field alpha in slate?

quaint zealot
#

Probably not

#

There's support for it at the font level, for things like canvas

#

But as you mentioned, Slate/UMG only uses runtime fonts

warm vault
#

Can u tell me how to solve delay between server and client

quaint zealot
#

Wrong channel

mild oracle
frank delta
#

I have a sobjectpropertyentrybox that allows me to select a static mesh asset, but I can't get the thumbnail to work. It seems I need a IDetailLayoutBuilder but I can't find any real documentation on it. Does anyone know how I can grab a reference to one or maybe has some documentation you can link?

gray thistle
#

I'm trying to get the WebBrowser widget to run at 60FPS. It seems to have a couple of Slate components which are hardcoded to 24fps.

I tried just duplicating the Slate components and running them at 60fps but entered a bit of dependency hell due to its Chromium libraries. Are my only real options here to move to a source engine build, or to re-implement the entire widget plugin?

pastel phoenix
#

it is not so hard to rewrite WebBrowser

#

using source build is a piece of pain

#

can share you my own already rewrited @gray thistle

gray thistle
#

Thanks @pastel phoenix I'd appreciate that so I can at least figure out what I was doing wrong.

pastel phoenix
#

btw, if you planning to recompile CEF, be careful, it have virus in Chromium repository, lol

quaint zealot
#

It does not, of course

wide plaza
#

LOL that’s probably a test image to reproduce a browser exploit

stable bloom
eager charm
#

You can get it from the AllottedGeometry in OnPaint or Tick I believe

const FVector2D WidgetSize = BoundingRect.GetSize();```
stable bloom
#

@eager charm Thanks! I will give that a shot

craggy holly
#

You can use GetCachedGeometry() to get the previous frames' info from somewhere else too

stable bloom
#

@craggy holly I was using TitleBar->GetCachedGeometry().GetAbsoluteSize() but it was giving me weird results.. Either 0 or a massive int.

gritty frigate
#

It would certainly give you 0 before it has had a chance to lay itself out

narrow terrace
#

Does anybody know where to set Global Invalidation on and off at runtime? or should we just be running console command's for
Slate.EnableGlobalInvalidation [0/1]?

#

So far I can only seem to find FSlateApplication::Get().ToggleGlobalInvalidation([true/false]);

cold solar
#

Hello guys, Any idea or hint on how I can have my custom hardware cursor on mac os displaying after packaging? It's working well on PC and on Standalone on Mac but not after the package

queen citrus
#

Hello,
I want to display a text which is in HTML format, correctly formatted in Unreal. The text comes from a web server and could look like this: <h2>test</h2>\n\n<p>This is a test</p>\n\n<p><strong>test</strong> Nice Test <em>Cool</em> lol</p>\n\n<ul>>li>Ball</li>\n<li>Cow</li>\n<li>Car</li>\n</ul>

The only way I have found is to build my own Rich Textblock Markup Language and parse the HTML text into this language. Does anyone know a simpler method ?

pastel phoenix
#

simpler method is WebBrowser, but it can only show your html page, you can't use it other way

queen citrus
#

Unfortunately this is not possible, because I would like to create an interactive training and get the text from a Wiki.

wide plaza
#

not sure how that makes it impossible

#

but i think you're right about the alternative, you would essentially have to convert the input HTML to rich text markup

warm vault
#

Trying to use an FWidgetRenderer to render a uimage to a utexturerendertarget2D throws the following error:

[2020.10.18-10.22.35:811][332]LogWindows: Error: Fatal error: [File:D:/Build/++UE4+Licensee/Sync/Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp] [Line: 855] 
[2020.10.18-10.22.35:812][332]LogWindows: Error: Rendering thread exception:
[2020.10.18-10.22.35:812][332]LogWindows: Error: Assertion failed: SharedThis.Get() == this [File:D:\Build\++UE4+Licensee\Sync\Engine\Source\Runtime\Core\Public\Templates/SharedPointer.h] [Line: 1329] 

code:

TSharedPtr<FWidgetRenderer> WidgetRenderer = MakeShareable(new FWidgetRenderer(false));
TSharedRef<SWidget> SlateWidget = Widget->TakeWidget();
UTextureRenderTarget2D* TextureRenderTarget2D = WidgetRenderer->DrawWidget(SlateWidget, DrawSize);
#

it's the last line

#

this is called in a static method

narrow terrace
#

Its cause your not cleaning up the widget renderer, dont use a shared ptr for it, just use a regular one. This is what I use in it

FWidgetRenderer* Renderer = new FWidgetRenderer(true);
// Do stuff with it here

// Call this when your done with the renderer to clean it up
BeginCleanup(Renderer);
stable bloom
#

Slate coordinate system is driving me insane. May I please ask for a bit of guidance. I want to move the node where the mouse is. But no matter what I do, I can't align MouseEvent position with Node::GetPosition(). There is always some weird offset.
`
FReply SGraphNode_MyNode::OnMouseMove(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent)
{
FVector2D mousePosGraph = NodeCoordToGraphCoord(MouseEvent.GetScreenSpacePosition());

SGraphNode::FNodeSet NodeFilter;
SGraphNode::MoveTo(mousePosGraph, NodeFilter);

}
`

#

I also tried MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition()); , but no luck

pastel phoenix
#

try MyGeometry.GetAbsolutePosition().IntPoint()

#

@stable bloom

stable bloom
#

Should that return an absolute position of the cursor? @pastel phoenix

pastel phoenix
#

may be, i don't know exactly

#

why you trying to work with local position?

#

i know nothing about SGraphNode, i working with scale in different things

#
    const float DPI = ParentWindow.IsValid() ? ParentWindow->GetNativeWindow()->GetDPIScaleFactor() : 1.0f;
    const float DPIScale = AllottedGeometry.Scale / DPI;
    FVector2D AbsoluteSize = AllottedGeometry.GetLocalSize() * DPIScale;
stable bloom
#

In code, absolute is depricated since it doesn't account for zoom, etc

pastel phoenix
#

like this

#

absolute = local * (scale / DPI)

#

btw - double ZoomLevel = (double((DPI * 100) - 100)) / 25.0;

#

you are right

#

don't listen to me 😸

#

FVector2D LocalPos = MyGeometry.AbsoluteToLocal(MouseEvent.GetScreenSpacePosition()) * DPIScale; is for you

stable bloom
#

@pastel phoenix Thanks, I have tried that but it still didn't yield the desired result... I guess because it is using MyGeometry (of the node), it flickers between 2 positions and the movement delta is not correct either... Damn

rocky abyss
#

Can you hotswap a DPI curve? anyone know off the top of their head and tried it? 😉

#

tried it in build I mean using some kind of debug/setting

mild oracle
#

@rocky abyss interesting question! I don't know but can you share if you find out?
For a player-modifiable UI scale I've just been using UUserInterfaceSettings ApplicationScale and it does the trick

rocky abyss
#

do you know if that's the same as the engineDefault.ini DPI curve in scaling?

#

it's a little annoying designing UMG at 1K resolution if you're using 4K textures and have to scale them down due to the DPI curve

#

so I was pondering making my DPI engine curve to 1 to be default 4K so no scaling down textures in UMG just to have unreal scale them back up

#

but want to hotswap test just to see what issues might come out of it

mild oracle
#

@rocky abyss afaik that's something that's multiplied against the DPI curve. So we have a DPI curve that we've tested at 1.0 ApplicationScale. Players can use 2.0, but it will make stuff overlap at v low resolutions

#

@rocky abyss Oh I hadn't even thought about the scale-down+scale-up issue, maybe our stuff looks awful at 4k and I haven't noticed :S

rocky abyss
#

@mild oracle 😄 thanks for answering, I'm more looking at workflow issues, to have any 4K textures in our UMGs we need to remember to scale them all down to 1k and then have unreal scale them back up? Seems like a waste of calculations to literally have to pre-pass calculate extra layout calculations on every widget. So why not design UMG native at 4K and just have engine scale down, however, the way unreal scales down textures is an interesting beast, and I've run quite a few builds looking at them. Mostly going below .5 texture size scale is meh on harsh white UI icons but this is with no mipmaps. So I wanted to run some builds on some devices with 4k UMG layouts and see what does unreal look like when the texture is scaled down like 75% of it's original look. Thus the hot swapping DPI curve to see what adjusting that curve in build does to the textures/UI/Fonts. I think most engines generally think scale up textures, and now we're in a world of 4K.... I don't think a lot of ppl have considered design at the top and scale down instead.

#

In general unreal is pretty decent at scaling up, a little more weird on scaling down, but that could just be my mipmap settings, thus was hoping to build me a quick pipeline to test it all

mild oracle
#

Whoa you've done more than us on this. I've recently been changing as many of our UI elements as possible to be power-of-two so we can enable mipmaps. For example for 4k loading screen images so they look OK at 1280x720, and for icons

south cobalt
#

Anyone know how to set order in which properties appear in a category? (From CustomizeDetails(..)) ?

south cobalt
#

I guess you just have to re-add them, even if unmodified.

rocky abyss
#

@mild oracle we couldn't get a DPI curve to swap on the fly but setting it in the defaultEngine.ini did the trick as a last resort for our build test.

mild oracle
#

@rocky abyss oh, that sucks but thanks for the update!

scenic sun
#

Is there a Slate or UMG class that you can extend to get functionality similar to HTML5 Canvas? As in, direct drawing?

scenic sun
#

Can use UCanvasRenderTarget2D in combination with a SImage

proud horizon
#
lethal kite
#

does anyone know what the slate widget handling bitmask enums is called?

quaint zealot
#

Anyone familiar with FGCObject ? Does a Slate widget simply need it as-is to store UObjects safely, or does the widget also need to be referenced by another object ?

#

Assuming the widget, inheriting from FGCObject, is kept alive by a TSharedPtr

main hedge
#

it just needs to exist

#

if you build chains of uobject with shared ptr to gc object -> uobject -> gc object -> uobject -> gc object ... it will require several gc cycles to destroy them

#

this is what the mystery ensure in umg is trying to warn you about

quaint zealot
#

Haven't seen that one yet, but I'll only have UObject -> (TSharedPtr) SSomething -> (FGCObject) UObject

queen citrus
#

Does anyone know how to get a reference to the data table in Slate for the text style set in the Rich Text block?

craggy holly
#

That's UMG

#

The property is called TextStyleSet but there is no accessor for it

queen citrus
#

I have a SNew(SRichTextBlock) and want to refer to the table in CPP as in UMG