Limen Framework 0.1 Help

SLimenGridInventory

Overview

SLimenGridInventory is a Slate compound widget that visualizes an inventory grid. It handles drag-and-drop operations, updates the UI based on inventory changes, and manages cell highlighting during interactions.

Properties

Type

Name

Access

Description

TWeakObjectPtr<[ULimenGridInventoryComponent](LimenGridInventoryComponent.md)>

InventoryComponent

Private

Weak pointer to the inventory component.

FIntVector2

InventorySize

Private

Size of the inventory grid.

FVector2D

CellSize

Public

Size of each cell in the grid.

TSubclassOf<ULimenGridCellWidget>

CellWidget

Public

Class type for individual grid cells.

TSharedPtr<SGridPanel>

GridPanel

Private

Slate grid panel widget that holds the inventory cells.

FDelegateHandle

CellUpdateDelegateHandle

Private

Delegate handle for handling cell updates from the inventory component.

TSet<FIntVector2>

HighlightedCells

Private

Set of highlighted cells during drag-and-drop operations.

TArray<TSharedPtr<SLimenGridInventoryEntry>>

GridCellWidgets

Private

Array of Slate widgets representing individual grid cells.

Functions

Return Type

Signature

Description

void

Construct(const FArguments& InArgs)

Initializes the widget with arguments and sets up the inventory grid.

void

SetInventory(ULimenGridInventoryComponent* InInventory)

Sets the inventory component and updates the grid accordingly.

FReply

OnDragOver(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)

Handles drag-over events to highlight potential drop cells.

FReply

OnDrop(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent)

Handles drop events to place items in the inventory grid.

void

OnDragLeave(const FDragDropEvent& DragDropEvent)

Clears highlighted cells when drag leaves the widget area.

void

InventoryCellUpdate(const TArray

& Updates)

Updates the grid based on cell updates from the inventory component.

FIntVector2

CursorPositionToCellCoordinate(const FGeometry& MyGeometry, const FVector2D& ScreenCursorPosition) const

Converts screen cursor position to grid cell coordinates.

TOptional<FIntVector2>

GetRootCellCoordinates(const FGeometry& MyGeometry, const FDragDropEvent& DragDropEvent) const

Calculates the root cell coordinates for drag-and-drop operations.

TSet<FIntVector2>

GetPlacementCells(const FIntVector2& RootCell, const FDragDropEvent& DragDropEvent)

Determines the set of cells where an item can be placed during a drag-and-drop operation.

void

CreateInventoryGrid()

Creates and updates the grid based on the current inventory state.

void

ClearHighlightedCells()

Clears all highlighted cells in the grid.

Usage & Implementation Notes

  • The widget handles drag-and-drop operations to allow items to be placed in the inventory grid.

  • It uses a SGridPanel to layout individual grid cells.

  • Cell highlighting is managed during drag-and-drop events to indicate valid and invalid placement areas.

  • The widget updates its display based on changes from an associated ULimenGridInventoryComponent.

22 May 2026