Skip to content

Sein Selection Model

Class · USeinSelectionModel : UObject

#include "ViewModel/SeinSelectionModel.h"

Tracks the current selection and provides entity ViewModels for selected units.

Owned by USeinUISubsystem. Automatically listens to the player controller’s OnSelectionChanged delegate and rebuilds its ViewModel list.

Get ViewModels for all currently selected entities.

TArray<USeinEntityViewModel*> GetSelectedViewModels() const;

Get the ViewModel for the focused entity. Returns nullptr if active focus is “All” (-1).

USeinEntityViewModel* GetFocusedViewModel() const;

Get the “primary” ViewModel: the focused entity if one is focused, otherwise the first selected entity. Returns nullptr if nothing is selected.

USeinEntityViewModel* GetPrimaryViewModel() const;

Get the number of currently selected entities.

int32 GetSelectionCount() const;

Get the active focus index (-1 = “All”, 0+ = specific entity).

int32 GetActiveFocusIndex() const;

Check if a specific entity is in the current selection.

bool IsEntitySelected(FSeinEntityHandle Handle) const;

Check if a specific entity is the currently focused entity.

bool IsEntityFocused(FSeinEntityHandle Handle) const;

The abilities available across the whole selection, one entry per ability tag with the entries of every selected unit merged. Use it for an action panel that shows everything the selection can do.

TArray<FSeinAbilityInfo> GetSelectionAbilities() const;

The merged info for one ability across the selection. Returns an empty, invalid info if no selected entity has it.

FSeinAbilityInfo GetSelectionAbilityByTag(FGameplayTag Tag) const;

True if any selected entity, or any member of a selected group, has the ability.

bool SelectionHasAbilityWithTag(FGameplayTag Tag) const;

FOnSelectionModelChanged OnSelectionChanged

Fired when the selection or active focus changes.

void HandleSelectionChanged();

Called when the player controller’s selection changes.

C++ members (4)
  • void Initialize(USeinUISubsystem* InOwningSubsystem); Initialize. Binds to the player controller’s selection delegate if one is already available.
  • void Deinitialize(); Unbind from delegates.
  • void EnsurePlayerControllerBound(); Bind to the local player controller’s OnSelectionChanged if we haven’t yet. Cheap no-op once bound. Called every sim tick by the UI subsystem so we catch the PC once it spawns (WorldSubsystem init runs before PC creation).
  • void InvalidateAbilityCache(); Mark selection-wide ability state stale for the next UI read. Called once after each completed simulation frame. The first action-panel query rebuilds the aggregate; every other Blueprint binding/event in that presentation frame reuses it instead of rescanning the whole selection.