Difference between revisions of "Modding/Inventory/Item menu builders"

From SDG Wiki
Jump to: navigation, search
Line 2: Line 2:
  
 
Several of the inventory item widgets are designed to very easily extendable and customizable:
 
Several of the inventory item widgets are designed to very easily extendable and customizable:
 +
 +
== Common ==
 +
 +
All custom menu buildables share a function you should override called ShouldIncludeForItem. This determines whether your menu content is eligible for building details/actions/etc for an item instance.
 +
 +
When your menu buildable's Create and CreateWidget functions are called they receive a InBuilder parameter. You should use this to register your built menu contents. For example an action builder has BuildAction and BuildActionWidget functions allowing you to build as many or as few as you need.
  
 
== At-A-Glance Synopses ==
 
== At-A-Glance Synopses ==
 +
 +
At-a-glance overlays are shown on top of item icons to quickly convey critical information. For example the charge in a battery, or the amount of ammunition in a firearm or magazine:
 +
 +
[[File:UE4Editor_2018-02-26_17-52-49.png]]
 +
 +
You can create your own by subclassing UInventoryItemAtAGlanceMenu_SynopsisBase, and widget subclasses of UInventoryItemAtAGlanceMenu_SynopsisWidgetBase. For very advanced cases you can specify a custom UInventoryItemAtAGlanceMenu_Builder in your UInventoryItemDataAsset.
  
 
== Context Actions ==
 
== Context Actions ==
 +
 +
Action buttons are available when clicking on most items, and are also used to auto-perform some tasks such as dropping an item when you hold a specific key and click it. Some examples are equipping, dropping or inspecting an item:
 +
 +
[[File:UE4Editor_2018-02-26_17-53-01.png]]
 +
 +
You can create your own by subclassing UInventoryItemContextMenu_ActionBase. Most of the vanilla actions use ActionBase's helper function CreateDefaultActionWidget which creates a button with an icon and a label. For very advanced cases you can specify a custom UInventoryItemContextMenu_Builder in your UInventoryItemDataAsset.
  
 
=== Sort Order ===
 
=== Sort Order ===
Line 24: Line 42:
  
 
== Inspector Details ==
 
== Inspector Details ==
 +
 +
Inspector details are used when inspecting the 3D preview of an item. They're for the extended information about your item like stats and lore, or can be used for extra options like whether a coat should be zipped or unzipped.
 +
 +
[[File:UE4Editor_2018-02-26_17-50-05.png]]
 +
 +
You can create your own by subclassing UInventoryItemInspectorMenu_DetailsBase. For simple text details you can use DetailsBase's helper function CreateTextDetailsWidget which adds a line of text like the item's description. For very advanced cases you can specify a custom UInventoryItemInspectorMenu_Builder in your UInventoryItemDataAsset.

Revision as of 23:25, 26 February 2018

Template:Ambox/Documentation

Several of the inventory item widgets are designed to very easily extendable and customizable:

Common

All custom menu buildables share a function you should override called ShouldIncludeForItem. This determines whether your menu content is eligible for building details/actions/etc for an item instance.

When your menu buildable's Create and CreateWidget functions are called they receive a InBuilder parameter. You should use this to register your built menu contents. For example an action builder has BuildAction and BuildActionWidget functions allowing you to build as many or as few as you need.

At-A-Glance Synopses

At-a-glance overlays are shown on top of item icons to quickly convey critical information. For example the charge in a battery, or the amount of ammunition in a firearm or magazine:

File:UE4Editor 2018-02-26 17-52-49.png

You can create your own by subclassing UInventoryItemAtAGlanceMenu_SynopsisBase, and widget subclasses of UInventoryItemAtAGlanceMenu_SynopsisWidgetBase. For very advanced cases you can specify a custom UInventoryItemAtAGlanceMenu_Builder in your UInventoryItemDataAsset.

Context Actions

Action buttons are available when clicking on most items, and are also used to auto-perform some tasks such as dropping an item when you hold a specific key and click it. Some examples are equipping, dropping or inspecting an item:

File:UE4Editor 2018-02-26 17-53-01.png

You can create your own by subclassing UInventoryItemContextMenu_ActionBase. Most of the vanilla actions use ActionBase's helper function CreateDefaultActionWidget which creates a button with an icon and a label. For very advanced cases you can specify a custom UInventoryItemContextMenu_Builder in your UInventoryItemDataAsset.

Sort Order

Sort order is used to rank each action's priority. The highest priority action (lowest number) is auto-performed in some cases.

Sort Order Description
1000 Equip or Dequip
5000 Pickup or Drop
10000 Default

Inspector Details

Inspector details are used when inspecting the 3D preview of an item. They're for the extended information about your item like stats and lore, or can be used for extra options like whether a coat should be zipped or unzipped.

File:UE4Editor 2018-02-26 17-50-05.png

You can create your own by subclassing UInventoryItemInspectorMenu_DetailsBase. For simple text details you can use DetailsBase's helper function CreateTextDetailsWidget which adds a line of text like the item's description. For very advanced cases you can specify a custom UInventoryItemInspectorMenu_Builder in your UInventoryItemDataAsset.