#slate
1 messages ยท Page 20 of 1
But you are setting the images etc. in the asset in the editor?
I'm setting images, margins, sizes in editor for the main, shared assets. Stuff like icons, that are used only once or twice, would use the GetIcon("MySlateBrush") approach
Random icon example here
Random theme setting example there
These are just how I liked to work on that game, it's not necessarily best. Most UI people are UMG only
Right, so you have a StyleSet that is static
That one retruns the StyleCatalog when calling GetDefaultTheme on the StyleSet instance
And the StyleCatalog is then where you grab the brushes from
return FFlareStyleSet::Get().GetWidgetStyle<FFlareStyleCatalog>("/Style/DefaultTheme");
What does the /Style/DefaultTheme stuff refer to?
Is that something engine default or did you specify that somewhere
That's my style asset.
That doesn't explain me how this works though :P
I can't find anything about /Style/DefaultTheme in your project.
Is that a path to something in the content folder, or is it some sort of path for slate that you registered as?
It refers to a PropertyName in the function
But what is that PropertyName
Can I call that "MyOtherTheme" if I want to?
It's not in the project, it's a content asset. BP instance from the FlareWidgetStyleCatalog class
Just the name of the file
So it just sits in /Content/Style and is called DefaultTheme.uasset?
Yes.
That makes more sense
Like I said earlier, Slate is the kind of framework you'll use to create your own environment depending on what you're doing. Working with a stylesheet asset that defines all common stuff - the content padding setting is one used in like 500 lines - worked for me
It's my version of avoiding hardcoding stuff
You could also simply just have all of these settings in the styleset header.
FMyStyleSet and then FLoadingScreenStyle
And putting all required stuff into the FLoadingScreenStyle asset
Think that might work out
Not a fan of putting everything into the same style
Thanks! Will see how far I get
Just beware, if your loading screen is of the "standalone game module" variety, it also means the style set needs to live there too.
If it's of the "compiled in game module and started from level loading callback" variety, it's fine
It's done in the GameInstance, called when the level loads
HR was #1 and doesn't use styleset in loading as a result, new project is #2, looks like you're doing 2 too.
Yeah I don't have a second module for the loadingscreen part
Good for your health
There are enough other things to hurt my health
Do I need something special to get FSlateWidgetStyle to be found?
Build.cs lists SlateCor and Slate.
And I include #include "Styling/SlateWidgetStyle.h"
Yet it tells me it can't find the FSlateWidgetStyle class
Ah
Still had class instead of struct infront of it
Stupid templates when creating empty classes via editor
Hm, can seem to get Slate to do what a UMG Widget in terms of layout.
Pretty sure I recreated the UMG widget in Slate 1:1, but some parts are still broken.
Such as a HorizontalBox with a text and a throbber looking totally normal in UMG, but in Slate the Text doesn't properly fill the box and is half behind the throbber (cut off)
Also in UMG nearly every element can be aligned. In Slate some of the HAlign and VAlign settings aren't existing
Can't even debug this properly as it's a Loading Screen which doesn't show up in Editor, so can't use the Widger reflector
+ SOverlay::Slot()
[
SNew(SBox)
.HAlign(HAlign_Right)
.VAlign(VAlign_Bottom)
.Padding(FMargin(0.f, 0.f, 50.f, 50.f))
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.HAlign(HAlign_Fill)
[
SNew(SBox)
.HAlign(HAlign_Fill)
.VAlign(VAlign_Center)
[
SNew(STextBlock)
.Text(FText::FromString("LOADING"))
.Font(FSlateFontInfo(FPaths::ProjectContentDir() / TEXT("Fonts/Rajdhani/Font_Rajdhani_Medium.ttf"), 42))
.Justification(ETextJustify::Left)
]
]
+ SHorizontalBox::Slot()
[
SNew(SThrobber)
.NumPieces(1)
.Animate(static_cast<SThrobber::EAnimation>(ThrobberAnimation))
.PieceImage(&LoadingScreenStyle.ThrobberBrush)
]
]
]
If I don't put the SBox around the text, I can't vertically align it as center :/
Actually I think I misunderstood how slots work in UMG vs Slate.
In UMG they are shown as part of the Widget element.
So it seemd the settings are based on the element.
However in Slate the Slot and the Element are two pieces
Moving stuff from SBox to the slot now and see what that does
That however didn't fix a single thing
Seems like Slate Slots are set to FILL by default.
AutoWidth solved it
+ SOverlay::Slot()
.HAlign(HAlign_Right)
.VAlign(VAlign_Bottom)
.Padding(FMargin(0.f, 0.f, 50.f, 50.f))
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.HAlign(HAlign_Fill)
.VAlign(VAlign_Center)
.Padding(FMargin(0.f, 0.f, 40.f, 0.f))
.AutoWidth()
[
SNew(STextBlock)
.Text(FText::FromString("LOADING"))
.Font(FSlateFontInfo(FPaths::ProjectContentDir() / TEXT("Fonts/Rajdhani/Font_Rajdhani_Medium.ttf"), 42))
.Justification(ETextJustify::Left)
]
+ SHorizontalBox::Slot()
.HAlign(HAlign_Center)
.VAlign(VAlign_Center)
.AutoWidth()
[
SNew(SThrobber)
.NumPieces(1)
.Animate(static_cast<SThrobber::EAnimation>(ThrobberAnimation))
.PieceImage(&LoadingScreenStyle.ThrobberBrush)
]
]
New code, in case someone wants to learn from my bad slate skills
@low bluff Yeah, layout in Slate basically works like this : you set on each object what the contents of the widget align to, and autowidth makes it use "the size it needs". Autowidth everywhere makes a compact layout, no autowidth makes a full-width layout with everything getting the same space.
Slots indeed fill by default.
Quick question: If I have a Text Variable in a Slate widget that I use for a TextBlock and I update the TextVariable, will it update the TextBlock?
Or do I always have to use a function binding to live update the TextBlock?
FText SomeText = FText::FromString("SomeText");
SNew(STextBlock)
.Text(SomeText)
SomeText = FText::FromString("SomeOtherText");
Will that update the TextBlock properly?
Doesn't look like it updates
I believe you can only have a value or a getter function (using TAttribute)
TAttribute can either have a set value or a callback
you can use something like this to set a callback (in this case, a static function)
You can pass values, attributes or callbacks to almost every Slate property
.Text(this, &MyClass::MyMethodThatReturnsFText)
Yeah so just text won't update
What signature do I need for the Text function?
const FText Function() const isn't correct hehe
FText Class::Method() const
Alright
Plenty of that stuff in Helium Rain ๐
:P I know, not the reason I asked
TAttribute<FText> in your class is a bit cleaner if you're going to update it directly
As a class member
Should be able to pass that to Text() and "just update it"
I don't think that would work, as setting a value for TAttributes only copies it
You could also just bind a function that simply returns your text property
TAttribute has functions like BindUObject, BindUFunction
Passing a TAttribute to an attribute parameter of a Slate widgets will store the attribute, not the value
Look at the slate parameters and check for SLATE_ARGUMENT vs SLATE_ATTRIBUTE
Well I tried using it and it didn't work. So I probably did it wrong.
The first assigned value worked, the updating didn't.
From the UE4 code for STextBlock :
SLATE_ATTRIBUTE( FText, Text )
TAttribute<FText> SomeText;
SomeText.Set(FText::FromString("SomeText"));
SNew(STextBlock)
.Text(SomeText)
SomeText.Set(FText::FromString("SomeOtherText"));
Is that wrong?
Cause it didn't work
SomeText is a class member right ?
Yes
I'm not saving the TextBlock widget and call SetText, that works
So the code that randomizes my text works (just to cut that option out)
Well, that's weird but okay, callback it is
Yeah, well just calling setText is still better than binding ยฏ_(ใ)_/ยฏ
Bindings's better if you have a bit of complexity, but yeah
Yeah, I just keep remembering Nick saying "Binding is the worst that happened."
And try to make it more event based instead of polling
E.g. Bullet Count only updates if you shoot, so tell the text to update instead of polling the BulletCount
Bindings are easier and more convenient of course
Quick Question about styles: Can I expose a Float variable in them? o.o
Binding is safer imho because you don't need to worry about forgetting some random case in a if somewhere, but yeah, of course it's potentially slower
You... can expose a float ? I don't see why not.
UPROPERTY(EditAnywhere, Category = Main) float BlurRadius;
Float !
It supports all regular Blueprint
Probably not the best idea to expose LoadingScreen parameters like this, but heeeeeeeeeey
Just need a float to control the time between two random tips
Without having to go into code so others can change it too
So into the LoadingScreenStyle it is
That's pretty much how styles are intended ๐
I guess? You don't get into contact with Styles much in UMG
Yeah you also rather go and wrap your Native Button into a custom Button widget
And assign style there
instead of using Styles directly
Which is not THAT bad, but still
i dont get whats the difference between slate_attribute and slate_argument
does slate_attribute just put the variable inside of tattribute and thats it?
FSlateDynamicImageBrush can take UTexture2D
... SProgressBar doesn't have a color & opacity setting for the background, apparently.
@quaint zealot But the UMG progressbar as a Style that has a Background Tint?
So basically a SlateBrush
Yeah, FProgressBarStyle has FSlateBrush BackgroundImage
Isn't that what you need? the Tint has Color/Opacity
Doesn't apply to the background apparently
@quaint zealot it needs to know to draw as Image so it can apply via the tint
otherwise it will default to box and I dont think it will show as working
hmm. actually maybe not. box should still work
It's not a brush problem, it's a SPRogressBar problem ๐
The bar colors fine, the background doesn't
Style works, too
There's just no runtime coloring for the background, so no way to fade the object in and out of existence.
I dont get it. I can fade one out in UMG, so its gonna work in slate right?
Style has a Background Image, Fill Image and Marquee Image. By default, if I just fade out the Background Image via the Tint colour, it fades out fine
@quaint zealot how did you make your 3d widgets?
The widget that appears when I click the Edit button for GameplayTag, what would I do to have it as an umg widget, in the palette? I don't really know much about Cpp.
Are the palette widgets the ones in the SlateTypes.h?
I'm working on an editor tool and I made viewport and viewportclient classes, but I have no idea how to spawn them, any help?
this is what it looks like
but the SNew is saying FCharacterToolViewportClient has no member FArguments?
ok nvm needed to pass the slate class not the client
still don't know how to spawn it, but at least it's compiling
Am I going crazy, or does SRichTextBlock not support shadows?
/chases @mild oracle with a butterfly net
OK so I am crazy
I dunno what I'm doing wrong, the FTextBlockStyle that's being used has a shadow set
Do you need to do it by Style?
ie. are you following the tutorial or have you implemented another method?
shadow works in our rich text
I'm still using the rich text stuff from before the re-write
so maybe that's it
FSlateTextRun etc.
this is how it looks in the tutorial.
that's out line not shadow tho
yeah I meant how they apply the styling
might be worth looking into Decorator classes too
I'll rewrite our rich text engine to use the new stuff, I've been putting it off
yeah Font + Styling can be a tricky thing to get right.
the outlines used to fuck with it too until I just commented out the part where it took them into account
I wonder what the proper fix is
I used to get a lot of issues in Scaleform with such things. Anything widget based that is dynamic can get hairy with Fonts. Had to micro-manage my own kerning and shit. Kinda felt that stuff should already be exposed so you can truly customise everything about your fonts and layout/styling
I hope it's still possible (maybe easier?) to get inline images, and inline buttons in text
And to use my custom rich text format thing too. e.g. This is *bold*, this is _italics_.
seems like we made the same thing
well easy is a relative concept. But you could go as far as producing your images in external code and bringing them in with Asset Manager or similar. There are PHP scripts you could call with VaRest or something to generate your images + shadows etc exactly how you want them
wow
I was just talking about putting UWidgets or brushes inline for icons and stuff
yeah @main hedge ? ๐
everyone likes unnecessary chat features
Ideally I want to support stuff like Upgrade to [weap:laser2] and it puts a clickable button with the correct name of the weapon
I had some crappy impl. working before the rewrite
then 4.21 or whatever it was completely rewrote everything xD
it is surprisingly difficult to parse markdown
I've just had two weeks of imagining the results of a matrix calculation, several-ty hundreds of times. My brain is in rows and columns now
what is the matrix for ๐ค
@urban bloom OK get in the van
rofl zeb
Hi Guys! Anybody knows how to make something like this on a plugin? I've been struggling a lot with it. I found SListView but it didn't help me too much
It's an array of TSubclassOf<>
If I want to create an custom editor window similar to this.
where should I start looking?
basically moving trough an animation and be able to place boxes.
I would start with the plugin tutorial on the Unreal Academy. That will give you insight into making a custom asset and a little on the custom graphs and how they are made.
@gray mesa
the video is not available
do you happen to know a mirror?@urban bloom
nvm it was on me
sorry for the ping
heh no worries
Any one know how to fix this?
ue4 is on my c drive
when I use the widget reflector
and click on something it says it cannot find the file
but it is looking in the wrong path
wild guess, but do you have debugging symbols downloaded?
yes....
Never had that feature work for me
Just alt shift O in Visual and search for the class, if you've got Visual Assist
@gray mesa Symlink that directory to your install
sym what?
yes
So symlink that directory to your install directory
so should I simlink my D drive with my C drive?
the install folder you mean?
that folder does not exist
the whole structure?
And make it point to your real install dir
Yes
So like
mklink /D D:\Build\++UE4\Sync\Engine C:\Whatever\Engine
@gray mesa i actually made that, what did u want to know?
oh you are the programmer who is working on Unreal Fighter 2D?
sick
I am currently just learning slate to create my own boxframe data system for my beat m up.
can I ask you questions in the future for when I come across specific stuff I need some direction in?
sure i guess, i wont answer everythig though
I can do it in a quarter of the time, but my rate is 8x as high and I require minimum hours 
what kind of stuff won't you answer for example?
Spilling source code for what i did, it was private contract work.
and anything thats going to take me more than 30 seconds to explain
Unless you want to pay me, busy bee
oh that wont be needed. it will only be simple stuff anyone knowing slate should be able to answer
Thats not how it works
Slate != Editor slate and support editor slate kits
not even close
ok, maybe not so simple stuff... I just started 2 days ago with this stuff I'll learn and know better in the future
lol Marc
Is there a way how to access FWidgetBlueprintEditor without modifying engine?
I am getting crazy that absolutely every pointer is private, so there is not even a way to hack it
I would like to get FWidgetReference of one specific widget from my project editor module
That is one thing which is driving me crazy about slate and umg. It lacks extensiblity from project code and all workarounds are blocked by strict access modifiers.
I beg to differ but then I have no shame in editing engine code. ๐ I think there is a block because they are meant to be private functions internal to a process. WidgetBlueprint stuff has some weird accessor methods in the editor. Usually from some Util class somewhere.
Nah, downloading source build. I knew that the time of source build is getting closer and closer to our project.
Going to do some work on enabling child widget properties propagation in UMG, I think it is one feature which is really missing
if you explain what you are doing a bit more, I might be able to help
ps. yes to child widget property propagation. I run a chain of SetupDefaults functions atm. It's tidy but its not the tidiest
Our new UI is built mostly on composition system, so we have multiple reusable widgets. Let's say that you have reusable widget WBP_Button (button style enum) and WBP_GenericDialog which contains this button widget. If you place your WBP_GenericDialog into another widget blueprint you lose access to WBP_Button properties because it is deeper then one level.
I see
I already have nice setup which is abusing SaveGame propety flag. If this flag is checked, then this property is visible in all parent widget properties, no matter how deep it is. This work's nicely however values get reset on compile, so I suspect that I am modifying just preview widget, not actual template widget.
Can you not abuse the WidgetTree to get access?
When I select a Widget in my detail panel, I only get the variable's Detail Panel. If you wanted to show the properties of that widget, you can do it with a Detail Panel Customisation. You would simply loop the Widget Tree of the passed in widget, then output it's Slate views
What I do is that in details panel customization I am geting customized object (=selected umg widget). For this customized object I am calling GetPropagatedProperties recursively (using WidgetTree). Output of GetPropagatedProperties is array of UProperty*. Every UProperty has own entry in details panel and when I modify it, value get's set correctly in UProperty. However, after compile, value of UProperty resets.
are you marking it dirty?
I noticed that if I modify the variable then yellow 'reset to defaults' arrow does not pop up. My guess was that it needs to get invalidated/marked dirty. However, I tried many different ways to mark it dirty
there are ways to save objects in a widget blueprint too. I have a function that gets the outer Widget Blueprint from a passed widget. Then I do what I need to its widget tree objects. Save the file manually and tadaa
nothing did the job
Save resets the value too.
There is another interesting thing about this. I originally tried to make these variables use standard properties customization (IPropertyHandle)
however that crashes on modify when modified variable is copied from Preview widget to Template widget,
because preview widget is hardcoded as currently selected widget
so I ended up using just simple SEditableText instead of original property customization widgets
but that gives me the error above
I will try to look for some manual save function
Looking at some old code. I have this that I use to mark a blueprint as dirty so the compile is required, which will save properly. First you mark your object dirty as usual. Then call this
FBlueprintEditorUtils::MarkBlueprintAsModified(UYourAPI::GetWidgetOwningBlueprint(WidgetInstance));
UWidgetBlueprint* UYourAPI::GetWidgetOwningBlueprint(UWidget* InWidget)
{
TWeakObjectPtr<UObject> WidgetObj = InWidget->WidgetGeneratedBy;
UWidgetBlueprint* OutWidget = Cast<UWidgetBlueprint>(WidgetObj.Get());
if (OutWidget)
{
return OutWidget;
}
else {
return nullptr;
}
}```
That's interesting, I was trying to find some way of calling MarkBlueprintAsModified() but I could not find anything. I am going to try that, thank you
that util class is a life saver
I see, i was looking at FWidgetBlueprintEditorUtils before. FBlueprintEditorUtils has whole bunch of new toy functions, haha
Yeah the WidgetBlueprintEditor stuff is kind of behind a wall because its a layer on top of UUserWidget in terms of what the developer is supposed to edit. I found this out the hard way trying to make a new WidgetBlueprint class that derives from UUserWidget. It did not go well. Instead I merely used the "switch the class parent" method which isn't the same but works.
So it did not help
however, I was able to get it work with custom engine
I needed to add just one line!
I was able to make it work using default property customization, no need for custom editable text
...without modified engine:
IDetailCategoryBuilder& Cat = DetailBuilder.EditCategory(TEXT("Designer"));
Cat.AddExternalObjectProperty({ PropOwnerPair.Owner }, PropOwnerPair.Property->GetFName());
this external object details customization crashes the engine because of this checkf in UProperty:
nah, i tested it incorrectly, It still needs some work
Anyone have any idea what would cause ProcessMouseMove from spiking hard by just sweeping my mouse across the viewport, while playing in a standalone application? UpdateTooltipTime also spikes with it, even when there's no UI in the viewport
I wish if you set an image to tile vertical & horizontal it wouldn't set its minimum size to be the size of the texture. I have a 32x32 tiling image that I want to use in many places, even places that are smaller than 32x32... But without sizeboxes it doesn't work
it's kinda annoying
Hello Im right now learning slate and Im working on sort of recreating the throbber widget but to be able to also have each piece disappear if the animation is set to none. And Im having trouble understanding how the animation curve actually adjusts each piece via scale or opacity... because I dont see any regular syntax for a delegate being bound or anything like that...
If anybody is able to explain how this works I would really appreciate it ๐
So I think I figured it out...
They setup a throbber curve to play and while its playing they also bound the functions GetBrushScale and GetPieceColor which will get the curve's current time while its playing and calculates how to adjust its scale, and opacity and such...
I don't suppose anybody has made a PIE chart widget in Slate have they at all?
I'm looking for something where I can define a bunch of regions then drag handles around to tweak ratios.
yeah nah I'm looking for a special widget for a details customisation. I'll figure something out
@craggy holly There's a plugin called kantan charts that I think had a pie chart in it?
If you make something I'd love it if you could post it, I have to do pie charts for our game too ๐
Im sure I saw one. Ill see if I can dig it up
nm. it was a material
but then you could just make your own widget for it with a material + some UMG input control
How would I make a grid of clickable buttons in slate
cool, good starting point, thanks
i made a subclass of the SButton, and i have some init logic that should only be done once, where should i do that? it seems like there is no constructor but a Construct function. should i override that?
yep
so is that jus a slate thing? treat the Construct function as the constructor conceptually?
Yup
thx ๐
can you change the size of an SCheckBox?
of course
I'm trying to set my slate font, but for some reason it doesn't get applied. Is there a specific setting I have to select in the font, or font face in order to make a font work with slate?
.Font(FSlateFontInfo(FPaths::EngineContentDir() / TEXT("Slate/Fonts/My-Font.ttf"), 12))
@urban bloom how do you do that? I'm very new to slate
SetRenderScale
ah ok, didn't know that existed, thanks
I think I have my brain wrapped around how to build the UI, just how do I get data back out of it? There's the callbacks... but they only give me the value, not what was changed.
if I have a SEditableTextBox, how do I get it's value after it's been changed?
Has anyone successfully masked a BackgroundBlur?
is there a way to extend the FSlateApplication? or more specially, the FHittestGrid behavior inside it? trying to see if i can avoid an engine change
@cosmic herald depends how you want to modify it. The best way is to extend from it with a new class and use that. If not, you can manage your own properties seperate from the class but you will have to serialise and save your associated data properly (can be a pain). There may be some Editor Utility interface to it. But essentially you are looking as a plugin to avoid engine changes
@urban bloom but it seems to have the getter for FHittestGrid only and no setter, not sure how I can extend it without adding a setter to the engine code
actually, that's from a SWindow....๐ค
Greetings. I have a question. Can Slate be changed dynamically? (as example text color loaded from ini file)
@pastel basin wdym
I think i found an answer (i wanted to make an ui element that can be set from ini file)
Hello, I can't seem to figure out why my Sliders are Visible but very very small
I'm doing this:
Overlay->AddSlot()
.HAlign(HAlign_Left)
[
SAssignNew(PitchSlider, SSlider)
.Orientation(Orient_Vertical)
.IsFocusable(false)
.Value(this, &SInspectorModePreviewEditorViewport::GetCurrentPitchOffset)
.OnValueChanged(this, &SInspectorModePreviewEditorViewport::OnPitchSliderValueChanged)
];
// Yaw, bottom centered slider
Overlay->AddSlot()
.VAlign(VAlign_Bottom)
[
SAssignNew(PitchSlider, SSlider)
.Orientation(Orient_Vertical)
.IsFocusable(false)
.Value(this, &SInspectorModePreviewEditorViewport::GetCurrentPitchOffset)
.OnValueChanged(this, &SInspectorModePreviewEditorViewport::OnPitchSliderValueChanged)
];
And they are small as hell, can see them in the Widget reflector but not where they are supposed to be
I thought elements filled the space in an Overlay? AM I doing something wrong please?
did you tried
.VAlign(VAlign_Fill)
.HAlign(HAlign_Fill)
I have more like VS question than Slate. But very related.
When i'm opening a CPP from WidgetReflector, it opens a new instance of VS. How to make it open in already running VS where the project is opened?
try to open VS first, then start your editor from VS via ctrl-F5
So i'm trying to create a custom button that's a child of SButton. When I try to create it in RebuildWidget, I'm getting an error that says OnClicked is not a member of SAdvancedButton::FArguments
MyButton = SNew(SAdvancedButton)
.AdvancedOnClicked(BIND_UOBJECT_DELEGATE(Delegates::FMouseButtonSignature, HandleClicked))
.OnClicked(BIND_UOBJECT_DELEGATE(FOnClicked, SlateHandleClicked))
.OnPressed(BIND_UOBJECT_DELEGATE(FSimpleDelegate, SlateHandlePressed))
.OnReleased(BIND_UOBJECT_DELEGATE(FSimpleDelegate, SlateHandleReleased))
.OnHovered_UObject(this, &UAdvancedButton::SlateHandleHovered)
.OnUnhovered_UObject(this, &UAdvancedButton::SlateHandleUnhovered)
.ButtonStyle(&WidgetStyle)
.ClickMethod(ClickMethod)
.TouchMethod(TouchMethod)
.IsFocusable(IsFocusable)
;
@cold quarry What does your .h for your widget look like?
And I also have a problem.
I'm trying to use SListView and I'm struggling.
I pass in an array of TWeakObjectPtr<MyType> as the ListItemsSource as follows:
SNew(SListView<TreeDataSharedPtr>)
.ItemHeight(24)
.ListItemsSource(&MyArray)
.OnGenerateRow(this, &MyClass::OnGenerateItemTreeRow)
.OnSelectionChanged(this, &MyClass::OnItemTreeSelectionChanged)
.SelectionMode(ESelectionMode::Single)
And for some reason, once in the SListView::GenerateWidgetForItem() my CurItem is null and if I go back up a bit from the callstack, I can see that my entire array of source items is invalid... But when I break in the Construct(), I have my 2 items and it's setting it properly...
What could mess up that array inbetween please? Any suggestion is welcome
perhaps you should keep MyArray in the class somehow, don't let him be destroyed, @sand fable
is it local variable?
It's a class variable
I sorta fixed the issue by using SAssignNew and storing the resulting widget as a SharedPtr as well in my class
But I still have problems with the list resetting to empty and so I have 0 children despite initializing it with an array of 2 items and everything working well in the Construct
mListView = SNew(SListView<TSharedPtr<Choice>>)
....
SNew(SScrollBox)
+ SScrollBox::Slot()
[
mListView.ToSharedRef()
]
works fine for me
It's a lot more convoluted than that in terms of modules, dependencies, pointers etc, so I'm guessing the problem stems from that
Thank you for your input though!
btw, class variables are:
TArray<TSharedPtr<Choice>> mChoices;
TSharedPtr<SListView<TSharedPtr<Choice>>> mListView;
Hello, much like a IDetailsView, is there a way to have, inside one of my Widgets (for example, an SExapandableArea), a widget allowing for the display of 1 specific property from an object,
In my case, my object has an array of structs and I would want to display 1 of those struct in each ExpandableArea, but everything under it handled to be modifying a given object.
Much like DetailsView, without all the fuss about filters and picking only a single property etc etc, does that exist please?
Hello. I'm trying to customize my details and add a button to the right of a string property. I did it but some details of customization are bothering me. So I have two questions.
- My property is added with right align but I can't find where I can change it. If I disable property name displaying then the property is left align.
- Is it possible to add a row in a category not in the top but in the bottom after other properties? In the best case, I want to add my property in the same style as other properties in the category. I mean with general splitting on two columns.
I'm sorry if I did mistakes in English or in the description of my problem.
My code looks like that:
.CustomWidget(true)
[
SNew(SSplitter)
+ SSplitter::Slot()
[
SNew(SProperty, DirectoryProperty)
]
+ SSplitter::Slot()
[
SNew(SHorizontalBox)
+ SHorizontalBox::Slot()
.AutoWidth()
[
SNew(SButton)
.Text(NSLOCTEXT("English", "SetPath", "..."))
.HAlign(EHorizontalAlignment::HAlign_Left)
.OnClicked_Lambda(SetPathDialog)
]
]
];```
I have an SHorizontalBox, how can I make its slots fixed size? I tried the following but FillWidth didn't do what I thought it would do
.FillWidth(100)
.MaxWidth(100)
[
SNew(STextBlock)
.Text(title)
];```
.WidthOverride() Does not seem to exist, only AutoWidth()
@jolly prawn Yeah so far from what I've seen, slate doesn't let you arbitrarely give a pixel size to widgets. They fill each other using specific rules but that's about it. Also, FilleWidth takes in a value from 0 to 1, it's a % of its parent.
ok! I can probably work with that! Thanks.
Nvm, I can't work with that. I thought I could set a good size on my slots by setting them to a percentage of their parent but I can't make them fill out the entire space
That might be because the content isn't taking the entire space, the problem might be deeper
Could you screenshot the problem using the Widget Reflector please? Just to make sure we're on the same page here
SGitWidget is just a SVerticalBox and SGitWidgetRow is just a SHorizontalBox
You're right, my SVerticalBox isn't taking up the entire space of the SBox
I have a function that returns my SVerticalBox and it's meant to fill its parent
I thought that maybe I could set the padding of my SVerticalBox to 0 but it doesn't seem to have a function for that ๐ฉ
@jolly prawn SOrry for the very late answer. You probably figured it out by now, but it's because your widget doesn't have everything setup properly. I think if it did, it would calculate its size properly and fill up its parent!
StillerAutoMatte and StillerFlair
When I had an SListView missing arguments such as OnGenerateRow and OnGetChildren, it was doing the exact same. As soon as I added those, it created my items and they were filling the entire thing
im trying to extend the FButtonStyle to include an extra an state, but im not exactly sure how to hook it up to my custom button widget. every reference to the style variable is of type FButtonStyle, how would i change that?
Copy paste sbutton class and change fbuttonstyle to your own style
I found the issue to my widget not filling their parent. The parent had .HAlign(HAlign_Center) and .VAlign(VAlign_Center) that messed up my child widgets. Obvious in hindsight, but I didn't know that it would mess up my stuff back then.
Hi, trying to display a custom widget showing certain fields of a certain struct.
So far, I create it like that:
bool PropertyFilter(const FPropertyAndParent& Property) const
{
bool bShouldBeDisplayed;
const FString& PropName = Property.Property.GetOwnerProperty()->GetNameCPP();
bShouldBeDisplayed = Property.ParentProperty
|| PropName == FString("bOverrideDefaultCameraSettings")
|| PropName == FString("SpecificCameraParameters");
return bShouldBeDisplayed;
}
// inside a function that takes care of initializing stuff
// Property module to create a Structure Details View
FPropertyEditorModule& PropertyEditorModule = FModuleManager::GetModuleChecked<FPropertyEditorModule>("PropertyEditor");
FStructureDetailsViewArgs StructureDetailsViewArgs = FStructureDetailsViewArgs();
FDetailsViewArgs DetailsViewArgs = FDetailsViewArgs(
/*bUpdateFromSelection = */ false,
/*bLockable = */ false,
/*bAllowSearch = */ false,
/*NameAreaSettings = */ FDetailsViewArgs::ENameAreaSettings::HideNameArea,
/*bHideSelectionTip = */ true,
/*NotifyHook = */ nullptr,
/*bSearchInitialKeyFocus = */ false,
/*ViewIdentifier = */ NAME_None
);
StructureDetailsView = PropertyEditorModule.CreateStructureDetailView(DetailsViewArgs, StructureDetailsViewArgs, nullptr);
StructureDetailsView->GetDetailsView()->SetIsPropertyVisibleDelegate(FIsPropertyVisible::CreateRaw(this, &STMEInspectorModePreviewWidgetImpl::SMyWidget::PropertyFilter));
StructureDetailsView->GetOnFinishedChangingPropertiesDelegate().AddRaw(this, &SMyWidget::OnCameraParamsChanged);
// later on in the code, same class
const MyStruct* State = MyActor->GetMyStruct(InName);
FStructOnScope* StateStruct = new FStructOnScope(MyStruct::StaticStruct(), (uint8*)&State);
StateStruct->SetPackage(MyActor->GetOutermost());
StructureDetailsView->SetStructureData(MakeShareable(StateStruct));
And it seems it's loading forever and end up causing out of memory exception and crash the editor.
Is it because of Nested Structs ??? MyStruct contains another struct. But before I tried that, I tried displaying that other struct that's inside and it worked fine.
All I did was change the type of struct used in the FStructInScope and suddenly nothing works. Any suggestion is welcome.
Seems to be stuck in the SetStructureData
It would appear as though, even though I filtered some things out (including some arrays), those empty arrays are still causing trouble
Is there a way to make TArrays not collapse when adding a new item in details view?
Crossposting from cpp. Can we override/work around GetDesiredSize on UWidgets to force a certain height or width without a sizebox?
It's not virtual, so overriding won't work ๐ฆ
you can override it on a custom SWidget, otherwise, that's exactly the point of a size box so it would be silly to not use one
So I have an SVerticalBox (going to change it to a scroll box later) with rows of SHorizontalBox's. There are can be 2 or 3 slots on each row, I want each slot to take a third of the space available so that if there are only two slots being used then the the space where the third slot would have been is not occupied. I was able to implement this by adding an empty text slot to the third "non-existing" slot. I wanted to know if there was a less hackish solution I could use instead?
I can't use SGridPanel because I want to be able to scroll the top layer with an SScrollBox, but maybe i could put an SGridPanel inside an SScrollBox slot? I'd have to make some refactoring if I wanted to change to SGridPanel though, if that's the only right way to do this then I'll just keep using my empty slot hack.
a scrollbox only has one child slot
so you'd put the vertical box or the grid panel inside it
it seems like a grid panel is more appropriate here
The scrollbox in the example here seems to have more than one slot though https://docs.unrealengine.com/en-US/Programming/Slate/Widgets/index.html
Layout and widget complexities not demonstrated in the Slate Viewer Widget Gallery.
huh, interesting
well anyway, putting the grid panel into the scroll is how you'd achieve that
This is my SVerticalBox with MaxHeight(60)
This is my SScrollBox with a single slot with the same exact SVerticalBox as above within
How can I make my ScrollBox container look like the version without a scroll box? I've tried setting the VAlign to fill for both the scroll box slot and vertical box slot. I also tried setting the padding of my scroll box slot to 0 (though I haven't tried using both at the same time) but it didn't help
By using the widget reflector I found out that the scroll box is occupying all available space but the vertical box is not, for some reason I do no understand
hm I've never tried to make something fill a scroll box before in the direction it is supposed to be scrolling
that seems counter intuitive also since then the elements would shrink when you add more
I guess yeah, kinda wanted a vertical list but if it overflows then I can scroll the rest of the contents
@jolly prawn Have you tried adding a SSpacer?
No idea what that is, I'll look into it tommorrow at work! Thanks for the tip
it's a widget that takes up a fixed amount of layout space and otherwise does nothing
Is it possible to get the absolute size of a widget that's a child of a UGridPanel?
get its cached geometry after it has been rendered for a frame or prepass has happened some other way
is it possible to force redraw of the slate ui while the game thread is frozen processing some a thing for a while? I know this isn't a nice thing to need, but the editor can do this too while importing meshes etc
can't seem to figure out how it is done in the editor
@main hedge I guess it depends if Slate is running on the game thread or not. I never actually had to check that out but I presumed it was due to the way it is affected by a 0.0 global dilation. Not that it means for sure, but my presumption.
Im not 100% on this but if Slate is essentially rendered as part of the RHI system, then it should be possible to have it in another thread right?
{
SCOPE_TIME_GUARD(TEXT("FSlateApplication::Tick"));
// It is not valid to tick Slate on any other thread but the game thread unless we are only updating time
check(IsInGameThread() || TickType == ESlateTickType::TimeOnly);
or maybe not
is there any widget for tab bar?
You can use the widget reflector to see which widgets are used in the editor
:17 PM] phy: Is there a way to make TArrays not collapse when adding a new item in details view?
@royal geode did you find a solution to this?
I think I solved it in the task plugin in some cases in a branch but I gave up
will have to look
๐
how many 1000 lines to make this with slate
i can go count lol
nvm too many files ๐คฃ
it involves 3 different custom gameplay modules though to be fully functional
do it works without UEditor?
no its an editor extension
I remember doing that for setting up a traffic system
is it possible to create slate windows from Python?
How can I bind a slate widget created with SNew()?
I really just want to get a TArray of all selected items in an SListView Widget but can't seem to figure it out
I have tried doing SAssignNew(InstantiatedWidget, SListView) where instantiated widget is an object of type SListViewWidget but its not working.
Ok I managed to get it to work with the instantiated widget by using a custom SListViewWidget
TSharedPtr<SListView<TSharedPtr<Choice>>> mListView;
...
mListView = SNew(SListView<TSharedPtr<Choice>>)
SAssignNew(mListView, SListView<TSharedPtr<Choice>>) is also a thing
Parameters might be swapped, can't recall
btw, about slate
when don't have any UE4 editor windows open, the empty window is around 120 fps, on a gtx 1080 TI
opening a single blueprint window makes the viewport go to 100 fps
80 fps 11 milliseconds with a bunch of Blueprints opened, 120fps 8 milliseconds without any
this isn't too much of an issue to be honest, and I don't know if other GUI Apis would have similar issues
but still, it doesn't seems like slate is so lightweight
this is because people bound thousands of delegates to retrieve values every frame in bp graph widgets
๐
no I mean @royal geode it's not like your voxel plugin, the voxel plugin is awesome
the voxel plugin is built on UE4 and inherits UE4 limitations
@main hedge this was during editor, the game wasn't running or anything
I don't even use delegates
I think phyronaz voxel plugin is rather powerful tbh... I can't say i've seen other plugins display anything like it
interesting to know that it's probably more a blueprint issue tho
ok
i had a goofy idea, since you cant get em boosted through the UI texture what if you rendered out to texture a boosted version of the UI elements and got it that way?
what do you mean by boosted?
I got it working through the 2d Scene Capture camera but it is easier to control just creating a 2d plane and projecting a material with an em boost.
hmm.. so I have a custom struct detail override. it works perfectly.
except.. when this struct happens to be in a map.. there is no way to remove the map element. Is there an easy way to add the little down arrow with the "delete" element button, when struct with IPropertyTypeCustomization is used?
(i assume it would be same issue if it's in a TArray too, but ihaven't checked that one yet)
Nevermind
it is on the value lol
im blind.
Hey guys, so I searched around the last few days in order to find some kind of solution for UE to render to multiple windows. I know that it is possible to workaround restrictions by using SceneCapture, but I am looking for a solution similar to ExtraWindow on github which sadly is too old and doesnt work anymore. I imitated the PIE engine code, but I cant get it to work and I dont want to dig too deep into the engine. If someone tried this stuff before I would happily receive any hints or clues ๐
For a IDetailCustomization interface, I'm trying to use IDetailLayoutBuilder::GetObjectsBeingCustomized inside of "CustomizeDetails", how would I cast the object to a struct to access the data? GetObjectsBeingCustomized fills an array of type TWeakObjectPtr<UObject>
@bleak tapir you can only customize objects using that
why breakpoint only hit HandleTabManagerSpawnTab?
If I have a TSubclassOf<UUserWidget>, is there really no way to spawn it through Slate? I really want to be able to show custom tooltips on rich text inline widgets
I'm not sure that latter part is true actually - but you can inherit from FGCObject for your Slate Widget and add the instantiated UObject to the list of GC references, then clean it up later.
There's a few places where the engine does that.
the widget hierarchy generated by a UUserWidget begins with a SObjectWidget that is a FGCObject for the explicit purpose of keeping the UObject alive
Does anyone know what SControl they use for a localizable FText property?
not really well experienced with slate but i'm working on an editor tool. i added a SScrollBox but it doesn't appear to be working after resizing the window (content still overflows w/out scrolling)
there must be something i'm missing
nvm figured it out, it was .AutoHeight on the containing vertical box slot
Do I have any chance of replacing FSlateApplication with a custom child of it?
Cause I'm a bit pissed that Epic thinks Tresholds for Axis "KeyDown" isn't needed.
if you modify FSlateApplication::Create then yes
@main hedge Is it against all nature to do that? :D
Hm create is not virtual
Mรคh
If I have to modify the engine then I could also just implement thresholds :/
Has anyone investigated implementing ToolTips for gamepad and know of specific pitfalls I should be aware of?
cool lol
you cold make your own child of IInputProcessor, @low bluff , and process all inputs as you wish
Hey so I'm trying to figure out how to draw a filled custom shape, given a number of points, on screen?
I can draw lines and whatnot but how to fill the screen space within those lines I have no idea
is there a way to set the fixed size of a tab
I know about SetSizeCoefficient but that's relative
or do I not do that with NewStack
Hey Ya'll, I'd like to change the default (top) representation of a struct in an array in the details panel to ideally all in-line like this. I'm currently following some basic guide for writing slate but I was curious if anyone had specific advice to achieve this?
If you want to customize the header, one thing you can do is wrap the array inside a UStruct, the array must be UProperty exposed to Editor (EditAnywhere) and with a Category specified... Then you can create a struct customization and replace the header widget with your own.
Hello, I've run into a slight problem which I already described in a question at https://answers.unrealengine.com/questions/157504/draw-a-slate-widget-at-mouse-location.html. I have already asked about it at CPP section (screenshot included) but as it turns out, the problem might be slightly more #slate related. I'd appreciate any help
I think that @azure tundra 's idea is not bad, although I can't figure out how to put it inside of a data asset
Hmm, what do you mean by multiplying position? What I meant is that I can't get a preview image displayed in a data asset
But sure, this one might be useful further on
can I disable the dpi-downscaling of tooltips?
Hello guys. I'm drawing a material to screen using viewport client with HUD, and using movie player with Slate
(don't ask)
It works well, but both renders look a tiny bit off
The Slate one is brighter
Any idea ?
Okay, it's a canvas issue - it doesn't use srgb apparently
So the funny thing about drawing a material through the Canvas API (I know, I know) is that it will draw SRGB textures as linear.
Hey guys how can I create bindable properties in slate?
you mean umg? just check out how they do it
but actually don't, bindings are horrible and slow
@low bluff Do you know where I can find some good docs on how to do it?
I havent found good docs :/
There are non
You can find one stream
From epic
And then you gotta look unto the engine on how the editor works
Best thing is checking paper2d plugin
Hi, I have an issue with slate not recognizing my font and outputting this. Any ideas how to fix this?
@lament marsh maybe that the text is in unicode?
@pastel basin Thanks for the reply. I'm a total newbie to slate. I'm using a ttf file.
yeah, but all fonts have ranges, and if the text is in unicode it may be encoded in a different range, generally that's not issue for latin characters, but it may be
Could it be the way I'm declaring it?
const FSlateFontInfo _fontinfo = FSlateFontInfo(FPaths::EngineContentDir() / TEXT("UI/Fonts/MyFont.ttf"), 16);
SNew(STextBlock)
.ShadowColorAndOpacity(FLinearColor::White)
.ColorAndOpacity(_loadingTextColor)
.Font(FSlateFontInfo(_fontinfo.FontMaterial, _fontinfo.Size))
.Text(this, &SAsyncLoadingScreen::GetText)
Sounds like you're using a pretty old approach here
The all font info thing isn't required anymore
@quaint zealot I see. I found this thread, where it's done like this:
https://answers.unrealengine.com/questions/28727/slate-fonts.html
But it won't let me compile this way.
I currently use this UPROPERTY(EditAnywhere) FTextBlockStyle Font;on a FSlateWidgetStyle type objet (any UObject, like UDataAsset, should do)
You can then do .Font(&AssetObject->Font)
Amusingly I was the one asking in that AnswerHub thread ๐
And that was 5 years ago - this isn't the way anymore
The really simple and no-bullshit way today is to have an UDataAsset class with whatever style settings or font object you want, create such an object in content browser, reference it in your code through the Asset Manager
You can then just pass the name / path of your asset to widgets you build
SNew(SCustomButtonClass).StyleAsset("/Game/UI/MainButtonStyle");
In any case, let a content asset hold the font for you, don't load it from a TTF.
Awesome, thanks. I'll give that a shot.
There's an entire style system in Slate, too
I officially use it, I guess, but... really I don't even need it and I could just use my asset manager interface class (that basically searches all UDataAssets at boot time and has nice lookup functions for them)
Ok, yeah it sounds like the datasset will definitely do for me. I'm just trying to set a font.
The important part is, assets that you create in the content browser to hold content is the safest approach
That makes them packaged, loaded, searchable programmatically in a generic way
Whether you use data assets or Slate styles is pretty much the same thing AFAIK
Hi everyone! Is there a way to hide/show properties depending on some condition (enum for example) in details?
Yes
meta = (EditCondition = "bMyBool")
That only disables, but look into the other metas, there's probably one to hide
I don't need bool in properties. I need something like enum list where I choose some type and depending on that type some properties are appeared or hidden
Then you'll need to look at something more involved
Guide to customizing the display of properties in the Details panels within Unreal Editor.
Okay, thanks ๐
So. I have UMyClass. In this class I have TMap<FName, FMyStruct> SomeMap. In FMyStruct I have EMyEnumType and other properties like float Property1, float Property2. How do I access EMyEnumType in CustomizeDetails function and hide/show Property1 or Property2 depending on EMyEnumType on every FMyStruct instance in SomeMap?๐
for hiding some properties
you can bind to the details view's IsPropertyVisible delegate
there is one for allowing editing as well
does anybody know a good example of how to use tabs?
just use the widget inspector and inspect any of the editor widgets and read their classes
find one you like
what do you mean?
the code will tell you exactly how?
oh you mean how to actually create the widgets and display then
yeah its not super intuitive
especially when you have like super deep hirarchies of widgets^^
just break into the construct of a widget, and then read code
like for example, I cant figure out how SDockingTabStack works
read the callstack
or if it even is what I need
unfortunately extending the editor is not something that is readily accessible in the form of a neat guide, because honestly the best tutorial is just reading the engine code. break into one editor window you like and climb the callstack and investigate how it ends up being spawned
and then you can start making cool tools like these for your designers!
that looks neat ๐
i really dont remember which editor window i read to start this up
maybe it was the blueprint debugger out of all things
this one
go look how its made
never even knew about this window
thx
so FTabManager seems to be responsible for them tabs
yes
Success! Thx @toxic dove
hurray
Almost
@toxic dove thanks. Will try that.
@sturdy shale looks like you didn't register your tab spawners
yeah it idnt re register them after closing the window
If I wanted to have my own Widget for an Editor Window, would I create the containing NomadTab inside that widget aswell?
Hey, are there any decent slate tutorials/examples? I am trying to figure out couple things and so far it is giving me nothing but trouble, currently trying to create a ComboButton MenuContent and things are just not working out for me :/ (fails to compile)
there's no real good examples or documentation on slate unfortunately, the best advice I can give you is to look at engine source code
been there ... I did use a menubuilder in a past for a small thing but that thing just does not want to work here
I will take bad examples...but complete ones as well ๐
Hey guys.. I'm new here, and i thought maybe there is help to be found. SO ... I want to animate the alignment of an SConstraintCanvas slot ... is that even possible. If it is i have no clue how to reference that slot... SConstraintCanvas::AddSlot returns the slot but like i said.. i have no clue how to reference it properly
hello, i was able to use a userwidget as a SWidget for the movieplayer to display a loading screen. The problem is that the script i did in the umg widget to do . .. ... over time doesn't work. i believe that is because umg uses the game thread and the movie player uses the slate thread so it doesnt run the script. Is there any way of doing this without having to use slate?
Hey, just a quick one... I have a SDockTab and inside it SBox, and in it SVerticalBox... in the Vertical box I have SScrollbar but that does not want to scroll as it stretches beyond the boundaries of the available window space the SDockTab provides. Trying to set fill where ever I can but the thing is still overflowing...
Any hints would be greatly appreciated ๐
I can share the code but it is a bit messy at the moment ๐
So my best guess at this moment is that the expandable area has no idea how big its content is so it just kind of overflows ๐ which is unfortunate but what can I do ...
Is there some way to get buttons to just be flat colors without any border effects? If i set it to image with "None" it seems to use a border image anyhow
yes you have to specifically give it a button style, otherwise it will fallback to the default
does anyone know how to get the mouse position when there is a drag-n-drop operation occurring? you cant get it through the player controller anymore during a drag-n-drop
are slate widgets you make with SNew or SAssignNew automatically garbage collected when the owning widget is closed?
No, the garbage collector only works on UObjects
However, Slate uses smart pointers everywhere
but e.g. can you call SNew without assignin the result to anything and it will be cleaned out of memory?
cause for AssignNew I use smart pointers as well so I assume that is safe memory wise
It will be cleaned out, yes.
is this normal?
or is it cause it's a weakptr instead of shared
ok shared ptr doesn't seem to crash
but it's still not getting focus it seems ๐ค
got it working, needed to be delayed one frame
so I made a details customization for a custom type
but when they're in an array, they don't have the delete insert duplicate button
I found the DetailPropertyRow does it with PropertyEditorHelpers::MakeRequiredPropertyButtons
which in turn uses PropertyCustomizationHelpers::MakeInsertDeleteDuplicateButton
but idk how to know if my object is in an array or not, and how to get the array that it's part of
or do I somehow need to make a detailscustomization for the array of the type as well
Hi All, I've created a Slate window with a UMG widget. all is working fine, but when I resize the window it just stretched everything. I'm sure there must be some kind of redraw or re-render function, but I can't seem to find it.
Any suggestion on how to not stretch the content of the SWindow when resizing?
@tall axle Have you tried changing your DPI scaling inside ProjectSettings?
what do we use to create a table-like view?
SListView along with SMultiColumnTableRow as table rows?
why wouldn't you use the actual STableView?
Because when I googled for it, I didn't find anything ๐ I couldn't find the class in engine code either. I will search again, seems like I was careless in my search
there are only STableViewBase and STableViewTesting :/ are you sure that STableView exists?
sorry but I think the only table views there are, are SListView, STreeView and STileView?
What's the issue with using the Base version?
can someone help me with drag drop operations? drag visual blocks everything until it ends. i need to capture ondragover but it wont happen at all.
@low bluff its abstract
what do we do to fix visual studio's code formatting for Slate code?
or does everybody just live with it?
I just live with it
I embrace the chaos
I format it manually 
the worst is when you want to change it to another function or something and copy past it and your formatting is gone again ๐ฆ
press ctrl z
cry
slate code is just a style, you can not use it
instead of + SCanvas::Slot() you could use canvas->AddSlot();
etc
everything is replacible by normal c++ code
And you often need to
dont try to reference a style that doesnt exist
@warm vault WHYYYYYYYYYYYYYYYYYYYYYYY
well I think at that point I already reimplemented most of them in my own helpers ๐ญ
i feel you man xD
FPropertyEditorModule provides some nice tools to create slate widgets for properties as well
anyway, life got a lot easier after learning how to use all the helpers hidden in the engine
Does anyone know how to draw the draw material function of the hud class over a widget? There is no Z-Order and the widget is drawn on top of it
may be you should draw to texture, and integrate texture in widget
stupid question but: are the editor built-in widgets (like SClassViewer) not usable in our own code? I see them in Private folders most of the time...
or SPropertyEditorAsset which seems super useful
if they are in /Runtime/ they are usable
@pastel phoenix even in an editor module and even if they are in a Private subfolder?
editor module is not in Runtime. private - no
arf too bad ๐ฆ thanks for the help !
ah my bad
I meant even for use in my editor module
not if the widget I'm interested in is in an editor module
for instance, if I have an editor module in my game, and I need something in Runtime/Private, will it work? I've got lots of errors at compile time but beginning with Slate and it could come from anywhere as far as I know with my knowledge ^^'
you could use editor module in developement, but you can't include it is shipping build
did you tried make shipping?
ah yes indeed, I don't want my editor module to package, it's juse for use by designers in the editor
aah, ok
no it's at compile time in development editor
trying to use SPropertyEditorAsset to have a nice actor picker
I switched to use the helper methods but did not manage to make it work for now
yeah you should use the helpers if you want to edit it inline, but you can also use the SClassPickerDialog
just search the engine for uses of SClassPickerDialog and you will get it how to use it
the only thing less obvious about this is the fact, that you need to implement your own class view filter by implementing the IClassViewerFilter interface. the interface is public, but all implementations you will find for this interface are private. the class viewer module uses the interface though.
@exotic isle
thanks @warm vault ! ๐ I will look into it. I tried to find usage of SClassPickerDialog but I must I've missed something in my research as I did not find anything. Will try again
you can search for references
good idea it may work better than search in global solution
did you do a text based search ๐ฑ
well sometimes it works better than intellisense ^^'
Hi guys - I've just upgraded my project from 4.19 to 4.23 and this image swap has stopped working. Is it wrong or a bug? Anyone got any ideas? PS it's not because of the big jump in versions cos I did it first to 4.20 and same thing happened
Hello, how can I render just chosen widgets to same render target?
Hello. I placed my hardware cursor called cursor.cur inside a "Slate" folder inside my content folder. I adjusted the hardware cursor path inside the project settings to "Slate/cursor" and it's not working. What am I missing?
output log gives me this error:
Ok i got it working. Appearantly the cursor can not be named cursor. Changing the name to cursor_sword fixed it ๐คท
Anyone know why? Is this a name reserved by the engine or something?
i think it should be cursor_64x64.cur or something like that to really work as expected
at least if i interpret the error message right @jagged jewel
The error basically says that _64x64.cur stuff needs to be removed:P
I guess the solution says more about the problem than the error by itself. Because WixZ wrote that there is no suffix like _64x64 and he fixed it by adding _sword I think he's right with the assumption that cursor.cur is already reserved by unreal engine
nah i think UE4 expects the cursor name and then searches for the right cursor by adding the _WidthxHeight and file ending ๐คท๐ผ
But error message said that there shouldn't be a file suffix like _WidthxHeight and he only added _sword as name appendix not as information suffix
i assume it ignores everything beyond the _
how would I go about Adding a EditorWidget to be Launched inside of a SDockTab?
Is that possible
?
@unkempt locust what do you mean by EditorWidget you mean like an SListView or SButton inside of SDockTab?
Well i'm working on launching a EditorWidget seperately. Was going to try and launch it into a Tabbed window
I just can't seem to figure out how todo it properly
@unkempt locust but I don't know exactly what you mean with EditorWidget. If you have a SDockTab you can spawn buttons and stuff in it, but I don't know what you want to spawn inside the Tab when you use the word EditorWidget.
Describes Editor Utility Widgets, and how to create them.
ok now I know what you want to do. If you want to spawn. I didn't do it by myself yet but maybe this will help you: https://isaratech.com/ue4-programmatically-starting-an-editor-utility-widget/
How would I go on by extracting the Swidget from UUserWidget
to use with FLoadingScreenAttributes::WidgetLoadingScreen
Is there a way to have a moving material on slate?
Yeah, use a time parameter and drive it from tick
@quaint zealot Ok, thanks. I'll give that a shot.
is it possible to distribute a slate app as a single binary (with resources for the style included) ?
Can I extract a materialinstancedynamic from a FSlateDynamicImageBrush?
I have found GetSourceObject, but that seems to only work with UMaterialInterface.
@main hedge You mean like the Epic launcher ?
Basically make an UE game with just Slate UI in it
Well, you're not getting single-file though, sorry
@main hedge Pretty sure Allar made a pure Slate app once, which was not directly a game but more in the sense of other standalone apps like the UnrealFrontend. Is that what you mean?
Probably, but Slate resources still need to be UE4 resources that go in a pak
Right, so it wouldn'T be a single file
I'm looking at the Helium Git example in order to figure out how to play a video, but it doesn't seem like they are actually using videos for anything. The only thing I could find was on:
I'm doing this in my slate code, but I only get a 10 seconds black screen in editor and build.
LoadingScreen.bAutoCompleteWhenLoadingCompletes = false;
LoadingScreen.MinimumLoadingScreenDisplayTime = 10.f;
LoadingScreen.MoviePaths.Add("LoadingScreenPlayer_Video");
GetMoviePlayer()->SetupLoadingScreen(LoadingScreen);
GetMoviePlayer()->PlayMovie();```
No, we 're not using video for anything.
Just that SFlareLoadingScreen Slate widget in the file you linked, which is a simple throbber under the game title
@severe shard Are you creating a loading screen from a video?
What resolution is the video?
I remember something about Videos need to have an odd resolution. Like instead of 1080p it has to be 1088p in order for it to appear.
Dont ask me why, i cant remember haha
how do i make a donut shape where i can give the start and end angles
like one section of a radial menu
or even just a radial menu to start with
sorry for asking i'm sure there are posts out there but i can't find anything with the forums being down
if i wanted to attach it to a UWigdetComponent i has to inherit from UUserWidgetComponent
You usually make these shapes outside of UE4 in your 2D application
And then you import that.
You can then calculate which option to highlight/select based on the mouse position
what about dynamically resizing them based on how many items it has
a radial menu can be done with a material
convert pixel position to radial gradient and check if you're within some angle
@quaint zealot I see, but thanks for putting up the code so we can have an example project.
@spring frost Yeah, it's 1920x1080. Hm, I wish there was more official information out there than just the bare basics on how to make a static loading screen, especially when it comes to weird settings like that.
Try changing the res to 1088 and see what happens
Not sure if its a bug or design choice or something weird.
๐คท
I'll give it a try, thanks.
Hello! Guys
Any ideas how to make editor context menu for RMB in the level viewport?
Hitproxy, catch click, create menu?
bool MyInputProcessor::HandleMouseButtonDownEvent(FSlateApplication& SlateApp, const FPointerEvent& MouseEvent)
any idea why retainer box with RenderOnPhase turned off keeps rendering container? Especially calling SlatePrepass
IIRC RenderOnPhase means render it at discrete intervals. if you turn it off, it re-renders every frame if it's invalidated.
If you're calling SlatePrepass manually won't it invalidate the geometry and force the whole thing to re-render anyway?
Oh I'm two days late. wups
is there a way i could get an owner if UProperty? in terms of IPropertyHandle
right, just figured it out myself, there's GetOuter
how can i get some kind of global SWidget to use in FSlateApplication::PushMenu?
the closest real SWidget i have is NameContent/ValueContent from FDetailWidgetRow. they don't work though, always reference some invalid widget for some reason
or, a little bit different question, doing struct customization where can i get any actual SWidget to have as parent?
think i got what i was looking for
Hey everyone. I'm stuck on a problem and thought maybe someone can offer a suggestion. I have a textbox with text too big to fit. In a normal situation I'd be happy with a scrollbar and call it a day. However, this time I want to use an additional textbox and split the text into pages. Both are of the same size. So my logic is this: Take one textbox and check initial text. If it's too large, split it and perform the same action recursively on the bits that were split. Logic sounds solid but I'm stuck at the 'checking if text doesn't fit box' part.
Anyone knows how that is done? I keep digging through code but I can't find anything of the sorts so far. Thanks!
SScrollbox should contain the answer I'm guessing, since it has the option to display the bar when the content is too large. Will come back if I find anything relevant.
Could anyone help me with figuring out how to get a Widget to show on screen when i press a button.... and when i press the same button....it will also be dissapear
make your InputProcessor class
bool MyInputProcessor::HandleKeyDownEvent(FSlateApplication& SlateApp, const FKeyEvent& InKeyEvent)
{
FKey key = InKeyEvent.GetKey();
AMyPlayerController* playerController = GetPlayerController();
AssertRet(playerController, false);
if (key == EKeys::Escape)
{
if (playerController->isIngameMainMenuOpened())
{
playerController->closeMenu();
return true;
}
playerController->openIngameMainMenu();
return true;
}
something like this
then in controller you must create and destroy widget by
mWidget = SNew(MyWidget);
GEngine->GameViewport->AddViewportWidgetContent(
SNew(SWeakWidget)
.PossiblyNullContent(mWidget.ToSharedRef())
);
and
if (mWidget.IsValid())
{
GEngine->GameViewport->RemoveViewportWidgetContent(mWidget.ToSharedRef());
mWidget.Reset();
}
and you need also make a function to turn on and off mouse
Hello, how can I render slate/umg widgets faster then 8 fps?
is there a way to debug slate hit test regions, something that will show a translucent overlay of them or something?
in editor or pie in new window, my mouse clicks are offset by 60 pixels or something, but in editor builds launched with -game they are fine
things looked ok in widget reflector, I didn't know if the shapes there represented the hit box or some kind of render bounds or something
try to change screen size and watch how mouse click offset will change
may be it i s just DPI scalling
I'm trying to use a material with buttons. I want to be able to update a parameter on my material instance when the player mouses-over a button. But the only way I can think to do this is to create a new Material Instance on every single button and update that material. Isn't this a huge waste of memory? Are there smarter ways?
@mild oracle That sounds right to me. There are global material properties if you want all material instances in each button to react at once
I'm going to try to do a pooling system so every single one of my buttons isn't creating a new dynamic material instance
Seems kind of weird that this is so difficult though
Having a material instance per button seems like the right thing to do and I don't think material instances are perf heavy, depending on the material
You likely won't have to do any kind of performance wrangling unless you have hundreds of buttons drawing all at once
@wary steeple I was mainly worried about every time a button gets created, we have to create a matinst and deal w it. I can easily have 30-50 buttons on-screen
Hey, have you guys tried to get rid of automatic game pause when dragging viewport window or scaling it?
Would like to disable that especially for server
Hey all. Stuck on this right now. I have a UWidget in the world with Slate components inside and I can't figure out how to get mouseover events on in-world things behind this UWidget... all the slate components are HitTestInvisible and I haven't found anything on the UWidgetComponent that looks like it would help -- any hints?
solved it... was collision-related... stupid
should have checked that first
๐
When using:
.Font(FSlateFontInfo("SomeFont", 30))
Does the font file have to be in a specific folder? It doesn't apply the font for me, but the size changes just fine.
I was able to fix the font problem, but I have a different question. Has anyone ever successfully used a MaterialInstanceDynamic to update a material in tick in a slate widget?
I've done it in a tick, not in a slate widget though
Yes @severe shard
@quaint zealot Ok, so it is possible then. I must be doing something wrong. The material is properly showing on screen, but it won't move, even though the breakpoint does hit tick as it should and even updates the value.
It's probably updated and you've not shown the correct material
LoadingInstance = UMaterialInstanceDynamic::Create(_loadingScreenMaterial.Get()->GetMaterial(), OwnerHUD.Get()->GetWorld());
loadingBrush = new FSlateMaterialBrush(*_loadingScreenMaterial.Get(), FVector2D(100.f, 100.f));
loadingBrush->SetResourceObject(_loadingScreenMaterial.Get());
.HAlign(HAlign_Fill)
.VAlign(VAlign_Fill)
[
SNew(SImage)
.Image(GetSlateBrush())
]
{
if (LoadingInstance != nullptr)
{
time += InDeltaTime;
LoadingInstance->SetScalarParameterValue("Time", time);
}
}
FSlateMaterialBrush* STestSlateWidget::GetSlateBrush() const
{
return loadingBrush;
}
That's my setup. LoadingInstance is a UMaterialInstanceDynamic
_loadingScreenMaterial is a UMaterialInterface
Does anything jump out as an obvious issue why it doesn't update?
Nothing shocking I think
What's LoadingInstance ?
Should be _loadingScreenMaterial ->SetScalarParameterValue("Time", time);
AH sorry
It's a UMaterialInstanceDynamic
I misread ๐
Here's your issue
loadingBrush = new FSlateMaterialBrush(*_loadingScreenMaterial.Get(), FVector2D(100.f, 100.f));
Should be LoadingInstance
Not the source (unchanging) material
Also '*stuff.get()' is just 'stuff' AFAIK
Ok, I'll give that a shot, thanks.
I was using Get(), because it's a TWeakObjectPtr
Should work anyway ?
Awesome it's moving now, thanks.
I'm not sure about the get.
If I remove the get out of this for example: _loadingScreenMaterial.Get()->GetMaterial()
I can't use GetMaterial().
What's _loadingScreenMaterial in the first place ?
I specifically meant that '*_loadingScreenMaterial.Get()', and nothing else, should just be _loadingScreenMaterial
Anyway if it works, it works
It's a TWeakObjectPtr<UMaterialInterface> _loadingScreenMaterial. It seemed to be recommended to use weak object pointers.
I'm trying to create list of assets (UObjects) with selected asset details panel. Anyone know where I can start searching for how to get UObject array from content browser?
Are you looking for all content assets ?
You want to edit your assets? So basically you want to work on the class default objects right?
@quaint zealot - just my UClass. Trying to get this working using AssetRegistry but can't find my assets.
@split laurel - yes, exactly.
What's your class inheriting from ? What's the purpose ?
UObject. I'm trying to create items editor which will search for items (UObjects) and user would be able to change their properties in one place without searching for items in content browser.
if you have assets in the content browser you should be able to find them via AssetRegistry. How are you using the AssetRegistry?
They're not assets.
another thing I want to do to edit their properties in a list directly
Dataasset allows it too IIRC
trying like this
was trying using StaticClass() but still can't find them.
but when I'm searching for UBlueprint (like SClassViewer does) it finds my assets but with bunch of other
@quaint zealot for me it sounds like he is looking for assets though?
yes, those UObjects (each item) is in content browser
if you are looking for specific blueprint classes that's a tad more difficult
UObjects are not assets
and this is finding them but with 10000 other
but his UObjects are assets
if they are in the content browser they count as assets to me
As classes, or content ?
As content = asset registry finds them
= assets
as classes = not assets
apparently they do get found with asset registry
They don't
guys, above function find them
Ah, well
..xD
yeah blueprints are a bit tricky since they all share the same 'class', which is Blueprint and not the class they inherit from
you have to access the blueprint's generated class and test that
filtering used 2 image above isn't working for my exact class but with others (which are based on UObject) is
for example UNiagaraParameterCollection can be found using GetAssetsByClass
but my UGDInvItem wont ๐
and I don't see any differences from collection and my class - they use the same macros etc
so you have a C++ class UGDInvItem, you create Blueprints inheriting from UGDInvItem and want to find only those right?
yes, exactly
yeah ok let me take a look in my code, done that before
which GetAssetsByClass is used for, but not working for my class
Just loop over the result with IsA(UGDInvItem::StaticClass())
I don't think that works with blueprints
yeah with generated class it does
but I think you'll have to loop over them
Blueprints are kind of an exception
ok then, will loop
thanks guys, will be asking while working on it. Want to use property editor to list the assets and be able to change their variables using property matrix
sure
damn I see that I need to load them to check if they are my class
FAssetData is just info where it is
no defaults object or something
maybe I can filter them using name - will check what's in that structure
good point, I'll have to think about how to handle that with my tool too because currently Im looping over them
unfortinately need to load it, this suck
as asset class is Blueprint
it's on the map ๐
yes, TagAndValues - will paste my code when finished
with my current batch renaming tool I did the mistake of loading all the assets before actually renaming them lol. Anyone know if there is a way of renaming assets without actually loading them? Probably not?
This is working but I'm not sure yet if it's good approach.
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>(TEXT("AssetRegistry"));
// Retrieve all blueprint classes
TArray<FAssetData> BlueprintList;
TArray<FAssetData> ItemsList;
FARFilter Filter;
Filter.ClassNames.Add(UBlueprint::StaticClass()->GetFName());
Filter.ClassNames.Add(UBlueprintGeneratedClass::StaticClass()->GetFName());
Filter.bRecursiveClasses = true;
AssetRegistryModule.Get().GetAssets(Filter, BlueprintList);
for (FAssetData& BPAssetData : BlueprintList)
{
UClass* ParentClass = nullptr;
FString ParentClassName;
BPAssetData.GetTagValue(FBlueprintTags::NativeParentClassPath, ParentClassName);
if (!ParentClassName.IsEmpty())
{
UObject* Outer = nullptr;
ResolveName(Outer, ParentClassName, false, false);
ParentClass = FindObject<UClass>(ANY_PACKAGE, *ParentClassName);
if (ParentClass->IsChildOf(UGDInvItem::StaticClass()))
{
ItemsList.Add(BPAssetData);
}
}
}
not sure about performance of FindObject
but for now I guess it doesn't hurt to try
now I need to get pointer to that UGDInvItem - default object using FAssetData
yup, you can access the BlueprintGeneratedClass' function GetDefaultObject
hmn how? I just have FAssetData currently
got it. Have MutableDefault. Can move to property matrix.
is there any way to tell if property was created in blueprints and not in c++ using UPROPERTY?
was easy
you are moving fast, did you just add the property matrix or is that custom UI?
I'm using property matrix - don't want to create my editor for this, to much work
now I'm working on how to add colums for properties created in Blueprints and marked that they should be added to etir
*editor
to show selected item details I need to use IDetailCustomization or there is some SWidget that can be used instead? Just pass Property into it.
you mean a details panel? There's a function that creates it for you and you just need to pass in the UObject
yes, exactly, any chance you can check where I can find this function?
FPropertyModule CreatePropertyView or CreateDetailsView, I'm not sure which one is the correct or most adequate one rn
well can't find FPropertyModule in ue4 4.23 ๐
sorry, FPropertyEditorModule
damn, Epic did a lot of job with slate... was able to create simple items editor in like 4 hours.
yup I love Slate :-) just browsing through all of that engine code to find the function you need for your tool and bam, it works
I was working with slate like 3 or 4 years ago and wasn't so great then ๐ maybe I was just not skilled enough ๐
slate is very powerful but documentation is less than existent. Even if you go through source code sometimes struggle to how a Slate Widget works properly. It's a lot of try and error. Had to learn a lot about the framework before I could work in it in any kind of a decent way.
btw one suggestion, your tools is a really great idea. How about making use of a class filter on top that refreshes the list when being updated?
that way you could filter directly for whatever type of class you want
want to edit all potions? Go ahead. Edit all collision blueprints? Go ahead!
also yes Slate is a pain at first, but learning with source & trial and error will teach you more than some docs ever would imo. But some references for many common use cases would be nice indeed
if you figured out how slate is designed it's much easier and more easy because like the most widgets are same in how they are designed and there aren't a lot of special cases.
@split laurel yes, I'm doing it right now, will change categories as well when changing item type.
niiiice ๐ช
What sort of slate widget should I be using for drawing graphs?
Do I need to just use SImage with a texture that I build as a bitmap, procedurally on the CPU, or is it easier to use these things like FSlateDrawElement::MakeLines()?
I'm trying to load async my items (testing 10k items for performance) and maybe someone know how to use FStreamableManager to have delegade when one item or less was loaded? There is only delegate when finished everything. I want to populate items list while async loading assets.
@tribal fractal you should be able to register to AssetRegistry with the delegate 'OnAssetAdded', which gets called for every asset while discovering afaik. There are tons of engine assets though that you will not want to handle
that is if you are talking about at engine startup. On second thought, that's probably not what you mean right? You just want to load 10k assets
I have created lambda and have the callback, but I can see that FStreamableManager is loading to much data
like 1GB for 10k items.
hmm dunno about that, but tell me if you find out about it. My renaming tool right now needs about 5 seconds to populate 60k assets
and I need to use FAssetData::FastGetAsset(true); to be able to add it to property table, and doing this way while having 10k items take a lot of glitch but isn't creating that memory
5 seconds for 60k assets sounds cool ๐
it's not loading them.. just creating lots of structs based on fassetdata :D
hmn AssetData uses LoadObject and StreamManager StaticLoadObject
maybe here is difference
if I won't be able to find solution will do this other way: just do search and pages to load 100 items per page.
Yeah, you could have a timer trigger every 0.5 seconds or so that gathers the currently available assets
it wouldn't be 100% smooth but probably smooth enough
well streaming is working OK for me, BUT why it's taking so much memory ๐
maybe thats just what happens when you load 10k assets
yea, trying to find a way to use FAssetData without using GetAsset