Generic Epic Games Coding questions

Greetings!
I’ve been working on some modification for the camera navigation and faced some strange (IMO) fact.

  1. Many setters have no checking:

...
UPROPERTY(config, meta=(UIMin = "1", UIMax = "8", ClampMin="1", ClampMax="8"))
int32 CameraSpeed;
...

...
void FLevelEditorViewportClient::SetCameraSpeedSetting(int32 SpeedSetting)
{
    GetMutableDefault<ULevelEditorViewportSettings>()->CameraSpeed = SpeedSetting;
}
...

I would like to hear why it’s done that way?
I always used to think that setters have to check the values they set, except some cases (like heavy math or limited scope).
But since I’m working on Epic’s code (and hopefully would make a PR), I’m trying to write code “by the book”.

  1. Also, I would like to hear what would be the proper way to write similar functions:

int32 FEditorViewportClient::GetCameraSpeedSetting(int32 SpeedSetting)
int32 FEditorViewportClient::GetCameraFlightSpeedSetting(int32 FlightSpeedSetting)

or

int32 FEditorViewportClient::GetCameraSpeedSetting( int32 SpeedSetting, bool bFlightMode = false )


void FEditorViewportClient::FlightCameraAccelerate()
void FEditorViewportClient::FlightCameraDecelerate()

or

void FEditorViewportClient::FlightCameraApplyAcceleration( bool bSlowdown = false )

From the sources I could assume that code duplication is less critical than readability (means - two functions better than one).

  1. Last one, trickiest question. What is SCS? (SimpleConstructionScript?)
    USimpleConstructionScript | Unreal Engine 5.2 Documentation
    SSCSEditor | Unreal Engine 5.2 Documentation
    (I’m asking since it also has camera navigation, at least in c++ sources)
    The only description I found was:

And I just… “Huh?”

Questions on Answerhub

  1. Probably an oversight. GetMutableDefault can return a nullptr (although its unlikely in the case you provided - editor settings are already loaded by the editor at that point).
  2. Personal preference. Do you want more, smaller functions? Or do you want larger functions that take lots of parameters? There’s pros and cons for both.
  3. SCS is the Construction Script that runs on a Blueprint during initialization, when you drag and drop a component (or simply add one) to a blueprint - it creates a construction script node with that info. See: Construction Script | Unreal Engine Documentation

Are You sure about that? SSCSEditor has a camera that could Orbit!

Yup. That Camera is used by the SCSViewport widget.

You’ve said:

Where’s Viewport there? So, what SCS is if it has GUI?

Viewport is part of the SCSEditor which edits the Construction Scripts.