Commands Extensions
Create a new command
To create a new command in Skyreal VR, create a new blueprint in the extension plugins that inherits from "SkrSdkCommand". Create a data asset that inherits from "SkrSdkCommandDescription" in a folder "RegistrableAssets" at the root of the plugin. Fill the property "Command" of the data asset with the newly created command. Fill basic command information such as the display name, the texture that will be displayed for the command and if it is a VR or 2D (Desktop) compatible command.
Set command properties
Commands have properties that define some of their default behaviors when launched . To set them up, open your blueprint command. The properties can be found in the "Class Defaults" of the blueprint in the category "Skr".
Implement command behavior
To start implementing the desired command launch behavior, open the created blueprint command. In the "My Blueprint" panel, click on "Override" from the functions section. The list of the overridable functions of this blueprint will be displayed. Select "On Launched" to get the command launch event in blueprint. The other overridable functions can be selected to receive informations from the interactions with the command such as "On Canceled" to get the triggered event when the user cancels the command or the button pressed/released event.
Display User Interface
Adding an User Interface (UI) to the command depends on the launch context. There are two different contexts: VR context and desktop context.
VR context
VR commands uses Skyreal VR VR bracelet to display their UI. Skyreal VR VR bracelet is an interface attached to the user's wrist and several tabs can be added.
Here is an example of a bracelet using 2 tabs, the first one has a medium sized access button and the second one a large sized access button.
To add tabs to the bracelet, it is first needed to create a new widget blueprint that inherits from "SkrCustomizableCommandWidget". This widget is the one that will be displayed on the bracelet when its tab is selected on the left. It is possible to change the button on the left that selects the tab in the "Skr" category of the "Details" tab in the Designer editor of the widget.
To add behaviors to the widget, there is a overridable event in the graph editor called "Event Post Command and Command Description Init". From this event, use the "Get Related Command" to start binding UI with the command behaviors.
Desktop context
For the desktop context, Skyreal VR uses the viewport to display UI. To display UI on screen, create a new widget blueprint that will be the displayed UI.
Adding interfaces to the command
After creating the UI for either desktop or VR, the next step is to add it to the newly created command. Open the command blueprint and reference the UI in the "Class Defaults" -> "Details" -> "Skr" -> "SDK".