#slate

1 messages ยท Page 14 of 1

river thunder
#

it's not bad as help, but i feel like there's no ground truth for Slate, since it's so... rarely used in the wild

#

also it's easy to steer ChatGPT into the wrong direction unintended (when not knowing what the result should be like)

#

i think that's where things went down the drain

grave hatch
#

Just wrap that class in a uuserwidget.

#

Sorted

river thunder
#

i don't need a UUserWidget, that was total BS

#

textblock etc. are also UWidget

#

i should have looked at engine classes earlier tbh

#

also shows up as UWidget

jade chasm
#

I'm working on some editor tooling and I'd like to display a TArray in an editable way, like the details view. From what I can tell, there's no easy way to do that and I need to write my own.

grave hatch
#

Is it a uproperty?

jade chasm
#

yes

grave hatch
#

FPropertyEditorModule's create single property view?

jade chasm
#

that gives me a visible array with + and trash icons, but I can't click on them.

#

in theory single property should work on array?

grave hatch
#

Is there anything else on the object containing the array?

jade chasm
#

yes

grave hatch
#

You could create an entire details view to edit it.

#

Or use a filter.

#

Or use the CustomDetailsView plugin.

jade chasm
#

doesn't that only work in a regular details view panel?

#

or am I thinking of something else

#

it's a single node for giving items to a character that mission designers use. I'm about to admit defeat and have them edit it in the details view, rather than on the node itself.

grave hatch
#

CDV is a plugin we developed because working with the details panel was shitty.

#

(it's in the engine, just enable it)

jade chasm
#

hmm. who is we?

grave hatch
#

The company I work for.

#

I think most of the reasons we made it have gone now, though, lol.

jade chasm
#

you got me all excited

#

I am not familiar enough with slate.

grave hatch
#

Time to learn. ๐Ÿ™‚

jade chasm
#

Unfortunately I think now is not the time for this task.

pallid gyro
#

It's never been easier to get into slate, the only thing confusing about slate is the syntax and with copilot the syntax becomes trivial.

stuck jewel
#

(This video is from me having a problem with it, lol)

obtuse prairie
#

im using the same label name and settings, but on the level editor toolbar no label is shown

#

only diff between these is the section

        UToolMenu* ToolbarMenu = UToolMenus::Get()->ExtendMenu("AssetEditor.BlueprintEditor.ToolBar.GraphName");
        FToolMenuSection& ToolbarSection = ToolbarMenu->AddSection("PrefabSystemSection.BlueprintEditor.Top", INVTEXT("Prefab System"));

        UToolMenu* ToolbarMenu = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorToolBar.User");
        FToolMenuSection& ToolbarSection = ToolbarMenu->AddSection("PrefabSystemSection.MainLevel.Top", INVTEXT("Prefab System"));
obtuse prairie
grave hatch
#

Look at how the other buttons do it?

#

I think it works if you add it with a ui command maybe?

obtuse prairie
#

i tracked how the platforms button is done and i tried to mimic it (while at the end it was "doing the same"), nothing to make it show the label

grave hatch
#

We've definitely had success in adding buttons with text.

obtuse prairie
#

uh, there is no ui command to pass when adding a entry ?

#

thats my code, none of the funcs asks for a command list

// main level top bar
    {
        UToolMenu* ToolbarMenu = UToolMenus::Get()->ExtendMenu("LevelEditor.LevelEditorToolbar.User");
        FToolMenuSection& ToolbarSection = ToolbarMenu->AddSection("PrefabSystemSection.MainLevel.Top");

        // preview settings options
        ToolbarSection.AddEntry(FToolMenuEntry::InitComboButton(
            PrefabPreviewSettings_EntryName,
            FToolUIActionChoice(),
            FOnGetContent::CreateLambda([this]()
            {
               return PreviewSettings_LevelEditor_GenerateWidget();
            }),
            PrefabPreviewSettings_Label,
            PrefabPreviewSettings_ToolTip,
            FSlateIconFinder::FindIcon(PrefabPreviewSettings_IconName),
            false
        ));
    }
grave hatch
#

Oh you want a combo button?

obtuse prairie
#

yeah, its a combo button

#

same code for the BP section button, only the toolmenu and section is different

grave hatch
#

When I said a ui command, I meant an FUICommand, not a command list. ๐Ÿ™‚

#

But yeah, I I'm not sure you can do that with a ui command.

obtuse prairie
grave hatch
#

Check FPixelStreaming2Toolbar::RegisterMenus()

obtuse prairie
#

doesnt exist for my rider ?

#

5.5

grave hatch
#

Shrug

bronze vigil
#

anyone knows of any "barebones" example of a SViewport being used for a custom 3D asset editor? afaik all the uses in the UE editor are pretty complex to analyse

kindred nova
#

like the one in bp editor or anim editor? anim editor is relatively small

grave hatch
#

The one in the material designer plugin is pretty simple (DynamicMaterial plugin) It's got a fairly minimal extension of SEditorViewport.

#

SDMMaterialPreview

bronze vigil
#

alright, thank you

#

Also, am I correct in thinking that if I wrap SViewport (not SEditorViewport) in a UMG widget I can spawn a 2nd world and render it in game in the UI, including in a shipping build not just in editor?

grave hatch
#

Correct

#

The pocketworld plugin in Lyra (I think?) does something like that.

kindred nova
#

althought it is messy - can be refactored / cleaned up

bronze vigil
#

thank you

bronze vigil
#

oh yeah messy is an understatement. 1 shared .cpp for all classes lol

bronze vigil
#

also using some existing level in a preview scene seems very annoying to do
creating a FAdvancedPreviewScene and FEditorViewportClient and using UGameplayStatics::OpenLevelBySoftObjectPtr on the FEditorViewportClient world doesn't seem to work, it'll just use the scene generated by FAdvancedPreviewSceneAnyway

bronze vigil
#

ok so I'm pretty sure that :
SEditorViewport requires a FEditorViewportClient
FEditorViewportClient requires a FPreviewScene
FPreviewScene on its own already creates and set up a world in specific ways, no apparent way to override that behaviour
so if I want to just show a level as is without interference, I might have to remake all 3 of these classes from scratch, or at least copy them and hack them into doing what I want
swell

worn gust
#

Hi, i'm fighting with WrapBox widgets to allow for insertion of new widgets in them (since by default only adding at the end works)

I subclassed UWrapBox and made a function identical to UPanelWidget::AddChild, but using insert instead of adding to Slots array.
The result is that new widgets are still shown at the end of the wrap box even tho they are not at the end of the Slots array.
If i remove the widget from viewport and add it back, the order is now the expected one.

This means that there must be a way to refresh the WrapBox widget, but i do not know how

bronze vigil
obtuse prairie
#

how should i profile to known what takes so much time here ?
im in the editor

river thunder
obtuse prairie
#

i get random frame drop, 120 to 60

river thunder
#

then you should look at a frame which drops

#

because that one is closer to 120 with 6ms

upbeat orchid
#

Is there a way to get the modified UV coords in material editor
i.e. I assume the DrawAs Box for SImage might have a corresponding variabl that could be accessed in the material editor?

river thunder
#

would check 1/2/3/4

upbeat orchid
#

I had a lapse in brain function. Im using a RetainerBox which doesnt know about its child SImage and its DrawAs type so it's material most likely has no access to it by default

upbeat orchid
#

found a useful reference (GetUserInterfaceUV node)

#

note: 9 slice UV isnt actually 9 sliced for a retainer box ( which has no DrawAs option )
annoyingly, OutputPixelSize is physical pixels instead of device pixels ( doesnt account for window scale so basically useless imo... )

river thunder
#

i thought texel density was in one, but maybe they changed it to be a separate node alltogether ๐Ÿคท

upbeat orchid
#

oh maybe this will help me convert to device pixels then? (will try it in a bit) im a bit unfamiliar with gpu terms tbh. ( comepletely disregarded this on the first pass looking for stuff )
Im also on an old engine version ( 4.26 )
EDIT: scene texel size doesn't seem useful for this use case. Not my favorite solution, but just going to pass in needed information as a parameter for now
EDIT2: solution for me was to modify SRetainerWidget to support DrawAsBox

obtuse prairie
#

Same for adding BPSummoner tabs

obtuse prairie
grave hatch
#

Ah.

vernal moth
#

How am I supposed to update this SComboBox after I make a selection lol, surely I don't need to use SharedPtrs to the entries. In my case it's an array of FNames

.OnSelectionChanged_Lambda(
[this](TOptional<FName> Selected, ESelectInfo::Type SelectInfo)
{
   SelectedStyle = Selected.Get("Empty");
   ComboBox->SetSelectedItem(SelectedStyle);
   ComboBox->RefreshOptions();
})
obtuse prairie
#

thats how it works on enum combo box

#

i store the value somewhere else, set/get it from the get/set Slate lambdas

obtuse prairie
vernal moth
# obtuse prairie i think it has a GetContent/CurrentValue thing

Yeah It does, I found my issue anyway. I can't use an option that doesn't exist in the source options. Basically I had an array of FNames and I was starting the combo box with "Empty" (just for the UI to be "nice") and it turns out bc Empty wasnt in my options it was being weird. It is all sorted now though

obtuse prairie
thick ice
#

Hello! Does anybody know why focusing on a Slate widget breaks the navigation system? I have a widget structure

Border // Overwrites navigation directions Up, Down, Left, Right
L Vertical Box
  L Focusable UMG widget
  L Focusable UMG widget
  L UMG Widget with focusable element
  L UMG Widget with focusable element
  L CPP Widget with focusable Slate widget
  L CPP Widget with focusable Slate widget

So navigation using gamepad works fine until I get to widgets with slate SButton. Then navigation system simply stops calling functions that are responsible for getting widget to focus on.

obtuse prairie
#

how should i manage dynamicly editing the inside of a slate widget ?

#

creating new widgets on tick, calling ClearChildren and so on doesnt seem quite right

vale stump
obtuse prairie
#

its constant

#

cant use OnPaint because its const

vale stump
#

? I mean you override OnPaint and make your own implementation

#

But yeah if you need constant updates then you need a function being called all the time. Tick works for that

#

If you're only moving widgets and don't need to recreate them, then you want OnPaint. OnPaint is where all widget drawing is done. It manages size changes and slot movement and all that stuff

low bluff
#

Might want to check what the native UButton calls and check the callstack

thick ice
low bluff
thick ice
low bluff
#

The only option you have is to follow the functions upwards in the callstack and to check where it fails for your widget. :/

#

Input in slate doesn't go very deep. Starts somewhere in the FEngineLoop and quickly reaches the Widgets

thick ice
#

The only difference from UButton I have is that I have my own SFocusButton between UFocusButton(my widget) and SButton

#

But it does not really matter which widget gets focus, my or SButton. Navigation system simply stops working

thick ice
thick ice
low bluff
low bluff
thick ice
thick ice
thick ice
split maple
#

Hi, When I create Slate widgets, I often run into the problem that I lose track of where a given widget or slot is in the hierarchy.
So I have a question โ€” do you think it's a good idea to mark every widget/slot with its place in the hierarchy using comments like this:

// A text block that displays the category name [1.1.1]
SNew(STextBlock)
.Text(FText::FromString("Category A"))
.Font(FCoreStyle::GetDefaultFontStyle("Bold", 16))```
obtuse prairie
#

how can I draw a simple line ?
i tried to replicate what i would do with UMG: an Image stretching horizontaly and only a few pixels high, but with SImage im not getting the default white image but a default checkboard texture

#

nvm, SColorBlock is a thing

river thunder
#

you can draw lines in the OnPaint method, too

#

with FSlateDrawElement::MakeLines()

obtuse prairie
#

for some reasons it feels like adding my subwidget in a scrollbar fucks up the layout ? they are all stacked

SAssignNew(PRCDataContainer, SVerticalBox);
            PRCDataContainer->AddSlot()
                .AutoHeight()
                [
                    SNew(STextBlock).Text(FText::FromString(FString::Printf(
                    TEXT("%i Prefab Reference Component%s found"),
                        CachedLoopData->CachedEntries.Num(),
                        CachedLoopData->CachedEntries.Num() > 1 ? TEXT("s") : TEXT("")
                    )))
                ];

            for (int32 i = 0; i < CachedLoopData->CachedEntries.Num(); i++)
            {
                auto& Entry = CachedLoopData->CachedEntries[i];

                PRCDataContainer->AddSlot()
                [
                    SNew(SVerticalBox)
                        // PRC Info
                        +SVerticalBox::Slot()
                        .AutoHeight()
                        [
                            SNew(STextBlock).Text(FText::FromName(Entry->PRCName))
                        ]
                ];
            }
            
            ScrollBox->AddSlot().AttachWidget(PRCDataContainer.ToSharedRef());
#

even with one slot in PRCDataContainer, it sounds like the bounding boxes are not here ? (see green area, its a line)

thick ice
# low bluff Hm, that's strange. You aren't using a InputPreProcessor by any chance?

I think I solved it. I had to override OnKeyDown function, which was blocking inputs. The navigation part made it work.

FReply SFocusButton::OnKeyDown(const FGeometry& MyGeometry, const FKeyEvent& InKeyEvent)
{
    bool Pressed = false;
    if (FSlateApplication::Get().GetNavigationActionFromKey(InKeyEvent) == EUINavigationAction::Accept)
    {
        OnKeyPressed.Execute(MyGeometry, InKeyEvent);

        Pressed = true;
    }

    FReply Reply = Pressed ? FReply::Handled() : FReply::Unhandled();

    EUINavigation Navigation = FSlateApplicationBase::Get().GetNavigationDirectionFromKey(InKeyEvent);
    if(Navigation != EUINavigation::Invalid)
    {
        const ENavigationGenesis Genesis = InKeyEvent.GetKey().IsGamepadKey() ? ENavigationGenesis::Controller : ENavigationGenesis::Keyboard;
        Reply.SetNavigation(Navigation, Genesis);
    }
    return Reply;
}
obtuse prairie
low bluff
obtuse prairie
#

so i found out that the issue came that slate needs more than 1 tick to update its layout, so i added a interval amount and it indeed helped.
my issue is that at every update you can see the widget being refilled, is there a way to hide that ?

stuck jewel
#

welcome to slate, i fucking hate it. the editor is full of this jank once you start to see it

obtuse prairie
#

i guess the only positive thing about slate is how you build it in code

mental badge
#

with the new Slate IM, can it be per world context ?

stuck jewel
grave hatch
#

IM?

upbeat orchid
#

I'm trying to get the absolute ScreenPosition ( in pixels ) of a widget relative to the viewport ( and use it for a dynamic material )
This seems to be fairly innacurate from what I can tell, and perhaps Im doing something wrong:

Get widget rect in screen space in units of physical pixels ( seems to be off by roughly 4 pixels but it grows slightly the larger the viewport is)

  const auto TopLeftPx = InWidget->GetCachedGeometry().GetAbsolutePositionAtCoordinates(FVector2D(0,0)); // <--- get this widget's position in screen space 
  const auto BottomRightPx = InWidget->GetCachedGeometry().GetAbsolutePositionAtCoordinates(FVector2D(1,1));
  
  UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
  if ( World && World->IsGameWorld() )
  {
    if ( UGameViewportClient* ViewportClient = World->GetGameViewport() )
    {
      TSharedPtr<IGameLayerManager> GameLayerManager = ViewportClient->GetGameLayerManager();
      if (GameLayerManager.IsValid())
      {
        const auto& GameViewport = *ViewportClient->GetGameViewport();
        const auto ViewportOffsetPx = GameViewport.ViewportToVirtualDesktopPixel(FVector2D( 0.f, 0.f )); // <--- get viewport widget's position in screen space
        
        return {
          .TopLeft = TopLeftPx - ViewportOffsetPx,        
          .BottomRight = BottomRightPx - ViewportOffsetPx
        };
      }
    }
  }

Get widget rect in ViewportUV space ( this is much more accurate and I dont know why ). But I need the pixel units version so I cant use it.

  const auto TopLeftPx = InWidget->GetCachedGeometry().GetAbsolutePositionAtCoordinates(FVector2D(0,0)); // <--- get this widget's position in screen space 
  const auto BottomRightPx = InWidget->GetCachedGeometry().GetAbsolutePositionAtCoordinates(FVector2D(1,1));
  UWorld* World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
  if ( World && World->IsGameWorld() )
  {
    if ( UGameViewportClient* ViewportClient = World->GetGameViewport() )
    {
      TSharedPtr<IGameLayerManager> GameLayerManager = ViewportClient->GetGameLayerManager();
      if (GameLayerManager.IsValid())
      {
        return {
          .TopLeft = ViewportClient->Viewport->VirtualDesktopPixelToViewport(FIntPoint(TopLeftPx.X, TopLeftPx.Y)), // <--- convert to ViewportUV space.
          .BottomRight = ViewportClient->Viewport->VirtualDesktopPixelToViewport(FIntPoint(BottomRightPx.X, BottomRightPx.Y)),
        };
      }
    }
  }
  return {};
grave hatch
#

The absolute position is relative to the inner window border, not the desktop or anything.

#

So if it's off by 4 pixels, that might be due to the window having a border.

upbeat orchid
#

seems to be no way to get the border width that I know of

#

from looking around

grave hatch
#

Also afaik this doesn't use UV coordinates: InWidget->GetCachedGeometry().GetAbsolutePositionAtCoordinates(FVector2D(1,1));

upbeat orchid
#

but I might have missed it

grave hatch
#

Why not just get the cached geometry (now called TickspaceGeometry) of the viewport instead of hte virtual desktop pixel stuff?

upbeat orchid
grave hatch
#

Do you need it in desktop pixels?

grave hatch
#

(in local space)

upbeat orchid
#

here is the comments:

    /**
     * Get the absolute position on the surface of the geometry using normalized coordinates.
     *   (0,0) - upper left
     *   (1,1) - bottom right
     *
     * Example: Say you wanted to know the center of the widget in absolute space, GetAbsolutePositionAtCoordinates(FVector2D(0.5f, 0.5f));
     */
    FORCEINLINE FVector2D GetAbsolutePositionAtCoordinates(const FVector2D& NormalCoordinates) const
grave hatch
#

huh.

#

Fair enough!

upbeat orchid
#

the border thing is definitely the issue tho

#

I was testing the x coordinate only. I decided to test the y coordinate because the border padding is much thicker on top for the title bar

#

and it was super offset

#

thumbsshakeleft omegalul thumbsshakeright pain

grave hatch
#

Hehe.

#

Yeah, it's shitty.

mental badge
#

And the in viewport one stops other widgets working

stuck jewel
grave hatch
#

Ah.

mental badge
#

ooo_0

#

getting the hang of this now

split maple
#

where can I find list of all available Editor/Game Styles ?

grave hatch
#

I install a plugin called Slate Icon Browser.

#

It's on git if you google it.

#

It lists them all and the icons they provide.

river thunder
#
Fab.com

Slate Style Browser is a tool for developers working with Unreal Engine's Slate UI system. It improves your UI development workflow by providing a streamlined way to explore and manage Slate styles and brushes.Why You'll Love ItEffortless Style Exploration: Easily browse and preview a wide variety of Slate styles and brushes used in Unreal Engin...

grave hatch
#

That looks nice!

#

(not the plugin I mentioned, though)

#

Seems he renamed it and expanded it. Nice.

river thunder
#

yea, the fab page links to the same github

mental badge
#

messing with SlateIM

#

hehe

drowsy galleon
mental badge
#

actually i have one issue @drowsy galleon

#

ViewportRoot eats the mouse from UI (not the world)

#

couldnt work out how to solve that

#

even if i set a low Z index

drowsy galleon
#

Like, any UI rendering in front of the slateIM root doesn't receive mouse events?

mental badge
#

thing is, its always rendering over other widgets

#

let me show you,can i DM?

#

its got some confidential stuff

drowsy galleon
mental badge
#

sent, probably in pending list

#

@drowsy galleon i think i solved it

#

sorry

#

is there a way for viewport widgets to be like movable in the viewport?

#

or are they kinda stuck in place?

drowsy galleon
#

Modifying the anchors at runtime should work but I haven't tested it

mental badge
#

i have void WarningText(const FStringView& Text) { static FTextBlockStyle ThisStyle = FCoreStyle::Get().GetWidgetStyle<FTextBlockStyle>("TextBlock.ShadowedTextWarning"); SlateIM::Text(Text, FSlateColor(FLinearColor(255, 68, 51)), &ThisStyle); }

#

this helper

#

but the text is not Orange

#

infact its the same color

#

KaosSlateIM::WarningText(TEXT("No Ability System Component found."));

#

its like the color doesnt get applied at all

#

@drowsy galleon sorry for the ping ๐Ÿ˜›

#

even tried with no text style

#

so weird, works if i do FLinearColor::Red (?)

#

๐Ÿค”

drowsy galleon
#

Does the colored text in the example window work?

mental badge
#

so it works if i use FSlateColor(FColor())

#

but not FLinearColor, unless its a caching issue

pallid gyro
#

I'm suffering a little bit trying to use SListView, maybe someone figured these two out:

  1. How can I get the cell contents to clip correctly and not draw on top of the header row when I scroll?
  2. How can I remove the dark gray background from the header row? I know how to draw a custom widget but that border is always there -
#

I'm already doing this, so, really quite annoying. I might need to copy the SListView sources and make my own modified variant, was hoping to avoid that.

pallid gyro
#

Well, apparently some things can be done with FHeaderRowStyle (which isn't BP exposed, but I guess that'll have to do)

#

Messing around with the various slate styling options sure can be a time sink.

stuck jewel
#

i have spent like 2 hours trying to make an icon appear on a button so far

#

fucking nonsense

stuck jewel
#

i am certain i shaved whole days off of my wasted time after i figured that out

pallid gyro
#

sigh now why is that last one ignoring the changes :\

#

Yeah I know live edits help a lot and I sometimes use them but most of the time I don't

#

I don't know why really.

stuck jewel
#

style sets are typically loaded on startup and unloaded on shutdown but you can hook into live coding to unload/reload it when live coding runs. you do have to close asset windows and reopen them before & after (else it'll crash as widgets try to use the unloaded style) but that can also be automated

pallid gyro
#

Yeah I should definitely do that cause I'm burning time like this

#

On the off chance that anyone knows what could possibly make the last header column in a listview ignore the column style I'd love to know, cause I have no idea.

split maple
#

Slate was made by the evil...

grave hatch
#

Did somebody delete my quip about slate? ๐Ÿ˜›

#

Oh it was in #cpp heh.

pallid gyro
#

Joy!!! I still have no idea what the issue actually was but I hacked it by adding another column with a fixed width of 0

#

I kinda understand why the header row option isn't exposed in UMG cause it's pretty broken

pallid gyro
#

I guess I missed this -

obtuse prairie
#

is SlateIM a independant window ? or is it contained in a SWidget and be used however we want ?

#

im working on a plugin utility panel, which needs to be able to refresh itself, the issue is that using a regular slate widget and updating it on tick breaks the layout (as its take at least 1 frame to calc it) so rn i have to use a update interval, and you can still see the 1 frame where the window seems like blinking

mental badge
#

and yes it uses an underlying SWidget

obtuse prairie
#

seems like its only a 5.6 plugin

mental badge
#

i got it to work in 5.5

obtuse prairie
#

okay SlateIM is pretty good

#

way better than imgui for UE

obtuse prairie
#

i wonder if anyone here tried to use FSlateIMExposedBase to get the exposed widget to embed it in something else
currently trying and feels like you have to tick it yourself externally, and create it BEFORE it needs to be used (since it needs 1 pretick after being enabled to have a valid SWidget created)

#

but yeah, you can embed it (here used in a FWorkflowTabFactory)

mental badge
#

not used the exposed widget

obtuse prairie
obtuse prairie
#

thanks epic for putting a important function as private

drowsy galleon
obtuse prairie
#

i cant do a PR because im on 5.5

mental badge
#

SlateIM is giving me some headaches lol

#

cant get these two tables to be equal size

obtuse prairie
#

got a different headache
i have 2 instances of FSlateIMExposedBase, which each one has its own SWidget, but it renders the same ?

drowsy galleon
obtuse prairie
#

meaning you can only get a valid exposed widget after 1 frame, after you enabled it

#

in my case i needed the widget in the same frame as i enable it

#

so im doing this

void FPSBlueprintPanelWidget::Initialize()
    {
        EnableWidget();
        DrawWidget(FApp::GetDeltaTime());
    }
drowsy galleon
#

Ah gotcha, I'll look at fixing that without needing to expose DrawWidget

drowsy galleon
obtuse prairie
drowsy galleon
#

Ah yeah, GitHub might force you to at least make the PR against the release/5.6 branch since the code won't exist in 5.5

obtuse prairie
obtuse prairie
#

im stuck on a weird issue with SlateIM
basically i got some conditions, if its true i add a tab children like so:

if (MyCond)
{
   if (SlateIM::BeginTableRowChildren())
   {
    /// Some more rows
   }
    SlateIM::EndTableRowChildren();
}

this works fine when my conditions switch from false to true (result: new child rows are added)
but no the other way around (true to false, result: child rows are still there, clicking on a expander arrow removes them)

it seems like a "refresh" issue

split maple
#
SNew(SCheckBox)
.IsChecked_Lambda``` this lambda will be called in the every frame, (or small interval)  right?
grave hatch
#

Correct

#

Generally you want either an event based check (set check manually) or, if it's an expensive check, use that event to set a bool which the checkbox can read.

stuck jewel
#

i can't believe how not-slow polling is tbh. i've mentioned this before but i had at least a thousand attributes bound to funcs checking on tick and as a test one day i changed almost all of them to just dumb assignments and i couldn't notice any editor performance change at all

pallid gyro
#

Why is slate so horrible with right to left languages. I pretty much have to make custom logic for every horizontal container widget to insert elements in a reverse order.

#

otherwise everything goes wrong, like, button clicks don't register, only some elements are reversed, etc.

split maple
pallid gyro
#

Uhm, okay.

merry prawn
#

How can I get rid of this black gray-ish background from a combo box string, I am searching for days but all I read is on the forums was Unreal overriding the color value. So do I have to create a ScrollBox Widget with buttons ?

merry prawn
#

Never mind I created a dropdown base widget from scratch and I highly recommend everyone having this issue to do the same

obtuse prairie
#

I found another bug for SlateIM trees, sometimes the expander arrow isnt showed

drowsy galleon
obtuse prairie
split maple
#

Plugin to slate?

obtuse prairie
#

Imgui slate

obtuse prairie
obtuse prairie
#

nvm, it still happens if you run SlateIM::BeginTableRowChildren() and SlateIM::EndTableRowChildren() AFTER it already didnt ran after a SlateIM::NextTableCell()

split maple
#

What does the lifecycle of a widget look like?

kindred nova
split maple
#

yes

kindred nova
#

slate widgets are all shared pointers, so thats pretty much all of it.
new - c++ ctor - SWidget::Construct
c++ dtor - delete

split maple
#

Thx, i thought thatโ€™s more complicated

drowsy galleon
split maple
stuck jewel
upbeat orchid
#

Materials used for FSlateBrush don't load when previewing in editor. ( Unreal Engine 4.26 )
Textures work fine.
Materials load when running PIE or Packaged

stuck jewel
upbeat orchid
#

creating a minimal repro. 1 sec

#

in Unreal 4.26 ( I have not checked other engine versions )
create an Image Widget,
set the image to a very basic ui material ( note: not a texture -- specifically a User Interface Material ),
restart the editor,
notice that image is blank

#

once I open the combo box for FSlateBrush::Image every widget using a UI Material displays correctly
( seemingly the editor code for opening the Image combo box calls something that "fully" loads the resource object being used by the slate brush. the materials persist until I restart the editor again )

#

updated the repro steps

#

Im checking if this is only for translucent UI materials

#

opaque and masked UI materials affected as well

stuck jewel
#

odd, 5.6? i won't be opening unreal again for several hours (but might chekc locally when i can)

upbeat orchid
#

4.26

stuck jewel
#

oh right lol

#

well :\

upbeat orchid
#

might help to know if it's fixed on the latest tho not sure how easy it would be to find the changes

stuck jewel
#

might be on your own with that dinosaur

upbeat orchid
#

that's fair

stuck jewel
#

i bet you've had others beat you to death on being on 4.26 by now, but is it your call to do this to yourself? ๐Ÿ˜„ or are you stuck there because of decisions of others

upbeat orchid
#

I did the merge in my free time back when 5.1 was out but was vetoed before even benchmarking

on 5.4 we benchmarked and it lost significant performance for our app so I was effectively vetoed but in partial agreement as well.

I heard 5.6 has improved performance but don't know if I have it in me to do an engine + project merge for a 3rd time just to see

#

changing our project to jump from 4.26 to 5.4 was very very time consuming

obtuse prairie
stuck jewel
brave holly
#

Did you guys know that popup menus have transition effects built it? This is true in editor as well, all popup menus could have slick open animations. But they donโ€™t because โ€œbMenuAnimationsEnabledโ€ is disabled in FSlateApplication.

I can re-enable it from C++ viaFSlateApplication::Get().EnableMenuAnimations(true); but why is this disabled? Did this feature get lost during engine development?

stuck jewel
#

i encountered a comment about that recently but never looked into it. i'm assuming it had some non-zero performance implications and they just said screw it

brave holly
#

It's been deprecated. Not sure why I didn't see it first.UE_DEPRECATED(5.0, "Enable Window Animations is no longer used and is a no-op so calling this function is no longer necessary.")

stuck jewel
#

if it still works what does it actually do lol

brave holly
#

Gives animation to every popup basically.

stuck jewel
#

ah, i actually hate it lol

brave holly
#

But I also found the inner code with some more info.

stuck jewel
#

funnily enough tooltips still do this, more subtle though

brave holly
#

It could have been used for a lot of stuff in my opinion.

#

The type of anim is configured per popup.

brave holly
#

But hey at least I can steal the MorphToPosition code from here

obtuse prairie
#

(video showing the issue being uploaded)

drowsy galleon
#

Based on the video, it seems like the bug is that the children still show after unchecking the box?

obtuse prairie
#

Yup

#

Child rows are dynamicly added fine, but aren't removed when its not asked to

drowsy galleon
#

Ok cool, I'll take a look, thanks for the repro

obtuse prairie
#

If a fix is made, ill be glade to be notified on the git commit ๐Ÿ™

#

(Or if its small enough whatever needs to be changed)

drowsy galleon
obtuse prairie
#

thanks !
ill apply the changes to my version in 5.5. (update: works)

i still have (in same edge cases) an issue with expander arrows not showing, ill try to find how to repro it in a sample code ill send here;
(but they will maybe be fixed with your fix)

grave hatch
#

Expander arrows don't show if there aren't any children. They should if there are

obtuse prairie
#

yeah but sometimes i do have children but they dont show up (didnt repro it since the above fix)

grave hatch
#

Ah.

drowsy galleon
obtuse prairie
#

when using SlateIM PopUp functions in elemnts inside a table, i have this weird glitch
they go away when collapsing tree childrens

drowsy galleon
#

Giving the table a max height might fix it

obtuse prairie
#

users must be able to stretch the window however they want

delicate pagoda
#

**Do you guys know where these 2 underlined icons are found inside the engine content? **

I made the underlined editor widgets for myself, but I'd like to tint the icons and thus need the PNG files.
According to the source code it's Icons/icon_playInWindow_40x and Icons/icon_playInSelectedViewport_40x but those icons look completely different, as if they're the old UE4 style.

#

maybe UE_5.5\Engine\Content\Editor\Slate\Icons is the wrong location to search for them?

kindred nova
#

those can be from somewhere else

#

or from widgetreflector find where button/icon is created

stuck jewel
#

PlayNewEditorWindow.svg

delicate pagoda
#

\Content\Editor\Slate\Starship\MainToolbar

#

Thank you so much!!

storm lance
#

Hey fellas. Is there a way to Open & Close a ComboBoxKey/ComboBoxString via C++?

stuck jewel
#

I don't know what those look like. Are they like dropdowns you click on and click off of?

#

If so then you could use slate application to set focus (or clear focus) probably

kindred nova
#

since MyComboBox is private, you would need to use DefinePrivateMemberPtr.h to access it

#

but possible to implement/expose as BFL static helper

storm lance
drowsy galleon
obtuse prairie
#

i guess, i am not using any height/width functions

#

i tried setting max height with like 2000f (my window is smaller than that), but this dont solve the problem

#

@drowsy galleon

drowsy galleon
#

A fixed height would do it, but you should be able to have it autoheight, but that might be a slate limitation

hazy torrent
#

Does anyone have an example of how to use .Font(FCompositeFont()) on a text box? I'm wanting to change the font size but struggling with setting up the compsite font. (Still new to slate)

stuck jewel
#

do you want to load your own ttf or reuse an engine font?

hazy torrent
stuck jewel
#

one way:
FSlateFontInfo NewFontInfo = FCoreStyle::GetDefaultFontStyle("Normal", 10);

have to just store NewFontInfo somewhere like in your style class or something

#

common strings there are "Normal", "Bold", "Italic" ... not sure if there's more

hazy torrent
stuck jewel
#

no it isn't

hazy torrent
stuck jewel
#

no

#

that constructor is deprecated

#

still if you want it, here's an example of loading a font into an FCompositeFont and using it to build the FSlateFontInfo:

TSharedRef<FCompositeFont> SourceCompositeFont_Font_OpenSans_Regular = MakeShared<FStandaloneCompositeFont>();
SourceCompositeFont_Font_OpenSans_Regular->DefaultTypeface.AppendFont(L"Regular", Yap::FileUtilities::GetResourcesFolder() / "Fonts/OpenSans-Regular.ttf", EFontHinting::Default, EFontLoadingPolicy::LazyLoad);
YapFonts.Font_OpenSans_Regular = FSlateFontInfo(SourceCompositeFont_Font_OpenSans_Regular, 10);```
hazy torrent
stuck jewel
#

(sorry it's ugly because it's an expanded macro of mine)

obtuse prairie
#

any way of knowing if a slate widget is being hidden or not ? (im trying to know if at a given time a FBlueprintEditor is visible or not)

drowsy galleon
#

Use the widget reflector

obtuse prairie
#

i mean for code

#

i want to skip some heavy functions if my BP editor isnt viewed

stuck jewel
# obtuse prairie i want to skip some heavy functions if my BP editor isnt viewed

someone else might easily have better ideas than me but the two ideas i know of are:

  1. it is possible to query the editor for open blueprint assets (you may be able to see what kind of blueprints or assets are opened for editing from that)
  2. this would be ghetto but if you have a custom slate widget you're worried about, you could store its existence in some static vars that you set/clear on creation and destruction
#

if 1st option sounds useful i'll go find it in my plugin

obtuse prairie
stuck jewel
#

ill go find it for you

#

i use it to close all open asset editors during live coding and reopen them after so i can edit and reload slate style data

obtuse prairie
#

thanks for sharing but this doesnt answer what I just said.

#

for a given BP editor (meaning its a living editor that exists, aka the user opened a BP), how can i know if its rendered/viewed or collapsed/hidden

bright maple
#

Can you remind me, do we have something like MultiLineEditableText with color support, like in Rich Color Text Box?

pallid gyro
#

SMultiLineEditableText has support for switching colors fonts and styles but it's bit convoluted to set up. It is used in the various code editors within unreal to do syntax highlighting, so you can pretty much do whatever you want with it.

#

There are several examples within the editor to learn from, one is the custom material expression node (in the code it's called OptimusHLSL), another is the experimental and unused CodeEditor plugin that has c++ syntax highlighting.

I managed to hack the code editor into a custom code editor for this esoteric musical programming language called ChucK, my code is on Github and can perhaps be used for reference, took me a while to set it up, would probably be easier these days with the help of an LLM - https://github.com/Amir-BK/chunreal-midi/blob/main/Source/Chunreal/Public/SChunrealMultiLineEditableText.h

#

FWIW the whole thing is not editor only, I managed to run the code editing widget in game, which is fun cause ChucK can be compiled on the fly. So yeah, it's possible.

placid basin
#

I'm updating from UE5.4 to UE5.6 and I got a deprecation message that I'm using the wrong FSlateFontInfo constructor. Is there a migration guide for deprecations like this?

stuck jewel
placid basin
#

Do I need to make one for each flavor like Bold and italic? Or what is the point of a composite font?

stuck jewel
#

That I cannot answer sorry SR_Heh_pray

#

I made one for each but I was not interested in learning more than making it work. Lol

placid basin
#

I'll go with one for each then lol, thank you for the help!

hybrid nest
#

anyone who can help me with this plz, whenever i am zooming my timeline, the keyframe gets dissapear, when i change the scroll offset it gets visible again.

grave hatch
#

Try not to spam multiple channels.

plain acorn
#

I'm gonna assume this is for Slate, given somewhat C++

What in the heck controls a widgets unable to tick while off-screen/ not rendered/ not visible?

stuck jewel
#

what are you trying to solve?

plain acorn
#

I just wanted tick, while off-screen basically.
I thought that surely there must be a can tick.
There is, but it seems to be more about generic checks, and the off-screen seems super deep in the C++

#

Basically 24/ 7 tick, while the widget is added to viewport

grave hatch
#

You can register your own tick function if you want. Extend from FGCTickableObject or some such. Or set something up with a world timer.

#

(If you're doing this for a game)

plain acorn
#

Never registered my own tick before.
Is this what that widget extensions shit was, or something very different?

Is this some function I define, some new file, or what exactly?

#

(NVM, quick google was easier then expected. ๐Ÿ˜› )

grave hatch
#

This isn't the ideal solution at all, but if it's a 3d widget that doesn't tick off screen, there's absolutely definitely a checkbox for that somewhere.

#

But if you can't find it, there's the pragmatic approach like this. ๐Ÿ˜›

plain acorn
#

lol
A whole like 1-2 of these will ever exist at a time, so shouldn't run into any issues, i'd hope

obtuse prairie
#

still wondering how i can know if a slate widget is rendered/collapsed/blocked

spring frost
#

If I have an IPropertyHandle to something like an FGameplayTag property, how on earth do I embed that into a widget? CreatePropertyValueWidget() is not doing what it suggests?

#

Surely I don't have to manually setup the widget for it?

stuck jewel
obtuse prairie
#

what does CreatePropertyValueWidget do for you ?

#

oh yeah

stuck jewel
#

it will draw the default uncustomized widget, which will be blank for a gameplay tag

#

this may be a massive pain in the rear. i did it once, or almost... before i discovered the new func in UE5... maybe you can study the new function and pseudo backport it...

TSharedRef<SWidget> FPropertyHandleBase::CreatePropertyValueWidgetWithCustomization( const IDetailsView* DetailsView )
{
    FCustomPropertyTypeLayoutMap CustomPropertyTypeLayoutMap = [DetailsView]()
    {
        if ( DetailsView )
        {
            return static_cast<const IDetailsViewPrivate*>( DetailsView )->GetCustomPropertyTypeLayoutMap();
        }
        else
        {
            return FCustomPropertyTypeLayoutMap();
        }
    }();

    FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");

    FPropertyTypeLayoutCallback LayoutCallback = PropertyEditorModule.GetPropertyTypeCustomization( GetProperty(), *this, CustomPropertyTypeLayoutMap );
    if (LayoutCallback.IsValid())
    {
        TSharedRef<IPropertyTypeCustomization> PropertyTypeCustomization = LayoutCallback.GetCustomizationInstance();

        return SNew( SStandaloneCustomizedValueWidget, PropertyTypeCustomization, AsShared() );
    }
    else
    {
        // Opting to not generate the default buttons since the code path that goes through a customization would likely not have them
        const bool bDisplayDefaultPropertyButtons = false;
        return CreatePropertyValueWidget( bDisplayDefaultPropertyButtons );
    }
}
#

in UE5 this function works fine if you pass nullptr for the DetailsView (i.e. if you're in a property type customization not a details customization, where you don't have a DetailsView instance)

spring frost
#

SStandaloneCustomizedValueWidget Isnt available

#

In 4.27

#

Must be a new thing

stuck jewel
#
// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "DetailGroup.h"
#include "DetailWidgetRow.h"
#include "Widgets/SCompoundWidget.h"

/**
 * Generates the header widget for a customized struct or other type.
 * This widget is generally used in the property editor to display a struct as a single row, like with an FColor.
 * Properties passed in that do not have a header customization will return a null widget.
 */
class PROPERTYEDITOR_API SStandaloneCustomizedValueWidget : public SCompoundWidget, public IPropertyTypeCustomizationUtils
{
public:
    SLATE_BEGIN_ARGS( SStandaloneCustomizedValueWidget )
    {}
        /** Optional Parent Detail Category, useful to access Thumbnail Pool. */
        SLATE_ARGUMENT( TSharedPtr<FDetailCategoryImpl>, ParentCategory)
    SLATE_END_ARGS()
    
    void Construct( const FArguments& InArgs,
        TSharedPtr<IPropertyTypeCustomization> InCustomizationInterface, TSharedRef<IPropertyHandle> InPropertyHandle)
    {
        ParentCategory = InArgs._ParentCategory;
        
        CustomizationInterface = InCustomizationInterface;
        PropertyHandle = InPropertyHandle;
        CustomPropertyWidget = MakeShareable(new FDetailWidgetRow);

        CustomizationInterface->CustomizeHeader(InPropertyHandle, *CustomPropertyWidget, *this);

        ChildSlot
        [
            CustomPropertyWidget->ValueWidget.Widget
        ];
    }

    virtual TSharedPtr<FAssetThumbnailPool> GetThumbnailPool() const override
    {
        TSharedPtr<FDetailCategoryImpl> ParentCategoryPinned = ParentCategory.Pin();
        return ParentCategoryPinned.IsValid() ? ParentCategoryPinned->GetParentLayout().GetThumbnailPool() : NULL;
    }

private:
    TWeakPtr<FDetailCategoryImpl> ParentCategory;
    TSharedPtr<IPropertyTypeCustomization> CustomizationInterface;
    TSharedPtr<IPropertyHandle> PropertyHandle;
    TSharedPtr<FDetailWidgetRow> CustomPropertyWidget;
};

make your own. it's less than 30 LOC if i remove the white space and comments lol

#

hopefully the new dependencies end here

spring frost
#

@stuck jewel I found that using AddProperty from an IDetailChidlrenBuilder seems to work.

#

But the only problem is, my property is inside a TMap and the silly icons for deleting the entry appear with the property widget...

stuck jewel
spring frost
#

Yeah I only just started looking at that interface.

#

Ill play with it

#

Cheers

#

@stuck jewel This worked even better

#
        TSharedPtr<SWidget> KeyNameWidget = nullptr;
        TSharedPtr<SWidget> KeyValueWidget = nullptr;

        ChildrenBuilder
            .AddProperty(KeyProperty.ToSharedRef())
            .Visibility(EVisibility::Hidden)
            .GetDefaultWidgets(KeyNameWidget, KeyValueWidget);

        TSharedPtr<SWidget> ValueNameWidget = nullptr;
        TSharedPtr<SWidget> ValueValueWidget = nullptr;

        ChildrenBuilder
            .AddProperty(ValueProperty.ToSharedRef())
            .Visibility(EVisibility::Hidden)
            .GetDefaultWidgets(ValueNameWidget, ValueValueWidget);
#

GetDefaultWidgets

#

From the AddProperty

stuck jewel
#

ah interesting!

spring frost
#

Lets you extract the actual Name and Value

#

Widgets

#

Which I can then embed whereever I like

strange moon
#

Has anyone experienced, or know the reason why am i getting unresolved external symbol error when trying to call function from different module/plugin within the SLATE_BEGIN_ARGS macro ? The crazy thing is that is works just fine if i call the function anywhere else, it only happens when i try to do that here inside the FArguments constructor:

SLATE_BEGIN_ARGS(SIE_Slate_Button)
    {    
        // i get unresolved external here
        _FontSize = ULibFromOtherModule::DefaultFontSize();
    }
kindred nova
# strange moon Has anyone experienced, or know the reason why am i getting unresolved external ...

doesn't really matter what or where - it is cross-module import/export problem.
1 - you're missing dependency of module that contains that class. the module that does the call must have calee module as dependency
2 - class does not export function (no api macro on class/function)

and since function body in header - whatever uses it will require linking to appropriate module
if you want to hide it - break down using intermediary

SLATE_BEGIN_ARGS(SIE_Slate_Button)
    {    
        InternalInit(*this);
    }

   static void InternalInit(SIE_Slate_Button::FArguments& Self);

// in cpp
   void SIE_Slate_Button::InternalInit(SIE_Slate_Button::FArguments& Self);
   {
    Self._FontSize = ULibFromOtherModule::DefaultFontSize();
   } 

making modules that se SIE_Slate_Button::FArgs link to InternalInit function instead of ULibFromOtherModule and avoid needing extra module for linking

plain acorn
#

I'm gonna post this in here, cuz its widget related, but at the same time feels more generic UE C++ related.

I'm using the FTickableGameObject after someone suggested it, so I can have my widget tick 24/ 7 while its "added to viewport"
But, if I idle for like 30 seconds - 1 minute
I get an exception, but no direct crash, if I simply just tell it to resume.
The stack drops into BP, since it calls my BP function.
But, nothing is implemented in BP yet.

#

That thread get, is this.

#

Hmmm.
After a bit of testing, i'm a bit lost on what to check for.
I have this (image)
But, a widget that doesn't exist is somehow reach-able, and doesn't have said flag
Is there some special value to check for?

stuck jewel
#

At this point I'd kind of like to ask why you need the widget to tick while off screen ๐Ÿ˜„

grave hatch
#

The widget might be being destroyed when not rendered off screen.

#

30s - 1m is the GC time (60s)

#

You could try doing ->AddToRoot() on the widget.

#

We're getting way out of the "good coding" playbook here, though ๐Ÿ˜›

#

What you should probabyl do is not have any of your "tick every frame" shit in the widget at all, put it in another object and use the widget as a view to whatever other process is going on.

#

So it doesn't matter if the widget is alive or not.

plain acorn
stuck jewel
#

that's just it though (what daekesh said). your game "model" should be ticking. if the widget isn't visible, why should it tick. there could be exceptions to this of course but it's the starting point

#

you're having a chicken/egg problem of some sort?

plain acorn
#

I didn't wanna constantly destroy, remove, add, create 1 widget class over and over.
So I just set its visibility, when theres no data.
Which makes it unable to tick

grave hatch
#

Do the ticking somewhere else.

plain acorn
#

Wasn't that the whole point of moving it to the widget?
Seems weird to like triple obfuscate the ticking visual.

Something gathers data.
Widget display data
But, 3rd thing computes it all?

But, wouldn't the same issue occur?
A tick is occurring on the widget, when its not supposed to. (that be caused by itself, or caused by the Hud calling tick.

grave hatch
#

Why is the thing that's gathering the data not the thing doing the updating?

#

Why does the widget do anything at all in that respect?

plain acorn
#

Thats what someone had suggested, and to me it made sense.
Something only gathers data, doesn't need to worry about certain stuff being valid, ready, or etc.

Widget can just exist whenever, and get the data from the thing doing the gathering.

(This all stemed from how the hud begin play occurs after controller, which means all my gathering would need widget valid checks, just to be safe)

grave hatch
#

Indeed.

#

The thing doing the gathering can trigger events to notify any listeners of important changes, rather than having a direct connection.

plain acorn
#

Hmmm, ok.
I can swap to that, just seemd like a tiny waste, when at the end of the day it'd just be a glorified tick delegate.
hence just using direct tick on widgets.

Then, what about #1.
I use it for a tiny thing, but its quite useful, when I don't wanna step on myself by accident constantly.
There no form of C++ function override for being added, just initialize, but I don't want that.

#

I guess I could scuff it by just keeping a timer running on tick, so when the timer actual completes, it means tick stopped.

half garden
#

Hey all, I have an issue with text input for editable text boxes and I hope this is the right place to ask this question.
I'm trying to get a text chat system working which works fine, but it only works for English character inputs. When changing my language to KR/CH/JP, the game and editor forces me to be inputting English characters. However, when I create a new project, it allows me to switch language input. What could be the problem with my other project that it forces me to only input English characters?

pallid gyro
#

What do you mean 'forces'? does it ignore language switch and inputs only in english or are you seeing weird characters? Cause I'm using editable text boxes with non english languages in one of my projects and if you use a font that supports the language everything works fine

half garden
#

Forces as in it automatically changes my keyboard to input English characters whenever I focus on the unreal editor window. And same with a packaged game, whenever I open the game, it forces English input

#

When I open my other project however, it lets me freely change input to Japanese in this example, and I can type Japanese characters in the editable text boxes

kindred nova
#

when application starts it uses system-default language, it should be able to change as it is on OS-level and not App-level controlled.
not really related to slate.

#

initially i thought it was about non-cjk font but that should not prevent input or swaps

little mauve
#

any widget can be hit traced?
I wonder if I could make subclass of Horizontal Box to capture mouse click instead of passing it to child components

random ocean
#

Hey, is there any way of making the joyistick navigation a little bit more forgiving? Like with a larger or bigger radius of detecting the next focus target?

steady walrus
#

hey there, is there any command that hide/show all the ui? or slate related?

#

I want to test something because my ui doesnt show after I use loadingscreen when I load same level from same level

#

even default unreal console ui doesnt show

faint totem
#

Need help with the Size box with Slate heres my Example code I guees:

SNew(SOverlay)

  • SOverlay::Slot()
    [
    SNew(SBox)
    .WidthOverride(300.f)
    .HeightOverride(150.f)
    [
    SNew(SImage)
    .ColorAndOpacit(FColor::Black)
    ]
    }

After I go into the engine it ust gives me a black Box with it covering the whole screen

pallid gyro
#

You probably need AutoSize on the slot

faint totem
#

With the overlay slot correct?

ember veldt
#

Anyone knows how to extend FDragDropOperation?

#

I'm suffering brain damage sifting through the engine code to figure it out

#

nevermind I did everything but reading the class' comment which literally says how facepalm

grave hatch
#

Lol

#

You have to call construct manually if you want a custom decorator.

bright maple
snow bough
#

i'm playing with slate and Unreal editor UI stuff
i'm looking specifically to create something like in the image,
a timeline of sort with layers and keyframes,
this one is from Gearbox Borderlands 3 stream in youtube

i'm looking for anything similar, maybe sequencer can be used here or other base timeline class.
any help or guide would be appreciated

i was successful in creating my asset type and initializing a custom editor for it, not i just need to continue on with the logic

grave hatch
#

You want to recreate sequencer?

snow bough
# grave hatch You want to recreate sequencer?

no no, in unreal some stuff like the viewport or details panels can be called and just work on top of it.
i just need it -or any other timeline- to build like a day night cycle , something similar to the one used in borderlands

snow bough
#

with GPT i managed to open sequencer in a custom tab , but the code was unstable , i dont rely in AI on such a big task

grave hatch
#

If you rely on AI at all, you're gonna run into a lot of road blocks with UE.

#

Especially with the lower level stuff.

snow bough
grave hatch
#

Hehe. Indeed!

pallid gyro
#

Extending the unreal sequencer other than where you're meant to (like custom tracks and stuff) is kinda hard, I mean, there's the motion designer sequencer (which @grave hatch was heavily involved with) but if you'll look at it it's like a very big thing, not so easy. Making your own custom timeline though can be pretty simple depending on what you're going for exactly, I made a midi pianoroll, which is a timeline in a way, and it wasn't too difficult.

#

But yeah really, the unreal sequencer itself has a lot going for it, if you'll check the Level Sequencer code or the Avalance Level Sequencer (motion designer) you'll see that thing is massive, I wouldn't recommend.

#

Making a simple timeline and a pannable panel is not too hard (I mean, it is for me cause I'm stupid and I had plenty of trial and error but conceptually, it's not too hard)

snow bough
#

i'm still checking it out, but its really impressive

grave hatch
#

I wouldn't say "heavily" ๐Ÿ˜›

pallid gyro
#

as far as I'm concerned you did the whole thing by yourself

grave hatch
#

๐Ÿ˜„

pallid gyro
snow bough
grave hatch
#

It's mostly my manager, but I did some of the initial work.

snow bough
snow bough
grave hatch
#

I did a lot of work on the motion design viewport stuff. The draw modes. Snapping, grid (it still looks awful...), the material designer, remote control, media viewer, plenty of other random crap.

snow bough
#

you sound indifferent, but you're describing really interesting stuff ๐Ÿ˜‚

#

how long have you been with epic

stuck jewel
#

based on how long it takes to make something as simple as a slate graph widget, by my math, i would estimate approximately... 67 years

snow bough
grave hatch
snow bough
grave hatch
#

Thanks!

bronze vigil
#

hey, in unreal insights, Slate3D refers to drawing widget components right? suddenly having it take up 6ms per frame on lower end platforms and I can't figure out where it's coming from

kindred nova
bronze vigil
#

thank you
as it turns out though it also covers retainer boxes with materials for some reason

vernal moth
#

does UE have a native "GetParentOfType" slate function that just iterates the hierarchy getting for an FName match? Just don't want to be reinventing the wheel here

#

Also another question, are all widget types supposed to implement the macro SLATE_DECLARE_WIDGET_API(SCompoundWidget, SWidget, SLATECORE_API)(this is from SCompoundWidget obv)

I would be curious of why they aren't supposed to in some cases because that would seem weird, but I might be wrong

#

Here is why I ask, I have this popup window and the widget inside needs to close it when I hit a button.

Its supposed to be like a throw away call once and forget function so no one holds the SWindow besides
FSlateApplication::Get().AddWindow(Window); so the component within needs to find the parent and call close when we are done

This Doesn't work since SWindow doesnt implement the macro SLATE_DECLARE_WIDGET_API but its parent does, so this returns "SCompoundWidget"

if (TSharedPtr<SWindow> Window = BF::Slate::TryGetParentOfType<SWindow>(SWindow::StaticWidgetClass().GetWidgetType(), W))
{
  Window->RequestDestroyWindow();
}

I can obviously just write "SWindow" myself but I figured i'd use slates impl of a static class and be more "official" but it seems to be half supported so I am curious as to why (if any) the reason would be for SWindow and plenty of child classes not doing that

stuck jewel
#

my very VERY entry-level understanding is that SLATE_DECLARE_WIDGET_API is supposed to just be kind of a helper to give slate widgets similar typedefs as UObjects (ThisClass), and it also forces you to set up a PrivateRegisterAttributes function which i think is supposed to somehow give more intelligent (performant) attribute/dirtying behavior. but i also have no idea if that's really true or not. i just use it sometimes to get Super/ThisClass

but what's the window for, is it like click on a button and get a popup to do things in and then you want it to go away?

vernal moth
#

Yeah it's like a custom popup - afaik UE doesn't have anything native that lets me create a popup but pass the content of the popup to the spawner

stuck jewel
#

look at SMenuAnchor

#

i built a custom child of it for all my yap crap

vernal moth
#

I did try that (its for a right click context menu button when I right click an asset in the content browser), It just despawned the menu once I clicked my entry and I couldn't see SMenuAnchor

I might have been doing something dumb though

stuck jewel
#

it vanishes if it doesn't have focus. i can't remember 100% how the base class works with regards to that

vernal moth
#

Yeah that was probably the issue since the right click context menu despawned when I click an entry it loses the context to anchor to

#

when I click the menu entry it despawns the right click menu

stuck jewel
#

UX wise i feel like everything in this video looks proper ๐Ÿ˜„

#

or maybe you mean this is working correctly but you did a hack to make it

vernal moth
#

this is via my own throw away func that spawns a window (I was just showing why I think the SMenuAnchor route didn't work for me)

        TSharedRef<SWindow> SpawnSlateWindow(const FString& WindowTitle,
            TSharedRef<SWidget> Content, ESizingRule SizingRule, float WindowX, float WindowY,
            const FOnWindowClosed& OnWindowClosed)
        {
            TSharedRef<SWindow> Window = SNew(SWindow)
                .Title(FText::FromString(WindowTitle))
                .ClientSize(FVector2D(WindowX, WindowY))
                .SupportsMinimize(false)
                .SupportsMaximize(false)
                .SizingRule(SizingRule)
                .CreateTitleBar(!WindowTitle.IsEmpty())
                .UseOSWindowBorder(false);

            Window->SetContent(
                SNew(SBorder).Padding(8)
                [
                    Content
                ]
            );

            Window->SetOnWindowClosed(OnWindowClosed);
            FSlateApplication::Get().AddWindow(Window);
            return Window;
        }
#

But yeah what I have now works, It was just what lead me to wonder if UE had a native get parent of type as well as why the macro was only implemented in some classes but you kind of explained the latter

snow bough
#

@pallid gyro @grave hatch hey guys.
the timeline i started working on is coming along nicely

stuck jewel
#

Just curious, what did you find lacking in unreal's built in features?

snow bough
stuck jewel
#

๐Ÿ‘ cheers, no i haven't used it yet just browsed through its docs and thought it seemed very thorough

snow bough
modest ruin
#

Has anyone used UE's MVMM plugin? Just wondering what your thoughts were about it if you have.

river thunder
#

it's awesome, once you figured out how it works

pallid gyro
#

In c++ it feels great and very reliable in BP there are some quirks, but either way itโ€™s better than creating a bunch of delegates or having logic on the tick event

bright maple
#

Do we have any example that demonstrates how to create a slate Widget that allows you to add custom tags to a Custom Event or Function? I remember finding for variables, but I don't remember finding for functions.

kindred nova
bright maple
# kindred nova > add custom tags to a Custom Event or Function what kind of tags?

https://www.fab.com/listings/6410b8cb-4726-4320-b90d-2b491126bc65
Some like here, custom metadata tags, in this plugin for var.

Fab.com

ไธญๆ–‡๏ผš/ ๆ–‡ๆกฃ / ๆ•™็จ‹English๏ผš/ Documentation / TutorialsExamples:ย Key๏ผšGetOptions Value๏ผšFunctionNameKey๏ผšLongPackageName Key๏ผšRelativeToGameContentDirKey๏ผšForceInlineRowKey๏ผšCategories Value๏ผšXXX.XXXKey๏ผšExcludeBaseStructKey๏ผšBaseStruct Value๏ผš/Script/Module.StructDisplayPriority, EditCondition, etc...

kindred nova
bright maple
kindred nova
#

maybe, if you dig where the details view reads custom event data could track to corresponsing UBlueprint/UEdGraph and find how to assign metadata to corresponding generated UFunction or it's source

for BPVariables it is just stored in bp variable definition itself and it can use BlueprintEditorModule.RegisterVariableCustomization for the property to inject editor
https://github.com/DoubleDeez/MDMetaDataEditor/blob/main/Source/MDMetaDataEditor/Private/MDMetaDataEditorModule.cpp#L28C33-L28C84
compared to function it is significantly simpler

#

still it will be limited only to Custom Events and BP-declared Functions.

start point will be details view with selected event or function, then bp graph source

#

TLDR: possible with enough research about engine bp internals, no solution out of the box

grave hatch
#

Can you not just do GetOptions if the list is static? (not possible for function inputs)

#

It's pretty trivial to add context sensitive ones to any function. You can customise the function input value to show whatever you want.

#

If you search for PinFactory from me (maybe in here or #cpp) I posted an example.

#

If you need it on details panel it's a lot harder. Mostly because the details customisation system is shit, but it's effectively the same thing.

bright maple
static lion
#

Does one know, how to make the Label of a SGraphPin invisible (best collapsed)?

static lion
#

Seems like I need to create my own SGraphPin child and give the label a NULL Widget..

snow bough
pallid gyro
#

Nice so this whole thing is a custom sequencer in its own toolkit?

#

Does it implement isequencer or is it an entirely custom widget?

snow bough
static lion
#

Also making progress with my Dialog Editor..

#

just the Pins are annoying.. need to find a way to remove those Labels..

stuck jewel
#

are you making the pins yourself?

#

i.e. CreatePinWidgets() override?

static lion
#

I have a custom class, inheriting from the SGraphPin..

stuck jewel
#

then just set bShowLabel = false?

static lion
#

๐Ÿซ 

#

Thank you very muuuuuch ๐Ÿ˜

static lion
# stuck jewel then just set bShowLabel = false?

is that bool in any form protected?

Cause i cannot get my Custom Pin to work..
Either the Image i want it to have is squeezed or distorted...
Or it does not react to any input of the mouse..

static lion
#

ok.. i managed to get the labels be gone.. beside Option Pin.. which should have "Options" stand beside.. which i have done with another custom Widget containing a text..

But..

The custom Pins do not react to any Mouse input.. so i can not drag a wire from or to them..

And they all have this weird, slighty grey border around them..

static lion
#

WHOOP WHOOP..

#

finally working..

static lion
#

Now we are talking about style:

river thunder
#

looks sweet ๐Ÿ™‚

grave hatch
#

Reminds me of the allsop mouse mats!

red plank
#

Is anyone here currently versed in the current state of Automotive HMI with Unreal? Only seeing a few projects out there at the moment. Teaching a class this Fall and I wanted to teach the class how to build a shippable prototype of an HMI in 14 weeks and Iโ€™m not sure how relevant the Automotive HMI Template is these days.

static lion
#

Question:
i ant to implement an embed ColorPicker to Detail Tab.
What Delegates do i need to use to update stuff WHILE selecting a new color (while dragging the indicator)?

        DataCategory.AddCustomRow(LOCTEXT("CommentColorRowFilter", "Comment Color"))
        .WholeRowContent()
        [
            SNew(SColorPicker)
            .TargetColorAttribute(this, &FDialogTreeDetails::GetCommentNodeColor)
            .??????(this, &FDialogTreeDetails::OnLiveColorChange)
            .OnColorCommitted(this, &FDialogTreeDetails::OnSetCommentNodeColor)
            .UseAlpha(true)
        ];
static lion
#

ok.. nvm.. got it..

static lion
# stuck jewel then just set bShowLabel = false?

Hi..

Thanks for the Tip with the bShowLabel.

I got another thing i cannot get my head around, how to remove/change it.
The normal Brush of the Pin works fine.. showing my Ring..

But the Hovered is showing a Linear gradient Rect behind the Ring (maybe cause it is stretched..)

Is there a way to remove that hovered brush or change it to not being drawn?

rain heron
#

I am struggeling with font measure service.
I just want to draw two texts (using MakeText) right after each other.

But they will overlap. The longer the first text, the more there is an overlap.
The font doesnt have any outline.

FVector2D Start = Position;
    FSlateFontInfo FontA = Font;
    FString TextA = TEXT("First Text");
    FSlateFontInfo FontB = Font;
    FString TextB = TEXT("Second Text");

    FVector2D SizeA = FSlateApplication::Get().GetRenderer()->GetFontMeasureService()->Measure(TextA, FontA);

    FSlateDrawElement::MakeText(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(FSlateLayoutTransform(Start)),
                                TextA, FontA, ESlateDrawEffect::None, Color);

    FVector2D SecondPos = Start + FVector2D(SizeA.X, 0);
    FSlateDrawElement::MakeText(OutDrawElements, LayerId, AllottedGeometry.ToPaintGeometry(FSlateLayoutTransform(SecondPos)),
        TextB, FontB, ESlateDrawEffect::None, Color);

What am I doing wrong?

rain heron
#

font scales 10 - 14

river thunder
#

it may not take DPI scaling into account, and as result your final widget size will be different?!

rain heron
#

If you mean Application Scale.... that is at 1

grave hatch
#

It should be better if you use vector fonts.

#

I forget exactly what they're called in ue.

#

There aren't many in the engine by default.

#

It could also be the slate layout transform call that's not correct.

rain heron
#

If i use the same for boxes or lines the layout transform works just fine.

What is it font dependent? It should work regardless of font.

static lion
pallid gyro
#

did you check all the brushes in the style class for the widget? there's often a lot that's hiding there

vale stump
#

I have a struct of float properties I'm using for stats, that are EditAnywhere. i want to be able to set some stats to not be modifiable in runtime depending on the item by my stat upgrade system, by setting a bool somewhere.
i cant think of a good way to do this, as making a TMap and assigning each stat to a bool and then turning them on or off is kind of annoying, and i wouldnt know the best place to put it.

i had the idea to use the InlineEditCondition option on the UPROPERTY macro for this purpose, and i need some advice on how i can access the meta properties in normal runtime, and check if the EditCondition is false or able to change it

#

like so

grave hatch
#

Make a struct that contains your float?

#

Have it have a bool and a float.

vale stump
#

oh. just nest structs

grave hatch
#

Meta properties are not available at runtime.

vale stump
#

damn

#

ok then. thanks. nesting structs works i suppose.

grave hatch
#

Simply having a struct with a float and a bool and your interaction with that struct always checks the bool is, of course, always available anywhere.

vale stump
#

i dont know why i didnt consider that simple solution

#

and i can make the struct always show its inner properties right, so it doesnt clutter detail panels

grave hatch
#

Sometimes you see a rabbit hole and you simply have to jump down it ๐Ÿ˜›

vale stump
#

and i can still use edit conditions i guess, so the check box shows next to the item

grave hatch
#

You can make it be an edit condition still

#

And it'll hide it and put the checkbox on the name bit.

#

The one disadvantage with a struct is you need a new one for each data type.

vale stump
#

yeah. currently they are just floats so it should be easy enough to swap over

#

but i can make it so the individual structs do not show up in the detail panel as a separate dropdown right. so my outer struct only shows the inner properties of the float structs

grave hatch
#

Yeah. That should work.

vale stump
#

im not sure what i did wrong

grave hatch
#

Remove the inner properties thing and see if it fixes itself.

#

(you'll have to unfurl them then, though)

vale stump
#

k

grave hatch
#

The details panel is a beast that must be tamed.

#

Often with customisations.

#

Save yourself now!

vale stump
#

lul. i do know the pain

#

took me forever to figure out my first slate project

#

removing the inner thing didnt fix it

#

do i need both to declare it?

#

or one. or do i only need the Inline one at all maybe?

grave hatch
#

You could try adding EditAnywhere to the bool.

vale stump
#

smart. also, i think the InlineEditCondition might need to be on the bool itself

#

not on the thing it works on

grave hatch
#

Possibly?

#

This has examples of all of them.

vale stump
#

ok yeah. according to this, seems i should have it on the bool

#

which does make sense

#

benUI coming in with the good info again

#

huge. now i can try the inner properties again. oh and i need TitleProperty maybe also. idk where the outer name goes if i show the inner

grave hatch
#

TitleProperty I think just works on arrays/maps/sets.

vale stump
#

mm yeah

#

ill see what inner prop does first

#

weird. didnt seem to do anything?

grave hatch
#

Details panel things

vale stump
#

i could make a detail customization, go through hours of effort and tons of bugs and needing to learn how to write slate code again, or i could give up

grave hatch
#

I know what I'd choose!

#

(write my own details panel)

vale stump
#

i dont think i have that sauce

#

doing it once was enough for me

grave hatch
#

๐Ÿ˜„

#

I wrote one and a template-based slate property exposure system.

#

For making a wysiwyg slate editor.

#

Never finished the editor, though.

vale stump
#

that sounds difficult

grave hatch
#

There was some mind-bendingly bad templating.

vale stump
#

my relatively simple slate plugin had like 400 lines of detail customization code in it. i cant imagine doing something bigger. that would be cancer

#

this took me weeks

grave hatch
#

Dang.

#

But now you've learned!

#

You're ready to do more!

vale stump
#

ive learned to not do it again

#

lol

#

the reset button alone took me days of research and googling, because i couldnt get the normal InlineReset thing to show up

#

this dude

grave hatch
#

Just gotta run that "create reset button" function!

vale stump
#

i did! didnt do anything

#

i think i did. idk i tried everything before deciding to just make my own button and put it on the same line

grave hatch
#

It'll be invisible if the property can't be reset to default.

vale stump
#

idk it was a while ago. i dont remember all the things i tried

#

pretty sure i went over every reset option on the property, row, and category options

grave hatch
#

Do you know about the widget reflector?

vale stump
#

i do

#

uh. what does ctrl+w do? i thought that was the widget reflector, but i think it closes windows

#

woops

grave hatch
#

ctrl+w is the generic close window bind.

vale stump
#

well, good to know

#

i cant find the widget reflector now

grave hatch
#

Not just in UE ๐Ÿ˜›

#

Tools -> debug -> bottom of the list.

vale stump
#

ah right. i knew it was in tools. didnt know it was in a sub group

#

this is the invisible reset button i assume?

#

i dont see the "create reset button" option. on the property

#

idk i think its because im doing manual name/value creation for the rows.

grave hatch
#

On the IPropertyHandle

vale stump
#

i dont see it

#

and i think i tried the other things like making custom reset to default

#

honestly i dont rly wanna dive back into this. i wasted too much time on it lol. i have buttons that do what i want now anyway, so im good

grave hatch
#

Maybe on the IDetailRow thing?

#

I'm bad with names. ๐Ÿ™

static lion
# vale stump this took me weeks

Haha.. you don't wanna see my 2000+ Lines of Custom Details for my Dialog Editor.. where each Node has its own custom Details to replace the Structure Details of a Datatable..

Without a proper modular basement.. you go crazy with Slate..

#

Should be IDetailRow::CreateResetButton() afaik

vale stump
vale stump
wicked thicket
#

hello everyone

I am doing a loading screen using Slate and the Movie Player

Do you know if the Time node in a material is updated during this?
I have tried to invalidate the SImage but seems like it is still not updated. Did anyone hit this issue before?

vale stump
#

the time node in materials is constant and always running

static lion
#

"Small" Update to my Custom Detail for the Mesdsage Node..:

static lion
pallid gyro
#

@static lion ran into your level selector plugin on github, cool stuff! I modified it a little bit to use SSearchableComboBox (actually asked copilot to do the heavy lifting)

#

I dunno why the favorites icon doesn't load, actually the favorite icon does load it's the 'unfavorited' icon that doesn't.

static lion
#

I currently do a new iteration, containing a filter for a tag and a search function..

Will take the Slate style problem of the UnFav icon into the current sprint, too

pallid gyro
#

the refresh icon also appeared squished, I tried to fix it but as you can see I wasn't fully succesful.

static lion
#

That has already been fixed..
Just not pushed yet ๐Ÿ™‚

static lion
#

@pallid gyro

fervent raven
#

My right mouse down click is not processed in FSceneViewport::OnMouseButtonDown while in a menu due to these lines:

const bool bProcessInputPrimary = !IsCurrentlyGameViewport() || HasMouseCapture() || (ViewportClient->GetMouseCaptureMode() == EMouseCaptureMode::CapturePermanently_IncludingInitialMouseDown);

const bool bAnyMenuWasVisible = FSlateApplication::Get().AnyMenusVisible();

// Process the mouse event
if (bTemporaryCapture || bProcessInputPrimary)
{
    if (!ViewportClient->InputKey(FInputKeyEventArgs(this, InMouseEvent.GetUserIndex(), InMouseEvent.GetEffectingButton(), IE_Pressed, 1.0f, InMouseEvent.IsTouchEvent())))
    {
        CurrentReplyState = FReply::Unhandled();
    }
}

since both bools always seem to be false while inside of my menu.

Is suspect that bAnyMenuWasVisible should return true, but I can't find much about the Slate MenuStack. Is this still in use? I am using Unreal 5.4.

#

Or could there be another reason why my input is not processed?

grave hatch
#

In the editor or game?

snow bough
#

hey
i hape a question about SNumericEntryBox

the min value works fine, but the max value is always 100

SNew(SNumericEntryBox<double>).AllowSpin(true).AllowWheel(true).MinDesiredValueWidth(30.0f)
// .SpinBoxStyle(&FCoreStyle::Get().GetWidgetStyle<FSpinBoxStyle>("SpinBox"))
.MinValue(20.0f).MaxValue(512.0f).SliderExponent(1.0f)
.Delta(0.1)
.Value_Lambda([this]() -> TOptional<double>
{
    return TOptional<double>(fff);
})
.OnValueChanged_Lambda([this](double NewValue)
{
    fff = NewValue;
})
.OnValueCommitted_Lambda([this](double NewValue, ETextCommit::Type CommitType)
{
    fff = NewValue;
})
pallid gyro
#

did you try setting the max slider value parameter?

snow bough
river thunder
#

is there anything like SSplitter which could be used to control size of a target widget?

pallid gyro
#

SBox?

river thunder
#

yea kind of, was more thinking of something which provides visual "handles" for the user

#

so guess i would have to make my own

pallid gyro
#

SSplitter works but it is limited, I also ran into issues with it and I believe that just using a bunch of SBoxes is the the way to go. I'm pretty sure that the unreal sequencer just uses a few SBoxes inside an SScrollBox, but it's been a while since I looked into it.

ember veldt
#

Anyone knows how HitTestInvisible works under the hood? Does it go to each child widget in the hierarchy recursively and set their visibility? Or maybe it only sets it on the widget you specify and children are ignored by checking if their parent is HitTestInvisible?

grave hatch
#

I think it's just the widget and the children use their own visibility? Maybe?

ember veldt
#

Ran a quick test, turns out it doesn't set visibility on all children, like you said. If a child widget was visible, it stays that way. Cool :p

grave hatch
#

Thought so!

#

I use that specifically for floating panels that need to be click-through-able, but contain buttons and the like.

ember veldt
#

Yeah it's neat! Currently using it to prevent the client from dragging items around. It covers that short window before the Inventory has replicated back after an action. Mostly useful for high ping players

lunar walrus
#

Hello, can someone
help me ? I created a widget with a specific ratio using a SizeBox that wraps the widget, and I would like to add several of them in a Vertical Box. However, it doesnโ€™t exactly maintain the ratio. The width is correct and matches the width of the Vertical Box, but the height is incorrect (visually, the widget looks correct, but the Vertical Box adds a huge space above and below). This is not a padding issue. Could you help me?

grave hatch
#

You'd need to set the alignment of the slot your vertical box is in or wrap it with a box.

#

Or you can try fiddling with the vertical box slots, e.g. setting .AutoHeight() on each slot

lunar walrus
rustic bone
#

Does someone know why my widget invisible after creating and adding to viewport successfully?

grave hatch
#

Use the widget reflector to find out.

rustic bone
# rustic bone Does someone know why my widget invisible after creating and adding to viewport ...

was this
Youโ€™ve hit a classic UMG pitfall: youโ€™re building/changing the WidgetTree in NativeConstruct. Thatโ€™s too late. The actual Slate widget hierarchy is already built by the time NativeConstruct runs (itโ€™s built in RebuildWidget). So reassigning WidgetTree->RootWidget or creating a new root/canvas in NativeConstruct will not affect whatโ€™s actually rendered. Thatโ€™s why your C++-created content never appears (and doesnโ€™t show in Widget Reflector), while the BP text (โ€œay cabronโ€) does.

heady plank
#

Hi y'all. I've got an interesting situation. I'm using Slate.ApplyDisabledEffectOnWidgets=0 to not apply transparency on disabled widgets, but the transparency is still being applied upon children within a** Retainer Box**. Any hopes of my being able to fix this without moving to a source build?

balmy sinew
#

anybody else missing the option to click on the cine actor button to get into the options of it quickly?

last estuary
#

as a programmer how much can i get away with actually not creating UI, in the sense of assigning functions in pure cpp and drawing etc, similar to persona workflow per se, creation of buttons, windows similar as to ImGui type of deal but that game ready, as for more context i have a couple of game features that rely on UI to function properly(Strategy Game), show selected units and other useful stuff sleek and functional nothing special and ugly.

low bluff
# last estuary as a programmer how much can i get away with actually not creating UI, in the se...

If you write stuff in slate, you can stick to C++. It's not gonna be immediate like ImGui, but well.

That said, if you aren't running into performance issues, using Slate instead of just UMG doesn't make too much sense.

You can create C++ class for the UUserWidgets in which you can have native UWidgets and your own UUserWidgets as BindWidget variables. Those will then be automatically linked up with the Blueprint UserWidgets once someone creates a child of the C++ one and creates matching Elements with the type and name.

mystic sleet
#

Is there a way to make a custom widget and have its display text be editable from the HUD it's housed in? I know I could set up a function to change it at runtime or the like, but it would be nice to edit it directly in the editor.

grave hatch
#

A slate widget?

#

Why not just wrap an SEditableTextBlock or whatever?

mystic sleet
grave hatch
#

So expose the text variable.

#

Also seems like #umg?

mystic sleet
#

Honestly not sure, I'm pretty new to Unreal's UI systems.

pallid gyro
#

Widgets on the hud are interactable as long as your player controller is set to 'UI only' or 'Game and UI'

mystic sleet
#

Ah, here we go. People had recommended making an editable text property which is applied on construct to the child text widget, but then I wasn't able to compile the HUD blueprint. I did pre-construct instead and it worked fine.

mystic sleet
#

I stand corrected, it compiles but still doesn't allow me to save the blueprint.

mystic sleet
#

Figured it out, it's because I had overridden the accessibility settings in the button blueprint.

last estuary
#

i did some slate shit, but its not looking to good not bad either

#

but i found this

low bluff
last estuary
#

i dont think it can be involved

low bluff
#

Then you are back to the usual flow. Peeps usually only use Slate for the Editor, when performance for a specific part of the UI is needed or if there is no alternative.

#

Other than that one usually uses UUserWidgets.

#

You can expose Slate Widget via UWidgets to UMG too fwiw.

last estuary
low bluff
#

But the MVVM and CommonUI are mainly meant for UMG.

low bluff
last estuary
#

๐Ÿ˜„

#

explored options to not touch Visual scripting ๐Ÿ˜„

low bluff
river thunder
#

i think anything can subscribe to the field notifies if i'm not wrong?!

low bluff
#

Which isn't even relevant to MVVM in that case.

hollow epoch
#

The interface supplies an โ€œAddFieldValueChangedDelegateโ€ function or something similar

pallid gyro
#

Does anyone know if you need to do something special to have a widget recognize touch gestures? I'm trying to implement pinch zoom in a slate widget and it's really strange, the touch gesture event never fires while the touch move event does (with the gesture type always being 'none' in the touch event)

grave hatch
#

Is there a gesture enable toggle?

pallid gyro
#

couldn't find anything like that

river thunder
#

iirc i had to override a enable input focus method to even get input to work on Slate widgets. If you didn't do that, it might be worth to check for that?!

pallid gyro
#

which method is that?

river thunder
#

i have no idea about the whole mouse/touch stuff

long pivot
#

Hello everyone, does anyone knows a tutorial or way to Drag and Drop Files from Windows (OS in general maybe) inside the game and basically gets its file path. I am creating a game that will require this implementation.

pallid gyro
#

try to find where it happens in the editor

#

some elements are in editor only code you'll have to extract and create a runtime equivalent of but other thingies are supported in runtime builds.

probably the ContentBrowser module would be a good place to look for the implementation.

shut dagger
#

Hey all, I think this has been asked before but I didn't see an answer.

I am trying to use a Retainer Box to apply an Post Process Effect to my HUD only.
The issue is, the Alpha from the Render Texture is wrong, translucent elements in some cases have solid Alphas, or maybe it is hidden elements still rendering their alphas into the texture?

Anyone had a similar issue? as it stop being able to set correct opacity so it can't blend back into the scene correctly.

grave hatch
#

Are you sure the alpha isn't just inverted?

agile juniper
river thunder
#

that is for sure not Slate related at all, and cross posting is against the rules...

grave hatch
bright maple
#

Hi. Is there any global delegate when a new Slate opens - a new Window opens in Unreal Engine?
Don't suggest rewriting a function in a class like PlayerViewport.

grave hatch
#

Check FSlateApplication

#

It has the open window functions and any events, if they exist, will be triggered in those functions.

bright maple
#

But i check one more time. Thank you!

formal dawn
#

trying to find why slate prepass is ticking like a monster any ideas?

grave hatch
#

In the editor?

formal dawn
#

does the same in standalone

grave hatch
#

Do you have many nested panels?

#

I'm surprised slate doesn't have a better breakdown.

formal dawn
#

i have one nested widget but i put it in an invalidation box, the actual slate process was showing that just cant really find the prepass stuff

grave hatch
#

If there's no further profiling info, all I can think is to remove things until it steps being silly.

formal dawn
#

maybe put every widget into an invalidation box?

meager snow
#

Guys

#

lets suppose i have a c++ code that fetchs an API

#

what is the best way to pass this data to a viewmodel that the blueprints are gonna use?

#

do I instantiate the viewmodels in c++ side and return the for the bp, using manual initialization?

pallid gyro
#

Using the UMVVM base view model object thingie is a good option I think as it allows you to display the info in a UMG widget with very little fuss and no need for any custom code to display updates.

meager snow
#

You mean, instantianting the VM and passing it?

#

sorry, kinda new to this

#

XD

pallid gyro
#

yeah, have some object derived from UMVVMViewModelBase and just pass that to the widget.

#

tbh if you only have one instance you could also probably make a global view model thingie but I am not familiar with that, NewObjecting a UMVVMViewModelBase derived object is easy enough

hollow epoch
#

If you only have one instance you can register it with the Global Viewmodel Subsystem, which makes it accessible with a "Global Viewmodel Instance" Creation type, but the annoying thing there is that it's basically this weird lookup with a Context object of the Viewmodel's class and a magic string FName.

#

I'd say have your fetch logic callable by blueprint and have it return a Viewmodel, and then yeah you can set it to Manual creation that wya.

urban chasm
#

Looking for some help with an unresolved external symbol.
I've got an ordinary DA class in my game's code:

UCLASS()
class UTAbilityTagRelationship : public UDataAsset

I've got a detail customization struct in the editor side which includes the .h, finds an instance of that DA, and wants to call a function on it:

#include "Character/Data/UTAbilityTagRelationship.h"
.
.
void FTGameplayAbilityCustomization::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
.
.
  FGameplayTagContainer OutTags;
  MyAbilityTagRelationship->GetRelatedTagsForExactTag(Tag, OutTags)

then I get an unresolved external error for the GetRelatedTagsForExactTag call (which is a real function on my DA class).
I get the sense that this would be fixed by adding another module dependency... but what dependency, and to which .build.cs file?

stuck jewel
urban chasm
stuck jewel
urban chasm
#

ah! I do, thank you, that was able to fix

urban chasm
#

another silly question - I'm doing a detail customization to change the value display for some fields in a class. per some advice I'm using Category->AddProperty with my new customized widgets. This seems to change the order that the fields are displayed in from their original layout... is there an alternative to customize the value display of certain properties without changing the order they're displayed in?

stuck jewel
#

can you describe what you're doing a little more detail?

#

your high-level options are a full customization of the details panel like you're doing, or building property type customizations e.g. for custom structs (think of FVector as a common example)

urban chasm
#

I was able to find what I was looking for - a difference of using DetailBuilder->EditDefaultProperty(PropertyHandle) instead of Category->AddProperty(). I figure this is the obvious way I was supposed to do that, just had a hard time finding the method name

stuck jewel
#

ah, right on. i don't even think i knew about that one, lol

#

typically if i know i want some custom behavior for a kind of property i consider making it a custom "type" (struct) and building a property type customization for that struct, which gives me something reusable. but that could often just be overengineering ๐Ÿ˜„

static lion
#

Will also push attention here.. cause it also fits here: #editor-scripting message

Edit: Solution found in the messages below that linked one..

warm grotto
#

Does someone knows, how to make part of plugin slate window dock able?
I just want part of the window to be dock able. Found something in source, FTabManager not sure if that is thing to use or how to use it

pallid gyro
fiery sphinx
#

I am making a small Editor plugin to automate some tasks in UE4, due to limitations of Python. I am wondering how to do layout of the UI without painful cycle of tweaking C++ code and reloading UE4 like every minute

stuck jewel
#

No live coding?

fiery sphinx
#

there is no live coding with UE 4.27 afaik

#

I am on Windows

#

and I mostly did BP with UE, so I don't really know much about C++ / hot reloading / live coding ๐Ÿ˜…

stuck jewel
#

Ah, diving into slate new to c++ is going to be quite a trip.

4.27 has live coding

grave hatch
#

Slate is.... Special.

fiery sphinx
#

is there a better (easier) way to make layout of the plugin's UI ?

grave hatch
#

Umg?

pallid gyro
#

I know nothing about what's available in 4.27 cause I've only ever used unreal 5 but other than Editor Utility Widgets which you can design in UMG you can also conceptually make some standard UMG widget and then use it in an editor customization using TakeWidget but if you really want editor only fancy c++ functionality this is almost certain going to have quite a few iterations involved.

#

Like generally if you're learning slate and editor modifications expecting a few recompilation cycles and some trial and error is par for the course, live coding helps but that's still recompiling stuff, if your testing project is light enough and you're not changing headers that are used in many .cpp files it's really not that bad.

stuck jewel
#

My brain still hasn't grok'd the difference in setting up anchors and stuff in umg vs slate since umg puts the settings in the child and slate you write the darn things under the parent

#

(Meaning: unless you're very XP, just making a UMG layout will not massively help with making a slate layout)

pallid gyro
#

Conceptually you can make some base c++ widget class with all your function definitions, then make a UMG BP class inheriting it and fully design that fella and then just use the class reference CreateWidget the mofo and TakeWidget the TSharedRef and throw that into your whatever, but really idk

#

I tried doing these sorta thing once or twice but you still need to iterate and compile, pretty much whenever you want to add a new method, it's pretty miserable

#

and the unspoken secret is that UMG editor widgets tend to look quite awful and even when epic make them they don't quite look the same as editor slate

stuck jewel
#

yeah live coding edits to classes likes to crash a lot. i felt like i had more success w/live coding if i only added new funcs/vars onto the bottom of an existing class, but that just becomes a mess. you also have to make sure to close widgets in between live codes because changing it while it's in use crashes most of the time too

grave hatch
stuck jewel
#

Yeah I know. It still makes it really hard to translate settings from umg to slate

low bluff
grave hatch
#

Good stuff...

static lion
#

Same for Border.. which does not exist in Slate.. they are just SBox with a Style applied..

grave hatch
#

...it doesn't use SBorder?

pallid gyro
#

Yeah SBorder definitely exists

static lion
#

Never used it.. crying
Maybe because it simply is an SBox with a style xD

grave hatch
#

It isn't

#

It's probably very similar, though.

static lion
#

๐Ÿคทโ€โ™‚๏ธ possible..
Tested it in the past 30 minutes.. does not seem to be different in behavior..

pallid gyro
#

SBorder doesn't manipulate the size of its contents like SBox does + it has some slate events for handling mouse interactions and stuff

static lion
#

Ah - understand

low bluff
#

Can I somehow cover all cases of "Widget is focused that can consume key presses"? I want to skip some debug logic if a player is typing into any form of input box (so not only text box, but whatever else can be typed into, slate-wise).

Currently using const TSharedPtr<SWidget> FocusedWidget = FSlateApplication::Get().GetKeyboardFocusedWidget();, but I'm not sure if that entails a button having keyboard focus for navigation.

#

Is it a matter of expecting a SEditableText widget as leaf?

#

Keyboard focus is def covering more than just things one can type into, hm.

grave hatch
#

It should do. I believe buttons can have keyboard focus. And CommonUI, for instance, definitely works with focus for gamepad navigation.

#

(and mouse)

low bluff
#

Yeah I checked a bit more and Keyboard Focus def doesn't cut it.
That's already "true" for the GameViewport...
Checking for SEditableText is also not enough cause there are multiple widgets that can handle text.

#

Think I just have to stay away from input chords that can be pressed while typing messages.

#

On top of that, the console window doesn't seem to be an actual slate window and is handled specifically by hand inside the ViewportClient..

bright maple
#

Hello.
Is there a way to override the output of a DynamicSection with another DynamicSection for a UToolMenu?

For example:

UToolMenu* Menu = UToolMenus::Get()->FindMenu("ContentBrowser.AssetViewOptions");
Menu->AddDynamicSection(
"AssetTreePickerDynamicEntry",
FNewToolMenuDelegate::CreateLambda([](UToolMenu* InMenu)
{
UContentBrowserAssetViewContextMenuContext* Context = InMenu->FindContext<UContentBrowserAssetViewContextMenuContext>();
if (Context == nullptr)
{
return;
}

UToolMenu* Menu = UToolMenus::Get()->FindMenu("ContentBrowser.AssetViewOptions");
Menu->FindSection("Test")->FindEntry("Test");
//Do some funny things;

As far as I can see from CallStack, much of the work with UToolMenu in Dynamic Section mode is done in isolation in a separate Temporary Tool Menu, and then The results are merged into one Tool Menu Result. (712 ToolMenu.cpp)

{
    TArray<FToolMenuSection> RemainingSections;

    UToolMenu* ConstructedSections = nullptr;
    for (const FToolMenuSection& OtherSection : Other->Sections)
    {
        if (!OtherSection.IsNonLegacyDynamic())
        {
            RemainingSections.Add(OtherSection);
            continue;
        }
        
        if (ConstructedSections == nullptr)
        {
            ConstructedSections = NewToolMenuObject(FName(TEXT("TempAssembleMenu")), NAME_None);
            if (!ensure(ConstructedSections))
true elbow
#

โ“ is there tutorial how to use Widget Reflector -> TakeSnapshot and use it's navigation debug options ?

#

โ“ is there any comprehensive guide on how CommonUI, EnhancedInput and focus works ?
I mean beside docs, the're hard to follow, hopefully somebody can recommend one where somebody figured out how those systems work in conjuction

grave hatch
#

For common ui, I'd ask #umg unless you specifically have a question about the slate side of it.

#

Then it's better to ask a specific slate question 9r check the common ui source. It's not that big.

zenith ruin
# true elbow โ“ is there any comprehensive guide on how CommonUI, EnhancedInput and focus work...

Hey! There is a useful slate compendium here, is perfect if you know what you need explaining, at least to point you in the right direction. But I would suggest taking it a step further and digging into the source code yourself...
https://github.com/YawLighthouse/UMG-Slate-Compendium

GitHub

A Compendium Information Guide for UMG and Slate in Unreal Engine. - YawLighthouse/UMG-Slate-Compendium

lethal pasture
#

Does anyone knows how landscape mode set these icons #cpp message

I tried to replicate it(I copied parts of the code exactly the same way epic did it) but all I got was a button with text Only, I dont understand how Epic set these icons!!!

grave hatch
#

It's part of the interactive tools framework.

#

You set up a command which has an icon set in a style, then add that as a tool to a tool set, which is part of your custom editor mode.

#

Good luck!

lethal pasture
# grave hatch It's part of the interactive tools framework.

I copied the code from landscape editor mode and i understand it, the only thing i dont understand is the icon, in UE the icon is not set in the command which is kinda blowing my mind let me look for github link of the command they are using

grave hatch
#

And?

lethal pasture
# grave hatch And?

you said You set up a command which has an icon set in a style, where's the icon style in this command?

grave hatch
#

In the style class.

lethal pasture
#

this command creates button with text only

lethal pasture
grave hatch
#

I don't know. Look at the module for a style class.

lethal pasture
#

i think i found out where the engine does it, i always ignored the file because i thought star fucking ship is some UE sample, so i ignored it

#

who would name a place where editor tool style is a starship !

grave hatch
#

That'll be the general editor styles, not sure if the landscape editor ones will be there.

lethal pasture
#

it is set there

#

but i always ignored the search result that had starship because i never thought main editor code would be in a place under that name!

#

it's in starshipeditorstyle a perfect name to describe code related to UE landscape editor style all the editor styles are set there in the FStarshipEditorStyle::FStyle::SetupLevelEditorStyle

stuck jewel
#

sadly the whole style system feels like an absolute piece of ass

#

but... it's a thing we've got

#

like... how come you can define something in FStarshipEditorStyle, and then just read that data from FAppStyle? wtf?

#

i guess i've never tried reading across from other children styles, maybe there's some inheritance system at play i've never noticed

lethal pasture
#

the whole engine has some nasty stuff but nothing like that like that, this one take the cake, I used to hate the chaotic naming convention inside a single system, for instance it seems like the person who wrote static mesh and the person who wrote skeletal mesh live in different universe there's no consistency in the naming between the two. Now This!

kindred nova
# stuck jewel like... how come you can define something in FStarshipEditorStyle, and then just...

style set inheritance was added in 5.0, with routing changes. Starship is the name of UE5 editor style set

in UE4 if you want editor items you access those via FEditorStyle, for non-editor items in FCoreStyle but it was all unified under FAppStyle.
in UE5 FEditorStyle, FCoreStyle now simply forwards calls to FAppStyle

in UE5 there is a single FAppStyle entry point which points to whatever app-default style set in runtime - CoreStyleSet, EditorStyleSet, StarshipStyleSet which also support inheritance to simplify search. When editor is running AppStyle set to Starship, when game is running AppStyle set to Core, when Program running you can set AppStyle to something else

If you ever need to write engine-agnostic editor code you can use this helper trick

#if UE_VERSION_OLDER_THAN(5, 0, 0)
#include "EditorStyleSet.h"
using FSlateStyleHelper = FEditorStyle;
#else
#include "Styling/AppStyle.h"
using FSlateStyleHelper = FAppStyle;
#endif

FAppStyle is only to read the current style set, if one want o modify the style set - you need to find the ISlateStyleSet and modify it

stuck jewel
#

Gross! Thanks for the info though โค๏ธ lol

lethal pasture
grave hatch
#

It's based on the name of the style I think. Or something like that.

#

It's not the module.

kindred nova
lethal pasture
#

What to write here if i am making my own style

    : FSlateStyleSet(StyleName)
{                                            
//MyPluginContentFolder/Editor/Icons/
    Set("What to write here", new IMAGE_BRUSH("Editor/Icons/MyIcon", CoreStyleConstants::Icon20x20)
    FSlateStyleRegistry::RegisterSlateStyle(*this);
}```
grave hatch
#

Do you have a commands class?

lethal pasture
grave hatch
#

You provide a style name as a parameter there.

#

I think it's that style name . command name

#

E.g. MyStyle.MyCommand

lethal pasture
#

and what about the Set in my style can i give it any descriptive name or does it have to be specific format

#

Set("What to write here", new IMAGE_BRUSH("Editor/Icons/MyIcon", CoreStyleConstants::Icon20x20)

grave hatch
#

I literally just told you that...

lethal pasture
#

Oh so this is for the parameter okay mybad sorry

lethal pasture
grave hatch
#

๐Ÿ‘

#

And in your case, the context was?

lethal pasture
#

the context name you put in the ctor of the command

grave hatch
#

Yeah.

#

The context, not the style name!

elder falcon
#

i have a unique case where i need a secondary UI window and the main window renders the game on a different screen. i'm currently using this plugin
https://www.fab.com/listings/d57cac24-2827-457a-a47d-37e694f57388
it just spawns a new SWindow which works great, but if i interact with any hit-testable UI on that window, it freezes the game on the main window. anyone have any ideas to prevent this freeze?

keen quartz
#

I need some advice on how to structure these UE5 U.I. asset?

I have a story system that runs 2D animations and a multiple choice dialogue system in a U.I. widget so I can overlay these quickly onto a 3D world. Currently I stream in the asset as they are needed, but all those assets are still present in a single UE5 level and load up when the editor is openned. In the past I actually could not open my UE5 project due to memory issues in the editor. I'm afraid I am going to hit that limit again soon when I merge in the 3D gameplay level.

Any suggestions on how I should structure these assets to not overload the UE5 editor? Is there some way to not have the tool load all these 2D animations and audio all the time?

Video of what I am doing included.

grave hatch
#

Use soft references?

keen quartz
# grave hatch Use soft references?

They are all soft references, but the actual art files are still loaded into the editor, and some of these characters have 1000s of frames.

grave hatch
#

They shouldn't be loaded when you open the level if you're using soft references correctly.

keen quartz
grave hatch
#

The editor does have a tendency to keep things alive. But that all gets flushed when maps are reloaded. What's opening all the assets when you open a map?

keen quartz
grave hatch
#

I mean when the level editor loads a new main map, sorry. Not streamed sub levels!

#

I still don't know what's actually loading all of that data when the level opens.

stuck jewel
#

is it when the level opens or is it after you click on too many of those things one by one (whether closing them in between or not)

grave hatch
#

You don't appear to be playing 50 videos when the map opens.

keen quartz
grave hatch
stuck jewel
#

also feels like kind of a weird UX choice to let someone open up all of them at the same time ๐Ÿ˜„

keen quartz
grave hatch
#

You just have to remove all references to a asset and it will be unloaded... Eventually.

stuck jewel
#

no it won'

grave hatch
#

No?

stuck jewel
#

i mean aside from maybe changing the main map, that i haven't checked

grave hatch
#

That does it for sure.

stuck jewel
#

i made this silly thing to garbage collect assets so i could debug async loading behavior but... it might be useful for you here, you would just have to mash this silly button once in a while and hope it frees up some memory. it might work for you to hit it in between PIE's for example https://github.com/HomerJohnston/UE-EditorGCButton

grave hatch
#

Btw, the editor doesn't even load async things in a different thread unless you pass a specific startup flag. It's great ๐Ÿ‘

keen quartz
#

thanks, will check that out. I did get super paranoid once I ran out of memory. Everything is soft reference and was moving towards separating each scene into a level as well. Worst case I could just not load all the levels into the main game until ready to build

grave hatch
#

Not sure about -game behavior.

keen quartz
#

This wa a case though, where the editor would not even start up... just complained not enough memory to load the project

stuck jewel
#

that sounds like wrong soft pointer usage somehow then

#

(you could also have both issues and be getting extra confused by seeing them at different times, the world is your oyster!)

grave hatch
#

Sadly not the uworld.

keen quartz
#

O.k. then maybe I'll be good then... I have since made big pass at all most references, was just worried as next week I merge the 3d gameplay into the main file

limpid ridge
#

I want to create a property customization for a uint32 bitflag that allows me to set the individual flags with check boxes rather than the default combo box menu. (See attached VeryHighQualityโ„ข mockup). I've managed to figure out how to create a row for every non-hidden flag in the bitmask, but I'm not sure how to add a checkbox that will set the appropriate flag bit. Slate is still very very new to me; can anyone point me in the right direction with this?

void FJoltCollisionLayersCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> PropertyHandle,
    IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& CustomizationUtils)
{
    if (!PropertyHandle->IsValidHandle())
    {
        return;
    }

    uint32 NumChildren = 0;
    PropertyHandle->GetNumChildren(NumChildren);

    auto LayerFlagsHandle = PropertyHandle->GetChildHandle("LayerFlags");

    auto& LayerFlagsRow = ChildBuilder.AddProperty(LayerFlagsHandle.ToSharedRef());

    // The individual flag bits are named using the EJoltCollisionLayer enum as the BitmaskEnum property
    // To minimize clutter we only generate rows for values of EJoltCollisionLayer that are not marked as UMETA(Hidden)
    // This corresponds to layers that have been set up in the project settings.
    auto* Enum = StaticEnum<EJoltCollisionLayer>();
    for (int32 Idx = 0; Idx < Enum->NumEnums(); ++Idx)
    {
        if (!Enum->HasMetaData(TEXT("Hidden"), Idx))
        {
            ChildBuilder.AddCustomRow(FText::GetEmpty())
            [
                LayerFlagsHandle->CreatePropertyNameWidget(Enum->GetDisplayNameTextByIndex(Idx))
            ];
        }
    }
}
#

(screenshot of the actual property customization in the details panel doesn't quite match the code because it was taken earlier in the process but it's still illustrative of what I have)

grave hatch
#

You specifically want checkboxes instead of the dropdown menu?

#

(You can get that to work with up to 64 bits afaik)

#

I would add a custom checkbox entry that links to the property and knows which flag it is toggling.

#

If you want checkboxes.

limpid ridge
# grave hatch You specifically want checkboxes instead of the dropdown menu?

Yes. This is editor integration for my project that I'm integrating Jolt physics into and
1.) I want to make the workflow as familiar as possible for the rest of the team, and Chaos collision setup uses checkboxes
2.) This is something that designers will be touching a LOT so even though a combo box isn't necessarily high friction it can get tedious to set up once collision layers are filled out

grave hatch
#

Yeah, then add an SCheckBox which has OnStateChanged (or whatever) which passes the payload of the flag it's changing. If you have no owning outer, it can have a weak ptr to the property in the payload too.

#

Honestly I can't remember the lifetime of the customisation for storing properties and the like.

limpid ridge
#

This value is just going to live in a UAssetUserData object that mimics UBodySetup so I should be able to rely on having an outer, I think

grave hatch
#

I mean an outer to the scheckbox that can store the property handle. But if it's just changing a specific uobject, you could pass a weakptr to the uobject in the payload.

limpid ridge
#
void FJoltCollisionLayersCustomization::CustomizeChildren(TSharedRef<IPropertyHandle> PropertyHandle, IDetailChildrenBuilder& ChildBuilder, IPropertyTypeCustomizationUtils& CustomizationUtils)
{
    if (!PropertyHandle->IsValidHandle())
    {
        return;
    }

    const auto LayerFlagsHandle = PropertyHandle->GetChildHandle("LayerFlags");
    auto& LayerFlagsRow = ChildBuilder.AddProperty(LayerFlagsHandle.ToSharedRef());
    auto& LayerFlagsGroup = ChildBuilder.AddGroup("LayerFlagsGroup", INVTEXT("LayerFlagsGroup"));

    const auto LayerMaskHandle = PropertyHandle->GetChildHandle("LayerMask");
    auto& LayerMaskRow = ChildBuilder.AddProperty(LayerMaskHandle.ToSharedRef());
    auto& LayerMaskGroup = ChildBuilder.AddGroup("LayerMaskGroup", INVTEXT("LayerMaskGroup"));
    
    uint32 NumChildren = 0;
    PropertyHandle->GetNumChildren(NumChildren);
        
    for (uint32 ChildIndex = 0; ChildIndex < NumChildren; ChildIndex++)
    {
        auto PropHandle = PropertyHandle->GetChildHandle(ChildIndex);
        
        if (PropHandle->GetProperty() == LayerFlagsHandle->GetProperty() || PropHandle->GetProperty() == LayerMaskHandle->GetProperty())
        {
            continue;
        }

        ChildBuilder.AddProperty(PropHandle.ToSharedRef());
    }
}

I'd like to indent LayerFlagsGroup and LayerMaskGroup one extra indentation layer. How can I do that? SDetailRowIndent or whatever the widget is called is private within the PropertyEditor module

limpid ridge
pallid gyro
#

I have this widget that is like a paint window (a midi piano roll) and I want to keep things modular so it's a slate with a UMG wrapper yada yada, I now want to have another widget that is like a 'palette' it lets you pick which some settings and tools that affect the main widget, now I figured I'd like to have some keyboard shortcuts, what would be a good way to achieve that? when I used asset editors and toolkits I used FUiCommands, would this approach be suitable here as well? just bind/unbind them when I create the widget?

Like what I 'worry' about here is that if I'm focused on the editor just using key pressed events won't affect the palette widget, but reFUiCommands I also probably wouldn't want to react to them when the widget is no longer focused, so I'm not sure about that.

I might also want to intercept Ctrl+Z to implement undo specific to this widget. Part of the motivation is that I also want this editor to be accessible in game runtime, so people could use it not just as an editor thing. Not that anyone is really likely to use it, but stil.

Should probably just experiment I guess.

grave hatch
#

Commands would be the way to go, yes.

#

You could use an input preprocessor to add a "global" keybind.

#

Screwing around with the editor toolkit's keybinds is just annoying.

gilded coyote
#

how do i get widget element's screen position?

grave hatch
#

get its tickspace geometry and it'll be on there somewhere.

#

Absolute position is the position within the window, not the screen, I think?

#

There's probably some conversion functions somewhere.

vapid stag
#

i'm using a custom URichTextBlockDecorator class to render images inline with a richtextblock, but I was wondering if theres a way to display the SImage without it taking up line space? so it doesn't shift the text at all and text could potentially be behind the image?

grave hatch
#

You could probably exploit overdraw to do it. I don't think there's a good way, though.

vapid stag
#

yeah there really isn't.. i guess i could use a canvas or something and just draw the image overtop seperately

grave hatch
#

By exploit overdraw, I mean add a zero sized element and use overdraw to draw the image outside of it.

#

Maybe combined with render transform.

#

Whether that would appear behind other things is a whole other question.

#

Will absolutely fail at the end of lines and stuff.

#

You could use an SOverlay to just put something behind the text and try to align it manually?

thorny condor
#

Not sure if this is more of a slate question or #materials but I'm trying to get the cursor position in a material. I'm using the UGameViewportClient->GetMousePosition method which returns a local mouse position but the material ScreenPosition > PixelPosition is in the frame buffer space.
It gets tricky when I need it to work in editor, in a popup editor window, and stand alone game. The viewport client mouse is always in a different hierarchy and it's not as simple as converting the mouse from local to absolute coords.

grave hatch
#

Have you tried getting the mouse position of the viewport, rather than teh viewport client?

thorny condor
#

That doesn't work in the editor because the viewport is a smaller rect than the editor window which is the space the pixel position is in

#

It works great in standalone though!

grave hatch
#

if (GEditor) { do one thing } else {do other thing} ๐Ÿ˜ข

thorny condor
#

This seems to be working!

    FSceneViewport* Viewport = ViewportClient->GetGameViewport();
    FIntPoint LocalMousePosition;
    Viewport->GetMousePos(LocalMousePosition, true);

    const TSharedPtr<SViewport> ViewportWidget = Viewport->GetViewportWidget().Pin();
    const FVector2D AdjustedMousePos = ViewportWidget->GetPaintSpaceGeometry().LocalToAbsolute(LocalMousePosition);
    FLinearColor CursorPosition;
    CursorPosition.R = AdjustedMousePos.X;
    CursorPosition.G = AdjustedMousePos.Y;
broken hemlock
#

I'm making my first plugin... and this Slate is insanely more difficult than UMG. I did not realize what I was getting into lol.

Any suggestions when you make an SWindow with a title how to really stop the X button from closing the window? I create a title and set the HasCloseButton(false) but like 20% of the time you can still click that close button and then it messes everything up. I can't find a callback for determining that the close button specifically was clicked, either.

#

Or if anyone could recommend handling close buttons in a more pragmatic way? Basically what I have are delegates that I've bound to with return values, and when the SWindow is created, I write this at the bottom to wait for the values to be input, and then I request destroy the main window from inside the lambdas for the text commits or button clicks and then it returns the values.


FSlateApplication& SlateApp = FSlateApplication::Get();
                SlateApp.AddModalWindow(Window, FGlobalTabmanager::Get()->GetRootWindow());

                while (Window->IsActive())
                {
                    SlateApp.Tick();
                }

                return bConfirmedPassword;
#

I can't seem to find a decent way to call for requesting the destroy of this Window by clicking the X close button in the title

#

And then naturally the first thing someone mentions to me when I demo the stuff to them is that it would be nice to have a title bar so they can understand better what all these things are doing

#

I agree with them tho

low bluff
#

Manually locking the thread and ticking the SlateApp sounds problematic

#

There is more stuff that happens during the Engine Loop than that

broken hemlock
#

Also if I looked better I could've just read that if I set all of those values to false it won't create the close button

#

No close box, no minimize, no maximize and it doesn't create them. If any of them are true then it creates them