#slate

1 messages · Page 24 of 1

queen citrus
#

Can it be set using the FSlateWidgetStyle?

craggy holly
#

SRichTextBlock doesn't use data tables

#

Only the UMG variation does

#

And that data table is used by a custom decorator

mild oracle
#

I'm trying to do a UX improvement to a custom vertical drag & drop vertical box and I'm wracking my brain how to do it.
The issue is users often overshoot the top or bottom of the box, and they want dropping outside the top/bottom to be detected as dropping to be the first/last item in the list.

#

The problem is I'm not sure how to connect a live drag event to my vertical box. Currently I just use OnDragOver to show where the item would end up when dropped

#

I could change my VerticalBox to keep a ptr to any live drag & drop, and on tick use the Y position of the mouse to give a more generous "snapping" to the drop but it seems kind of gross, and wouldn't work well with dragging between multiple folders

rocky abyss
#

I'll say this: most everything has this issue. Photoshop I struggle every time I try to get a layer to the very top or very bottom or between folders. I'd say a temporary visual of where it would be slotted would help prevent someone thinking they successfully placed it. That's assuming if the issue is someone overshoots the top and thinks they placed it correctly and release the mouse only to see it not move.

#

Or you could do a little color indicators like turn the drag item to have a color border and then color the top/bottom of the other one to show where it'd slot.

#

photoshop does this

#

assuming the color tells you where it ends up

mild oracle
#

Yeah we have a color bar that shows where it will end up, the problem is it's done via hover
so in that screenshot, because you're not over the vertical box, it won't actually be dropped at the topmost slot

#

@rocky abyss to get it to drop at the topmost slot, you have to mouse-over the top half of Dismantle

rocky abyss
#

can you extend the padding? and adjust via the layout?

#

in theory just put an extra 20px on top padding

#

I wonder if hover takes into account the padding

thin briar
#

Hi, any ideas on how to go about making a DetailCustomization so that I can change the UI for making a Map(dictionary) from 2 text fields for Key and Value to 2 combobox (dropdowns)? I have made a Text input into a combobox for an Array using FDetailArrayBuilder but did not find anything similar for customizing a TMap

thin briar
#

Since I want to make a way to customize setting a pair of values together, each pair is now a simple string and shows up in the FDetailArrayBuilder as a dropdown. The next part of the problem is when the selection changes in the dropdown how do I convert my pair from string back into its FPairStruct version using the PropertyHandle in OnSelectionChanged?

#

ChildHandle->SetValue only allows basic types like int,string,etc how do I set a struct type?

paper hamlet
#

is there a way to draw just a square with a diagonal line by line in a slate widget (i want to add it to a detail customization

mild oracle
#

Are we expected to subclass FCoreStyle to support our own custom styles like this?

quaint zealot
#

There is more than one way to use styles

gritty frigate
#

I pretty much went the same way as @quaint zealot

#

The trouble with what you're trying to do there, @mild oracle, is that you're requesting something from the style that hasn't been set in it

#

Unless you're inserting your FBYGButtonStyle into FCoreStyle elsewhere

stable bloom
#

I have created my own SWidget child (MyImageWidget) and I would like to change the behaviour of Paint(...) function inherited from SWidget. Sadly it is not virtual, but it feels like something that should be virtual. Except from editing the source, any ideas how to override it?

quaint zealot
#

OnPaint

#

That one is the virtual one you can override

gritty frigate
#

I find that SSlider is a good example for how OnPaint can be overridden

stable bloom
#

@quaint zealot Thanks, sadly it didn't do the trick. I wanted to change the ZOrder (LayerID) of my widget that is spawned in SGraphPanel and paint under all other widgets/nodes. Similar to the Comment Node, which is rendered beneath all other nodes.
The problem is that SGraphPanel has HARDCODED exception for Comments which positions them under everything

#

@gritty frigate Thank you too for the SSlider hint

gritty frigate
#

👍

paper hamlet
#

why am i getting unresolved symbol linker errors when i try to use SNumericEntryBox<float> for things like public: virtual class FReply __cdecl SSpinBox<float>::OnKeyDown i have sltae and slate core in my modules and i tried including the numeric entry box header in both my header and source files

quaint zealot
#

What's the error

paper hamlet
#

Module.HorizonVideoWallEditor.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl FKey::~FKey(void)" (__imp_??1FKey@@QEAA@XZ) referenced in function "private: virtual class FReply __cdecl SNumericEntryBox<float>::OnKeyDown(struct FGeometry const &,struct FKeyEvent const &)" (?OnKeyDown@?$SNumericEntryBox@M@@EEAA?AVFReply@@AEBUFGeometry@@AEBUFKeyEvent@@@Z)

#

i have 11 of them

#

but they are all like that

quaint zealot
#

That's quite weird because SNumericEntryBox is a template and so OnKeyDown is in header

paper hamlet
#

lets see what regeneratign the files does

#

and yeah i have noticed a bunch of issue where stuff being included in headers doesn't actually matter

#

i'm halfway considering doing a stream and actually taking the time to learn and write up to date documentation on slate and customizations for the community wiki

#

ooooooh

#

kill me

#

well i got rid to 10 if them by including inputcore

#

and the last one by including editorstyle

#

sure glad there is an abundance of info there

quaint zealot
#

Ah, that's my fault, I misread the log

#

unresolved external symbol "__declspec(dllimport) public: __cdecl FKey::~FKey(void)" (__imp_??1FKey@@QEAA@XZ

#

Googling "UE4 FKey" gives you the module to use

paper hamlet
#

yeah i just ended up VAXing it

#

still would be nice to have real documention so i might spend some time working on that

paper hamlet
#

anyone have advice for drawing graphs or a curve with a set of points in slate?

#

also is it possible to have a border with a dashed line?

gritty frigate
#

you've got FSlateDrawElement::MakeLines you can use

rain jay
#

I'm trying to get a pause/mission list widget to appear on top of all other widgets, but it seems like no matter what I do it always is created towards the back of the z-index. anyone know how to change this?

quaint zealot
#

Well, how are you doing it ?

rain jay
#

it's summoned with a keyboard input. Uses set input mode UI only.

quaint zealot
#

How are you adding your widget to the screen

rain jay
#

@quaint zealot I actually figured it out. Instead of just adding it to the viewport I'm now adding everything to a master HUD widget. but now I'm having some problems with other widgets not displaying as I want them to. Their width stays about the length of the original text block, rather than extending to the width of the canvas panel or to the width of the text that is fed into them. its always something haha

quaint zealot
#

I mean this is kind of why Slate is deprecated for game UI

#

Anyway, you should be able to add widgets as they are to the game viewport using a fixed z index

rain jay
#

@quaint zealot im not too big a fan of it. Is it like Matinee where they've begun phasing it out, or are we stuck with it in unreal?

quaint zealot
#

Slate is not going anywhere

#

It's also not getting any feature

#

(Or documentation, or...)

narrow terrace
#

Slate exists to be Slate, it just is

pastel basin
#

Greetings. I have a UMG related question. How to properly make Scrollbar BG image?

#

i've tried a variety of ways and all of them not scaling properly with a scrollbars

gritty frigate
#

That question may be better suited for #umg

pastel basin
#

well, i've asked there yesterday.

#

Just wondered if anyone here ever used them

paper hamlet
#

i'm having an issue where when i selected a new option in my scombobox it changes in game but not in the actual widgets display

    uint8 ScreenDiagonalMeasurementUnitCurrentValue;
    ScreenDiagonalMeasurementUnitPropertyHandle->GetValue(ScreenDiagonalMeasurementUnitCurrentValue);
    ScreenDiagonalMeasurementUnitComboBox = SNew(SComboBox<ScreenMeasurementUnitPtr>)
        .OptionsSource(&MeasurementUnitOptions)
        .OnGenerateWidget(this, &FVideoWallScreenDetails::OnGenerateScreenDiagonalMeasurementUnitWidget)
        .OnSelectionChanged(this, &FVideoWallScreenDetails::OnScreenDiagonalMeasurementUnitOptionSelected)
        .InitiallySelectedItem(MeasurementUnitOptions[ScreenDiagonalMeasurementUnitCurrentValue])
        [
            SNew(STextBlock)
            .Text(this, &FVideoWallScreenDetails::GetCurrentScreenDiagonalMeasurementUnitDisplayText)
        ];
#

it displays the correct options in the drop down and even has the correct on option selected behavior

#

it just doesn't actually ever change which value is displayed

orchid nova
#

Anyone know if there's some method for doing ListView pagination either via Slate or UMG? Eg. instead of scrolling, you'd only show as many items as fully fits within container, and then next page / prev page buttons

#

Been trying to look into this but haven't had much luck with google and looking through the code for how this could be achieved

#

Assuming the child items might take different amounts of space

thin briar
#

@orchid nova you could call GetDisplayedItems to get the max it can show then use that length - 1 or -2 that becomes your offset (this is to try to clip left/right half visible objects), then when you want shift pages on some button press you can call ScrollIndexIntoView and give it currentIndex + offset to go ahead or currentIndex-offset to go back a page. Don't forget to check if you go below zero or above the length of the items. Don't know if this would work for items that take different amounts of space though. On the forums, this looks like want you want but he hasn't really described how he did it https://forums.unrealengine.com/community/community-content-tools-and-tutorials/1595437-listview-getting-started-in-bp?p=1751822#post1751822

atomic forum
#

Hello. Is there a way to load a user widget without a world present? Trying to provide an option for custom user widgets during map transitions and startup. Right now my thinking is that if I can instatiate the widget without the world, it should be easy to pass off the root slate widget to moving loading screen property.

orchid nova
#

@thin briar thanks - it looks like in the forum post the items are all the same size, which is when you can just predefine how many items can be seen and you could just set that number of items and change them by page. It's where you have different sizes where it becomes problematic, I guess I'll have to see if there's some way of determining what the sizes of the individual children are and adjust based on that

atomic forum
#

Looks like it's not possible without an initial UUserWidget to construct via a WidgetTree

glass lynx
#

how to open and run .swf file in unreal engine

craggy holly
#

isn't that a flash file? There's no flash support in UE4

gritty frigate
#

@craggy holly this one's already been answered in #cpp 🙂

craggy holly
#

Yeah just noticed haha

pastel phoenix
#

may be you can play swf in web browser

young sleet
#

How to get IDetailLayoutBuilder from FDetailWidgetRow?

soft frigate
#

What is a SlateUser?

#

If you are calling this function and want to get the user, how would you do that?

#

void FAnalogCursor::UpdateCursorPosition(FSlateApplication& SlateApp, TSharedRef<FSlateUser> SlateUser, const FVector2D& NewPosition, bool bForce)

soft frigate
#

Nevermind, I was misinterpreting the warning message.

waxen gorge
#

Hi all. Interesting console command issue I'm having.

In 4.22, I used to use the SessionFrontend console to change tooltip timing. Slate.ToolTipDelay 1.25 for example.
I haven't used UE since then, but I've recently installed 4.25. I have a 4.25 instance of UE open, and also a 4.22 instance so I can refer to my past project.

So now in 4.25 I do the above slate console command, and it does change the tooltip delay ... ...
... ... in the 4.22 UE instance.

#

I tried closing both and just opening UE 4.25, and there's still no change in 4.25.

#

I have noticed that I can select different sessions from the Session Browser on the left. With that, I can select the session that is the UE4.22 instance and with that selected, change the tooltip timing from the console in either editor.
Ok so that makes sense.

#

But the same thing doesn't work if I select the 4.25 session in the Session Browser.
Mmm so maybe this session/4.22 business is just me confusing the problem. Maybe just the command has changed or something in 4.25?

#

Ah yeah, that was it 🙂 My entire knowledge of Slate is pretty much what I've written. But I found the dumpconsolecommands command and see they changed things a bit.

#

Here's me completely confusing the issue with thinking I'm commanding the wrong editor. 😄

tough badger
#

Hey guys, any ideas of how to do virtual joystick with buttons (with on pressed shooting event) ?

narrow terrace
#

@tough badger funny story, Nick Darnell made a project for it and then Rama made it into a plugin that no longer gets support that I added more support to; https://github.com/Oldsiren/UE4GamepadUMG

#

So far it just has the stuff for being able to simulate the click, but the source code is there for you to look at and mess with

tough badger
#

@narrow terrace Thx mate!

modest depot
civic pasture
#

Hey guys,

I've been using a filepicker using slate in my app from this tutorial
https://www.orfeasel.com/creating-a-file-picker/

However it does not work when packed as shipping.
I see in the comments in that tutorial that you should just use UMG. Anyone else run into this problem?

civic pasture
#

I've worked around the issue by using a third party library to handle my filepicking

warm vault
narrow terrace
#

I know the engine has a loading screen module, that basically plays video files by making an SImage and then setting the brush to that movie the same way you would in UMG

final vessel
#

UI sound is not playing a sound component, when the game is pause, any idea why is it happening

dry geyser
low bluff
#

You should check the Source Code of them then

#

It's the easiest to get around that

#

Right now you have a button that opens a dialog I assume

#

Also you may want to enable those green text hooks to see where you are placing stuff

dry geyser
#

@low bluff yes and i tried looking for it . just not sure where the source code is location in the engine source

low bluff
#
YourEditorCommands = MakeShareable(new FUICommandList);
// MAP ACTIONS TO YOUR COMMANDS
YourEditorCommands->MapAction(
    FYourEditorCommands::Get().YourCommand,
    FExecuteAction::CreateStatic(&FYourEditorCommands::OnClickedYourCommand),
    FCanExecuteAction());

FLevelEditorModule& levelEditorModule = FModuleManager::LoadModuleChecked<FLevelEditorModule>("LevelEditor");

TSharedPtr<FExtender> toolbarExtender = MakeShareable(new FExtender);
toolbarExtender->AddToolBarExtension("Game", EExtensionHook::After, YourEditorCommands,
    FToolBarExtensionDelegate::CreateRaw(this, &FYourEditorModule::CreateYourEditorCommmandSettings));

levelEditorModule.GetToolBarExtensibilityManager()->AddExtender(toolbarExtender);

levelEditorModule.GetGlobalLevelEditorActions()->Append(YourEditorCommands.ToSharedRef());
#
void FYourEditorModule::CreateYourEditorCommmandSettings(FToolBarBuilder& Builder)
{
    Builder.BeginSection(FName("YourSection"));
    Builder.AddComboButton(
        FUIAction(),
        FOnGetContent::CreateRaw(this, &FYourEditorModule::CreateYourEditorCommmandWidget),
        LOCTEXT("YourEditor_Title", "Some Title"),
        LOCTEXT("YourEditor_Tooltip", "Some tooltip."),
        FSlateIcon(FYourEditorStyle::GetStyleSetName(), "Your.Icon.Name"));
    Builder.EndSection();
}
#

That should get you somewhat started

#

There is more code involved in TSharedRef<SWidget> CreateYourEditorCommmandWidget() to actually make entries

dry geyser
#

@low bluff thanks for the quick response will try this out

low bluff
#

Ultimately, you need an FMenuBuilder

limpid fractal
#

Hello Everyone !

#

I'm trying to add a New toolbar button to current Sprite Editor without Editing Engine Source(Is That Possible?).So far I've Managed to get a ref to an AssetEditorInstance but i don't know how can i get a pointer to SpriteEditor From there!

#

@low bluff can you help me?

low bluff
#

Not without spending lots of time on this myself, sorry

royal geode
#

@limpid fractal enable "show editor hooks" or whatever the option is called in the editor settings

#

And see if there's a hook for that specific toolbar

limpid fractal
spring frost
#

Is there a Slate function for hiding the cursor directly?

placid beacon
#

FSlateApplication::Get().GetPlatformApplication().Get()->Cursor->Show(false);

spring frost
#

TY 🙂

placid beacon
#

np 🙂

dusty pecan
#

@dry geyser The widget reflector (Top Menu > Window > Developer Tools > Widget Reflector) can be useful when figuring out how to replicate stuff done in the editor GUI.

tired valley
#

is there a way to set different bindings for button presses?

#

like instead of enter on the keyboard and A on the controller, use E

#

or something?

sharp zinc
#

Hello, ppl. I wanted to add a slate element for selecting an actor from the scene. It turned out that this is in the private section of the "PropertyEditor" module and so the type is not exported. What can I do to be able to make a reference like this in mu custom details customization?

#

*my

serene eagle
sharp zinc
#

I mean to make a detail customization for a class that designers are supposed to use, and so I wanted to make a actor selection dropdown.

sharp zinc
sharp zinc
sharp zinc
sharp zinc
#

Hi, I am trying to make a detail customization for the editor for a specific class and I am trying to expose an Actor variable that is a field in ANOTHER class. These OTHER classes are contained in an ARRAY inside the class instance for which I am making the customization. Has anybody meddled with such things here?

#

I am successfully getting an SProperty widget drawn with a IPropertyHandle. The problem is that when I pick an actor it is not "saved" in the field. I have tried the same thing with an actor that is immediately in the instace of the customized class and it works.

sharp zinc
#

Okay, nailed it. I was overwriting my references with null objects on PostEditChangeProperty in my class (dull)

serene eagle
#

Ahh forgot about you. Since you said that you are doing a detail customization, you have a class which inherits from IDetailCustomization. There is a virtual function CustomizeDetails which has the IDetailLayoutBuilder. You can add rows to that which just uses slate code. You could add a combobox to the row to make the actor selectable.

sharp zinc
#

I am beginning to understand this. It has a bit of a slope-y learning curve to it, tho.

serene eagle
#

yeah slate is not that straight forward or rather editor customization and extension. And the pretty bad documentation doesn't help either. I usually look in the engine code to find out how certain things work.

sharp zinc
quaint zealot
#

Anyone familiar with SBackgroundBlur flashing to white for a frame when the parent widget fades out ?

#

Fading the strength/radius of the blur while fading the parent widget seems to fix the issue.

gritty frigate
#

@opal ledge you need to define SLATE_ARGS in the header

#

And then in Construct you’ll find them in InArgs

#

Most slate classes do this

#

Then you construct it like this:
SNew(SNinaLoadingScreen)
.MyString(SomeString);

opal ledge
#

yepe found it, ty!

gritty frigate
#

You’re welcome 🙂

queen citrus
#

Hi, does anybody know how to create a FSlateBrush from a UTexture2DDynamic?

gritty frigate
#

Have you tried calling SetResourceObject with the UTexture2DDynamic?

#

That's how I've done it with UMaterials in the past, but I believe that it supports various different types

queen citrus
#

Yes. If I use the normal FSlateBrush the image disappears after a short time

gritty frigate
#

Not sure then I'm afraid

queen citrus
#

yes

#

if I use TSharedPtr<FSlateBrush> the image wont be shown

craggy holly
#

Something needs to be keeping ImageTexture alive.

main hedge
#

so what's the deal with slate global invalidation? it has been defective in every version since it was introduced

#

4.24: layouts are fucked
4.25: layouts are fucked
4.26: stack overflow on map transition

rocky abyss
#

It seems like it was hacked together to help fortnite HUD performance but not a feature exposed well and supported. They did add a little article on it UDN in Aug? But I haven't looked into 4.26 with it

main hedge
#

yeah it now almost seems to work, save for the crash on level transition

#

though my spin boxes are behaving strangely... the text doesn't change

#

they are probably missing some invalidation on changing the value

sturdy ice
#

Hey guys What is slate 😇

pastel phoenix
#

it is underwear of UMG

serene eagle
#

it's even more. It's the framework which is used for every UI element in UE and the games it produces. UMG wraps that and make it more accessible.

sturdy ice
#

Oh, not familiar with the word as its just punch of widgets for me

#

Bunch *

sharp zinc
#

Does anybody know how to create a custom copy/paste CopyAction for an Actor in slate? I have the following lines that bring up a "GetOuter()" access violation on line 2 during copy:

            auto GoalValue = FJsonObjectConverter::UPropertyToJsonValue(Property_GoalTask_Goal, GoalTask->Goal, 0, 0);```
crystal socket
#

hey, trying to make a custom property in the editor using a Details Customization, and I'm trying to get the Reset to Default button to disappear. There's a bool for it in the "CreatePropertyNameWidget" function, but the arrow is still showing up

vast geode
lavish carbon
young sleet
#

Having trouble justifying the text on my CheckBox

#

Its like its getting cut off ..

#

Its an VBox, with an Hbox and a SearchBar inside

#

The HBox has a ChecBox and a TextBox

crystal socket
#

didn't work, unfortnately. Still seeing the reset to default button after hitting compile even after adding that meta specifier to all relevant data.

crystal socket
weary egret
#

I'm making a hierarchy following the SHierarchyView and SHierarchyViewItem pair, but I don't see where's the logic for adding/removing an Item to/from the View. Anyone's familiar?

mental sky
#

I don't have much experience with slate so if someone could help me that i would greatly appreciate it!

I would need some help with adding this combo box...

#

to this single property

tame granite
#

Anyone know how to not get mouse events when using a windows touch screen? I get the long press pop up doing right clicks etc. and don't want it

#

Touch joystick controls work but send mouse events at the same time unless I press and hold somewhere else while using them (and then that place gets a mouse click)

#

All my stuff is working with pixel streaming, no mouse events like that for first touch finger through pixel streaming, but it is not working correctly when using a multitouch monitor natively and is adding on those mouse events

#

seems this may be the answer, haven't tested yet:

#
/**
 * Hack to get around multiple mouse events being triggered for touch events.
 * Enabling this will prevent pen tablets from working since until we switch to the windows 8 sdk (and can use WM_POINTER*) events we cannot detect the difference
 */
static int32 bPreventDuplicateMouseEventsForTouch = false;

FAutoConsoleVariableRef CVarPreventDuplicateMouseEventsForTouch(
        TEXT("Slate.PreventDuplicateMouseEventsForTouchForWindows7"),
        bPreventDuplicateMouseEventsForTouch,
        TEXT("Hack to get around multiple mouse events being triggered for touch events on Windows 7 and lower.  Enabling this will prevent pen tablets from working on windows 7 since until we switch to the windows 8 sdk (and can use WM_POINTER* events) we cannot detect the difference")
);```
#

Hmm, didn't seem to fix it

stone goblet
#

Is the documentation incorrect? This piece of code did not work for me. I had to do this.

#
 GEngine->GameViewport->RemoveViewportWidgetContent(ObjectiveWidget.ToSharedRef());
sharp zinc
#

Does anybody know if I can create a widget that is copy/paste-able. For example when I "AddCustomRow()" -> it is copy-pastable by default. However this is a special class designed to be a row in the detail view that is copy-pastable by default. Can I wrap an SWidget in some class that allows me to have a copy paste functionality, that allows me to bind a method to a delegate?

#

For example, when I add an SProperty of a class reference it is copy-paste-able in the editor but it does not expose any delegates inside of the SProperty class.

turbid stone
#

Hey, creating an Mode plugin, it initially comes with,

void FModeToolkit::Init(const TSharedPtr<IToolkitHost>& InitToolkitHost)
    struct Locals
    {
        static bool IsWidgetEnabled()
        {
            return GEditor->GetSelectedActors()->Num() != 0;
        }
        ...


        SAssignNew(ToolkitWidget, SBorder)
        .HAlign(HAlign_Center)
        .Padding(10)
        .IsEnabled_Static(&Locals::IsWidgetEnabled)
        [
                 ...

Now, I don't know what I am doing, so I of course went on to try and copy paste this behaviour, since I want either one of two outcomes to appear in the widget depending on an TArray has been initialised. But this would end up like

void FModeToolkit::Init(const TSharedPtr<IToolkitHost>& InitToolkitHost)
    struct Locals
    {
        static bool IsEmpty(const TArray<uint8> Array)
        {
            return Array.Num() == 0U;
        }
        ...

        SAssignNew(ToolkitWidget, SBorder)
        .HAlign(HAlign_Center)
        .Padding(10.0f)
        .Visibility_Static(&Locals::IsEmpty)  // Need to pass in TArray somehow
        [

How can I pass the function parameter in this case? And I suspect there is a better way of doing this in the first place

tacit snow
#

Does anyone know how to create graphs for plotting data in Slate? Or know of any tutorials anywhere to get me started

gritty frigate
#

Your best bet is probably to override OnPaint yourself

#

You can call FSlateDrawElement::MakeLines() based on the data you're currently holding

craggy holly
gritty frigate
#

^ Or that 🙂

gleaming gull
#

Hey guys! Do you know if it's possible to make a SlateBrush consisting of an image which will be centred into its container?
Basically a SlateBoxBrush, but without the center stretching (only the corners)

granite thicket
turbid stone
mild oracle
#

Has anyone tried writing tests for Slate/UMG elements that require visual inspection? I'm trying to work out how to do it.
I want to create a window with some automatically-created widgets and check if they look right. Are there any examples of this in the codebase that anyone knows of?

mild oracle
#

I'm writing an editor plugin, and I want to embed a UWidget subclass in a SDockTab... am I out of luck? Is there any way to do it?

quaint zealot
#

No

serene eagle
#

I'd say if you have an use case where you need slate you can dig into it then, for the most use cases UMG are just fine. I'm not quite sure what's not present in UMG for what you would need slate, except if you want to write Unreal Editor plugins. Since the Editor uses Slate and not UMG you'd have to use Slate to write UI code for an editor plugin.

quaint zealot
#

Actually you can use UMG for editor plugins

serene eagle
#

So you can use UMG to create Docktabs and stuff? Didn't know that

solar cedar
#

Has anyone tried the ActionRPG's LoadingScreen module on 4.26? (or any material loading on preloading screen phase?). on 4.24.3 i can succesfully load a material and initialize the FSlateDynamicImageBrush but now it doesn't work (when the module starts). It does works when called with the game loaded.

hexed plank
#

Uhh

#

I don't think my slate memory is clearing after PIE

#

Frames get lower and lower in the editor with each play session

gritty frigate
#

Do you have your own Slate code?

hexed plank
#

Yes

#

But I destroy them when I stop play (to my knowledge, at least: they aren't on the screen anymore)

gritty frigate
#

You're using TSharedPtr, right? If you have a circular reference (widget A has a TSharedPtr to widget B, and widget B has a TSharedPtr to widget A), then the memory won't be freed

split laurel
#

is it generally safe to have two delegates with the same signature and assign one delegate variable with the other type?

gritty frigate
#

I believe so

royal geode
#

delegates are just typedefs

hexed plank
quaint zealot
#

If you're using UMG there is no reason to suspect Slate mismanagement of memory

#

And that profiler log is weird

#

8ms draw for editor Slate isn't shocking

#

2.8ms exclusive time for the draw on the same line makes no sense

hexed plank
#

Hmm good point

#

Well whatever it is, it's killing the editor framerate like crazy

#

Wonder what the best plan to debug this would be. Guessing there is some sort of slate debug tool I can use?

young sleet
#

Help! My ComboBox is showing weird. Items work, and items are selectable, but the actual display isn't the item.

#

I have onGenerateWidget_lambda

gritty frigate
#

You also need a child widget

#

OnGenerateWidget is for the content in the drop-down

#

and the child widget is for what it looks like inside the combo box itself

tribal fractal
#

Is there any way to draw UTexture2D screen space using Slate? As DrawLines is working screen space and DrawBox is working relative to panel UV :/

#

I'm trying to use AllottedGeometry.AbsoluteToLocal(IconLocation) Absolute To Local but it doesn't match the lines that I'm drawing

median anchor
#

Does anyone know how can i modify colors of UnrealEd? I already found "%Engine%/Content/Editor/Slate" folder, where i can change different slate textures and assets of editor. I already changed some bars and panels. But i still didn't find where can i change bars like toolbar or content browser. What can i do with this?

quaint zealot
#

Some of it will be hardcoded

#

Look at other themes by people on the net

topaz echo
#

(reposting from #cpp) Anyone have much experience with creating UUserWidgets in C++? Having a strange issue. Whenever I return a reference to a (fully constructed) SWidget in the overriden RebuildWidget(), which is also kept as a TSharedPtr variable in the UUserWidget, it causes a stack walk and dump when compiling a child blueprint of the widget for the first time after an editor restart:

Ensure condition failed: !PreviewSlateWidgetWeak.IsValid()

This does not occur if I simply return a shared reference to an SWidget that is not stored as a SharedPtr variable in the UUserWidget. Anyone have any idea what could be causing this?

#

(mulitple returns are just so I could put the notes about each case in the screencap)

topaz echo
#

I figured it out. WidgetBlueprintEditor checks to make sure the cached widget is destroyed after ReleaseSlateResources is called on the UserWidget.

#

I had to override ReleaseSlateResources in the UUserWidget and set the RootCanvas to nullptr

lucid dagger
#

Hi there

#

I'm just getting into plugins

#

Could anyone please explain these few lines of code to me please?

#
#define IMAGE_BRUSH( RelativePath, ... ) FSlateImageBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define BOX_BRUSH( RelativePath, ... ) FSlateBoxBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define BORDER_BRUSH( RelativePath, ... ) FSlateBorderBrush( Style->RootToContentDir( RelativePath, TEXT(".png") ), __VA_ARGS__ )
#define TTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".ttf") ), __VA_ARGS__ )
#define OTF_FONT( RelativePath, ... ) FSlateFontInfo( Style->RootToContentDir( RelativePath, TEXT(".otf") ), __VA_ARGS__ )
quaint zealot
#

These are macros

#

I don't know where you found that but this isn't stuff you should use

#

Brushes and fonts should be fetched directly from assets, not png files

mild oracle
#

@quaint zealot That's weird, basically all slate stylesets in the editor use this method to load images

quaint zealot
#

Yeah, and most of it is from 2013 or so

#

Assuming this is only for editor stuff that will never make its way into the game, feel free to keep doing that

mild oracle
#

@quaint zealot I'm writing a plugin now, and using this method. I guess I would have to change it to a plugin that allows content, import the icons to the plugin's Content folder and change the loading method?

#

Ah, yeah this is for editor-only icons so I guess it's ok

quaint zealot
#

I don't know really, I haven't done that manual stuff since 5 or 6 years ago

#

I only use stylesets + style assets

mild oracle
#

Can you share how you load your style assets for editor stuff?

lucid dagger
#

This is the default editor window plugin template

#

🤷‍♂️

#

I'm just trying to figure out what it does and how haha

#

This is my first time making a plugin

#

KaosSpectrum already helped me with what they do, however

quaint zealot
#

@mild oracle Look for FSlateWidgetStyle in the engine source, you'll find a lot of plugins and engine stuff implementing custom style assets. Get the style assets from

#

Basically using a style set to centralize styling

#

And then getting style assets from content

#

@lucid dagger These macros simply create Slate assets directly, manually, from uncooked, non-uasset files on the hard drive

#

One for each type of resource

lucid dagger
#

yeah

#

they do seem pretty complex

#

is your method simpler, I assume?

quaint zealot
#

No, my method isn't simpler at all, but it uses uasset files that you can package with a game

lucid dagger
#

ah

#

that makes sense

quaint zealot
#

If you just want to make an editor only plugin, stick to the method you found

lucid dagger
#

so then there's no need to depend on packaged uassets

quaint zealot
#

No there isn't indeed

lucid dagger
#

Cheers 😄

#

I assume you've made a few plugins?

quaint zealot
#

Some

#

Nothing really complex though

#

I usually stick to games

mild oracle
#

This is editor customization question, but I'm not sure where else to ask it. I have an object that contains an array of other objects, and I'm trying to customize the editor so it doesn't show them with the little pop-out arrows.

I'm using AddExternalObjects currently get the children, but it always seems to add them with the arrow.

Anyone got any pointers?

mild oracle
#

Nvm I did it by using TFieldRange<FProperty>

spring frost
#

Is there a way to tell Slate to not draw the UI layer?

#

Like, is there a way to hide the entire HUD from drawing (marketing wants to take video without any UI).

narrow terrace
#

@spring frost sorry to bother you like 5 hours later, but what I've done is getting the game viewport client->GetWindow()->SetRenderOpacity or you can set the visibility to hidden. This is the slate widget that holds all the UMG Ui related stuff. If you wanna dig into places where this is implemented/messed with in the engine. Inside UnrealClient.h/.cpp & GameViewportClient.h/.cpp The FScreenshotRequest class and FViewportClient talk to each other regarding screenshots for showing it with or without Ui

spring frost
#

Awesome, thanks, very helpful information. Ill see what I can find.

narrow terrace
#
    if(UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull))
    {
        World->GetGameViewport()->GetWindow()->SetRenderOpacity(bShowUi ? 1.0f : 0.0f);
    }
spring frost
#

👍

quaint zealot
#

@spring frost As far as I know you have to implement that yourself with a shortcut to remove or hide your widgets

astral tinsel
#

Hey everyone! Sorry if is a bit of a noob question, but im looking to add a TMap to a specific details panel. Ive got an array being added there just fine using the FArrayBuilder stuff - is there anywhere i can look for an example of how to add a TMap i a similar fashion?

#

apologies if this is a bit of a no-brainer - just getting started with Slate!

midnight fjord
#

Hey there guys, you got any handy examples of widgets and the slate code constructing them? I just feel the need to have some stuff to look at so I can see how to do the stuff I wanna do

#

there's a lot of widgets to choose from as a base, it'd be nice to see how they're used by others alongside pictures of the resulting UI

gritty frigate
#

I find that SSlider is a good example of using OnPaint

mild oracle
#

@midnight fjord SImage is pretty simple too

midnight fjord
#

Thanks!

gritty frigate
#

Also, look at anything that subclasses SCompoundWidget. That will show off how to combine other widgets into one

midnight fjord
#

Hm, I'm having a little issue I hope it's nothing too obvious - I'm making new widgets inheriting from SBox and SCompoundWidget - but while I can instantiate both of these parent classes using SNew(), the resulting child class results in an error. Is there something I should be overriding, or is SNew meant to work exclusively with vanilla UE4 widgets?

void SPlayerHUDOverlayWidget::Construct(const FArguments& InArgs)
{
    auto Canvas = SNew(SCanvas);
    ChildSlot[Canvas];

    auto& LookActionList = Canvas->AddSlot();

    LookActionList.HAlign(EHorizontalAlignment::HAlign_Center);
    LookActionList.VAlign(EVerticalAlignment::VAlign_Center);

    LookActionList[SNew(SLookActionList).OwnerHUD(OwnerHUD)];
}

adding code block just in case

The error simply complains about the [] operator not taking the argument

no operator "[]" matches these operands    
operand types are: SCanvas::FSlot [ TSharedRef<SLookActionList, ESPMode::NotThreadSafe> ]
#

The error occurs on the last line, where I'm trying to instantiate SLookActionList in a newly created slot

craggy holly
#

Is there a reason you're doing an in-game HUD in Slate btw and not using UMG? There's very little reason to use slate for game UI now, unless you want to make a new custom widget type

midnight fjord
#

@craggy holly I want options for custom widget types when needed, yes, but I'm also a one-man team and dragging UMG and blueprint stuff around actually hurts my wrist. It's one of the big reasons why I avoid the editor as much as possible

#

Don't worry as soon as I'm past the growing pains with the Slate system I'll be out of your hair

craggy holly
#

I don't mean it as a slight, but using Slate for in-game UI is generally just not advised as it creates a lot of additional challenges.

#

For an example of a full game UI done in Slate, you can study Epics' ShooterGame sample from the launcher.

midnight fjord
#

Thanks, I'll take a look

midnight fjord
#

Quick question! I dropped in a couple SImage widgets as a test, and for some reason despite being set to being a solid color its checkered? What's up with that?

craggy holly
#

So images have a "Brush" which is either a texture or material etc. that defines how they look, I think if you don't give it an object to draw (e.g the tex or material) it just falls back to a default one

#

I suspect anyway. There is a "default" brush which is just a white square texture

midnight fjord
#

@craggy holly gotcha! thanks

past swallow
#

hi, I'm cross-posting a problem from the cpp channel, because Slate makes everything bad. Sorry if I don't speak fluent c++. Basically I have this delegate? function I want to attack to an IsEnabled ... thingy. Nothing fancy.

#

I want to try and simplify my Slate stuff because reasons, to turn the commented out bit into the function call shown

#

I just want to pass a sodding pointer to my function basically

#

everything is defined within the same class (FRandomManagerEdModeToolkit)

#

I have spent 3 hours on this syntax problem and I hate everyone involved in the decision to make Slate but not document it properly

quaint zealot
#

This isn't how you use function pointers in Slate

#

You can't use C style function pointers

#

AddButton needs to be passed the delegate type expected for the button callback

#

(Like FOnClicked or whatever variant)

#

You then create a binding by using e.g. FOnClicked::CreateSP(this, &class::method) and pass that to AddButton

#

Obviously this isn't exactly trivial if you're not familiar with C++, Slate is hell to people unexperienced with the language

#

Search in the editor source for examples

past swallow
#

Thanks - I did, but actually all I find is the standard form
.Whatever (this, &myclass::function) and none of the creating binding stuff. This is just for building up multipart widgets for an edit mode tab

#

Maybe the .Whatever bit hides the binding

#

I thought i knew c++ but everything is indeed hell. I am spending weeks just dealing with magic made up c++ syntax that isn't documented at all

#

Perhaps i should apply for a Epic grant to pay someone to write this stuff up, because it's obviously beyond them

quaint zealot
#

@past swallow Just follow the tips I gave you - FOnClicked parameter to your function (for OnClicked, whatever other callback type for others), and FOnClicked::CreateSP(this, &class::method) to build the parameter when calling.

past swallow
#

Thanks

#

Will do

past swallow
#

I don't know if it works but finally it compiles. I think I understand why people don't bother doing this sort of thing. Commented code is what the function call replaces

#

part of the plan was to make everything more user-friendly to a non Slate expert (i.e. me). Back to the drawing board on that one!

past swallow
#

sorry, my struggle continues and I would be grateful for any further help

#

I've pretty much copied this straight off the UE4 demo code, looking to make a listview. I've simplified it to just using TSharedPtr<FString> types

#

I can't see any significant difference compared to the demo code

#

any ideas?

#

the demo code used a custom table row widget derived from SMultiColumnTableRow

#

this is the slightly more involved code to generate a widget from the demo code

#

ultimately what I'd like to do is display this struct in the listview

past swallow
#

I think I have to go the whole hog and make a new class derived from SMultiColumnTableRow? e.g.

    : public SMultiColumnTableRow< FDisplayedRetargetSourceInfoPtr >```
sterile glade
#

Any good tutorials out there for learning the basics for Slate? From a starting point I think I can figure out the rest there, but hard to find a step one for dummies

#

nevermind found a good tutorial to get me going

midnight fjord
#

Hey guys, any clue what "size to content" is in Slate? For SBorder and such

mental badge
#

it will size that container to the size of content inside that container

midnight fjord
#

@mental badge No, I meant like whats the equivalent of it in Slate? Cuz the Border widget in UMG has that, but I'm working with slate and I'm looking for the way to achieve the same effect

#

I tried using ComputeDesiredSize and applying it to the SCanvas slot containing the border, but I'm getting some inconsistent results that don't actually match the size of the widget I'm getting the size from.

midnight fjord
#

Please excuse my stupid ass

#

This was a property of SConstraintCanvas, not SCanvas

#

I can see it now, in code

#

thanks a lot anyway 🙂

winter mortar
#

Hi all. I'm trying to use this: https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Editor/PropertyEditor/Public/PropertyCustomizationHelpers.h#L144 MakePropertyComboBox, but i'm having trouble trying to set up the delegate for this: FOnGetPropertyComboBoxStrings. it's a DECLARE_DELEGATE_ThreeParams. In other areas for delegates i've used FSimpleDelegate::CreateSP, however that doesn't work in this case. It just gives the message "No matching function for call to 'CreateSP'" which i'm pretty sure means the definition of the function having arguments is preventing working. I'm not sure what the other options are. Can anyone point me in the right direction?

#

oh... nevermind. it's technically already a delegate in the struct i'm putting together, i just need to bind my function to it

spare cypress
#

how do I add widgets to an arbitrary FViewportClient?

#
FViewport* viewport = GEditor->GetActiveViewport();
FEditorViewportClient* viewportClient = static_cast<FEditorViewportClient*>(viewport->GetClient());
SEditorViewport* slateViewport = viewportClient->GetEditorViewportWidget().Get();

this is what I have and I want to add a widget to it

#

UGameViewportClient exposes an AddViewportWidgetContent() but not FEditorViewportClient

#

alternatively, given an arbitrary viewport how do I find the first SOverlay type widget in it?

median anchor
#

Hi, guys, where should i start leaning Slate? I need to draw some lines with specified thiccness, by points

gritty frigate
#

Probably best to look at an engine class that uses OnPaint()

#

You can ignore the interactivity of it, but I found that SSlider was a good place to get my head around this from

craggy holly
#

yeah OnPaint is the way to handle that

#

Using FSlateDrawElement::MakeLines

median anchor
#

Oh, great, thank you!

lethal sleet
#

Hey, I dont know where to post this question, but I think it fits in here.
I accidentally closed the sub tab in my asset window. Now I dont know how to reopen it. o.O

#

this is the window now

#

Oh got it

#

under the window tab > details

wide dragon
#

Just had to share my shock.

mild oracle
#

@wide dragon whaaat colour me shocked too! How did you find it? How do you spawn that window?

wide dragon
wide dragon
#

Is there an SWidget that lets you set a slot like the UMG canvas? I would like to set something to have full width with no horizontal offsets, and a specific width. I've tried SCanvas and SConstraintCanvas but I can't them to work.

#

It looks like SConstraintCanvas can do anchors like the UMG canvas, but I can't set a specific size.

mild oracle
#

@wide dragon looking into how UCanvasPanel works is no help?

wide dragon
#

That didn't occur to me haha. I just found an example that achieves what I'm going for, but I don't know if it's a good idea (performance-wise). It binds the Size of an SCanvas::Slot to a function which calls GetCachedGeometry().

craggy holly
#

UCanvasPanel is an SConstraintCanvas internally

#

You can set a specific size, just need the right anchor setup

random solstice
#

Setting the visibility of this widget on construction works. However, i'd like it so that I can toggle the visibility of this widget. I suppose I would have to setup some form of callback function for this. Any pointers as to how to achieve this? Basically, I have a dropdown widget, and based on its selection, i'd like to toggle the above.

warm vault
#

@open mountain re: from #cpp

#

If your widget is for editor only, here at #slate is the way.

#

If your widget is for a game, after begin play, you should consider user widgets at #umg

#

Nevermind , I see some conversation going #cpp for your question 😄

eternal wave
#

how slate batches images with different textures ? one draw call per image or it use things like texture array, .. ?

#

and NumBatch in stat slate is number of draw call right ?

olive kite
#

is 3ms total slate tick time normal( developer game build, without editor)? Or is that something that can be brought down lower? I'm using UMG mostly. 3ms seems a lot...

quaint zealot
#

Depends how complex the UI is

rocky abyss
#

I clocked 3ms for a relatively normal hud. But global invalidation I put it to like 1.5ms

wide dragon
#

I am trying to create a TextBlock that fades each character in one-at-a-time. I looked at the Slate Test Suite and found a sample that uses a Marshaller to style text wrapped in <TextStyle FontColor="(R=...,G=...,B=...,A=...)">...</> but I cannot get it to work with an SRichTextBlock, which has a Marshaller SLATE_ARGUMENT. Any ideas?

(I already have logic that wraps the last character of the desired Text in the TextStyle XML tag, with the proper alpha set each tick, but the XML tag displays verbatim in the UI, rather than applying the style).

wide dragon
#

^ Okay, I feel like I answer my own questions a lot shortly after asking them...usually I delete the question, but if anyone is curious, the run-time modification of TextStyles in that TestSuite example is all handled by a series of structs defined inside the TestSuite source; it isn't a built-in function of Marshallers and Decorators.

open mountain
#

how to I make a transform from UUserWidget to SWidget?
This is what I have in .cpp file:

void UHelpfullyBPLibrary::SetTestNewWindow(const UUserWidget* Widget, const FString Title, const FVector2D Size,const bool TitleBar, const bool Minimize, const bool Maximize, const bool Close, const bool Transparency, const float TransparencyAmound)
{
TSharedPtr<SWindow> Window = SNew(SWindow)
            .Title(FText::FromString(Title))
            .ClientSize(Size)
            .SupportsMaximize(Maximize)
            .SupportsMinimize(Minimize)
            .HasCloseButton(Close)
            .CreateTitleBar(TitleBar)
            .SupportsTransparency(Transparency ? EWindowTransparency::PerWindow : EWindowTransparency::None)
            .InitialOpacity(TransparencyAmound);

        FSlateApplication& SlateApp = FSlateApplication::Get();
        SlateApp.AddWindow(Window.ToSharedRef(), true);
        
        /* Here I stuck, I can't make a UserWidget to be set as window content. */
        //TShareRef<SWidget> wr = TakeWidget(Widget);
        TSharedPtr<class SWdget> wsp = Widget->TakeWidget();
        Window->SetContent(wsp);
}

So all I try to do is on blueprint function to get and blueprint widget reference and to render it on new window.

open mountain
#

this is teh resoul

#

this is how I try to create it, the only problem is with that Widget pin, what I can not figure out how to use it to set the content

mild oracle
#

All the examples I can find of programmatically showing brushes in Slate seem to create FSlateImageBrushes with a path to a .png, rather than to an imported UAsset.
Is there a way to easily load imported UAssets and use them instead?

quaint zealot
#

@mild oracle Slate brushes can be created directly in the content browser

tame granite
#

check type with cpp SOverlay * CastedOverlayParent = OverlayParent->GetType() == FName(TEXT("SOverlay")) ? static_cast<SOverlay *>(OverlayParent) : nullptr;

#

you might have to go level order/breadth first search to find the overlay that is highest up the hierarchy

#

or just find all and store the depth of each in the tree and take the one with min depth

spare cypress
#

oh I've solved that days ago but thx

past swallow
#

I have a question... I have a UE4 editor plugin I'm making. I have an SListView-derived class in an SVerticalBox inside an SBorder. Layout is a mess but you can see two listviews in this picture

#

example of my listview slate code

            // list of groups SListView
            + SVerticalBox::Slot()
            .HAlign(HAlign_Left)
            //.AutoHeight()
            .MaxHeight(200.0f)
            .FillHeight(1.0f)        // This is required to make the scrollbar work, as content overflows Slate containers by default
            [
                SAssignNew(GroupListView, SListView<FGroupListType>)
                //.ExternalScrollbar(ExternalScrollbar1)
                .ItemHeight(22.0f)
                .ListItemsSource(&GroupList)
                .OnGenerateRow(this, &FRandomManagerEdModeToolkit::OnGenerateGroupListRow)
                .SelectionMode(ESelectionMode::Single)
                .IsEnabled(this, &FRandomManagerEdModeToolkit::IsGroupListViewEnabled)
                //.OnContextMenuOpening(this, &STableViewTesting::GetListContextMenu)
                .OnSelectionChanged(this, &FRandomManagerEdModeToolkit::OnGroupListSelectionChanged)
                .HeaderRow
                (
                    SNew(SHeaderRow)
                    + SHeaderRow::Column("Group").DefaultLabel(LOCTEXT("GroupColumn", "Group"))        
                    + SHeaderRow::Column("GroupID").DefaultLabel(LOCTEXT("GroupIDColumn", "GroupID"))        
                    + SHeaderRow::Column("ParentGroupID").DefaultLabel(LOCTEXT("ParentGroupIDColumn", "ParentGroupID")) 
                    + SHeaderRow::Column("Weight").DefaultLabel(LOCTEXT("WeightColumn", "Weight"))                    
                    + SHeaderRow::Column("CustomTags").DefaultLabel(LOCTEXT("CustomTagColumn", "CustomTags"))        
                )                    
    
            ]
            ```
#

the listviews scale appropriately when the window is compressed

#

but they won't expand beyond a certain point to fill the available width. So my question is: what do I have to change, where, to get that happening? Thanks in advance

#

the lower listview also seems to scale headings differently to top one. I would be happy at least with the column headings being fully readable

desert cedar
#

When we set an Image to "HAlign_Fill" which part of the code makes it stretch? I would assume the new scale is determined by the parent slot but I can't find that code anywhere.

#

Reason I'm asking is because I made a custom slate widget loosely based on the image and mine isn't stretching.

quaint zealot
#

Look up SImage::OnPaint

#

It simply paints a box over the entire available geometry (== parent slot)

#

Most widgets don't stretch visually because they do things like "draw text 30 pixels right from edge"

desert cedar
#

@quaint zealot
It calls
FSlateDrawElement::MakeBox(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(), ImageBrush, DrawEffects, FinalColorAndOpacity);

but that call in itself doesn't stretch the image. I have the same call in my custom slate widget and it doesn't stretch the ImageBrush content

The AllottedGeometry has correct local size (already adjusted for HAlign_Filll)

quaint zealot
#

Is it the same image brush ?

desert cedar
#

Nope. It depends on the brush?

quaint zealot
#

Not 100% sure but brushes do have drawing logic associated with them

#

So try with the same brush first

#

SImage does almost nothing really, it calls MakeBox over the allotted geometry and gives a desired size for when it's not filling

desert cedar
#

@quaint zealot thanks, it worked. It seems it won't stretch if I add an offset but at least I know what to investigate now 🙂

midnight fjord
#

I was wondering if there was a way to force the SButton hitboxes to get clipped off to the size of the SConstraintCanvas that contains them

desert cedar
#

@midnight fjord did you use the widget reflector to confirm your suspicion? To me it seems as if some element is stealing your input but it's not clear which.

As for clipping, you can debug each element and see how clipping behaves. Start with the OnPaint event and follow it down the rabbit hole until you're certain that you're even fixing the right problem.

past swallow
#

obvious in hindsight I guess

midnight fjord
#

@desert cedar Thanks for the response! I definitely tracked it down to the SConstraintCanvas failing to properly clip the hitboxes of its slots

#

Inside the window, there's an SBox that contains the canvas, which I expected to be clipped along with its children when the sbox is resized. All the widgets inside of it are set to always clip, too

#

used the reflector, and thats definitely where the problem is coming from. Graphically they're being clipped but they're still grabbing events

#

I made them volatile just in case, still the same issue

desert cedar
#

Then it's a bug in the engine and you should probably report it :/

midnight fjord
#

dang :/

desert cedar
#

Slate is riddled with bugs. You can even crash a widget by puting two retainer or two invalidation boxes in parent->child relationships

#

resizing textures makes adjusting sprites impossible, it still causes caching errors

midnight fjord
#

Just to be absolutely sure that it's not been fixed in the latest version I'm going to upgrade to 4.26 before reporting

#

I'm 4.25 rn

#

Thanks for the help, getting a definitive answer that it's a bug at least made me feel a little less frustrated

desert cedar
#

they had several input area clipping bugs in the past. We've had to manually inject certain changesets from Epic. One clipping fix in particular was solved back in 4.24 but still isn't merged into 4.26. It's absolute chaos.

midnight fjord
#

I don't wanna be an angry pissy guy and complain and throw a fit but I do wish some things in UE4 were a little less overengineered or at least more standardized. And I don't mean to act like I know the best, but having CSS for UI instead of the current system would probably be pretty nice

desert cedar
#

They do have a "CSS"-like system but it's for slate only

midnight fjord
#

thats what I'm using 🙂

desert cedar
midnight fjord
#

Oh I by no means am a master with Slate but I definitely have become very comfortable

#

By saying I wish it used CSS I more meant using a standard system that has been tried and tested

#

this kinda bug that I'm having just kinda really blows my mind because you'd think it'd show up in many cases. It's just a canvas wiht buttons in an SBox

desert cedar
#

the more you stray from fortnite the more bugs it seems to have 😛

#

I was surprised with the blur widget. It only supports rectangle blur

midnight fjord
#

lol that can be said for every system in UE except replace bugs with user friendliness and the amount of asspain you gotta put in to get it to work

#

2021 and still no user friendly compute shaders for things like voxels etc.

#

At least you can do blur and other postprocess by wrapping your widgets with a retainer

#

so you dont need to rely on the blur widget

desert cedar
#

yeah but you don't get the blurred background (game world) unless you do some heavy engine modifications.

#

(im talking about proper, mip-map based blur, not H + V passes)

midnight fjord
#

Really? I was under the impression you could alter the category of your widget's postprocess material to allow you to modify the background as well

#

I might be wrong

#

Frankly I just wish unreal had more like, straight up coder shit

desert cedar
#

you can modify the background, but it's more expensive than with the blur widget

midnight fjord
#

let me write my own shaders hands on without having to go into the source and mess with your macros

#

Unity does it

desert cedar
#

now that you mention it... i should probably try making my own blur slate widget...

midnight fjord
#

The lack of actual shader support still blows my mind. Nodes are nice but damn so much spaghetti can be replaced with like three lines of code

#

And the compute shaders... Like I know we can use Unreal's systems for a lot of what normally is done with them, but its to the point where I can literally tell if a game was made in unreal by the canned particle systems that behave kinda samey

#

They're great, I just wish more control was readily available. And I know that source is available and i can technically write my own systems, but like... Unreal's guts are scary, man. I can never tell what's going on

#

alright I'm going on a rant now I'm gonna go ahead and stop

quaint zealot
#

@desert cedar For what it's worth a lot of my code is a bit shitt yin that repo

desert cedar
#

wow... i can't believe I didn't connect the dots until now -.-

#

Thank you for your kind contribution. It steered me away from a full blown slate implementation 😄

#

UMG with C++ parents gives me satisfying flexibility and iteration time

#

with slate being reserved for special cases with procedural content

quaint zealot
#

Yeah it's much easier

chrome root
#

Hey does anyone know why my colors appear flat when using them like this?

#

I know it's probably something with sRGB conversion, but I'm not quite sure how to change it

mild oracle
#

@chrome root FLinearColor::FromSRGBColor(const FColor& Color);

midnight fjord
#

Oh my god this is hilarious

#

they actually fixed it in UE 4.26

#

My UI is actually working right now

meager pasture
#

ooh wrong channel lol

#

I'm gettin close to rip my hair out point trying to figure out why my slate ui loading screen ported from Action RPG isn't displaying : /

#

anyone have any experience?

#

got the modules in place "Modules": [ { "Name": "MyProject", "Type": "Runtime", "LoadingPhase": "Default" }, { "Name": "MyProjectLoadingScreen", "Type": "ClientOnly", "LoadingPhase": "PreLoadingScreen" }

long canyon
meager pasture
#

Well to 4.26.1 a couple weeks ago

#

from 4.26

#

so not super recently

#

not sure where this project started.. maybe as 4.25

#

@long canyon what ya have in mind?

long canyon
#

I upgraded my project and found that defining module dependencies changed

meager pasture
#

rn i'm just copying what ActionRPG example does "Modules": [ { "Name": "ActionRPG", "Type": "Runtime", "LoadingPhase": "Default" }, { "Name": "ActionRPGLoadingScreen", "Type": "ClientOnly", "LoadingPhase": "PreLoadingScreen" } ],

#

rly copied everything to the T and so sad i can't get that darn thing to display

#
            new string[] {
                "MoviePlayer",
                "Slate",
                "SlateCore",
                "InputCore"

}```
#

HOLY SHIZ

long canyon
#

Yeah I’m pretty sure action rpg was made for an older engine version

meager pasture
#

IT WORKED!!!!!!

#

I had to disable a plugin

#

mother fuuuuuuuuuu....ers

#

😿

meager pasture
#

Did PieceImage() replace SetPieceImage() for SThrobber?

#

trying to change the dot image

shy dirge
#

how does one go about creating ruler guides like photoshop or illustrator in the UMG editor?

#

I simply want to drag a line down to help align UI elements

mild oracle
#

@shy dirge How familiar are you with Slate?

shy dirge
#

tbh not at all haha

midnight fjord
#

Anybody got a few seconds to explain how the engine treats widgets that you set as mouse pointers? There's a setting in the engine to select the widget you want to use as the pointer, and I just wanted to know if there's a preset size, or if it abides by the desired size of the widget etc etc.

How is their position defined? OH and also most importantly, is the cursor widget tied to the game's framerate? Before I found out about this pointer widget thing, I tried making an overlay that simply drew a widget under the mouse position and that one visibly lagged just a little bit, but enough to be noticeable

mild oracle
#

@midnight fjord I think I tried the same and switched to the hardware cursor to avoid the lag. But you can't use widgets afaik, only images

midnight fjord
#

@mild oracle oh, so the software cursor option in the project settings gives you the same lag?

mild oracle
#

@midnight fjord It's been a while since I tried, but I know we're using hardware cursors on our game, and I think that's why?

midnight fjord
#

gotcha. The main reason I'm interested in using a software cursor is because I have UV distortion shaders on my UI and I need a way to keep the cursor aligned in the same distorted space

#

I suppose I'll just have to live with the lag and hope it doesnt bother the player too much

mild oracle
#

@midnight fjord Now I'm curious what your UV-distorted UI looks like 😄

midnight fjord
#

@mild oracle Oh it's nothing much at the moment! 😄 I just wanted to account for it because later on I wanna add a parabolic distort kinda like Halo does it.

midnight fjord
#

If I detach a widget from parent in slate, I can expect it to be garbage collected, right?

#

There's no manual destruction required?

gritty frigate
#

Slate widgets aren’t garbage collected. They are smart pointers though, which means that the memory is automatically freed when nothing points to them any more

midnight fjord
#

oh okay!

gritty frigate
#

There are various types of automatic memory management. Garbage Collection is one (this is how UObjects work in UE) and Smart Pointers is another (which are used by Slate)

Smart pointers will free the memory as soon as it isn’t being referenced by anything (circular references can cause memory leaks)
GC will wait until a specific moment to look to see what can be freed

nova ice
#

guys I am new to slate and could use some help. I want to make a simple loading screen and saw the livestream where he talked about how this runs on a separate thread. I get how a slate UI element could be drawn on screen but how do I bind it to the completion of level loads

desert cedar
#

If you already know the UI part but lack info on how to fetch environment data then this is probably the wrong place to ask?
I would imagine you would find that info somewhere in the world or gameinstance and then make the latest known progress percentage exposed so that the player hud (or whichever main UI entitiy you're using to show and hide other widgets) can access it.

#

That entity can then send that data to the loading progress widget

#

The important part to remember is that it has to be something that's available on the client (if you're making a MP game)

#

Or a specific controller in case of split screen MP dynamic loading

midnight fjord
#

Alright this is getting a little rough for me, I'm on like day three of trying to get focusable windows working.

To elaborate, I need to detect at all times if a click has been performed within a particular area - but that area also contains other buttons.

The best solution seems to set up a button covering the entire area and simply allow the button to react to mouse clicks without blocking the buttons behind it from doing so. (in a way, I want to let the mouse click to "penetrate" the button its clicking so as to allow for two buttons to be clicked at once)

The question is - how? I'm not a master with Slate, I admit, but I'm not really seeing many options to customize the behavior.

I've been told that returning FReply::Unhandled() via the lambda bound to the button would allow a passthrough, but that does not seem to be the case:

Is it possible to achieve what I'm describing in Slate? The alternative is replacing the window background with a button, and appending OnFocusWindow to every single interactable in the frame, which is in my eyes a massive, annoying hack.

nova ice
#

umg wont work as rendering freezes in VR wanna try doing this. I wanted to avoid using level streaming to do this as lighting is static and I am getting lightmap issues

https://youtu.be/ON1_dEHoNDg

This engineer-oriented talk about assets loading management for good performance and smooth transitions by Epic Games' Support Engineer Axel Riffard goes over different methods to craft beautiful and highly optimized loading pipelines for your game, be it single or multi player.

Learn more about Unreal Engine at http://www.unrealengine.com

▶ Play video
desert cedar
midnight fjord
#

@desert cedar I could very well be doing something wrong, I'm 100% sure I am actually. Would it be ok if you wrote a sample of how you'd do it?

I'm implementing my functionality via a lambda, and then returning FReply::Unhandled, but that doesn't do the trick. I thought maybe the return gets ignored but no, the constructor for the event struct that the button takes actually requires an FReply return type for the lambda. In any case, I'd love to see how you would do it, I'm sure I'm doing something wrong

main shadow
#

Please can anyone help me with the scrollbar in Details Customization?

#
void FTestDetailsCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
{
    DetailBuilder.EditCategory(TEXT("Test"))
    .AddCustomRow(LOCTEXT("TestDetailsRow", "Test Details"))
    .NameContent()
    [
        SNew(STextBlock).Text(LOCTEXT("Test", "Test"))
    ]
    .ValueContent()
    [
        SNew(SBox).HeightOverride(800.f)
        [
            SNew(STextBlock).Text(LOCTEXT("Value", "Value"))
        ]
    ];
}
main shadow
#

Same with

    DetailBuilder.EditCategory(TEXT("Test"))
    .AddCustomRow(LOCTEXT("TestDetailsRow", "Test Details"))
    .WholeRowContent()
    [
        SNew(STextBlock)
        .Text(FText::FromString("Test\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\n" \
            "Test\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\n" \
            "Test\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\nTest\n"))
    ];
midnight fjord
#

@desert cedar nevermind, it had to do with the SButton not dispatching an event correctly - replacing it with SImage solved the issue

inland flower
#

I'm creating an asset picker and adding it to screen with

    TSharedPtr<SWindow> Parent = FSlateApplication::Get().GetActiveTopLevelWindow();
    FSlateApplication::Get().PushMenu(
        Parent.ToSharedRef(),
        FWidgetPath(),
        Picker.ToSharedRef(),
        FSlateApplication::Get().GetCursorPos(),
        FPopupTransitionEffect(FPopupTransitionEffect::ContextMenu)
    );
#

Does anyone know why it's turning into software gore?

inland flower
#

Using MenuBuilder seems to fix it

    FMenuBuilder MenuBuilder(true, NULL);
    MenuBuilder.BeginSection("Select Asset");
    MenuBuilder.AddWidget(Picker.ToSharedRef(), FText());
    MenuBuilder.EndSection();

    TSharedPtr<SWidget> MenuWidget = MenuBuilder.MakeWidget();
signal river
#

I am creating a IDetailCustomization and I have a STextComboBox and would like to know how to update the OptionsSource outside of the CustomizeDetails method

thin robin
#

Hi guys, has anyone tried to use a custom SViewport class? I would like to create SMyViewport in MyGameViewportClient, but I found that SViewport in created in UGameEngine::CreateGameViewportWidget

signal river
#

well I have use a custom SViewport class and i follow the plugin UnrealThumbnailGenerator for guidance. In the module class there is a function OnSpawnPluginTab, they just create a new pointer to their custom SViewport and not using UGameEngine::CreateGameViewportWidget
https://github.com/CelPlays/UnrealThumbnailGenerator

west herald
#

Would someone be able to direct me to a guide for implementing UI with c++? I created a widget blueprint and designed the UI already but I'm not sure how to go about implementing now though. This is for a project so I have to use c++ instead of blueprints. I'm still new to unreal and this is my first time working in it, though I'm not new to c++.

gritty frigate
#

I can’t help right now, but if you ping me on Monday I’ll be able to

west herald
#

I appreciate the help but I kinda need this much sooner, a guide would be great to follow at my own pace but still be able to work on it immediately

gritty frigate
#

Sorry - I don’t have a guide - I kind of figured it out as I went

#

Look for subclasses of SCompoundWidget

west herald
#

I'll look into it, thanks

chrome root
#

Hey there, does anyone know whether it's "easy" (as easy as slate can be) to replace the shape of the caret in a text box?

#

e.g. I wanna have a █ caret instead of a | caret 😛

quaint zealot
chrome root
#

it does not, but it uses the same FSlateEditableTextLayout where I could hack it in

chrome root
#

Finally, a custom text cursor

#

I had to copy/paste UE4's SMUltiLineEditableTextBox, SMultiLineEditableText, FSlateEditableTextLayout, ISlateEditableTextWidget and FSlateCursorLineHighlighter into my project and adjust them all together so they still work together with all the UE4 systems

#

this could have been easier

gritty frigate
#

Does anyone have a link to any docs on implementing Drag and Drop in Slate?

#

I've found some examples in the engine, but they are maybe more complicated than I want

#

My eventual goal is to be able to drag and drop items in a SScrollBox

#

I have a button in my row that returns FReply::Handled().BeginDragDrop()

#

I've also got this on each row, but none of these ever seem to be called

.OnDragDetected_Lambda( []( const FGeometry& Geometry, const FPointerEvent& Event )
{
    UE_LOG( MyLogType, Log, TEXT( "TableRow::OnDragDetected" ) );
    return FReply::Handled();
})
.OnDragEnter_Lambda( []( FDragDropEvent const& Event )
{
    UE_LOG( MyLogType, Log, TEXT( "TableRow::OnDragEnter" ) );
})
.OnDragLeave_Lambda( []( FDragDropEvent const& Event )
{
    UE_LOG( MyLogType, Log, TEXT( "TableRow::OnDragLeave" ) );
})
.OnDrop_Lambda( []( FDragDropEvent const& Event )
{
    UE_LOG( MyLogType, Log, TEXT( "TableRow::OnDrop" ) );
    return FReply::Handled();
})
royal geode
#

Did you implement a custom drag op @gritty frigate ?

gritty frigate
#

I have one, yeah

#

I haven't figured out what I need to override in it

#
class FConductorGraphicDragDropOp : public FDragDropOperation
{
public:
    static TSharedRef<FConductorGraphicDragDropOp> New(
        TSharedPtr<FConductorUIGraphic> ItemToDrag );

private:
    FConductorGraphicDragDropOp( TSharedPtr<FConductorUIGraphic> InItemToDrag );

    TSharedPtr<FConductorUIGraphic> ItemToDrag;
};```
royal geode
#

Nothing I think

gritty frigate
#

I'm calling FConductorGraphicDragDropOp::New() and passing that into BeginDragDrop()

royal geode
#

Ye that looks good

#

Then you just need to implement OnDrop

sharp zinc
#

Hi. I would like to create a slate widget window (+menu entry) for the editor. I was unable to find a resource on the internet. Should I go look into the source code or is there a good resource that I have missed? I have already created detail customization so I have an idea about slate syntax.

royal geode
#

and in OnDrop you do smthg like

gritty frigate
royal geode
#
    const TSharedPtr<FDragDropOperation> Operation = DragDropEvent.GetOperation();
    if (Operation.IsValid() && Operation->IsOfType<YourDrop```
#

on your widget that can handle being dropped on

royal geode
paper hamlet
#

i'm working on a tree view and i'm getting the following error in my OnGenerateRow delegate
cannot convert argument 2 from 'TSharedPtr<ITableRow,ESPMode::NotThreadSafe>(SNeoscapeProjectAnalyzerWidget::FNPATreeItem,const TSharedRef<STableViewBase,ESPMode::NotThreadSafe> &)' to 'TSharedRef<ITableRow,ESPMode::NotThreadSafe>(ArgumentType,const TSharedRef<STableViewBase,ESPMode::NotThreadSafe> &)'

#

the issue as i see it is that it can't convert ArgumentType to FNPATreeItem

gritty frigate
#

@royal geode I've got OnDrop implemented on each Row in the SScrollBox already, with a log line, which doesn't seem to ever be called

paper hamlet
#

except argument type should be templated and the Tree is decalared as STreeView<FNPATreeItem>

royal geode
#

Slots you mean?

#

I would try with a simpler widget first maybe

gritty frigate
#

okay

#

Thanks

royal geode
#

cuz as far as I can tell what I said above is all we're doing hehe

gritty frigate
#

Not slots, no - I'm trying to do this with separate rows in a SScrollBox

#

In OnGenerateWidgetForList() I create the new row widget, and that's where I'm doing it

royal geode
#

But SScrollBox has slots right?

#

not rows?

gritty frigate
#

Sorry... of course...
Everywhere I've mentioned SScrollBox, I was actually talking about SListView

#

I just have an SListView in the single slot in SScrollBox

#
SAssignNew( GraphicsListWidget, SListView<TSharedPtr<FConductorUIGraphic>> )
.SelectionMode( ESelectionMode::Single )
.ListItemsSource( &GraphicsList )
.OnGenerateRow( this, &SConductorGraphicsWidget::OnGenerateGraphicWidgetForList )
.OnSelectionChanged( this, &SConductorGraphicsWidget::OnGraphicSelectionChanged )
royal geode
#

Looks like SListView doesn't forward OnDrop

gritty frigate
#

Ahh

royal geode
#

mmh

#

nvm

gritty frigate
#

So I'd need OnDrop on the SListView itself...

royal geode
#

Try OnAcceptDrop?

gritty frigate
#

I shall give that a go 🙂

#

Thanks

royal geode
#

STableRow::OnDrop is where the fun is

gritty frigate
#

Also just stopped spotted OnCanAcceptDrop

#

Thanks @royal geode - I appreciate the pointers. I'm going to have to call it for the day now, but will see where I get to in the morning

royal geode
#

Slate is fun 😄

gritty frigate
#

I really quite enjoy it, TBH 🙂

#

I've got a lot of Slate code in this project

paper hamlet
#

i'm having an issue with STreeView I have declared the following in my header

typedef TSharedPtr<FTreeItem> FNPATreeItem;
typedef STreeView<FNPATreeItem> NPATree;
TSharedPtr<ITableRow> GenerateTreeRow(FNPATreeItem TreeItem, const TSharedRef<STableViewBase>& OwnerTable);
TSharedPtr<NPATree> TreeViewPtr;

and in source i have this as my tree constructor

SAssignNew(TreeViewPtr, NPATree)
  .TreeItemsSource(&TreeRootNodes)
  .OnGenerateRow(this, &SNeoscapeProjectAnalyzerWidget::GenerateTreeRow)
  .ItemHeight(30)
  .SelectionMode(ESelectionMode::Multi)
  .OnGetChildren(this, &SNeoscapeProjectAnalyzerWidget::GetChildrenForTree)
  .ClearSelectionOnClick(false)
  .HighlightParentNodesForSelection(true);

however i have an issue in my OnGetChildren where the GenerateTree row can't convert from

TSharedPtr<ITableRow>(FNPATreeItem, const TSharedRef<STableViewBase>&)
to
TSharedPtr<ITableRow>(ArgumentType, const TSharedRef<STableViewBase>&)

what have i missed

#

i thought i did all of my typedefs correctly and i followed the format of creating the tree as well but it seems like it's not templating correctly

junior mesa
#

Hello. Is it possible to specify the width of an SCombobox?

paper hamlet
#

You’d have to specify it in the combobox’s parent slot

junior mesa
#

Ah I see ok. Thanks @paper hamlet .

paper hamlet
#

some extra info on my error the log file actually has this block in is as well

with
                   [
                       UserClass=SNeoscapeProjectAnalyzerWidget,
                       ArgumentType=SNeoscapeProjectAnalyzerWidget::FNPATreeItem
                   ]
                   and
                   [
                       ArgumentType=SNeoscapeProjectAnalyzerWidget::FNPATreeItem
                   ]

i'm not even sure why the UserClass is there or what's going on

paper hamlet
#

as usual the slate errors were useless, it just needed to return TSharedRef instead of TSharedPtr

gritty frigate
#

@royal geode For when you're online - I figured out what wasn't working...
I was returning my FReply::Handled().BeginDragDrop() from an OnClicked on a button that was on the row. If I changed it to return from my OnDragDetected on the row itself, it seems to work as it should. I do want to only allow the drag from a certain area of the row, but OnDragDetected passes in the geometry, so I'll probably use that.

dusk swan
#

anyone know if BeginCleanup will delete the pointer it's passed or not?

#

basically, I have a slate widget that does WidgetRenderer = new FWidgetRenderer() on construct, and does BeginCleanup(WidgetRenderer) on destruct and just want to check I'm not leaking stuff here

patent stirrup
#

Does anyone know how to limit a slate SEditableTextBox to a desired size? It has a property for MinDesiredWidth but not a MaxDesiredWidth.

weary egret
#

wrap it in SizeBox[ScaleBox[Text]]

patent stirrup
#

Oh yes, I forgot about those.

#

While I'm here, and while my question remains unanswered on the forums, how can I remove a widget(Context Menu) once a button has been clicked? I've tried resetting the shared pointer, changing the visibility etc. When I change the visibility, it takes a double click to actually update the visibility.

#

As of now, the Context Menu is only removed when I click outside the widget.

weary egret
#

you can just do widget->RemoveFromViewport()

patent stirrup
weary egret
#

what context menu?

patent stirrup
#

SListView.OnContextMenuOpening -> return a TSharedPtr<SWidget>

#

I use the SAssignNew and assign the widget to a shared ptr, which I can use to work on the SWidget, but I just can't figure out how to remove it.

weary egret
#

it opens when you right click on the listview?

patent stirrup
#

Correct, and the only way to get rid of it naturally, is to click outside of it.

weary egret
#

try FSlateApplication::Get().DismissAllMenus()

patent stirrup
#

That done the trick. Out of curiosity, how did you find that?

weary egret
#

FSlateApplication is where it governs all the slate stuffs

#

slate uses FSlateApplication to interact with each other/gameplay

patent stirrup
#

Oh I wish the api reference was more documented 😄

twilit salmon
#

Somewhat rusty in using Slate, trying to figure out the proper way to change the text in a texblock?
Changing the text with SetText() does not update the text on the widget, SetText() only works initially when creating the shared-ref, but not later when used to try to set a new value., which I find a bit peculiar when other widget-types work as expected, like SButtons and SUniformGridPanels

gritty frigate
#

That should work - I do it all the time in my code

twilit salmon
#

@gritty frigate Ok then if it should work with textblocks but not in my case, then it means I must've made a mistake in the code somewhere and not noticed it

#

thanks for clarifying for me @gritty frigate

gritty frigate
#

No worries

#

If you want to paste some code in here, I can see if anything jumps out at me

twilit salmon
#

This is the important part

FString DefaultString = FString::FromInt(
                ManagerShared->GetAttributes<FSysManager::NeighbourMines>(TileCoords));
            auto TextBlock = 
                SNew(STextBlock).Text(FText::FromString(DefaultString))
                                .ColorAndOpacity(FLinearColor(0, 0, 0, 1));
            auto Btn =
                SNew(SButton).OnClicked_Static(
                    &FSLocal::OnTileClick,
                    TileCoords,
                    ManagerShared).ForegroundColor(FSlateColor::UseForeground())
                [
                    SNew(SBorder).BorderImage(ManagerShared->BombBrush.Get())
                    [
                        TextBlock
                    ]
                ];
            // vector of TSharedRef<SButton>, Works as expected when called through ManagerShared 
            ManagerShared->SlateGrid.emplace_back(Btn); 

            // vector of TSharedRef<STextBlock>, Does not work when called through ManagerShared, 
            // Surprisignly does not produce any assertions, access-violations nor exceptions, just does not work
            ManagerShared->TileDisplayGrid.emplace_back(TextBlock); 
#

When I call them both, it's in succession of eachother. GetGridFSlot() and GetTileTextBlock does the same things , resolve a 2d coordinate to 1d vector,and then returns the element. They get pushed on to their respective vector at the same time (as shown above) , so there can't be a mismatch between text-blocks index and button index in their vectors

            auto TileWidgetPtr = ManagerShared->GetGridFSlot(TileCoords);
            TileWidgetPtr->SetEnabled(false);
            FString ToString = FString::FromInt(ManagerShared->GetAttributes<FSysManager::NeighbourMines>(TileCoords));
            ManagerShared->GetTileTextBlock(TileCoords)->SetText(FText::FromString(ToString));
#

@gritty frigate Anything jumping out at you?

gritty frigate
#

Sorry - stepped away for a bit. Taking a look now

#

Nothing major. I tend to use TSharedPtr rather than TSharedRef for storing widgets myself

twilit salmon
#

I do think I have an idea of what the problem is, I'm prettys sure it's the problem infact, but can't test it until in about 5 minutes.
The problem is likely that I disable the SButton just before I access the STextBlock, as the text-block is a child to the SButton,

Me not having engine source on this workstation is also complicating it a bit, because I can't dive into the code of StextBlock or SButton to see how they're implemented

gritty frigate
#

Hmm - I’ve never tried changing the text after disabling a parent widget. It would be odd if it didn’t work when disabled though

twilit salmon
#

Funny enough, it was the issue

#

haah works now, that were some wasted hours alex

#

It's a bit slow tho sadly, well, that is the cost using atomic types I guess, I was thinking of moving the shared ref with std::move to get around some of the overhead that comes with atomic types, but I'd had to rewrite some of the code to accomodate moving the pointer like this, not sure if it is worth it for this use-case

patent stirrup
#

When working with SListViews, can I, and more importantly, should I, instantiate the template with my runtime UObject, or create a structure and use that? Which is what I am currently doing.

patent stirrup
#

Looking through SListView.h I can use a UObject as the template type(wrapped in a TSharedPtr). I am however experiencing an crash when shitting down the error. Weird.

quaint zealot
#

UObject in a TSharedPtr is not possible

#

UObjects should only be used with raw pointers ; and since Slate doesn't work with the Unreal GC (not UObject) they don't take ownership - you have to ensure the UObject has a valid owner

patent stirrup
#

So can a SListView be initialized with a derived UObject class, or does it specifically have to be a UObject, and do castings?

quaint zealot
#

Derived classes are fine

patent stirrup
#

Thanks for the Info. I'm assuming that UObjects wont work with Smart Pointers as they are wrapped in the Reflection System ?

quaint zealot
#

UObjects cannot ever work with smart pointers because they have their own memory management

lavish carbon
#

using a raw pointer of UObject in slate widget is dangerous because the object can be garbage collected while widget is alive. with TWeakObjectPtr you can check that object is still alive or not.

#

its only safe to use raw UObject pointers when they are marked as UPROPERTY.

#

use TSharedPtr<SListView<TWeakObjectPtr<UObject>>>

orchid nova
#

Is there some way to get an event when a Slate widget like a SSpinBox is focused?

#

I'm trying to run some logic when a UMG widget gets focused, but none of that appears to actually exist on the UMG level, and I'm seeing a OnFocusReceived in the Slate level APIs but I'm not quite sure if/how that works 🤔

tame granite
#

my software cursors seem to be offset wrong with dpi scaling, I added this as a fix but I'm not sure I understand it:


+++ b/Engine/Source/Runtime/Slate/Private/Framework/Application/SlateUser.cpp
@@ -599,11 +599,11 @@ void FSlateUser::DrawCursor(const TSharedRef<SWindow>& WindowToDraw, FSlateWindo
                        CursorWidget->SlatePrepass(WindowRootScale);

                        FVector2D CursorInScreen = GetCursorPosition();
                        FVector2D CursorPosInWindowSpace = WindowToDraw->GetWindowGeometryInScreen().AbsoluteToLocal(CursorInScreen) * WindowRootScale;
                        CursorPosInWindowSpace += (CursorWidget->GetDesiredSize() * -0.5) * WindowRootScale;
-                       const FGeometry CursorGeometry = FGeometry::MakeRoot(CursorWidget->GetDesiredSize(), FSlateLayoutTransform(CursorPosInWindowSpace));
+                       const FGeometry CursorGeometry = FGeometry::MakeRoot(CursorWidget->GetDesiredSize() * WindowRootScale, FSlateLayoutTransform(CursorPosInWindowSpace));

                        CursorWidget->Paint(
                                FPaintArgs(&WindowToDraw.Get(), WindowToDraw->GetHittestGrid(), WindowToDraw->GetPositionInScreen(), SlateApp.GetCurrentTime(), SlateApp.GetDeltaTime()),
                                CursorGeometry, WindowToDraw->GetClippingRectangleInWindow(),
                                WindowElementList,```
#

it seems adding in WindowRootScale there fixes it, but also removing WindowRootScale multiply from the line above fixes it too

#

I would expect that removing it from the above line would make the software cursor not scale with DPI when painted, but have the right offset to the center

#

and adding it where I did in the diff would make the curosr scale with DPI when painted, and have the right offset to center

#

does painting ignore the geometry scale that is passed in? neither change seemed to make the software cursor scale with DPI, but either change fixed the offset...

#

my cursor is a few 64x64 images in an overlay, and when I screenshot it with either change, it still takes up 64x64, when my desktop is at 1.5 DPI scaling (and WindowRootScale in the debugger shows 1.5)

#

it is a UMG cursor, if that is maybe making the difference

#

putting it in a scale box did make it scale, with the second fix

#

so it reports desired size of 64x64, then the 1.5 multiplier is applied and it is painted with 96x96 as the geometry

#

it was painted with that as the geometry before too, but because it didn't have a scale box it just drew the images into it at 64x64 (and I had them centered so the change fixed the click offset in that case too)

peak blaze
#

Hey everyone, need help to understand. I have FSlateDrawElement::MakeText with 3 options, but cannot really implement them. The problem comes when I include FString and FSlateFontInfo. My goal: create dynamic text inside Slate Class from some local variables (digits)

#

FString Hello = FString(TEXT("Hello")); const FString* MyHello = &Hello; const FSlateFontInfo* MyFont; FSlateDrawElement::MakeText(OutDrawElements,LayerId, AllottedGeometry.ToPaintGeometry(), MyHello, MyFont, DrawEffects,PlayerIconColorAndOpacity);

#

May be useful for explanation

#

the problem is on MakeText line

quaint zealot
#

Why not use STextBlock directly in your widget ?

#

Other than MyFont being uninitialized the rest looks fine, assuming this is in OnPaint for a completely custom widget

peak blaze
#

I have completely custom widget

quaint zealot
#

So what's the issue exactly

peak blaze
#

let me make you screenshot

#

so it is syntax problem

#

Error is "no matching call to "

#

So something is wrong with calling the function

#

I have followed the parameter calls, but when I reach MyHello, all of the options becomes wrong and colored in grey

quaint zealot
#

Show the full output log when compiling

peak blaze
#

ok, need time to compile, will send you in 5-10 mins

#

Error C2665 : 'FSlateDrawElement::MakeText': none of the 3 overloads could convert all the argument types

quaint zealot
#

The full log please

peak blaze
#

still compiling

#

1 sec

quaint zealot
#

At least the full error for this particular file

peak blaze
#

0>D:\Works\Project\Source\Private\Game\UI\SText.cpp(89,0): Error C2665 : 'FSlateDrawElement::MakeText': none of the 3 overloads could convert all the argument types 0>D:\Works\Engine\Source\Runtime\SlateCore\Public\Rendering/DrawElements.h(144,0): Reference C2665 : could be 'void FSlateDrawElement::MakeText(FSlateWindowElementList &,uint32,const FPaintGeometry &,const FText &,const FSlateFontInfo &,ESlateDrawEffect,const FLinearColor &)' 0>D:\Works\Engine\Source\Runtime\SlateCore\Public\Rendering/DrawElements.h(142,0): Reference C2665 : or 'void FSlateDrawElement::MakeText(FSlateWindowElementList &,uint32,const FPaintGeometry &,const FString &,const FSlateFontInfo &,ESlateDrawEffect,const FLinearColor &)' 0>D:\Works\Engine\Source\Runtime\SlateCore\Public\Rendering/DrawElements.h(140,0): Reference C2665 : or 'void FSlateDrawElement::MakeText(FSlateWindowElementList &,uint32,const FPaintGeometry &,const FString &,const int32,const int32,const FSlateFontInfo &,ESlateDrawEffect,const FLinearColor &)' 0>D:\WorksProject\Source\Private\Game\UI\SText.cpp(89,0): Reference C2665 : while trying to match the argument list '(FSlateWindowElementList, int32, FPaintGeometry, const FString *, const FSlateFontInfo *, const ESlateDrawEffect, const FLinearColor)'

quaint zealot
#

So you're trying to use
void FSlateDrawElement::MakeText(FSlateWindowElementList &,uint32,const FPaintGeometry &,const FString &,const FSlateFontInfo &,ESlateDrawEffect,const FLinearColor &)
but you passed
void FSlateDrawElement::MakeText(FSlateWindowElementList, int32, FPaintGeometry, const FString *, const FSlateFontInfo *, const ESlateDrawEffect, const FLinearColor)

#

Your error is using pointers for FString and FSlateFontInfo instead of const references

peak blaze
#

Thanks a lot, IDK why I did pointers there tbh.

sharp zinc
#

Hello. I would like to set an SProperty of an Actor to show a list of / only accept actors that have a certain component. I am currently scavanging the engine source but would love some help on it. What is a good way to do it?

silk vault
#

Hey @royal geode thank you for the response ❤️

note: while trying to match the argument list '(FCodekittenSelectionPluginModule *, FReply (__cdecl SSelectionWidget::* )(void))'
error C2664: 'void FUICommandList::MapAction(const TSharedPtr<const FUICommandInfo,0>,const FUIAction &)': cannot convert argument 2 from 'FCanExecuteAction' to 'FExecuteAction'
#

So I'm basically unsure how to have the delegate match. I believe it's because it's assumed that an executed action wants a void method, but I'm looking to call on the slate FReply method.

paper hamlet
#

hey just letting you know he was kicking us out and saying to come here and polute this channel instead of hogging the cpp one. you can head back there

silk vault
#

.... huh?

paper hamlet
#

nvm i misread your question

#

ignore me

royal geode
#

I'm kicking everyoooooooone

silk vault
#

Whereee do I goooo.

#

x)

paper hamlet
#

"I am your server admin"

#

stay here

royal geode
#

that error is pretty weird

#

Sure you're looking at the right line?

silk vault
#

hehe okay so.

    PluginCommands->MapAction(
        FCodekittenSelectionPluginCommands::Get().OpenPluginWindow,
        FExecuteAction::CreateSP(this, &SSelectionWidget::OnSelectByClassesClicked),
        FCanExecuteAction());

Is what I have. Which calls on a hella simple FReply function on a Compound Widget.

royal geode
#

yup that should work

silk vault
#

I mean, yep. It's referring to Line 38.

royal geode
#

🤔

#

Which engine version?

silk vault
#

4.25 🙂

royal geode
#

Oh I see

#

can you copy the full output log here 😄

silk vault
#

...Apparently 2000 char limit :p

royal geode
#

yup so CreateSP is failing

#

and then, since it failed, MapAction is called without it

#

making it FCanExecuteAction() the second argument

silk vault
#

Makes sense, 🙂

royal geode
#

creating all kind of silly errors

#

always look at errors top to bottom hehe

#

how does OnSelectByClassesClicked look?

silk vault
#

So.. hmm..

#

It's a pretty standard FReply for a button on a SCompoundWidget child class.

Nothing crazy.

royal geode
#

yup that won't work

#

DECLARE_DELEGATE(FExecuteAction);

#

^ this is expecting a void function

silk vault
#

Ah.. hmm..

#

I was afraid of that

royal geode
#

FReply would have been DECLARE_DELEGATE_RetVal(FReply, FExecuteAction);

#

Delegate errors are a pain hehe

silk vault
#

Absolutely. hehe :p

#

Okie dokie, so I just need to do some restructuring. Have my FReply call somewhere else to a void method and have my logic handled there.

#

I just wanted to UI_COMMAND it :p

royal geode
#

hehe

silk vault
#

Which like.. Idk, seems a little weird that you can't UI_COMMAND macro an FReply with the execute action delegate, when they're literally used to call on buttons and UI elements.

royal geode
#

UI_COMMAND is just to declare a command right, not to bind it

silk vault
#

For sure, it's Map Action and the CreateRaw/CreateSP that binds.

royal geode
#

yup yup

silk vault
#

It just seems... round-a-bout.

#

If I'm already setting up a button clicked method, it would make total sense to map and bind to that same method.

royal geode
#

I see what you mean

#

How's your SButton declaration looking like?

silk vault
#

It's a standard SNew(SButton) I've just wrapped it in a TSharedRef function to template it.
e.g:

#

Utilized this way.

royal geode
#

I would advise against making "create widget" helper functions

#

I used to do that, but it tends to be a lot messier than just creating a small wrapper widget

#

eg here you'd have a SFlatButton instead

#

This makes a lot of the syntax a lot nicer

silk vault
#

Hmm...

royal geode
#

For onclicked you'd just do .OnClicked(this, &SSelectionWidget::OnDeselect)

#

Or even

#
.OnClicked_Lambda([this]()
{
  OnDeselect();
  return FReply::Handled();
}```
#

assuming this is a parent widget making it safe to reference without a weak ptr

silk vault
#

Have you any examples why creating a helper method like this would be potentially a problem for something simple like a button?

#

Like.. So, I can understand creating a new slate widget for an actual button class and handling the logic.
But this helper function is purely just for styling.

royal geode
#

yup, even then I'd recommend a widget as it follows the general slate pattern IMO

#

Much easier to have optional arguments

#

can't mess up argument order

#

easy to bind additonal stuff if you somehow need to - eg Visibility stuff

silk vault
#

Makes sense actually 🙂

#

Well, I've got some restructuring to do it seems! Thanks Phy, I appreciate it ❤️

royal geode
#

Sure thing!

#

lmk if you have any more questions - Slate & editor customization is quite a beast 😄

silk vault
#

It is indeed, and I'm already starting to regret teaching it. :p

royal geode
#

hehehe

silk vault
#

Though, I'm still learning - and I just really want to share resources on it. There's really not enough out there for it.

royal geode
#

yup reading through the engine was a painful way to learn 😢

silk vault
#

Kantan's been absolutely useful during my learning curve.

#

That meow reaction is my brain on slate.
😛

royal geode
#

lol

frank nexus
#

Hi guys can anyone explain to me where the right spot is to open a full screen main menu on the game startup?
AHUD::BeginPlay() is not the right spot in my opinion because i want to use my AHUD Instance as a "menu manager" which shows and hide different menus in the game
So where is a good position to call AddViewportWidgetContent?
Thanks for help 🙂

quaint zealot
#

AHUD::BeginPlay would have been my suggestion

frank nexus
#

yeah but this way on every map change the main menu will appear

quaint zealot
#

Not if you do it conditionally

frank nexus
#

yeah

#

i get a big state machine 😄

quaint zealot
#

It doesn't have to be big, personally I use a custom world settings class and put a "main menu" option there

#

When the menu initializes it just reads that and goes "oh shit, main menu map"

#

Game mode works well enough for that too, since the main menu will always be single player

frank nexus
#

which function in the gamemode?

#

startplay?

quaint zealot
#

Just a simple bool variable, and the menu-initializing code reads that when the current role is authority, to see if the menu should open

craggy holly
#

You can also just use two different HUD classes, one for main menu, one for in-game.

#

Makes sense since you're most likely going to have a different "game mode" for the main menu as well.

frank nexus
#

I guess this is a better option

quaint zealot
#

This is what my version looks like btw

frank nexus
#

for now it will do the job i will use it
thanks

frank nexus
#

@quaint zealot is it possible that provide me your focus functions?

quaint zealot
#

Not really because it's logic spread across multiple functions, but a combination of PlayerController::SetInputMode and FSlateApplication::Get().SetAllUserFocus(DesiredFocusWidget.ToSharedRef());

frank nexus
#

Ok and how do you show the cursor?

#

Just set bShowCursor = true?

quaint zealot
#

Depending on the mouse capture settings

#

bShowCursor completely changes the engine's input model

frank nexus
#

Mh something i do wrong

#
    const FInputModeUIOnly InputMode;
    OwningHUD->PlayerOwner->SetInputMode(InputMode);
    FSlateApplication::Get().SetAllUserFocus(AsShared());
    FSlateApplication::Get().GetPlatformApplication()->Cursor->Show(true);
    FSlateApplication::Get().ReleaseAllPointerCapture();
    FSlateApplication::Get().GetPlatformApplication()->SetCapture(nullptr);

is not working no cursor is visible

quaint zealot
#

Check these out too

#

(project settings)

frank nexus
#

okay i changed my settings to settings in the screenshot

#

but its still not working i have no idea why

quaint zealot
#

Did you set bShowCursor to false

frank nexus
#

i did not changed bShowCursor

#

Its default

#

This should work or?

#

Do i have to set bShowCursor = true and after this control visibility with FSlateApplication::Get().GetPlatformApplication()->Cursor->Show(true/false);?

quaint zealot
#

You can try using bShowCursor, but like I said, it's not a small setting, it changes the entire input mode

frank nexus
#

Ok

#

But i guess it have to work with FSlateApplication::Get().GetPlatformApplication()->Cursor->Show

#

But i cant find any examples with a basic slate main menu which shows if the game is started

quaint zealot
#

Slate is not meant for game use

#

So that's probably why

#

You can look at UMG examples and try to dive into the UMG implementation to check what it does with Slate

frank nexus
#

Do you know some good small UMG C++ examples? I dont want to use blueprints at all

quaint zealot
#

Nah

#

If you absolutely want to make your UI in C++, you kind of need to accept that it's reverse-engineering all the time

frank nexus
#

mh sad

#

but ok

#

Thanks for your time and help 🙂

gritty frigate
#

Why are you avoiding blueprints? There is a lot that they are great for

frank nexus
#

Because of maintenance, Version Control and a lot of other reasons

mild oracle
# frank nexus Because of maintenance, Version Control and a lot of other reasons

If you're going to write your entire UI in C++, I don't know why you would need UMG. Just write Slate I guess?
But as Hugh said, UMG blueprints save a lot of time. I've worked on large projects and never hit version control or maintenance issues. We did optimization on some BP assets moving them to pure C++ but that's it.
(autocomplete changed Hugh to High... Sorry High)

chilly ravine
silk vault
#

Edit: Sorry I feel like I didn't actually state where I'm coming from - UMG is design perspective, C++ is implementation, both work well together and you should use them together.

UMG Also assists designers greatly. Allowing them to quickly prototype and go from one widget/screen to the next before implementation is done.
A UI Designer who has experience in blueprints will find this super useful for an "functional" prototype that one of our programmers/TA's will go over and optimize if need be. Doing it entirely in C++ would hinder that process and force designers into 'graphics only' and having to repeat work.

Same with Ben, worked on larger projects - We use UMG extensively for designing our UI/shaders etc, and use blueprints in the Widget Blueprint graph for handling UI logic. Slate, and C++ are only used mostly to optimize larger widgets with a lot of logic - or alternatively, fixing hella weird problems like Unreal's focus issue with multiple peripherals.

Consequently, with Slate. Not everything can be done with UMG, and there are more widgets defined across the editor that have a much clearer layout process. These are great examples, and are easier to implement in C++ Slate, with properties exposed to Blueprint.

There is some also specific types of widgets or rather screen palcement of widgets (markers etc) that are much easier to handle in C++ when it comes to logic.
Oh and, to agree - never an issue with Version Control or maintenance. Behaves exactly like any other UAsset in terms of VC.

frank nexus
#

The most blueprints i have seen was just terrible and not easy to read = not easy to maintain = not easy to review
I mean Epic already raped the c++ standard so this enough to worry so i dont need the headaches from blueprints too

silk vault
#

Wow, what a word to use to describe mishandling..

frank nexus
#

I mean u cant tell me that this spaghetti nodes over your entire screen (where u have to zoom and move) are easy to read vs clear structured code
In my opinion is this just a tool for guys who cant code and are to lazy to learn it

silk vault
#

That wasn't what I was referring to, Phil.
"I mean Epic already...."

#

And to counter your argument. At least in larger teams, blueprint is largely prototype, it's then cleared up by a different member of the team and passed to programmers to define or decide which parts end up staying as blueprint or get promoted to C++ for optimization or reusability.

Maybe spend some time with the people you work with to teach them better practices. As for guys who can't code and are to lazy:
A) It's a programming language, deal with it. And B) Not everyone can code, I know plenty of developers who have issues with either Dyslexia or other problems where Visual Graphs have aided them because legibility is an issue.

frank nexus
#

Maybe its not the best word for it but this was the first word i had in mind after reading several hours ue4 c++ code

silk vault
#

Oh and while I'm here - C ) You can have stupidly nested If statements, random classes and obfuscated code. How is that not the spaghetti equivalent of coding? Your argument is comparing spaghetti graphs to clear and structured code.

That is literally an Apple vs Oranges argument.

frank nexus
#

Why to prototype stuff if u have mockups

silk vault
#

Because generally, a Mockup is a bit like this. You can plan it out for days, but you won't actually know what fails, how it's going to fail, or plan for failure if you don't implement first in a prototype.

frank nexus
#

i mean gui mockups

silk vault
#

Same problem. You can make concept art, mockups, plan for how it should look. But until you implement and actually start working with it - how it works in engine from both a programmatic and UX perspective, you don't get the 'feel'.

frank nexus
#

I dont think so

silk vault
#

If I do a mockup of a UI for an Inventory. How do you know which classes you need to implement, where does it interface? How is going to link in with existing systems.
Prototyping is super useful, because it is a 'bare bones' proof of concept of Mockup to implementation in the shortest time possible.

A prototype should be scrapped, and is not final. But what it does teach us is where, how and why it can fail, what classes or implementations we should be aware of and any use-case we hadn't thought of. It also gives a general idea of complexity.

frank nexus
#

I mean this conversation is kind of useless because i will stay with slate, i dont want to put this shitty blueprints nodes together and review stuff like that

silk vault
#

Have fun, friend.

frank nexus
#

Maybe its my backend dev mindset idk

silk vault
#

It's likely that. Not everything can be done in code, and more problems can be solved when you see the other side of the coin. It enables more people to incorporate and work.

#

At the end of the day friend, it's another tool.

frank nexus
#

"Not everything can be done in code" is absolutely not true, blueprints are code too in a weird way

silk vault
#

My main argument is accessibility. There are people with vision and mobility problems. Blueprints for some people are fantastic for legibility, where code becomes a scrambled blurry mess for them.
Equally, it's entirely a matter of taste. Some people like apples, other like oranges. I just don't understand why you seem to viciously hate apples.

#

Some people can just follow graphs better, yo. That's pretty much it 😛

frank nexus
#

"My main argument is accessibility. There are people with vision and mobility problems." is this the reason too why everything should be done in blueprints?

silk vault
#

I did not once in my argument state that everything should be done in blueprints.

#

Sorry I feel like I didn't actually state where I'm coming from - UMG is design perspective, C++ is implementation, both work well together and you should use them together.

#

Don't strawman me.

frank nexus
#

The half of the discussion was blueprint related and not to slate lmao

silk vault
#

You brought it up.

frank nexus
#

A other topic which vc system u use?

#

Blueprints are binary files or?

silk vault
#

Perforce, Git and SVN. Depends on the project requirements.

frank nexus
#

Oh it is, i guess blueprints are binary files and binary files are terrible in git, create ur gui with slate results in text

#

In this point slate > umg (blueprints)

silk vault
#

Mate. I am not trying to have an argument with you, believe in whatever you want.
It is literally another tool, and a tool is a tool is a tool - every tool has an idea of what is better. That's why we have many tools.
One thing is not better than the other, just as the thing isn't better than the other thing.

#

But I'm done getting riled from you because you wanna start a divisive chat.

frank nexus
#

Its ok, but if u dont want to discuss dont revive a topic which is done

quaint zealot
#

Blueprint's version control problem is that you need UE4 to diff them, not that they mess with source control itself.

#

But this will compounded by the fact that any complex Slate UI will depend on dozens of binary assets - style assets, Slate brushes, materials, textures, fonts, sounds

#

And the more your game UI grows with animation, dynamic materials, post-processing effects... the more Slate will suck because it's not designed for game use.

frank nexus
#

Im using LFS the point is not repo size its is text vs non text

#

UMG is build on top of slate or? So its useable for games and i dont like the umg layer

quaint zealot
#

I'm familiar with Helium Rain, I was the main developer

frank nexus
#

Oh yeah now i see the pictures are the same XD

#

I saw a reddit post (from u idk?) where one guy said slate was the way to go and not umg for complexity reasons?

quaint zealot
#

Slate was the way to go because UMG did not exist when the project started, for the most part

#

So there's that

frank nexus
#

And u created a really nice ui and i can see the source in my browser without UE4

quaint zealot
#

"Really nice" is debatable : it has no decent controller support, almost no animation, and is routinely referred to by players as "weird" or "confusing". It's also 40% of the entire code for the game because it's so verbose

frank nexus
#

Is it possible for you to accept my friend request in discord so i can write u a pm?

gritty frigate
#

I think there's a big difference between "I don't like blueprints, so I'm going to do it all in C++" and "Blueprints are shitty", "In my opinion is this just a tool for guys who cant code and are to lazy to learn it"

frank nexus
#

As i said its my personal opinion and i pointed to enough points why it is

#

Looking nice and a good useability is a different thing, but u are right i forgot to say looking i never played it ^^

quaint zealot
#

My opinion is that using Slate for your game is viable if

  • your game is going to have exceedingly custom and complex widgets, like the project I'm doing now drawing hundreds of interconnected, animated 2D splines
  • you are ready to develop and maintain your own UI framework on top of Slate
  • you are ready to engineer the content support Slate doesn't have (like widgets having GC support for dynamic materials)
  • you want your game to never have any UI animation
#

If one of these things doesn't hit the mark, go with UMG

frank nexus
#

U will say me there is no way to create animations in a slate based ui? (i guess this is a joke)

quaint zealot
#

Well there is absolutely zero tool for it so a programmer has to do it entirely in C++, instead of a designer, and there's no preview - need to compile and test - and any animated widget is kind of going to need an absolute-positioned widget in an overlay and... it's just a terrible idea

frank nexus
#

Mh sounds true

quaint zealot
#

There's a reason Helium Rain has about 2 man-years of UI work over about 40,000 lines of code and a total of one (1) animation

#

(which is a simple linear movement)

frank nexus
#

This are all good points, but every declarative gui language have the problem that it will go crazy

#

The biggest reason against UMG is again:
It is binary, u cant work togheter on a file, u cant view it without ue4 editor, u cant diff it, it will get huge even with lfs and u have to put nodes togheter which are connected by tiny lines

#

If you can tell me it is possible to do ALL logic in c++ and just the layout of buttons and stuff like that are in binary assets i would think about using it

quaint zealot
#

Sure

#

Create your own UUserWidget class, and while IIRC you can't create one directly in content browser, you can create a regular Widget Blueprint and reparent it (or use the regular "new Blueprint" button)

#

Should be able to declare all your UMG elements and have the Blueprint do the positioning and animating

frank nexus
#

mh hard decision

frank nexus
#

U have a lot a lot more experience than me so your opinion have a heavy weight for me but i dont know if im able to handle this binary downside

quaint zealot
#

I mean you need Blueprint in UE4 anyway ? All your content interface should be there at the very least.

frank nexus
#

What u mean with content interface

quaint zealot
#

Asset references

frank nexus
#

I give umg a try

quaint zealot
#

I'm just saying don't dismiss UMG entirely and see where you can draw the line

#

Spending a week on having the good framework for your UI is worth it

#

If you end up with Slate, fine !

silk vault
silk vault
#

You'd have the same issue with blueprints right?

frank nexus
#

Yes

silk vault
#

So it's not about UMG. It's about binaries 😉

frank nexus
#

Yesterday u said "But I'm done getting riled" do u want to get riled again?

#

And it would be possible for me to explain it too u again but this is time waste

silk vault
#

x) dude. I just commented. relax.

coral schooner
#

Any idea on a editor modal Dialog box that is non blocking?

#

FSlateApplicatio0n::AddModalWindow Creates a blocking window. You can check bSlowTask=true, but that freezes the editor

frank nexus
#

@quaint zealot im confused by the example which you provided

#

He is doing his ui logic inside the blueprints, but i guess i can just implement the c++ function which he declared and im fine?

quaint zealot
#

Sure ? You basically should be able to declare UPROPERTY UMG widgets that you need - your buttons etc - and write your game logic in C++

median anchor
#

How to get widgeta from SListView?

patent stirrup
#

.OnGenerateRow

#

which will generate the row widget for said row.

#

Where the function pointer returns a TSharedRef<STableViewBase> widget.

mild oracle
#

Does anyone know a good visual reference for what to call to create all the various possible parts of a Slate editor UI?
I'm having trouble knowing my Categories from my Groups from my other stuff

#

Also I swear I've seen categories within categories in some UIs but I can't for the life of me work out how they did it

mild oracle
#

Customizing stuff is such a pain, I want collapsable child categories like this, but they don't support icons or customizing the typeface

narrow terrace
#

In the slate viewer app

mild oracle
#

@narrow terrace Slate examples module? 😮

narrow terrace
#

I am currently out and about, once I get back home I can get you the exact file name...

mild oracle
#

Oh My God the Slate Test Suite is amazing

narrow terrace
#

It's INCREDIBLE

mild oracle
#

I can't even subclass SDetailCategoryTableRow because it's private in the PropertyEditor module

toxic dove
mild oracle
toxic dove
#

im sorry i meant this slate test suite

mild oracle
toxic dove
#

ah neat, is there also an example of making a category like you wanted?

#

(without the custom text font)

mild oracle
toxic dove
#

what about just a simple category like the editor uses then?

#

cuz as far as im aware creating these categories that expand only work if you work on properties that have categories on them already

#

i was wondering if you could simulate this and mark a property to be under a category

#

or create your own category dynamically

#

does anyone know how to do this with details customization?

mild oracle
#

@toxic dove I can use the simple editor categories but it ends up being pretty hard to read with many nested properties, IMHO.

toxic dove
#

mild oracle
#

(sorry I hit enter by accident)

toxic dove
#

what do you mean by simple editor categories?

#

are you able to insert categories on your own?

mild oracle
#

I'll show you what I have and how I'm doing it

toxic dove
#

wooo thanks

mild oracle
#

This is what I have currently. This is a BP of a Stylesheet class. A Stylesheet can contain many Styles, and each Style can have many Properties. Properties are stuff like Text Size, Text Color, Alignment etc.

#

I'm using CustomizeDetails( IDetailLayoutBuilider& Builder ) to customize how to show the stylesheet in the inspector

#

You can add custom categories with Builder.EditCategory

#

There are a lot of examples of that in the engine source

toxic dove
#

ah ok that seemed counter-intuitive for a name

#

so i didnt look at that

#

ok i understand now, thanks :)!

mild oracle
#

EditCategory seems to both edit any existing categories that might be created with UPROPERTY( Category=Blah ) settings, but also create new ones

toxic dove
#

yeah i read the source code, the comment block says "will create if it doesnt exist" as well

#

they should have renamed the function to something more intuitive

split laurel
#

is it not possible to declare a delegate that uses a TMap as parameter?

DECLARE_DELEGATE_OneParam(FOnFiltersChanged, const TMap<bool, int32>&);

Doesn't seem to want to work

#

but typedef'ing the map and then passing that type in works

craggy holly
#

@split laurel Ah yeah its a parsing issue, I've had that before

#

the macro has trouble with the ,

split laurel
#

ah okay, thank you

quaint zealot
#

How are TAttribute meant to be forwarded across hierarchies ? I have this, it looks legit but the compiler won't take it :

{
    SLATE_BEGIN_ARGS(SSomeWidget) {}
    SLATE_ATTRIBUTE(FLinearColor, ColorAndOpacity)
    SLATE_END_ARGS()

    void Construct(const FArguments& InArgs)
    {
        SImage::Construct(SImage::FArguments().ColorAndOpacity(InArgs._ColorAndOpacity));
    }```
> 2>D:\UE_4.26\Engine\Source\Runtime\Core\Public\Misc/Attribute.h(43): error C2440: 'type cast': cannot convert from 'const OtherType' to 'ObjectType'
> 2>          with
> 2>          [
> 2>              OtherType=TAttribute<FLinearColor> *
> 2>          ]
> 2>          and
> 2>          [
> 2>              ObjectType=FSlateColor
> 2>          ]
> 2>  D:\UE_4.26\Engine\Source\Runtime\Core\Public\Misc/Attribute.h(43): note: No constructor could take the source type, or constructor overload resolution was ambiguous
> 2>  D:\Source/UI/Widget/SSomeWidget .h(40): note: see reference to function template instantiation 'TAttribute<FSlateColor>::TAttribute<TAttribute<FLinearColor>*>(const OtherType &)' being compiled
> 2>          with
> 2>          [
> 2>              OtherType=TAttribute<FLinearColor> *
> 2>          ]
> 2>  D:\Source/UI/Widget/SSomeWidget .h(40): note: see reference to function template instantiation 'TAttribute<FSlateColor>::TAttribute<TAttribute<FLinearColor>*>(const OtherType &)' being compiled
> 2>          with
> 2>          [
> 2>              OtherType=TAttribute<FLinearColor> *
> 2>          ]