#slate

1 messages ยท Page 18 of 1

silent patrol
#

should be in 4.20

toxic trench
#

ah, nice

#

I've also found I should do

FSlateApplication::Get().SetAllowTooltips(false);
#

that saves another 0.031 ms

#

is there anything else that I didn't know about yet that I can disable for my VR-only game?

silent patrol
#

cursor updating

toxic trench
#

obviously I don't care about anything that takes 0.002 ms. what time is cursor updating part of in the profiler?

silent patrol
#

should be around the same time process mouse was

#

it does similar work

toxic trench
#

ah? interesting. never saw anything like that in the profiler

silent patrol
#

synthesize mouse movement in slate app tick?

toxic trench
#

synthesize mouse movement is just calling ProcessMouseMove I think?

#

and that I killed already

silent patrol
#

im sure there's something

toxic trench
#

I don't see cursor updating there

#

or is that not part of "TotalSlateTickTime"?

#

or is it part of the 0.018 ms "Self" of TotalSlateTickTime?

silent patrol
#

it's in there

#

not sure why it's not under yours

toxic trench
#

those 2 are also slate and not part of TotalSlateTickTime

#

I'm on 4.19

silent patrol
#

Yeah slate input runs at the start of the frame

toxic trench
#

do I need SlateInput?

silent patrol
#

you need the keyboard part of it

toxic trench
#

even if I don't have any keyboard inputs?

silent patrol
#

alt f4 out of the game?

toxic trench
#

thats not what anyone should do

silent patrol
#

๐Ÿ˜›

toxic trench
#

I need widget interaction components to work, thats all.

silent patrol
#

they dont go through there so you should be fine

toxic trench
#

I'm happy that ProcessMouseMove isnt required for them

silent patrol
#

try killing it

#

in 4.20 these things should be faster b/c of fast widget path and parent pointers

#

the bulk of the work is building up the widget path

toxic trench
#

ok

#

RedrawViewports

#

is most of that stuff just because STATs are running?

#

DrawStatsHUD definitely sounds like its the red text in the top left with the time how long stats have been running etc

#

is CanvasTextItem Time also that?

silent patrol
#

hopefully you don't have the stats UI up when you capturing stats

toxic trench
#

@silent patrol the stats UI is always up when youre capturing stats, I don't think theres any way to disable that in UE4

#

whenever you type in stat startfile, you get red text at the top left that tells you that youre capturing stuff, for how long you have captured, how big the file is etc

#

maybe you mean some other stats ui

silent patrol
#

nah

#

you can capture stats without it being up

#

do it all the time

toxic trench
#

@silent patrol how?

silent patrol
#

stat dumpave -root=stat_slate -num=120 -ms=0

#

captures 120 frames of stats and averages them

toxic trench
#

is that same like stat startfile and stat stopfile regarding everything else?

silent patrol
#

should be

toxic trench
#

ok, didnt know about that command

silent patrol
#

It's a really good shorthand capture method on idle frames

toxic trench
#

thanks for making me aware

silent patrol
#

use it allll the time to optimize

toxic trench
#

and that doesnt bring up the red stat text?

silent patrol
#

nope

toxic trench
#

nice

tame granite
#

any good workarounds for UWidgetInteractionComponents clashing with each other because of VirtualUserIndex when doing multiple PIE?

#

maybe before Activate set

VirtualUserIndex = 
VirtualVirtualUserIndex + (GIsEditor ? WorldContext->PIEInstance *  [num_reserved_per_pie_instance] : 0));```
#

@silent patrol is there a better way?

#

and any danger of running out of indexes? I've got 3 per instance (an interactor for vr left hand, vr right hand, 2d crosshair)

#

actually it looks like I'm just using one index for all three

#

with different pointer indexes

tame granite
#

ended up with:


    // IMPORTANT no auto activate, activation relies on the VirtualUserIndex and
    // we don't know that until runtime, not construction time.  Need a custom
    // VirtualUserIndex to keep PIE instances from clashing with each other.
    MC_L_WidgetInteraction->bAutoActivate = false;
    MC_R_WidgetInteraction->bAutoActivate = false;
    CrosshairWidgetInteraction->bAutoActivate = false;```
in constructor
#

and

#

        auto ActivateWidgetInteractionComponent = [this](UWidgetInteractionComponent * WIC)
        {
            WIC->bEnableHitTesting = true;
            WIC->SetComponentTickEnabled(true);

            int32 DesiredVirtualUserIndex = 0;
            if (ensure(GEngine))
            {
                auto W = this->GetWorld();
                if (W)
                {
                    auto WC = GEngine->GetWorldContextFromWorld(W);
                    
                    check((GIsEditor && WC->PIEInstance >= 0) || (!GIsEditor));
                    // NOTE WorldContext->PIEInstance will be -1 in standalone game, but GIsEditor should be false and we fallback to 0 offset
                    DesiredVirtualUserIndex = DesiredVirtualUserIndex + (GIsEditor ? WC->PIEInstance * VIRTUAL_INDEXES_PER_PIE_INSTANCE : 0);
                }

            }
            WIC->VirtualUserIndex = DesiredVirtualUserIndex;
            WIC->Activate();
        };```
#

later where I activate

#

I could see blueprint-only people running into a blocker with this if FWorldContext or some way of getting the pie instance isn't exposed

#

tested and it works though, so that was the whole issue

frozen perch
elder zealot
#

ah yes, the brush problem... Simply declare your brush in the widget then pass it as a parameter

#

that way it's pretty sure you don't leak memory since the garbage collector takes care of it on destruction

frozen perch
#

Roger that, thanks

median basalt
limpid atlas
#

You can use anything that's in any module in the Runtime directory, so yes.

median basalt
#

Thank you for clarification!

mild oracle
#

@median basalt I'm curious, what kind of thing are you going to do with them outside the editor?

median basalt
#

use them in in game editor, that's the plan

mild oracle
#

Anyone know of a way of getting the widget under the cursor?

royal geode
#

Yep @mild oracle

#

Not sure I can share it though, not mine ๐Ÿค”

mild oracle
#

heh, well if you can, I'd appreciate it ๐Ÿ˜ƒ

royal geode
#

I guess I can as it's engine code after all

mild oracle
royal geode
#

That's basically that

#

Haven't tried myself, but that's how it's done: cpp FArrangedWidget NGAInputProcessor::GetArrangedGraphPanel(const FPointerEvent& MouseEvent) { FSlateApplication& slateApp = FSlateApplication::Get(); FWidgetPath widgetsUnderCursor = slateApp.LocateWindowUnderMouse(MouseEvent.GetScreenSpacePosition(), slateApp.GetInteractiveTopLevelWindows()); for (int i = widgetsUnderCursor.Widgets.Num() - 1; i >= 0; i--) { if (widgetsUnderCursor.Widgets[i].Widget->GetTypeAsString() == "SGraphPanel") { return widgetsUnderCursor.Widgets[i]; } } return FArrangedWidget::NullWidget; }

mild oracle
#

oh yay

#

Thanks @royal geode You're very helpful ๐Ÿ˜ƒ

royal geode
#

np, didn't do much here ๐Ÿ˜‰

mild oracle
#

@royal geode Have you used LocateWindowUnderMouse much? I'm trying to work out why some widgets that are visible on-screen are not found by this method

royal geode
#

@mild oracle Never used it actually

#

Maybe some caching issue

#

ยฏ_(ใƒ„)_/ยฏ

mild oracle
#

Looks like the raw widget that I called AddToViewport on is found, but any children that are added subsequently (e.g. AddToVerticalBox(UWidget)) don't register

#

Looks like SBorder responds but not other types... this is weird :S

toxic dove
#

well

#

have you used the widget reflector

#

if a widget is marked as HitTestInvisible, im pretty sure mouse queries wont work

#

check their visibility

mild oracle
#

@toxic dove That was my first guess too. I've used the Widget Reflector and yeah it's all SelfHitTestInvisible in the parent list, and then Visible

toxic dove
#

dig into engine code

craggy holly
#

SelfHitTestInvisible turns off hit queries for that widget alone

#

HitTestInvisible turns it off for that widget and all child widgets, regardless of the child setting

#

(just in case someone wasn't sure)

royal geode
#

Thx!

mild oracle
#

Yeah that was the first thing I checked, @craggy holly but even widgets not set to HitTestInvisible seem to be skipped

craggy holly
#

It might be that they're inside a parent widget that's invisible

white vale
#

Hey guys, can you recommend me some links to start learning slate? I'm interested in extending the editor.

tame granite
#

@silent patrol @trim kestrel in 4.20 comboboxes have stopped opening in UWidgetComponents

#

I've tracked it down to:

#


SMenuAnchor::SetIsOpen```
#

within that it calls:

#
FSlateApplication::Get().GeneratePathToWidgetUnchecked(AsShared(), MyWidgetPath);
                if (MyWidgetPath.IsValid())```
#

and the widget path is invalid

#

it works in PIE, but not in standalone

#

I looked through GeneratePathToWidgetUnchecked and it calls FSlateWindowHelper::FindPathToWidget which seems to have had a lot of changes in 4.20

#

and in there it checks against GSlateFastWidgetPath and does different logic depending on it

#

I tried setting Slate.EnableFastWidgetPath 0 on the console and it fixes the UWidgetComponent combobox behavior in standalone

#

There is also a bug that Slate.EnableFastWidgetPath will initially report zero when queried on the console in standalone, even though the underlying global is set to true

toxic dove
#

you should open an issue in the bug tracker

#

with repro steps

silent patrol
#

hmm

mild oracle
#

I'm getting some suuuuuper bizarre behaviour here on 4.19.2. Widgets that react to the mouse, have correct visibility settings etc. are not being found by LocateWidgetInWindow. I'm trying to work out if they're even being added to SWindow::HitTestGrid right now. Is there any reason why widgets might be interactable but not found by LocateWidgetInWindow, or not added to HitTestGrid?

tame granite
#

I just put in one for it, Case # 00021980

mild oracle
#

I found what the problem was. I was trying to check whether the mouse was over a widget owned by my UserWidget, but doing the checking during same UserWidget's NativeTick, when the UserWidget has not yet been painted, and so isn't in the hit test grid.

#

So I guess I need to move my checks to some kind of post-tick. Maybe something I have to create myself...?

mild oracle
#

I'm trying to work out whether an SWidget is owned by a particular UserWidget of mine. But there's no way of going from SWidget to its parent UWidget, it seems?

#

I tried checking the Tag on the SWidget, but it seems I can't set the tag on the SWidget after its construction

hexed plank
#

So is it just lines that do not anti-alias correctly? Or does it apply to other draws as well? Cause right now if I turn on anti-aliasing for lines they straight up blur into nothing... that a common thing?

pearl badger
#

Thats txaa

#

Ue4s aa solution is not sharp

bleak tapir
#

Does DrawLines draw a line from the last line to the first line at the end or something?

strange topaz
#

how long would it take for me to get skilled with c++ ? I made something with blueprints that is actually UI, and i thought it would also be cool to replicate it in C++ (slate) some day, as that seems to be the right way & i guess it would be a bit lighter? No idea, pls lmk. Would it be worth it? I've always wanted to learn c++ but its just way more difficult than learning blueprints. There aren't as many tuts and its way more complicated/spaghetti than blueprints.

#

What i'm basically asking is.. in what case would i need to learn/use c++ ?

urban bloom
#

If you are using Unreal, learn unreal C++. There is no reason not to, and every reason to do so. Im not saying stop using blueprints. Sometimes a blueprint shaves development time and the performance difference (which is minimal these days with nativization) isn't always a concern. Now the question of whether you should learn unreal c++ for the UI, im 50/50 on. Part of me says UMG is perfectly fine and makes sense over using Slate counterparts. Another part of me says if your UI is during gameplay, then Slate is the better option.

#

@strange topaz

strange topaz
#

but how long would it take? can it even be done? I keep thinking that i wont make it all the way thru and learn c++ and that just kills my motivation. Plus i've been really busy with blueprints. If i start c++ i wont be able todo anything, which means until i learn c++, i will not be developing anything.. so i dunno. I feel like learning c++ only if i have to, and so far i don't see a reason. There hasn't been a limitation with blueprints, that would make me think of c++.. so i keep thinking of learning c++ in the future but always just have no plan about when. ๐Ÿ˜•

toxic dove
#

its normal that you dont see why you'd need C++

#

you just dont know enough to know better

quaint zealot
#

So @strange topaz - C++ isn't "the right way" or "lighter". It's a more technical approach that enable developers to extract additional performance when they need it, and when they have the skills to do it, but if you're at a learning stage, C++ is going to cause more issues than it will solve

#

My personal top reason for doing mostly C++ is that it's a text file I can version, diff, read on a phone from my bed and update without fear of never be able to come back

#

Being text-based is a huge thing for long-term maintanability

#

Now if C++ terrorizes you and you are comfortable working without it, then keep working like that

#

You might need to learn some C++ at some point for some obscure feature - when that happens, take it slow, make sure to understand everything, don't rush it

#

Just don't go into saying "I need to redo it in C++ because it's better"

toxic dove
#

blueprints are also disgusting to debug with

#

its a maintenance nightmare

#

even with the new blueprint debugging callstack and watch window imporvements in 4.20

craggy holly
#

@bleak tapir yes. You define a series of points and it draws all lines between those points.

#

Also, my approach for UI - write the classes and code in C++, then use UMG to actually subclass and design the widgets. Best of both worlds IMO.

toxic dove
#

that is how it is intended

ancient wigeon
#

@silent patrol Hello Nick, have you experienced some rare scroll box stucking when using touch ? We are experiencing it quite often in our project. I tracked it down to some weird behavior when scroll box losts capture, however it does not lost it by usual way (OnTouchEnded()) because this function is also reseting bTouchPanningCapture variable to false. Sometimes it losts capture but bTouchPanningCapture is still true, so scroll box ends up in stucked state because new scroll requires capture to be false and also bTouchPanningCapture to be false. Sadly, no good repro steps, as it is usually replicated during crazy scrolling ,window switching and scroll box content updating. Easy (maybe hacky, not sure), fix would be setting bTouchPanningCapture to false in OnMouseCaptureLost(), however I can not really do it in subclass, as it is private.

#

There is probably some other way by which can widget (scroll box) lose mouse capture which scroll box is not expecting

silent patrol
#

Hey

#

Yeah it should get cleared in capture, but it's trickier than that I think, as it's actually not recording enough information i think

#

it needs to ensure that the pointer losing capture was the one that started the trigger

#

each finger can hold capture independent of the others

ancient wigeon
#

Ah, I see. Hmmm, so if I understand correctly it should be better to remember pointer on capture and then check against the remembered pointer when we want to end interaction, right?

#

but yeah, there is not enough information to do that in OnMouseCaptureLost(),

silent patrol
#

if you're looking to hack it up, you can use the #define private protected cheat

#

at the top of the Cpp

#

just make sure to undef it at the bottom hehe

ancient wigeon
#

hahah, yeah, thanks for help. I will see what I can do. Maybe I will endup just copy pasting whole class :)

toxic dove
#

@silent patrol is it possible to prevent map preloading on app startup until the splashscreen video completes? if so I can't find it under FLoadingScreenAttributes

craggy holly
#

Just create an empty map and load into that instead

#

That's what I do usually, just have an "Entry" map that takes almost no time to load

#

Then load the actual start level when startup movies have finished, usually main menu

toxic dove
#

its fine, i figured out the hitch i wanted to avoid and fixed that

tribal kayak
#

@toxic dove what'd you do to fix the hitch in the startup movie? have a similar issue on a project

toxic dove
#

it was just the GameInstance that had raw asset references so it was preloading the packages

#

dumb spaghetti BP

tribal kayak
#

might actually be the same issue for me, ill look into it thanks

toxic dove
#

you can look at the asset's size map, it was an issue with a BP cast in the game instance, this hard references the BP, which can be bad if it has other hard references, and so on.

#

hard references to assets (textures, meshes, etc.)

ancient wigeon
#

Hey guys, does somebody know what this means please? UI is almost UMG only

#

LogOutputDevice: Error: Ensure condition failed: BrushResource->DrawAs != ESlateBrushDrawType::NoDrawType [File:D:\Build++UE4+Release-4.19+Compile\Sync\Engine\Source\Runtime\SlateCore\Private\Rendering\ElementBatcher.cpp] [Line: 261]
This should have been filtered out earlier in the Make... call.

#

happens when scrollbox and its content finish hide away from screen in animation

#

sadly, nothing there is nothing really useful in debug mode

toxic dove
#

look at the callstack and inspect what widget is firing this

#

PS: an ensure is not fatal though, so your game will not crash if this happens

flat panther
#

hey, guys, I've created my IDetailCustomization class with all the layout etc..It's all registered in module StartupModule and paired with my UObject class..So far so good. My question is, how can I now display this in the tab? In Content [] ??

#

I'm using Editor Toolbar Button plugin layout

limpid atlas
#

@flat panther You want to create a details view widget?

reef sparrow
#

@flat panther I don't know what it meant by displaying in the tab, but you can get the details widget by creating a widget derived from SSingleObjectDetailsPanel and use your object class as the return value of its GetObjectToObserve method. And, you can put it literally anywhere in the editor, you can add it to your own custom window, or you can let it be part of unreal editor by adding it in your own docktab

#

SSingleObjectDetailsPanel will automatically apply the customizations that you've made for the observed object

flat panther
#

This is what I want to create and this is the tab I mentioned. On the documentation I read I need to create child of IDetailCustomization It's also used on many places in Editor..

reef sparrow
#

that's a dock tab

#

have a look at FModeToolkit

flat panther
#

Yes, if you create new plugin, you see it's derived from FModeToolkit and there is the function Init There is all slate code included, therfore my question, how do I put there my IDetailCustomization object ?

reef sparrow
#

I guess registering your own custom tab spawner in mode toolkit will add the doc tab in that toolkit

#

because it is the mode window

flat panther
#

The plugin creates all the tab window and also some demo code

#

SAssignNew(ToolkitWidget, SBorder) .HAlign(HAlign_Center) .Padding(25) .IsEnabled_Static(&Locals::IsWidgetEnabled) [ SNew(SVerticalBox) + SVerticalBox::Slot() .AutoHeight() .HAlign(HAlign_Center) .Padding(50) [ SNew(STextBlock) .AutoWrapText(true) .Text(LOCTEXT("HelperLabel", "Select some actors and move them around using buttons below")) ].....

#

like this

#

this is working well, I need help with displaying my own IDetailCustomization class in it

reef sparrow
#

oh, then just use SSingleObjectDetailsPanel

flat panther
#

oh, I'm lost ATM..there is so many ways doing something..

#

I was following this and it's used almost everywhere in the engine

reef sparrow
#

details customization is to customize the details panel

#

which is the details of an object

#

SSingleObjectDetailsPanel is the container of details view of an object

#

the details view is generated via many customizations in the editor, including yours if you make one

#

but this is not an asset editor, just an object details panel

#

project settings is a good example of a details panel, it is used to display the CDO of project settings class

flat panther
#

ok, what I want in general is to have this nice categories with header and arrow on the left, and I want to show/hide content if I click the arrow. There I want to use my own slate layout

reef sparrow
#

hmm.. let me get something clear, does it has anything to do with a UObject? if it is then do it in your own IDetailsPanel class, it has a lot of limitations but it's easy to use

#

if it's not, then just create you own widget

flat panther
#

Both of them..but how can I create this functionality in pure Widget?

reef sparrow
#

everything related to UI is possible using slate ๐Ÿ˜ƒ

#

You can make your own details panel if you want to

flat panther
#

I didn't notice it's there ?? Like I can't create this funcionality via SNew? right?

reef sparrow
#

PropertyEditorModules automate the creation of this widget for you

#

SNew is special function to create a widget

#

Widget has A LOT of macros (slate_args, slate_delegates, etc.) and it simply can't be created by using the c++ new function

#

it has its own flow of constructing the widget

#

understanding Slate was super hard for me at first, due to the lack of documentation, but now I can create almost anything I can create with other ui tookit (wxwidget, qt, etc.)

#

except for convenient dialog panels like FileBrowser and stuff

#

UE decided to use the system's native dialog for that, but they do provide an interface to opens up and querty this native windows

#

well, I gtg, good luck with whatever you want to do ๐Ÿ˜ƒ

flat panther
#

thanks for your time

tame granite
#
bool UWidgetInteractionComponent::PressKey(FKey Key, bool bRepeat)
{

[...]

    if (bHasCharCode)
    {
        FCharacterEvent CharacterEvent(CharCode, ModifierKeys, VirtualUser->GetUserIndex(), bRepeat);
        return FSlateApplication::Get().ProcessKeyCharEvent(CharacterEvent);
    }

    return DownResult;
#

why does having a char code elide the DownResult?

#

docs say PressKey shouldn't even do the ProcessKeyCharEvent and you should use SendKeyChar for that?

#

shouldn't it at least be:

#

    if (bHasCharCode)
    {
        FCharacterEvent CharacterEvent(CharCode, ModifierKeys, VirtualUser->GetUserIndex(), bRepeat);
        return DownResult || FSlateApplication::Get().ProcessKeyCharEvent(CharacterEvent);
    }

    return DownResult;
}```
warm vault
#

does anybody have an idea how I can programmatically set the focus to an editable textbox widget?

royal geode
#

Try FSlateApplication::Get().SetUserFocus(0, YourWidget);

#

@warm vault

warm vault
#

worked like a charm ๐Ÿ‘๐Ÿผ thanks @royal geode

royal geode
#

FYI, all I did is Alt Shift S + SetFocus @warm vault ๐Ÿ˜›

warm vault
#

๐Ÿ˜ณ

#

in which file did you find it?

royal geode
#

Actually I searched smthg like slate Set Focus

#

Then Alt Shift F on SetUserFocus

#

To see if it was used

warm vault
#

oh ok

royal geode
#

And somewhere there was FSlateApplication::Get().SetUserFocus

warm vault
#

didnt know about Alt Shift S

royal geode
#

rly

warm vault
#

its better than Ctrl T

royal geode
#

Damn

warm vault
#

i was using Ctrl T xD

royal geode
#

You know Alt G?

warm vault
#

now I do

royal geode
#

Alt Shift G?

#

Ctrl Shift V?

warm vault
#

now I do

#

what does Ctrl Shift V do?

#

keep track of my Ctrl C history?

#

and paste

royal geode
#

Yes

#

Can choose history size

#

Kinda useful

flat panther
#

hello! Can I get information in the moment the level is opened/loaded?

flat panther
#

the 2nd question is how can I focus to actor in the level ? Like if you press F ?

warm vault
#

you can get the current World, maybe that helps

#

btw, does anybody know how I can define a detailcustomization not just for one class, but for all its subclasses too?

#

currently, the details for a subclass is added on top of the details for my base class

flat panther
#

@warm vault thanks. I can take a look at World..About the focus, I don't want to focus at runtime, but in Editor ( from my plugin ) when I click on SButton I want to focus to Actor ( like when you press F )

warm vault
#

then I guess you have to dig into the code

flat panther
#

yeah, but try to search for focus

#

it's milions of results

warm vault
#

I would search for EKeys::F, there shouldnt be too many occurences

#

only as many as there are bindings

flat panther
#

this is nice ^^

#

going to try this

#

UI_COMMAND( FocusViewportToSelection, "Focus Selected", "Moves the camera in front of the selection", EUserInterfaceActionType::Button, FInputChord( EKeys::F ) );

warm vault
#

looks like you found something related

flat panther
#

๐Ÿ‘

warm vault
#

I found this

#
"D:\Epic Games\UE_4.20\Engine\Plugins\Editor\MeshEditor\Source\MeshEditor\MeshEditorCommands.cpp(108)":    UI_COMMAND(FrameSelectedElements, "Frame Selected Elements", "Moves the viewport camera to frame the currently selected elements.", EUserInterfaceActionType::None, FInputChord(EKeys::F));
warm vault
#

ok I kinda bruteforced my way, but I found a way to customize the details panel the way I want to

flat panther
#

I found 2 ways in case someone is interested

#

GEditor->MoveViewportCamerasToActor (a[0], true); // a[0] is AACtor*;

#

or

#
GoHereAction.ExecuteAction = FExecuteAction::CreateStatic(&FLevelEditorActionCallbacks::GoHere_Clicked, ClickLocation);
GoHereAction.Execute ();```
warm vault
#

the first one probably does more than you want to (it seems to set the cameras of all viewports)

#

anybody have an idea how to control the clipping of a textblock when there is no space left?

#

i want to display ellipses: ... if a word is too long,

flat panther
#

not really...there is 2nd argument which force focus on active viewport only

#

to the topic above. you can create 2 horizontal boxes with the actual text and text containg ... that shows up once the text is too long ?๐Ÿค”

warm vault
#

good idea

#

but that would require knowing the size of the text before its being rendered

earnest gyro
#

there are already helpers for shortening text with an ellipsis

#

i forgot what it's called. take a look at the Editor - it's used in several places. then use Widget Reflector to find the widget code.

#

there are also functions to measure the size of a string in pixels

warm vault
#

i will look into it, thx ๐Ÿ˜„ but I never noticed that the editor shortens text with an ellipses, on the contrary, I only remember that it its lacking that feature ๐Ÿ˜†

#

and I cant find any example of shortened texts right off the bat

#

btw @earnest gyro i watched your plugin tutorial on academy.unrealengine.com and it was really great ๐Ÿ‘๐Ÿผ helped me to start customizing the editor and now I have done quite a bit just in a few days

earnest gyro
#

nice, i'm glad it was useful. i had a pretty bad cold when we recorded it. we had to redo the second part.

#

let me see if i can find that ellipsis code

warm vault
#

it was super useful ๐Ÿ‘๐Ÿผ yeah I think your voice was a little strange in some videos ๐Ÿค” i think the audio for one of them was even recorded afterwards. At least, the audio and and your lips werent in sync ๐Ÿ˜†

earnest gyro
#

ok, it looks like you're right. all the ellipsis stuff in the code base is based on string length. however, there is one example that uses string measure: FGameplayDebuggerCategory_EQS::DrawDetailedItemRow

#

take a look at the for-loop near the top of that function

#

it first measures the string and then, while it is too long, it shortens it by one character and then measures again

#

you could probably optimize that, i.e. by doing a binary search

#

if you use a monospace font, then you could calculate the width directly

warm vault
#

found it ๐Ÿ˜„ looks rather simple, to be honest. I will only have to figure out how to get a UCanvas, but a default instance would probably do the trick?

#

thanks a bunch ๐Ÿ‘๐Ÿผ

earnest gyro
#

might be worthwhile checking out what UCanvas does under the hood. there might be some low-level helper function that you can use directly

warm vault
#

yeah but unfortunately the editor does not use monospace fonts, and I dont want to enforce it ๐Ÿ˜†

earnest gyro
#

for arbitrary fonts, binary search is probably the best approach. if your strings are short, linear search is fine, too

warm vault
#

they are just names, so it doesnt have to be efficient ๐Ÿ˜„

#

UCanvas::MeasureStringInternal is being used under the hood, but I think not using functions nested that deep will be easier to use

#

surprisingly, that function is public xD

#

you would expect internal functions to be private

royal geode
#

Don't complain on functions being public

#

๐Ÿ˜

warm vault
#

never xD

limpid atlas
#

Haha. Yeah, celebrate, write a bunch of code, then bang your head on the desk when linking fails because it turns out the function wasn't exported.

#

My usual approach ;)

warm vault
#

yaeh

#

but maybe one can just submit a pull request to expose such stuff

#

i dont see why not xD

limpid atlas
#

Absolutely. Helps if you really like waiting, though.

warm vault
#

i dont think accepting pull requests that only expose stuff will take so long ๐Ÿค”

limpid atlas
#

Last I checked (which was a while back because I lost interest), there was a backlog of PRs months long that hadn't even been reviewed.

#

It had been getting longer and longer for a while, at that point I just gave up even thinking about submitting any more.

little birch
#

How do I use widget reflector with invalidation box? According to the docs it should show green red and yellow borders around widgets but nothing shows up. Do I have to take a snapshot or something?

#

Also did I misunderstand invalidation box? I thought it disables paint calls on widgets all together unless I invalidate the widget or set it to volatile

ancient wigeon
#

There is button or some checkbox named something like debug invalidation or debug caching, on top of widget reflector

#

orange one

little birch
#

Yeah i used that one, but I don't see anything happening

ancient wigeon
#

Try to enable both Invalidation Debugging and Widget Caching

warm vault
#

how to add custom folder at ContentBrowser

#

at the path view of it, there are Content, C++ Classes , Engine Content, myCustomFolder

#

Content

#

C++ Classes

#

Engine Content

#

myCustomFolder

#

I want to add a root folder at the path view at the left side of CB

ancient wigeon
#

why would you need something like that? Plugins have custom root folder automatically, so if you are making plugin it is available for you. If you are making game then it belongs to game folder. If you are doing some engine stuff then you are going to use engine folder.

ashen hearth
#

any one is familiar with SListView? the OnItemScrolledIntoView Event does not work

warm vault
#

what do you mean it doesnt work? how did you set it up?

reef laurel
#

hey guys can i have some help with my UI i am working on a main menu and for some reason the button multiplayer works when i press it but when i select settings it comes up blank for example

mild oracle
#

Is there a function like FSlateDrawElement::MakeLines that allows for rendering material/textured lines? Looks like MakeBox takes a SlateBrush...

earnest gyro
#

@mild oracle maybe take a look at how the splines in the Blueprint editor are implemented

mild oracle
#

@earnest gyro Good idea! Do you know where that might be? I've seen FSlateDrawElement::MakeSpline

earnest gyro
#

I don't know where it is exactly. Probably buried somewhere in the lower level graph editor code

reef sparrow
#

there's one in the CurveEditor widget OnPaint

earnest gyro
#

i think the curve editor lines are not textured though, so it may not be what he's looking for

#

worth a look though

reef sparrow
#

I see

earnest gyro
#

for the graph editor, you can use the Widget Reflector to find the code for the blueprint editor, then dig down deeper from there

#

blueprint editor is built on top of graph editor. the line drawing stuff is probably handled in the lower layers

#

it's been a couple years since i looked at it

mild oracle
#

Curve editor uses MakeLines yeah

#

Poking around in GraphEditor I've found stuff about pins and nodes but nothing about edges, connections, lines, or anything else

#

Using WidgetInspector doesn't seem to work on the lines either

#

There is an effect when you hover an exec node that makes the lines thicker so they must be using something...

#

ok found it, it's in FConnectionDrawingPolicy::DrawConnection, it calls FSlateDrawElement::MakeDrawSpaceSpline

#

It lets you choose the thickness but that's about it

#

๐Ÿ˜ฆ

limpid atlas
#

@mild oracle There is a custom slate element that lets you implement an interface and draw anything at a lower level. That should let you do it, but it's a fair bit more work and requires a lower level knowledge of the code.

mild oracle
#

@limpid atlas Oh interesting, do you know what any of it might be called? I'm looking at SWidget...

limpid atlas
#

Start with ICustomSlateElement

mild oracle
#

uh-oh ๐Ÿ˜„

#

Yeah I posted there earlier today

#

I'm looking into how to make nicer-looking line charts for player-facing stats

#

oh wow the code in DrawRenderThread there is really useful, I never would have been able to work that out myself. So that's how you do low-level rendering

limpid atlas
#

Well, word of warning - that's how some engine code that I found about 3 years ago did some custom slate drawing. I suspect the approach that it used (with the FSimpleRenderTarget class, also in that plugin code) was far from optimal even back then.

#

But it seemed to work okay. So depends on your requirements I guess as to whether that's good enough.

#

I've no doubt that drawing directly onto the main render target would be more efficient, but for some charts it's probably not super critical anyway.

mild oracle
#

hmm looking at that func more it still seems like you're passing in points and a size. But maybe I can use this same thing to render some custom polygons to make textured curves/lines

limpid atlas
#

Yeah in that example I just used a canvas to draw some stuff that couldn't be done using regular slate elements. For your case, I'd assume you could use the RHICmdList parameter in the DrawRenderThread override to draw lines/triangles with a material.

#

Though I don't know exactly how. If you can somehow get a reference to a FPrimitiveDrawInterface or similar, then you'd be good. I don't have any experience with the FRHICommandListImmediate class though.

mild oracle
#

oh thanks for the tip!

#

I remembered now there's something called SMeshWidget, maybe I can refer to that

limpid atlas
#

Yeah that would be a good move I think. It's a bit newer, and not so long ago I asked Nick Darnell about that custom element code due to some clipping issues, and he suggested to look into the mesh widget.

mild oracle
#

Thanks again, I think I have a bunch of stuff to investigate now ๐Ÿ˜ƒ

mild oracle
#

I wonder if I could use SMeshWidget to make a UMG/Slate-space particle system

warm vault
#

Hello! I've been searching (without success) for the name of the resizable scroll bar used in the bottom of various keyframe panels throughout the UE4 Editor. I want to know if the element in question is simply called "scroll bar" with some additional parameters or a different type of UI element entirely. It's different from other scroll bars because it has 3 movable buttons, 2 to resize the button in the middle and the middle one is used like a regular draggable scroller

#

To be clear, I just need to know how a UI designer would call such a UI element. I don't need a class name or any specific string.

royal geode
#

@warm vault Tried the widget reflector yet?

warm vault
#

@royal geode nope. Why?

royal geode
#

To get the name of that widget?

warm vault
#

I didn't know there was such a thing

#

I'll give it a shot

#

Apparently it's STimeRangeSlider. Not the answer I was hoping for :/

#

Or rather, the element as a whole is unnamed in the Editor. A "range slider" in itself isn't a scrollable element. It's missing the middle draggable element

#

Again, I just want to know what a UI designer would call such an element. Does anyone know any source (book or web page) with listings including such advanced elements?

limpid atlas
#

Anyone any experience with getting SScaleBox to behave?

#

The thumbnail is in a scale box set to fit with maintained aspect ratio (square image), getting 30% of the width.

#

But the scale box still requests the full height of the underlying thumbnail even though it's scaled it down, so I get the big borders above and below...

warm vault
#

lol

#

you probably need to fit it into an SBox @limpid atlas

#

or maybe SSizeBox, i am not sure

#

i know that with SBox you can override the width and height, clipping the contents if they are too large

#

if you use a SScaleBox to scale it to the overriden width and height it should solve everything, I guess?

#

but I would be interested in the solution as well

limpid atlas
#

I did try messing around with SBox, although it was kind of random experimentation. I'll look into SSizeBox, forgot about that one.

#

Seems weird though that SScaleBox wouldn't adjust its own size based on how it sized its contents.

warm vault
#

ikr ๐Ÿคท๐Ÿผ

#

inside what did you place your SScaleBox before?

#

use cases I found in engine code all indicate that you need to contain the scale box in a widget which determines the size. then you just create the scale box like this

SNew(SScaleBox).Stretch(EStretch::ScaleToFit)

to scale the contents of the scale box to the size/dimension of its parent

limpid atlas
#

Hmm, yeah it's possible that it's a limitation I guess, that it just doesn't work properly if it's supposed to determine its own size.

#

In the above case, it's in a horizontal box, with fill ratio of 0.3. So the parent is giving it its width, but asking it what height it should be.

#

Thinking about it, if I can't get it to work I could probably just do a custom implementation.

warm vault
#

i dont think its a design limitation. one could compose the scale box out of two nested widgets, one for size and one for scaling...

#

I think its just a design principle that each widget is only for exactly one purpose

flat panther
#

hey, I'm trying to remove item from SList array and got an exception thrown at

 // Last shared reference was released!  Destroy the referenced object.
ReferenceController->DestroyObject();

My idea is to remove the item from this feeding array and then do RequestListRefresh

#

Is this correct approach or how am I supposed to remove an item from slist?

flat panther
#

Update: It's working, just had TSharedPtr to AActor insted of AActor* in the struct that was a row in the SList...

trim kestrel
#

Wait, what?

#

TSharedPtr<AActor> is absolutely not valid.

#

You can't mix and match reference counting with garbage collection.

flat panther
#

Yes, therefore it was not working. As I'm learning the slate in the late evenings I just made a mistake ๐Ÿ˜ƒ

toxic dove
#

use TWeakObjectPtr in your struct

#

especially if it's an actor

#

if you keep it strongly referenced, if the actor is destroyed, the object can be alive in memory but the actor could be invalid, you will run into problems with this

flat panther
#

@toxic dove yes, it's an actor in the level..If I press the button on the SList row, I delete the actor and delete the row too ( my struct holding AActor* and FText ) I'll try TWeakObjectPtr - it sounds exactly what I need

#

Thanks

flat panther
#

Trying to understand IDetailCustomization . I've everything prepared in my own DetailCustomization, I've added categories , etc... DetailCustomization is registered in StartupModule...Now the question is, how can I display this in some widget?

void SAHTestWidget::Construct(const FArguments& InArgs) 
{
  ChildSlot
[
  SNew(SBox)
.VAlign (VAlign_Top)
  [
      // HOW ???
  ]
];
limpid atlas
#

@flat panther Need to load the PropetyEditor module interface, then call CreateDetailsView.

flat panther
#

hm but detail view is TSharedPtr<IDetailsView> and I've TSharedPtr<IDetailCustomization>..Am I missing something?

#
FPropertyEditorModule& PropertyEditorModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
FDetailsViewArgs DetailsViewArgs(false, false, false, FDetailsViewArgs::HideNameArea, true);
DetailsPanel = PropertyEditorModule.CreateDetailView(DetailsViewArgs); // .h TSharedPtr<IDetailsView> DetailsPanel;
#

now I suppose have DetailsPanel and need to put the content of the IDetailCustomization somehow?

limpid atlas
#

If you've registered your customization, it will be applied automatically if you assign an object of the type you registered it for to the details panel.

#

After creating it, you need to call the SetObject method.

flat panther
#

ok, I see, it's working now ๐Ÿ˜ƒ thanks

warped pebble
#

Hey guys, does anyone know a good or didatic book/tutorial/learning documentation for someone who knows nothing about Slate, please? I want to learn how to create an editor window for a custom asset, but the few material available are giviving me a hard time (deprecated, no starting point, not for begginers, terrible explanations when there is some, etc.). Thank-you very much.

earnest gyro
#

I don't think there are any such materials, @warped pebble

#

the best option would be to dig into the Editor account and learn from that

#

as for tutorials, the closest I can think of is a blog post I wrote last year:

#

that should get you started with new assets, and it also shows how to create a simple asset editor window

#

there's also a video tutorial on plug-ins that covers some of this stuff:

#

I also have a two-part high-level overview on Slate:

warped pebble
#

@earnest gyro Actually your tutorial is exactly how I manage to create my custom asset so far, thank-you by the way, it's the only good one I could find and a secondo part would be great. I'm watching your class in Unreal Academy too, but still having trouble to open a custom editor for my custom asset, probably because of my own lack of knowledge ๐Ÿ˜… . I'm reading about editor toolkit now. Thanks.

earnest gyro
#

yeah, it's relatively easy to get started with custom assets, but it can get complicated quickly, depending on what you're trying to achieve

#

my recommendation is to following the tutorial, get a simple asset up and running, and then look at some of the other existing asset editors in the engine

#

if you know the basics, it will be easier to follow the more complicated stuff

warped pebble
#

Yes, I'm trying to follow this path. Thank-you for the help.

mild oracle
royal geode
#

ohhhhhhh

#

@mild oracle That's a nice website, created using manual html/css?

#

Or some kind of tool

mild oracle
#

@royal geode jekyll

#

it generates static html sites

royal geode
#

Thanks!

flat panther
#

In my widget, I need to get callback once the level is loaded and populate my list with specific actors from level. Where is the best place to subscribe to such a event? In the SCompoundWidget ? Also checking in Paint is I think a bad idea, right? And speaking of the callback, I found FCoreObjectDelegates::PostLoadMapWithWorld . What would be your approach?

ancient wigeon
#

What would you guys say on making some public funding for 4k monitors for Epic devs? I guess that would finally fix all those DPI issues. :D It's getting boring that new DPI issues are introduced almost every version.

royal geode
#

What kind of issues @ancient wigeon ?

ancient wigeon
#

In 4.19 you needed to click about 200 pixels (depending on the dpi) away from actor if you wanted to use on clicked/on touched event.

#

In 4.20 it probably works but now all screen space widget components have offset (ignoring DPI)

#

so deprojection world -> sceen is not respecting it

royal geode
#

๐Ÿ‘Œ

#

Good to know

warm vault
#

@warped pebble just download the TextAsset plugin from github and view the code as everything is explained the UE academy videos. I managed creating my own asset editor just by taking that plugin and replacing everything with my own code. doing that will also help you understand the effects of every code line. you should also slowly get used to read/navigate the engine source code this way, which should help you in creating a lot more advanced stuff just by copy-pasting engine source code.

warped pebble
#

@warm vault Yes, I did that ๐Ÿ˜€ . I succeed to create a custom editor for my asset reading the plugin source code. Thanks for the help.

warm vault
#

gj ๐Ÿ‘๐Ÿผ

#

what kind of asset type were you working on?

warped pebble
#

"Cards Assets" (for card game) and a "Visual Novel Dialog Asset"

warm vault
#

i see

flat panther
#

Hey! Please, how can I add in custom property layout featrure you can see in default regular AddProperty layout you see on the top and bottom?...Can't figure it out

mild oracle
#

@flat panther Have you seen NameContent() and ValueContent()? Searching online or in the editor's codebase might help for that

flat panther
#

@mild oracle yes, I've noticed that earlier but was not aware this has sometehing to do with that "moving divider" stuff.. Will take a look at this....

rich edge
#

Hey guys, So i have a problem where when I change resolution in fullscreen, or if im changing from windowed to fullscreen, sometimes the gamewindow will crop down to quarter the size of the screen and be up top left corner. Also sometimes it completely is tabbed out and im unable to get it back up again. Anyone who knows what it could be? im using ue 4.17

warm vault
#

yeah, ben is right, there are two slots called nameContent and ValueContent, you need to place your widget inside these in order to have them rendered properly

flat panther
#

nice, thank you. work like a charm ๐Ÿ˜ƒ

pearl badger
#

Anyone have a clue why when i change the variables for a UMG that is wrapping a custom slate widget that it updates fine in real time with synch props but when i hit umg compile it defaults too the slate widgets default variables

main hedge
#

are you maybe resetting them in the slate widget constructor

#

compile destroys the slate widget and makes a new one

pearl badger
#

I dont think so

#

im doing what all the other slate widgets are doing

#

so idk wtf is going on

main hedge
#

maybe put breakpoints

#

in all methods involved

#

oh you already solved it

#

๐Ÿ‘

pure cargo
#

anyone knows how is it supposed to use FSlateDrawElement::MakeCustom or FSlateDrawElement::MakeCustomVerts for drawing polygons on slate?

pure cargo
#
int32 TestCustomVerts(const FOnPaintHandlerParams& InParams)
    {
        const float Radius = FMath::Min(InParams.Geometry.GetLocalSize().X, InParams.Geometry.GetLocalSize().Y) * 0.5f;
        const FVector2D Center = InParams.Geometry.AbsolutePosition + InParams.Geometry.GetLocalSize() * 0.5f;

        const FSlateBrush* MyBrush = FCoreStyle::Get().GetBrush("ColorWheel.HueValueCircle");
        // @todo this is not the correct way to do this
        FSlateShaderResourceProxy* ResourceProxy = FSlateDataPayload::ResourceManager->GetShaderResource(*MyBrush);
        FSlateResourceHandle Handle = FSlateApplication::Get().GetRenderer()->GetResourceHandle( *MyBrush );
        ...
}

Also, why the only code example i was able to find, use an not correct way of doing things? Are there some usage example with the correct way?

pearl badger
#

does anyone know how to register a FDesignerExtension to UMGEditor?

pearl badger
#

Does anyone know why splines retain some sort of same thickness when you zoom in and out of the editor?

main hedge
#

probably because it doesn't scale the width

pearl badger
#

well i mean

#

when u zoom out in the umg editor

#

they get bigger

#

as if they are ignoring some sort of screen space

#

or something

#

Its only in the UMG editor though

#

Boarder images do the same as well in the umg editor

main hedge
#

wires in the bp editor don't scale either

#

it probably just ignores the dpi scale

pearl badger
#

Oh yeah i guess that would make sense

placid beacon
#

Does anyone know how a slot could get removed correctly from a UPanelWidget but not the underlying child of the SConstraintCanvas?

#

I have a UUserWidget for my HUD that is hidden using RemoveFromParent() and then when I show it again using AddToViewport() it seems to be recreating a widget that was destroyed while it was hidden.

#

So my HUDWidget has a UCanvasPanel* IndicatorPanel. And while the HUDWidget is hidden via RemoveFromParent(). I also am removing some of the children widgets of IndicatorPanel via RemoveFromParent()

#

The slot that is holding the child widget is removed correctly. However, when I re-show the HUDWidget with AddToViewport I end up with an extra child on IndicatorPanel->MyCanvas that is slot-less

toxic dove
#

are you adding a widget at runtime (in the Construct)?

placid beacon
#

I am creating the widget at runtime. Character::OnRep_PlayerState -> ... -> CreateWidget and IndicatorPanel->AddChildToCanvas

#

But these aren't hit an extra time or anything

#

The widget I'm working with here is an above head nametag

#

When the player presses tab it shows a scoreboard and hides the HUD

#

If a player kills an enemy, the nametag is destroyed

#

If a player kills an enemy while the scoreboard is up and releases tab to hide the scoreboard (and re-show the HUD). Then I get an slot-less nametag that is stuck on screen

#

The slot-less nametag doesn't get created until the player releases tab tho (which calls AddToViewport on the HUDWidget)

#

It seem that this is the chain of events AddToViewport -> AddToScreen -> TakeWidget -> TakeWidget_Private -> RebuildWidget.

And the parent/child hierarchy is
HUDWidget -> IndicatorPanel -> Nametag

#

For some reason it is rebuilding the nametag that was destroyed while the HUDWidget was hidden

#

And by "destroyed", I mean calling RemoveFromParent on the Nametag

toxic dove
#

RemoveFromParent will call the Destruct

#

it will also call remove on its children iirc

#

you should break into the Destruct and Construct of your UI (the scoreboard?) and watch the container that contains your rows of nametag widgets

#

it sounds to me like your logic just needs readjusting for it to behave the way you want

#

would be easy to configure out

placid beacon
#

The nametag is on the HUD. It is the name that appears above a players head. The scoreboard doesn't really have to do with much. It's just when I hide the HUD (to show the scoreboard), kill a player, and then re-show the HUD. It is re-creating the nametag widget that was destroyed while the HUD was hidden

#

And I don't know why

toxic dove
#

we dont have to know about your logic

#

simply debug your UI by placing breakpoints in the destruct/construct and data breakpoints in whatever panel widget contains your nametag widgets

placid beacon
#

"It is re-creating the nametag widget that was destroyed while the HUD was hidden" isn't my logic. It's an issue that I am debugging.

toxic dove
#

๐Ÿคท data breakpoint will tell you why

placid beacon
#

yeah I've been doing that, haven't been able to figure it out yet. Will keep at it

toxic dove
#

what do you mean? if you use a data breakpoint it will tell you exactly what is adding it

#

you can just look at the callstack

placid beacon
#

Well yeah, I see that RebuildWidget is re-creating it. I just haven't figured out why

#

AddToViewport -> AddToScreen -> TakeWidget -> TakeWidget_Private -> RebuildWidget

#

that bit

toxic dove
#

paste the callstack

placid beacon
toxic dove
#
     UE4Editor-PortalWars-Win64-DebugGame.dll!APortalWarsHUD::HideScoreboardWidget() Line 119    C++
     UE4Editor-PortalWars-Win64-DebugGame.dll!APortalWarsPlayerController::OnHideScoreboard() Line 546```
#

UPortalWarsNameIndicatorWidget is that the nametag widget?

placid beacon
#

yes

toxic dove
#

paste the functions from the callstack i pasted

placid beacon
toxic dove
#

what is HUDWidget

#

paste the construct of that widget

placid beacon
#

HUDWidget is a UUserWidget. The hierarchy goes HUDWidget -> IndicatorPanel (UCanvasPanel) -> NameIndicatorWidget

#

HUDWidget doesn't have a construct

toxic dove
#

well there you go then

#

if your widget tree for HUDWidget contains a UPortalWarsNameIndicatorWidget , it will rebuild its whole widget tree and call construct recursively

placid beacon
#

Hmm I'm removing the NameIndicatorWidget when the player is killed tho

toxic dove
#

removing it does not remove it from the widget tree

#

youre just making it not visible

placid beacon
#

I'm creating the NameIndicatorWidget at runtime tho

#

The HUDWidget has

    UPROPERTY(BlueprintReadWrite, meta = (BindWidget, OptionalWidget = true))
    class UCanvasPanel* IndicatorPanel;```

And then the NameIndicatorWidget's are created in `Character::OnRep_PlayerState` and added to the IndicatorPanel
toxic dove
#

you should make sure in the Destruct of HUDWidget that it is removing all NameIndicatorWidget in IndicatorPanel and make sure all references to these NameIndicatorWidget are nulled so that the GC can properly destroy the widgets

#

(otherwise you are actually causing a memory leak)

placid beacon
#

Interesting, I didn't know that. I'll try that right now ๐Ÿ˜ƒ

toxic dove
#

use MemReport after a minute or so and see if you have any NameIndicatorWidget objects alive

placid beacon
#

Like this?

void UPortalWarsHUDWidget::NativeDestruct() {
    Super::NativeDestruct();

    if (IndicatorPanel) {
        for (int32 i = IndicatorPanel->GetChildrenCount() - 1; i >= 0; i--) {
            UPortalWarsIndicatorWidget* Widget = Cast<UPortalWarsIndicatorWidget>(IndicatorPanel->GetChildAt(i));
            IndicatorPanel->RemoveChildAt(i);
        }
    }
}```
toxic dove
#

no there's no need to go Widget = nullptr, that's a local variable

#

when you add UPortalWarsIndicatorWidget where are you doing it?

#

there is also a better function to clear a panel widget's children

placid beacon
#
UPortalWarsIndicatorWidget* UPortalWarsHUDWidget::CreateIndicator(AActor* Actor, TSubclassOf<class UPortalWarsIndicatorWidget> IndicatorClass) {
    if (!Actor || !IndicatorClass || !IndicatorPanel) return nullptr;

    UPortalWarsIndicatorWidget* IndicatorWidget = CreateWidget<UPortalWarsIndicatorWidget>(GetOwningPlayer(), IndicatorClass);
    IndicatorWidget->IndicatorActor = Actor;
    // Add to Indicator Widget Panel
    UCanvasPanelSlot* CanvasPanelSlot = IndicatorPanel->AddChildToCanvas(IndicatorWidget);
    CanvasPanelSlot->SetAnchors(FAnchors(0.5f));
    CanvasPanelSlot->SetAlignment(FVector2D(0.5f, 0.5f));
    CanvasPanelSlot->SetAutoSize(true);

    return IndicatorWidget;
}
toxic dove
#

you can simply go IndicatorPanel->ClearChildren or Empty or Clear, I forget what it is.. it's something like that

placid beacon
#

Character::OnRep_PlayerState eventually calls that CreateIndicator

toxic dove
#

ok and you are not referencing UPortalWarsIndicatorWidget anywhere else?

#

wait

#

show me OnRep_PlayerState

placid beacon
#

okay

#
void APortalWarsCharacter::OnRep_PlayerState() {
    Super::OnRep_PlayerState();

    // [client] as soon as PlayerState is assigned
    if (PlayerState) {
        CreateNameWidgetForCharacter();
    }
}```
toxic dove
#

CreateNameWidgetForCharacter now

placid beacon
#
void APortalWarsCharacter::CreateNameWidgetForCharacter() {
    APortalWarsPlayerController *localController = Cast<APortalWarsPlayerController>(GEngine->GetFirstLocalPlayerController(GetWorld()));
    if (localController && localController->GetPortalWarsHUD()) localController->GetPortalWarsHUD()->CreateNameWidgetForCharacter(this);
}```
#
void APortalWarsHUD::CreateNameWidgetForCharacter(AActor* Character) {
    if (HUDWidget) HUDWidget->CreateNameIndicatorForCharacter(Character);
}```
#
void UPortalWarsHUDWidget::CreateNameIndicatorForCharacter(AActor* Character) {
    CreateIndicator(Character, NameIndicatorWidgetClass);
}```
#

Which calls that CreateIndicator function above

toxic dove
#

ok its just CreateIndicator returns a UPortalWarsIndicatorWidget so i was wondering if you were caching a reference to it

#

but you arent

placid beacon
#

yeah I"m not caching any references

toxic dove
#

so you can just call if(IndicatorPanel) { IndicatorPanel->ClearChildren(); } in the Destruct and it should be fine

placid beacon
#

okay, I'll try that now ๐Ÿ˜ƒ

#

Hmm the problem with this is that I want the nametags for characters who are still alive to be there again when I re-show the HUDWidget

#

I was actually already trying to remove the Widget from the IndicatorPanel when the player dies in several places, but it was getting re-created

toxic dove
#

if you do it this way, the widget should get GCed

#

and you also should really consider moving to an event-driven system instead of checking everything on Tick

#

as for UPortalWarsIndicatorWidget i would make it handle its own visibility. Give it a reference to the character it represents (a weak pointer), and let it bind to its OnDeath delegate, and let it remove itself if the character dies (or gets destroyed to make sure as a failsafe)

#

seems like the simplest way

placid beacon
#

NameIndicatorWidget has a normal point to the character it represents

#

class APortalWarsCharacter* IndicatorCharacter;

toxic dove
#

make it a TWeakObjectPtr

placid beacon
#

what you are saying makes sense. I don't understand why this tick solution isn't working

toxic dove
#

also whenever you have raw pointers like that to anything UObject-derived (like an actor in your example) you have to make sure to wrap it with UPROPERTY() to prevent GC as it creates a strong ref to it

#

but you shouldn't do that for actors, you should use weak pointers (because once that character dies and gets destroyed, you are keeping the object alive in memory)

placid beacon
#

Right, I didn't make it a UPROPERTY because I didn't want to interfere with GC. Since in my IsValid I check to see if IndicatorChracter is null and if it is then I call RemoveChildAt

toxic dove
#

as for your tick solution, it's a mess to debug properly compared to an event-driven system, although i dont see why you cant debug it either way with data breakpoints... its not anything obscure or abstract. it's just data not behaving the way you want ๐Ÿคท

placid beacon
#

Fair enough, I'll try debugging it further again. And if I can't figure it out will move to the event-driven system

placid beacon
#

@toxic dove So yeah the following fixes the issue (using delegate instead of lines 7-10)

void UNameIndicatorWidget::NativeConstruct() {
    Super::NativeConstruct();

    IndicatorCharacter = Cast<APortalWarsCharacter>(IndicatorActor);

    // Double check that all data and pointers are valid b4 moving on
    /*if (!IsValid()) {
        RemoveFromParent();
        return;
    }*/

    IndicatorCharacter->OnDeathDelegate.AddDynamic(this, &UUserWidget::RemoveFromParent);
}```
#

It seems like they should be doing the same thing, but must be a timing issue or something

toxic trench
#

@silent patrol hey nick, its surely possible to tell the background blur widget inside of a retainer box to just use some background from some random viewport when not caring about any correct position of anything?

#

or even any custom render target or texture

#

just something so that the retainer box thinks its rendering on top of anything that isn't black

toxic dove
#

@placid beacon try to use event-driven systems in the future

#

in UMG the whole binding system is pretty awful since it is basically polling for data on tick

#

also make sure for every binding call to a delegate, there is an unbind (in your case in the NativeDestruct)

#

and you should check if it's already bound to add/remove

#

it will assert if you try to add twice in a row, etc.

placid beacon
#

I see, yeah just delaying a tiny bit before calling RemoveFromParent "fixes" the ticking solution. So its definitely a timing issues somewhere.

void UPortalWarsNameIndicatorWidget::NativeConstruct() {
    Super::NativeConstruct();

    IndicatorCharacter = Cast<APortalWarsCharacter>(IndicatorActor);

    // Double check that all data and pointers are valid b4 moving on
    if (!IsValid()) {
        //RemoveFromParent();
        FTimerHandle Foo;
        GetWorld()->GetTimerManager().SetTimer(Foo, this, &UPortalWarsNameIndicatorWidget::Test, .1f);
        return;
    }
}

void UPortalWarsNameIndicatorWidget::Test() {
    RemoveFromParent();
}```
#

Yeah the event driven system is much cleaner

toxic dove
#

its awful to rely on tick

#

it is a mess for maintainability and debugging in general

placid beacon
#

Thank you for the help majo, yeah debugging it was definitely difficult

toxic trench
#

so if I'd copy the viewport render target into the retainer box render target before the retainer box starts its widget rendering, then the background would look fully correct I think?

#

@main hedge

main hedge
#

I would think that too

#

btw, where are you going with this

#

are you also trying to make blur with rounded corners?

toxic trench
#

no, I'm trying to display UI in the VR spectator screen while being able to blur the spectator screen behind

main hedge
#

ah

toxic trench
#

@silent patrol @main hedge look at that! ๐Ÿ˜ƒ

main hedge
#

that a blur in a retainer widget?

#

:D

toxic trench
#

yeah. I mean, the whole thing you see there is 1 retainer widget, and the blur is part of it

main hedge
#

how did you get it to work?

toxic trench
#

the way I mentioned above ๐Ÿ˜„

main hedge
#

nice

toxic trench
#

copying cropped eye view into retainer render target before it renders its widgets

pure cargo
#

anyone knows how to properly create a FSlateDynamicImageBrush ?
i tried this code here

UTexture2D* brushResource = Cast<UTexture2D>(StaticLoadObject(UTexture2D::StaticClass(), NULL, *Path);
const FSlateDynamicImageBrush* kMyBrush = new FSlateDynamicImageBrush(Clazz, FVector2D(16,16), kName);

and this

UTexture2D* Clazz = FindObject<UTexture2D>(brushResource, *Path);
const FSlateDynamicImageBrush* kMyBrush = new FSlateDynamicImageBrush(Clazz, FVector2D(16,16), kName);

but every time i use this code line for having a FSlateResourceHandle

FSlateResourceHandle Handle = FSlateApplication::Get().GetRenderer()->GetResourceHandle(*kMyBrush);

the handle is NOT valid and i can't find away to create this brush and having a valid handle. What am i doing wrong?

undone rose
#

Hey everyone!

eternal wave
#

wherer is SizeToContent in slate?

toxic dove
#

i think it's called AutoSize in slate

eternal wave
#

is there any cast function for slate? like Cast<>() for u objects?

#

is dynamic_cast safe for widget?

pearl badger
main hedge
#

what's the issue

pearl badger
#

Well it should just be a square, but randomly its getting wacked an infinite amount too the left

#
for (auto _handle : Handles)
    {
        if (!&_handle)
        {
            continue;
        }
        FSlateColorBrush _Brush = FSlateColorBrush(FColor::White);
        FLinearColor _Color = _handle.Color * FLinearColor(1, 1, 1, 0.25f);
        _Color.A = 0.25;
        FSlateDrawElement::MakeBox(
            OutDrawElements,
            (LayerId + 99990),
            AllottedGeometry.ToPaintGeometry(_handle.Size, FSlateLayoutTransform(_handle.GetHandleAnchored())),
            &_Brush,
            ESlateDrawEffect::None,
            _Color);
    }```
#

i mean its nothing fanncy

#

just drawing a box

#

Maybe its my lack of slate understanding with the _Brush

#

Do you need to define slate brush sizes or something even if its just an fill?

#

open fresh widget bp with it in
click the object
drag it
issue happens
hit compile it fixes,
cant cause it again with out reopening the widget lmao

#

oh a nice we are executing on pre construct event

#

oh a note*

#

oh ignore the layer thing LOL, it was happening before i did that, i was testing a thing

limpid atlas
#

@pearl badger You can't use a local variable for your brush, since you're passing a pointer and it stores it.

#

Also, it won't actually be causing any issue, but your if (!&_handle) doesn't make sense. Not sure what you're trying to check.

pearl badger
#

oh the handles are ptr's to other uprop's

#

not an actual whole data struct

#

ptr to ptr i guess

limpid atlas
#

The point is you've taken the address of a local variable. It can never be null.

pearl badger
#

oh right okay, i was copying what i seen in some of the engine doc stuff

pure cargo
#

Does anyone knows which is the right way to create a FSlateBrush and add a valid resource to it? I need it to draw on a canvas

quaint zealot
#

@pure cargo Right click, new slate brush in content browser

pure cargo
#

@quaint zealot oh. I was looking to much in achieving it through cpp code, probably. I'll look at it. Thank you so much. ๐Ÿ™‚

quaint zealot
#

Resources are not created in C++ usually

pure cargo
#

yeah, i'm not that used to ue4 pipeline and i more acquainted to cpp so i wasn't looking in the most obvious place, the engine ui.

mild oracle
#

Has anyone hit this error before? SObjectWidget for '%s' destroyed while collecting garbage. This can lead to multiple GCs being required to cleanup the object.
I can't work out what's causing it. I have a UWidget => SWidget hierarchy and I can't tell which one is to blame

main hedge
#

did your UWidget get garbage collected before the UI was manually destroyed?

#

the error happens if a UWidget is killed by the garbage collector while still owning an SWidget

#

it was added in 4.20

mild oracle
#

It happens when in the editor I hit Compile on my UserWidget that contains my UWidget/SWidget

#

The full error mentions "ReleaseSlateResources may not be implemented for the owner of this pointer" but I don't have to implement that for UserWidgets that refer to UWidgets inside them through BindWidget, do I?

main hedge
#

you shouldn't have to

#

I've managed to cause this error in lots of strange ways like it happens if you have a widget component on an actor and forgot to call super::endplay

mild oracle
#

oh hmm

#

I still don't 100% understand the error really

#

Or why it could happen in editor when hitting Compile

main hedge
#

not sure how it could happen there

toxic dove
#

check your destruct

#

pretty sure destruct is processed when you have a template open and compile it and have an instance of it open in another tab

feral stag
#

Assuming it's accidental

lone shoal
#

Our development build is crashing when trying to create a widget on line: Assertion failed: (InHasTemplate && InAllowDynamicCreation) || (!InHasTemplate && !InAllowDynamicCreation) [File:D:\Engine\Source\Runtime\UMG\Private\WidgetBlueprintGeneratedClass.cpp] [Line: 133] How can I figure out which widget, without having to debug in and catch it before the check()?

#

I presume this is because of the potential bug with force slow contruction path: https://issues.unrealengine.com/issue/UE-59665. I would just disable force slow on all my widgets, but I've got 1000s and you can't seem to through the mass matrix?

#

We're in 4.20.3 too.

#

An easy alternative would be: List all widgets with slow creation enabled, then I can manually disable it.

toxic dove
#

it's easy to just debug and look at the callstack

#

it will tell you which widget

#

climb the callstack to the widget responsible

lone shoal
#

That'll require an engine rebuild being we're using a custom rocket build, but yeah I guess that is probably the easiest way.

#

It's really bloody annoying that the assert doesn't just print the name of the widget in question though.

toxic dove
#

why would it require a rebuild?

#

you attach VS to your editor, or launch the editor through VS, and then reproduce the crash

#

then just look at callstack ๐Ÿคท

warm vault
#

maybe he didnt download the debug information

lone shoal
#

The crash only occurs in builds, not in the editor.

warm vault
#

oh I see

craggy holly
#

With Slate widgets, do widgets inherit the SLATE_ATRRIBUTES of their parent class?

#

And call the Construct() function with those args?

craggy holly
#

Anybody know how to declare PROPERTY_BINDING_IMPLEMENTATION for a non-slate type?

#
    UPROPERTY(EditAnywhere, Category = "Radar", meta = (ClampMin = "0.0", UIMin = "0.0"))
    float PulseFadeTime;
    UPROPERTY() FGetFloat PulseFadeTimeDelegate;
    PROPERTY_BINDING_IMPLEMENTATION(float, PulseFadeTime);

    UPROPERTY(EditAnywhere, Category = "Radar")
    FVector RadarSourceLocation;
    UPROPERTY() FGetVector RadarSourceLocationDelegate;
    PROPERTY_BINDING_IMPLEMENTATION(FVector, RadarSourceLocation);

    UPROPERTY(EditAnywhere, Category = "Radar")
    uint8 RadarTeam;
    UPROPERTY() FGetByte RadarTeamDelegate;
    PROPERTY_BINDING_IMPLEMENTATION(uint8, RadarTeam);```
#

FGetFloat works fine

#

FGetVector and FGetByte don't compile. Totally guessing as to what they're supposed to be, since there's no documentation on this and very few examples.

craggy holly
#

solved

#

Need to create UPropertyBinding objects and delegates for them. ugh

lyric shoal
royal geode
#

What exactly @lyric shoal?

#

Doing that outside of a detail panel?

#

Cuz the easiest way might be to create a detail panel widget

lyric shoal
#

it's SNew(SDockTab)

#

I want custom tab with specific stuff for our game

#

probably I can just put text field there and load file that way

#

but this thing looks better

royal geode
#

So you want to show an object properties?

lyric shoal
#

It's data asset selection

royal geode
#

๐Ÿค”

lyric shoal
#

UPROPERTY(EditAnywhere)
does that in blueprint window but I need it in the tab

#

And I was like there got to be a way to do that properly without recreating every button of this thing

royal geode
#

Yep create a detail panel

lyric shoal
#

I not sure I understand how to do that. Well got to google

#

i can create detail panel for my custom tab?

royal geode
#

@lyric shoal ```cpp
FPropertyEditorModule& PropertyEditorModule = FModuleManager::LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");
FDetailsViewArgs DetailsViewArgs(false, false, false, FDetailsViewArgs::HideNameArea);

WorldSelectDetailsPanel = PropertyEditorModule.CreateDetailView(DetailsViewArgs);
WorldSelectDetailsPanel->SetObject(MyObject, true);

#

And then can use WorldSelectDetailsPanel.ToSharedRef() to get the widget

lyric shoal
#

thanks I will try that. Do you probably have some links what I can read about it?

royal geode
#

I usually just look at the engine code

#

ยฏ_(ใƒ„)_/ยฏ

#

There's probably some blogs mentioning it though

lyric shoal
#

Yeah it's just kinda slow way to do that ๐Ÿ˜ƒ

royal geode
#

hehe

#

I kinda think the opposite ๐Ÿ™ƒ

#

Using engine code guarantee you to have the latest code

lyric shoal
#

How do you find what code to read? Widget reflector?

royal geode
#
  • Ctrl Shift F
lyric shoal
#

oh just searching for usage

#

somehow I can find how those buttons implemented

low bluff
#

You really just spawn a DetailsPanel.
That's what Epic uses everywhere.

#

You can point it to an UObject Instance that holds Variables.
And these variables will show up in the DetailsPanel just like they do in a normal Blueprint.

#

It's basically the exact thing you see when highlighting an Actor in the Scene and looking at the Details Tab on the right.

#

That means you simply create a UObject Child. Put all your information you want to display into that and then create the DetailsView and set the Object to an Instance of your UObject Child.

#

The rest is handled in the Engine.

#

You can further customize this with a DetailsCustomization

#

Epic has a Stream in which, I think, Michael Noland talks about it and shows an example.

lyric shoal
#

@low bluff But can I do that without actor in the scene? I don't have that

low bluff
#

Yes, it works on a UObject basis

#

The Actor thing is just an example

#

Watch the video I posted please

#

@lyric shoal

lyric shoal
#

I watched it. Probably just have to stick with it for some time to understand

#

it's just buttons that I created in new tab work great. And this UObject thing is something I need to merge with my buttons. So I am confused atm

low bluff
#

Well you can leave the buttons in there?

#

You can always put the DetailsView in some VerticalBox or so

#

And your buttons below that

#

Or above

#

Or HorizontalBox

#

Whatever you want

lyric shoal
#

Thanks I am going to try that

lyric shoal
#

So there is SNew(SObjectPropertyEntryBox)
and looks like it's what I need

lyric vortex
#

Has anyone tried turning off pixel snapping in the engine?

low bluff
#

Hoverloop_Win64_Shipping!FHittestGrid::FindFocusableWidget<<lambda_20e01330dba2e93322511effa011bc64>,<lambda_89daff5bf47f11501fe467461d258219>,<lambda_cbd514484e8df5aac6c36d9225987898> >()
Hoverloop_Win64_Shipping!FHittestGrid::FindNextFocusableWidget()
Hoverloop_Win64_Shipping!FSlateApplication::AttemptNavigation()
Hoverloop_Win64_Shipping!FSlateApplication::ProcessReply()
Hoverloop_Win64_Shipping!FEventRouter::Route<FReply,FEventRouter::FBubblePolicy,FAnalogInputEvent,<lambda_a5074b48e3f487d955abe2a2156baffa> >()
Hoverloop_Win64_Shipping!FSlateApplication::ProcessAnalogInputEvent()
Hoverloop_Win64_Shipping!FSlateApplication::OnControllerAnalog()
Hoverloop_Win64_Shipping!XInputInterface::SendControllerEvents()
Hoverloop_Win64_Shipping!FWindowsApplication::PollGameDeviceState()
Hoverloop_Win64_Shipping!FEngineLoop::Tick()
Hoverloop_Win64_Shipping!GuardedMain()
Hoverloop_Win64_Shipping!GuardedMainWrapper()
Hoverloop_Win64_Shipping!WinMain()
Hoverloop_Win64_Shipping!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll```
#

Anyone an idea why this happens? It's UMG, but since this is Engine code, #slate makes more sense.
As far as I can see, it tries to navigate based on controller input and crashes on FindFocusableWidget when trying to focus the next widget.

#

4.19 and seems to happen when going from gameplay level back to mainmenu

#

Sadly doesn't seem to happen outside of a shipping build, so I can't debug further

low bluff
#

Seems like it's "fixed" in 4.20.3 Hotfix

#

Now I have 0 idea if that means that it was only broken in 4.20 or also in 4.19 already

#

@silent patrol Is it possible for you to check if "UE-64239" was reported in 4.19 already?
The issues page is not listing it for me (probably a private entry).
I would just like to know if I'm doing something wrong of if this is something Engine related.

#

Idk if @fluid steppe has access to the issues page and could check that for me.
Still pinging just in case :P

royal geode
#

@low bluff Weird, nothing looking like that in the commits between 4.20.2 and 4.20.3

#

Have you tried in 4.20.3 to see if it's actually fixed? ๐Ÿค”

low bluff
#

No, don't know what is cuasing it and can't update the project atm

next chasm
#

Does any of you have problems with custom cursors ? The scale is off by quite a bit

toxic dove
#

you should be using hardware cursors

#

look at your project settings and search hardware cursor

#

(this is assuming you are in 4.18+ i think)

next chasm
#

@toxic dove How come, are they better ?

toxic dove
#

of course hardware cursors are better

next chasm
#

ok i'll give it a swirl, thank you @toxic dove

fluid steppe
#

@low bluff I am not seeing UE-64239

low bluff
#

Amanda already looked it up for me. The bug you just posted got listed in the 4.20.3 Hotfix Forum Thread

#

Simply wanted to know if that bug existed in 4.19 or ealier already.

fluid steppe
#

I can't see the history of it from here.

low bluff
#

But Amanda said it only got reported in 4.20, so no one knows I guess.

fluid steppe
#

I am at home.

#

I can check on Monday

low bluff
#

Don't worry. It's been quite a while since I pinged you :P

#

Have a nice weekend!

halcyon grove
#

Hello, all. I'm trying access a TSublcass<> property in a custom property editor

#

But I CANNOT find how to access the selected class through the PropertyHandle

#

There is a GetValue for everything except classes

#

Can anyone point me in the right direction? Thanks!

halcyon grove
#

Found it. It appears one must use AccessRawData and then reinterpret_cast which makes my heart stop

#
TSubclassOf<UBBSAttribute> AttributeClass;
    TArray<void*> RawData;
    AttributePropHdl->AccessRawData(RawData);
    ensure(RawData.Num() == 1);
    AttributeClass = *reinterpret_cast<TSubclassOf<UBBSAttribute>*>(RawData[0]);
    if (IsValid(AttributeClass)) {
}
#

Please help if you can. I don't want this to be the correct way to access a subclass drop-down property

royal geode
#

@halcyon grove a UClass is an uobject

#

So GetValue(UObject*&) should work

quaint zealot
#

Anyone using FSlateDynamicImageBrush with 4.20 ?

#

Apparently the class was refactored and ResourceObject is private

toxic trench
#

@silent patrol with your loading screen plugin, when bWaitForManualStop is used, what do I have to call for stopping it?

low bluff
#

@toxic trench "StopMovie" on the MoviePlayer

#

It does a bunch of tests

// Continue to wait until the user calls finish (if enabled) or when loading completes or the minimum enforced time (if any) has been reached.
        // Don't continue playing on game shutdown
        while ( !GIsRequestingExit &&
                ((bWaitForManualStop && !bUserCalledFinish)
            ||    (!bUserCalledFinish && !bEnforceMinimumTime && !IsMovieStreamingFinished() && !bAutoCompleteWhenLoadingCompletes) 
            ||    (bEnforceMinimumTime && (FPlatformTime::Seconds() - LastPlayTime) < LoadingScreenAttributes.MinimumLoadingScreenDisplayTime)))
{...}
#

One of them is (bWaitForManualStop && !bUserCalledFinish)

#

Means if bWaitForManualStop is true, it would stop if you set bUserCalledFinish to true

#
void FDefaultGameMoviePlayer::StopMovie()
{
    LastPlayTime = 0;
    bUserCalledFinish = true;
}
#

So if his Plugin exposes that, then that's your answer. If not, then you'd need to expose it yourself.
Since you use the Plugin, I assume you use this in BP atm?

toxic trench
#

@low bluff thanks!

#

not quite sure why you think using the plugin is related to using BP? ๐Ÿ˜„

#

I always use a mix of BP and C++

low bluff
#

Cause if you use C++ you don't need the Plugin?

#

@toxic trench

#

I mean spawning a Loadingscreen is a few lines

toxic trench
#

why should I spend time with doing it myself if I can let the plugin handle it

low bluff
#

Well, I needed a few lines. Idk what the Plugin does, but for a Loading Screen it doesn't need much

#
void UHLGameInstance::BeginLoadingScreen(const FString& MapName)
{
    if (!IsRunningDedicatedServer())
    {
        FLoadingScreenAttributes LoadingScreen;
        LoadingScreen.bAutoCompleteWhenLoadingCompletes = true;
        LoadingScreen.bMoviesAreSkippable = false;
        LoadingScreen.bAllowInEarlyStartup = false;
        LoadingScreen.bMoviesAreSkippable = false;
        LoadingScreen.bWaitForManualStop = false;
        LoadingScreen.MinimumLoadingScreenDisplayTime = 5.f;
        LoadingScreen.WidgetLoadingScreen = SNew(SLoadingScreen_Base).InLoadingScreenImages(LoadingScreens);

        GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
    }
}
#

Is the Plugin any faster or smaller?

toxic trench
#

well the plugin needs 0 lines of code ๐Ÿ˜„

low bluff
#

So it exposes it to the Editor?

toxic trench
#

its fully configured through project settings

low bluff
#

Ah well, then I wrote that wrong, that's what I see as BP too

#

Kinda at least

#

Everything outside c++, exposed to the Editor. Sorry

toxic trench
#

@low bluff is it normal that begin play is only called after the loading screen is over?

low bluff
#

That I'm not sure. I usually use it with the settings I posed above

#

For us it's only for between two levels when loading

toxic trench
#

I want to end the loading screen on begin play + delay of 4 seconds, but I see that it never ends since begin play never runs. Only if I click the loading screen to skip it, then begin play starts executing

low bluff
#

That can totally be normal

#

As BeginPlay is seen as the start of the match or?

#

Might be that the BeginPlay stuff waits for the MoviePlayer to stop playing

#

But not sure

toxic trench
#

well I don't just want to use that loading screen for the level load itself but also for my own stuff that I start doing when the level is loaded, so I need begin play on all actors to run while the loading screen still plays

low bluff
#

I'm not sure what the exact usecase of that thing is

#

It might be tied into the Loading of Maps

#

You could bind to the Start and End of Map Loading

#

And when the Map finishes loading, you just create the loading screen widget "again"

#

So that it seamless goes over from map loading screen to the one you control

#

Just a random idea, could also be that you can somehow get the map loading screen to stay alive with begin play calling

#

Might be worth digging into the source when beginplay is being called

toxic trench
#

pretty hard to make the movie continue play at the exact same time though

low bluff
#

Ah you actively play a movie?

#

Hmpf

toxic trench
#

what do you mean with "actively"?

#

the movie player plays a movie of course ๐Ÿ˜„

low bluff
#

I just have a Slate Widget show images, tipps, loading throbber etc.

#

LoadingScreen.WidgetLoadingScreen = SNew(SLoadingScreen_Base).InLoadingScreenImages(LoadingScreens);

toxic trench
#

I use a 16 second movie

low bluff
#

Hm, then I'm not sure tbh. Check if BeginPlay depends on the movieplayer

toxic trench
#

I guess I have to do that, yeah

#

actually, its Tick that doesn't run, BeginPlay runs

#

but since Tick doesn't run the Event Begin Play in BP also doesn't run

#

@silent patrol would be nice if you could comment on that

low bluff
#

Can't seem to find any hint towards the MoviePlayer

#

I'm up to the TickTaskManager already and it's pretty much chaos down here

#

I assume the MoviePlayer or LoadingScreen being infront of everything is actively stopping your frame with being started

#

So Tick is also not happening

#

Could be a stupid side effect?

tame granite
#

shooter game does:


                        ScreenRes = Viewport->GetSizeXY() / AllottedGeometry.Scale;

Docs say FGeometry.Scale is deprecated; where should be used in its place? I got one crash when resizing window where it caused a divide by zero there

#

protected against it, but then saw that var is deprecated

#

ah looks like it was changed to:


        if (Viewport)
        {
            const FVector2D Size = Viewport->GetSizeXY();
            ScreenRes = (Size / AllottedGeometry.Scale).IntPoint();
        }```
#

fixes int rounding issue that caused divide by zero, but still using deprecated Scale value

mild oracle
#

Is there a way to create slate/UMG widgets with custom-shape hitboxes? I want to make a two-part button that's split diagonally, clicking on the top-left triangle area does one thing, bottom-right does another.

#

I figured I'd ask here over #umg as it seems a lower-level issue

low bluff
#

In most cases you'll have to math it out @mild oracle

#

E.g. for your diagonal cut you can math out if the player clicked above or below it

#

Half sure there is not custom hitbox. It's a rectangle or nothing :D

stray plank
#

@silent patrol was there a reason the Slate.PixelSnapRenderTransform cvar (and functionality) was removed in 4.20? Will try to add it back into our engine fork for now, but curious if there was some important reason it had to go away?

shell falcon
#

I'm creating some custom editor tools for the first time, is there any better way to create slate layouts other than manually? At Valve we had similar markup but also had a visual editor that produced code.

tame granite
#

I have a blank widget to capture drag/drop events and I added it to the main GameViewportClient SOverlay with a high Z priority. It gets the drag/drop events, but doesn't let normal mouse events through to siblings in the SOverlay, even though they are unhandled

#

seems they only bubble up the hierarchy and don't visit siblings.. is there a way to change that (I've seen some routing policy stuff in the code?)

tame granite
#

reeally ugly but this is what I ended up with:


    Super::AddViewportWidgetContent(DragDropWidget.ToSharedRef(), 1000 );
    
    FWidgetPath OutPath;
    if (FSlateApplication::Get().FindPathToWidget(DragDropWidget.ToSharedRef(), OutPath))
    {
        if (OutPath.Widgets.Num() > 2)
        {
            auto ParentOverlay = OutPath.Widgets[OutPath.Widgets.Num() - 2].Widget;
            auto OverlayParent = &(OutPath.Widgets[OutPath.Widgets.Num() - 3].Widget.Get());
            SOverlay * CastedOverlayParent = OverlayParent->GetType() == FName(TEXT("SOverlay")) ? static_cast<SOverlay *>(OverlayParent) : nullptr;
            if (ensure(CastedOverlayParent))
            {
                Super::RemoveViewportWidgetContent(DragDropWidget.ToSharedRef());
                CastedOverlayParent->RemoveSlot(ParentOverlay);
                CastedOverlayParent->AddSlot(0)
                    [
                        DragDropWidget.ToSharedRef()
                    ];
                DragDropWidget->AddSlot(0)
                    [
                        ParentOverlay
                    ];
            }
        }
    }
    ```
#

DragDropWidget derives from SOverlay and handles drag/drop events.. I get widget path and inject it as a parent of the main UGameViewportClient::ViewportOverlayWidget

#

I'm sure there is a much better way to have done it..

eternal wave
#

how to close a SWindow by code

#

?

tame granite
#

@eternal wave I think it is this: cpp /** Request that this window be destroyed. The window is not destroyed immediately. Instead it is placed in a queue for destruction on next Tick */ void RequestDestroyWindow();

#

on SWindow

#

There is also:

    /** Warning: use Request Destroy Window whenever possible!  This method destroys the window immediately! */
    void DestroyWindowImmediately();```

better to use the former from the comments there.
echo eagle
#

hi - is there a way to use FSlateDrawElement::MakeLines such that it stays within a scissorrect? specifically i am trying to paint lines onto a widget, and i want them to stay within the bounds of the widget and not overdraw

#

here's an example of what i mean. i am moving it with the mouse. i want it to stay within the bounds of the black box and not move out into the gray area

#

nvm. i figured it out. i needed to set the clipping property

flat panther
#

Hey ๐Ÿ˜ƒ Please, I need help. How can I get my transform in editor? I mean, I want to spawn some objects in front of me....something like MyRot().fwdvector()*100.f; It's possible in editor?

low bluff
#

@flat panther What does that have to do with Slate?

flat panther
#

@low bluff I'm working on plugin, extending editor..after I click the button, I want to spawn, but can't figure out how to get my location in viewport...

#

hm I see there is maybe a better place

low bluff
#

Probably can check the ViewportClient class

flat panther
low bluff
#

But this is really not Slate related

toxic dove
#

is it possible to apply a rotation to the hardware cursor?

cold hinge
#

Hi, I need to create a horizontal scroll widget that hold children.i want all children to have the same width that match screen width. I tried with a size box but I can't get it working properly.

#

In fact I take the screen width and tried to remove the dpi scaling but the result in slate unit is not correct so my widget don't have the good size. Can anyone can drive me I the right path to do this?

#

My goal is to create a menu like Clash Royale that has a horizontal scroll menu. Each menu item has the width of the screen. Thanks

toxic dove
#

make a vertical box widget... add it to the screen... make it "fill" alignment and it will cover the whole screen

cold hinge
#

My widget are in a scrollbox. I can t use this trick.

toxic dove
#

so what? same principle. make the scrollbox fill align

cold hinge
#

I need the widget inside the scroll box to "fill" I mean I need each child to have the same size with Width = screen Width

#

The Scrollbox already fill the screen but the child inside it don't follow the same rule. They are using the DesiredSize.

toxic dove
#

then don't let them use desired size

cold hinge
#

How do you suggest to do that? How can constrain to the parent width?

heavy badger
toxic dove
#

what exactly is your question..?

heavy badger
toxic dove
#

that looks like a texture sample

heavy badger
#

I also tried a texture sample but mine looks different

toxic dove
#

๐Ÿคท its definitely a texture sample

heavy badger
#

hmm ok, I guess that's not the issue then. The above material setup is supposed to fix my widget issue but it doesn't work for me.

#

I'll ask in the forums

mild oracle
#

I've found SDragAndDropVerticalBox that looks like it might help...

untold oyster
#

@heavy badger What is the issue you're trying to fix?

#

You probably want to use a RetainerBox. With that you can set your Param2D (needs to be a TextureParameter2D) by name in the RetainerBox's details panel, "Texture Parameter" input box

#

I just got done using it for something else (curved HUD material) so that'd be my guess.

heavy badger
#

I've got it kinda working now, instead of creating the material from scratch I just found the parent material which had the SlateUI.

strange topaz
#

any idea on how the ue4 colorpicker's eye dropper works? Is it possible to check the source-code of the colorpicker and see how the eye dropper works?

low bluff
#

Yeah it's possible

#

It's all around SColorPicker or so

#

Just check GitHub/Source

strange topaz
#

So i suppose i found it. It was under SEyeDropperButton.cpp, but i didn't get much from that, considering i'm completely unexperienced with c++ and github.

https://imgur.com/8xTZaPg This is what i ended up with and ofc i still don't understand how the color eyedropper works, but i'm pretty sure that it isn't possible to make the eyedropper system in blueprint which is what I'm experienced with.

So my question is this. Is it possible to make an eyedropper plugin? (because then i'd be able to add it in a bp)

low bluff
#

Well, there are multiple ways to expose that

#

I assume this is not a widget in itself?

#

If you only want the Coler EyeDropper, you can probably use the FPlatform stuff they use and expose that

strange topaz
#

I guess yeah, it's possible to make a plugin.

restive thunder
#

hello i have a c++ menu and wanna fake a left mouse click on it, like a macro of many mouse positions and clicks combined in 1 click

#

can i use WidgetInteractionComponent on c++ menu?

restive thunder
#

it has Mouse as Source, but doesn't really work in 2D

desert lark
#

Does anyone here know If there any example project out there that uses SWidgetCarousel of unreal engine, or any project that has a carousel UI that I can look into ?

mild oracle
#

@desert lark There are a bunch of widgets in slate that aren't really used. I'd search the test code in the engine and google but that's about all there is

desert lark
#

@mild oracle, thanks for replying, searched engine code, it isn't used anywhere. And I don't see any projects that use it. Well, I think I'll make my own carousel using UMG and animated widgets.

ocean mason
#

anyone knows if possible to get cursor location in SMultiLineEditableTextBox. like row number and character?

elder badger
#

Is there a tutorial to add a button to the editor's toolbar somewhere?

#

I can add the button just fine, but whatever I do to change its texture and text, it crashes with no information whatsoever.

#

This is likely the dumbest module from UE4 that I came across so far.

#

And everywhere I look on the internet, it's just "how to add a button", "how to make a list". No explanation whatsoever about how everything is tied (loosely glued) together, apart from the one the vaguest sections the official docs have to offer.

ivory adder
#

look at engine source code

main hedge
#

will localization gather correctly parse NSLOCTEXT split over multiple lines so it doesn't become multiple monitors wide?

#

it seems like the style in the engine source is just to make it ridiculous wide..

elder badger
#

Thank you for the very helpful tip. It never crossed my mind to look at the engine's code. I was hoping to get away by bashing my dick against the keyboard and pray for some magic.

toxic dove
#

that always works out

low bluff
#

@elder badger There is one single Epic Games Stream about it

#

Not a tutorial, but at least some info

elder badger
#

I watched it.

#

Michael Noland.

low bluff
#

Yeah, it helps a bit, but well.

elder badger
#

Found the answer in the mean time, but thanks! Took me 2 days to add a button with text and an icon.

low bluff
#

For the rest: Plugins can be created with Templates. One of these adds a button already.

elder badger
#

Yea, I looked at those. They're sort of helpful

#

But as a first time slate experience, every single step was horrible. A macro hell-hole.

thin briar
#

Does anyone know if ReadPixels should display the UMG widgets currently on screen? Its not showing for me.

craggy holly
#

Anybody else experience slate crashing during map travel?

#

Seems to occur all the frigging time

#

Problem is it's in the Render Thread, so it's almost impossible to trace

#

SlateRHIRenderingPolicy line 798 - which is even more puzzling

low bluff
#

Does it persist if you remove all widgets?

craggy holly
#

Figured it out.. turns out you can't use the Movie Player for seamless travel ๐Ÿ˜ฆ

#

Which is annoying because it breaks my loading screen.. dangit

#

And naturally, steam doesn't work without seamless travel. RIP

#

Guess I should update my loading screen tutorial :/

low bluff
#

Waaaait a minute

#

That would affect me too

#

fml

craggy holly
#

Was having so many strange issues with it, turns out that's likely the cause

#

Only reported on UDN though ๐Ÿ˜ฆ

#

Apparently you can use UMG/Slate widgets added via the usual method for seamless travel, and use the media framework to play videos etc.

#

But anything done with Movie Player isn't safe for seamless travel apparently ๐Ÿ˜ฆ

craggy holly
#

Alright well now I'm getting the crash with no loading screen. Lord I hate seamless travel

low bluff
#

Hm I'm actually all for it

#

Cause of the easy way of passing stuff

#

Does it only happen with seamlesstravel?

craggy holly
#

yeah, absolute travel seems okay

#

seamless seems to cause crashes pretty much every time in slate

#

Sooo.. seems to be related to SMeshWidget

#

If I remove those, I get perfect seamless travel

#

Greaaaaaat

low bluff
#

@craggy holly Are you getting loading screens working at all for seamless travel?

#

I use the same GameInstance call etc. but it seems my screen stays black

#

Actually I use the MovePlayer ๐Ÿค” It's not crashing for me

#
if (!IsRunningDedicatedServer())
{
    FLoadingScreenAttributes LoadingScreen;
    LoadingScreen.bAutoCompleteWhenLoadingCompletes = true;
    LoadingScreen.bMoviesAreSkippable = false;
    LoadingScreen.bAllowInEarlyStartup = false;
    LoadingScreen.bMoviesAreSkippable = false;
    LoadingScreen.bWaitForManualStop = false;
    LoadingScreen.MinimumLoadingScreenDisplayTime = 5.f;
    LoadingScreen.WidgetLoadingScreen = SNew(SLoadingScreen_Base).InLoadingScreenImages(LoadingScreens);

    GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
}
craggy holly
#

You got UDN access? The only post on the subject was from 2016.. maybe it's been changed since then

low bluff
#

Nope.

#

Quick other question, if I have UIOnly Input Mode, what class grabs input events if nothing is focused?

#

GameViewport?

craggy holly
#

I believe nothing, might just get absorbed by slate

#

Hmm possibly

mild oracle
#

Has anyone dealt with supporting 2x resolution UI textures for 4k/high-DPI? Did you roll your own solution?

quaint zealot
#

We just upscaled every resource 2x

#

Worked fine in 1080p

mild oracle
#

@quaint zealot Doesn't that make the UI really blurry? :S

quaint zealot
#

It didn't, provided you make sure to use power-of-two assets with the "UI" domain & compression

mild oracle
#

What compression did you use?

quaint zealot
#

The "UI" one

mild oracle
#

For me that's defaulting to "DXT1/5, BC1/3 on DX11""

quaint zealot
#

"UserInterface2D"

#

And the "UI" texture group

mild oracle
#

UserInterface2D is uncompressed

quaint zealot
#

Yeah

#

Probably

#

We mostly had small icons here so it didn't matter much

mild oracle
#

I guess I can test w/o any fancy 2x solution and see how it feels at 4k

#

A lot of other frameworks/platforms have a 2x asset solution

quaint zealot
#

You can definitely build that too

#

Create a slate style set that holds all your assets, make a 1080p and a 4K version with dedicated assets

main hedge
#

you'd have to carefully design the ui with that restriction in mind, otherwise you'll absolutely need non-power of 2 textures for ui ๐Ÿค”

mild oracle
#

Which restriction?

#

I'm already using non-power of 2 textures for UI, it became way too much of a hassle