Reset value variable set by console command / Read default scalability settings from C++

Hello to everyone,

I’m working on a settings menu where I change the post process quality using a button. I also have some checkboxes to enable / disable some graphics settings on top the scalability settings. So you can set, for example, the post process quality to 3 and it applies the scalability quality 3, but you can maybe want to disable motion blur on top of that.

The problem I found is that if I change one specific value, let’s say motion blur (r.MotionBlurQuality), it works fine but when I change again the scalability settings the motion blur value doesn’t change. Reading the documentation here it seems that the console value is the last one applied. I’m changing the values from C++ using APlayerController->ConsoleCommand.

Is there any way to reset the value set by the console? If is not possible, how can I read all the values for each scalability setting from C++ and apply them manually?

Thanks in advance.

Ok, I found a way to change it. This is how the order is applied to the console settings:

ECVF_SetByConstructor = 0x00000000,

ECVF_SetByScalability = 0x01000000,

ECVF_SetByGameSetting = 0x02000000,

ECVF_SetByProjectSetting = 0x03000000,

ECVF_SetByDeviceProfile = 0x04000000,

ECVF_SetBySystemSettingsIni = 0x05000000,

ECVF_SetByConsoleVariablesIni = 0x06000000,

ECVF_SetByCommandline = 0x07000000,

ECVF_SetByCode = 0x08000000,

ECVF_SetByConsole = 0x09000000,

What I was doing was using UWorld::Exec / APlayerController->ConsoleCommand, and they both use flag SetByConsole, so when I changed the Scalability settings it used the flag SetByScalability, so the specific settings I changed manually were not updated because of the priority.

What I ended doing was setting the value manually using the flag SetByGameSetting. Here the example for MotionBlur:

// That sets specifically the motion blur
static auto CVar = IConsoleManager::Get().FindConsoleVariable(“r.MotionBlurQuality”);
CVar->Set(value, ECVF_SetByGameSetting);

If instead of r.MotionBlurQuality you use sg.PostProcessQuality you change all the settings (including motion blur).

I hope this could help to someone.

1 Like