New Program
Programs in Operating System are just Blueprint classes created in Content Browser. Programs can either be created in C++ or Blueprints. They define the basics of a program (or an app) like it's name, description, supported Operating Systems, version number, icon and many more.
To create a new program, right click inside Content Browser and select Blueprint Class. From the resulting dialog box, search for Operating System Program and select Operating System Base Program from the search result.
Select and give it a name you like. (The Blueprint name you give in Content Browser is irrelevant). Now open the Blueprint and you will be greeted with an empty graph view. Close it and open again and you will now see what is called the data-view.
Let's go through the properties:
Program | |
---|---|
Name | Name of the program |
Author | Company or individual who created the program. Typically used to display on Store. |
Description | A simple description for this program. Typically used to display on Store. |
Identifier | A unique identifier. This should not be shared and each program MUST have unique identifier. |
Version | Program version |
Supported Operating Systems | Gameplay Tag container that determines what type of Operating System should support. If empty, all Operating Systems are supported. |
Min Operating System Version | If enabled, Operating System should be running at-least this version number for this program to run. |
Icon Object | A UI material or texture that defines an Icon for this program. |
Space Required in MB | How much space does this program consume after installation (specified in MB size). |
Save Method | Determines when this program should save. |
Settings Class | Optional class to save anything regarding this program. |
Data Class | Optional class to manipulate any data for this program. |
Requires Data | If true, validate this program has a valid data class set and it should be constructable. It means when you run the program, you will have a data obj guaranteed for this program. |
Add to Desktop | Add this program icon to the desktop after install. |
Create Notification | Shows a toast notification after installing this program. |
Single Instance Only | If true, only one instance of this program can run at any given time. |
Create Settings Before Starting | Creates the settings object before starting this program. |
Store Settings:
Program Store | |
---|---|
Store Display Name | Overrides the name to show on Store. If left blank, Name property of the program is used. |
Store Type | Specifies the category of the program. Like Entertainment, Utilities, Finance and so on. |
Store Price | Price to display on Store. 0 makes free. |
Widget Settings:
Program Widgets | |
---|---|
Icon Widget Class | Widget That Shows The Icon Of This Program. Pre-Defined To Wbp_programicon But You Can Modify It Or Set Your Own. |
Widget Class | The Main Widget That Represents This Program. This Is What Users Will See And Interact With The Most. |
Override Window Class | Optional Draggable Window Class To Use For This Program. E.g: /OperatingSystemContent/Shared/Blueprints/Programs/WebBrowser/BP_Prog_WebBrowser |
Taskbar Button Class | Widget that shows the taskbar button for this program. |
Window Settings:
Program Window | |
---|---|
Remember Last Window Position | If true, window position will be saved and restored automatically. This option is disabled until you set a valid Save Method and Settings Class. |
Allow Dragging | If true, user will be able to drag the window of this program. |
Allow Resizing | If true, user can resize the window by clicking and dragging at the bottom right corner of the program window. |
Override Window Size | If enabled, you can set an absolute value of the size you want this program to be when starting. If disabled, the plugin will decide the starting size automatically. |
Minimum Window Resize | Specifies the minimum width and maximize height this program is allowed to resize. If both X and Y are 0, no limit is imposed. |
Start Window State | Defines the starting window state. |
Every program goes through a validation check before it is created. For those who prefer C++, you can override the OnValidate function. For example: Imagine you have a TSoftClassPtr in your custom program and you need to make sure it is set always. In order to validate, add the following in your header:
virtual void OnValidate(FGenericError& OutError) const override;
Then in your cpp file, implement like this:
void UMyCustomProgram::OnValidate(FGenericError& OutError) const
{
if (MySoftClassPtr.IsNull())
{
OutError = MAKE_ERROR("ERROR", FString::Printf(TEXT("%s validation error: Soft class pointer missing."), *Name.ToString()));
}
}
That's all. You don't have to call Super::OnValidate (unless you have deep inheritance). Just make sure you set OutError property using the MAKE_ERROR macro. This single override will make sure the program is not created unless the required conditions are met.
For Blueprint users, you simply override the On Validate Blueprint event.
Inside this function do the logic and in any case if you want the validation to fail, you must use Create Generic Error node and return it.