Help with Slate (modding - SlateViewer)

Hi,

My first post here and wanted to get feedback on how to proceed on modding the SlateViewer, later I would integrate into a real project these styles and layout.

I have looked at the ShooterGame & StrategyGame content they contain very useful information, but haven’t been able to achieve my goal.

Using the mentioned content, I have tried to change the style for the SpinBoxes as a starting point.
I created a new Style widget in the editor (not sure which path to use to store it because it is not a game, instead I want the resource to be used by an stand alone application, this might be changed later np).

For the STestSuite.cpp class I made this changes



void SRenderTransformManipulatorWidgetImpl::Construct(const FArguments& InArgs)
{
...

const FSpinBoxStyle* SpinBoxStyle = &FCoreStyle::Get().GetWidgetStyle<FSpinBoxStyle>("MySpinBoxWidgetStyleAsset");

...

SNew(SSpinBox<float>)
.MinValue(0.0f)
.MaxValue(360.0f)
.Style(Style)
.OnValueChanged_Static(](float val) { RotDeg = val; Rot = FQuat2D(FMath::DegreesToRadians(val)); })
.Value_Static(] { return RotDeg; })



But I think there is a missing step for the new style to be recognized, should probably create and register the new style (following the ShooterStyle.cpp example):


TSharedRef<FSlateGameResources> StyleRef = FSlateGameResources::New(FGameMenuBuilderStyle::GetStyleSetName(), "/Game/Items/UI");
FSlateStyleSet& Style = StyleRef.Get();

FSlateStyleRegistry::RegisterSlateStyle( *Style );


Then another header will need to be included



#include "SlateGameResources.h:"


This inclusion throws a compiling error, I guess from the SlateViewer application this header seems to be not accessible.

Is this one correct way to proceed with it?
How and where to store the new style widgets for applications like this?

Appreciate any help.

Why do you want to modify SlateViewer? If you just want to preview some widgets, just start working directly in your game and iterate in there, it’ll be simpler in the long run.

SlateViewer is a standalone program and does not use the engine. It doesn’t even use CoreUObject, which will prevent you from loading the style assets you would want to use to visually edit Slate styles.

On the other hand, SlateGameResources is part of the engine module. In order to get SlateGameResources to work within the Slate viewer, you’d need to pull the entire engine, thus defeating the purpose of having a lightweight standalone demo application.

If you’re adamant about using SlateViewer, you’ll have to create your own FSlateStyleSet (as opposed to the one created by SlateGameResources) and manually define and add your styles to it. And you’ll be mostly on your own doing that because it’s contrary to recommended practice and the direction Slate is taking.

Thank you for your answer cmartel.

Seems that changing the look of the slate for an standalone application is too much, and basically I am bounded to use the default style if I don’t want to do more work.
Are all the default color/sizes handled in SlateStyleSet & StyleDefaults?
Would you point out where the color of the SpinBox sliders is taken from?

Anyways I understand my best workflow will be using Slate in the editor or in/game.

edit:
Alright I can see all the style is in Engine\Content\Slate\Common
and is actually set in the StandaloneRenderer



..
Renderer = TSharedPtr<FSlateRenderer>( new FSlateD3DRenderer( FCoreStyle::Get() ) );
..


Thanks