Chooser¶
14 tools for Chooser tables: their columns, rows, cells and outcomes, and evaluating one.
Back to the index.
add_chooser_column¶
Additive
Add a column of column_type, its input left unbound, to a UChooserTable asset as one undo step, then compile and save the table; success is false, with save_error, when the save fails. Each call adds a new column, even of a type the table already has, except Randomize: a table holds at most one, so an existing Randomize column is returned with already_existed=true and nothing changes. The column goes where the Chooser editor puts it: a filter column before the first output or Randomize column, so filters stay ahead of them; an output column at the end but before a trailing Randomize column; a Randomize column last. The columns after it move up one index; column_index is where the new column went. The new column gets one cell, its DefaultRowValue, per row already in the table, so columns and rows stay in step whichever is added first. Besides the types listed under column_type it accepts OutputFloat, OutputBool, OutputName, OutputEnum, ObjectClass, Name, MultiEnum and Randomize.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable. |
column_type |
string | yes | Column struct to add: "FloatRange", "Bool", "Enum", "Object", or "OutputObject". Name and OutputName need UE 5.8. |
column_name |
string | yes | Label echoed back in the reply only; it is not stored on the column. |
Returns: { table_path: string, column_index: int, column_name: string, column_type: string, already_existed: bool, row_count?: int, saved?: bool, save_error?: string }
add_chooser_row¶
Additive
Add one implicit row to a UChooserTable. Grows every column's RowValues by one (using each column's DefaultRowValue where available) and grows ResultsStructs by one, as one undo step, then compiles and saves the table; success is false, with save_error, when the save fails.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable. |
Returns: { table_path: string, row_index: int, row_count: int, saved: bool, save_error?: string }
create_chooser_table¶
Additive
Create (or load if it already exists) a UChooserTable asset under the given package path. A new table is compiled and saved. On an existing table only the result_type and output_object_class the call gives are applied, as one undo step, and the table is compiled and saved only when that changes it (saved false otherwise). success is false, with save_error, when the save fails. An unknown result_type, or an output_object_class that does not load as a UClass, is an error checked before the asset is created or loaded.
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Asset short name (e.g. "MyChooser"); becomes the package short name. |
package_path |
string | no | Long package root (default "/Game/MCP"); full asset path = <package_path>/<name>. |
result_type |
string | no | EObjectChooserResultType: "Object" (default), "Class", or "NoPrimaryResult". |
output_object_class |
string | no | UClass path used as OutputObjectType (default UObject), loaded via LoadObject<UClass>; a path that does not load is an error. |
Returns: { asset_path: string, already_existed: bool, result_type: string, output_object_class: string|null, saved: bool, save_error?: string }
delete_chooser_table¶
Destructive Idempotent
Destroy a UChooserTable asset at a /Game path (mirror of create_chooser_table). Typed-delete: it loads the asset and REFUSES to delete it if it is not a UChooserTable, so it cannot wipe the wrong asset the way the generic delete_asset can; that refusal, and a delete the engine does not carry out, make success false with deleted false. Idempotent on missing assets.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Full /Game/.../Chooser asset path. |
Returns: { table_path, deleted, already_existed, asset_class?, note? }
evaluate_chooser_table¶
Read-only
Actually RUN a UChooserTable and get the SINGLE chosen result, or with all_results EVERY matching result (for a chooser meant to select a set) -- the way to test a chooser you just authored without opening the editor. Headless-safe: it is a pure runtime API, so it needs no PIE and no render. Pass context_object_path (any UObject in the editor world) to seed the evaluation context. A table with no columns, or one where no context property matches, falls through to the table's FallbackResult (reported as fallback_used); a table that matches nothing and has no fallback returns null (an empty results list with all_results). With all_results, null entries the engine interleaves in its array are skipped, so result_count is the count of REAL results, and result_object_path is the first of them.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable. |
context_object_path |
string | no | Optional UObject path used to seed the evaluation context. |
object_class |
string | no | Optional UClass path for the expected result type (default = /Script/CoreUObject.Object); results are filtered with IsA. |
all_results |
boolean | no | Optional bool, default false: true evaluates with EvaluateChooserMulti and returns every matching result in results. |
Returns: { table_path, evaluated, result_object_path, result_object_class, fallback_used, column_count, result_count?: int, results?: [{ result_object_path, result_object_class }], note? }
get_chooser_column_values¶
Read-only
Read ONE COLUMN ACROSS ALL ROWS of a UChooserTable, plus that column's DefaultRowValue -- the column-wise counterpart of get_chooser_row_values (one row across all columns), with the same typed cell shapes. The per-column default is EDITOR-ONLY: outside an editor build it comes back null with a note, while the row values themselves always resolve. column_index out of range is an honest error. Read-only: no compile, no save.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable. |
column_index |
integer | yes | 0-based column index to read. |
Returns: { table_path, column_index, column_type, row_count, default: {<typed>}|null, row_values: [{<typed>}] }
get_chooser_row_values¶
Read-only
Read ONE ROW ACROSS ALL COLUMNS of a UChooserTable, as typed cells -- the row-wise counterpart of get_chooser_column_values (one column across all rows) and finer-grained than get_chooser_table_info. Cell shapes by column type: FloatRange {min,max,b_no_min,b_no_max}; Bool {cell_value}; Enum {comparison,value}; Object {comparison,asset_path}; OutputObject {asset_path}. row_index out of range is an honest error. Read-only -- no compile, no save -- and it works headless, since row data is not editor-only. A cell of a row is written with set_chooser_cell.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable. |
row_index |
integer | yes | 0-based row index to read across all columns. |
Returns: { table_path, row_index, row_count, cells: [{ column_index, column_type, <typed fields> }] }
get_chooser_table_info¶
Read-only
Read the shape of one Chooser Table asset without changing it: its result type, output object class, columns (index and column struct type), row count, result count and context-data count. Use it first, to learn the column indices and row count that get_chooser_column_values (one column across all rows), get_chooser_row_values (one row across all columns), set_chooser_cell and remove_chooser_row take; to see which row a context would pick, use evaluate_chooser_table; to find tables, list_chooser_tables. row_count is the largest of the result count and every column's row array, so a half-built table still reports all its rows. A path that does not load a Chooser Table is an error and nothing is read.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of the Chooser Table, without the object suffix, e.g. "/Game/Animation/CHT_Locomotion", as list_chooser_tables returns it. |
Returns: { table_path: string, result_type: "Object"|"Class"|"NoPrimaryResult", output_object_class: string (empty when none), column_count: int, columns: [{index, type}], row_count: int, results_count: int, context_data_count: int }
list_chooser_tables¶
Read-only
Lists the Chooser Table assets under a content folder and all its sub-folders, found through the Asset Registry, each with its name, object path, class and row and column counts. Each match is loaded to count its rows and columns; nothing is changed or saved. A folder without Chooser Tables returns total 0, not an error, and only assets of exactly the UChooserTable class are listed. Use it to find the table_path the other chooser tools take; then get_chooser_table_info for one table's columns and result type, evaluate_chooser_table to run one, create_chooser_table to make a new one.
| Parameter | Type | Required | Description |
|---|---|---|---|
package_path |
string | no | Optional content folder to scan, sub-folders included (default "/Game"; an empty string also means /Game), e.g. "/Game/Animation/Choosers"; plugin content lives under its mount point, such as "/MyPlugin". |
offset |
integer | no | Index of the first entry returned, counted from 0 (default 0). Read the next page at the reply's next_offset. |
limit |
integer | no | Most entries returned per call, 1..1000 (default 100). |
Returns: { package_path, tables:[{ asset_name, asset_path, asset_class, row_count, column_count }], total: int, offset: int, limit: int, returned: int, truncated: bool, next_offset: int|null }
remove_chooser_column¶
Destructive
Remove a column from a UChooserTable by index (inverse of add_chooser_column). The column's per-row cells go with it -- a column owns its own RowValues, so nothing needs re-syncing across the other columns and the row COUNT is unchanged (use remove_chooser_row for that). The removal is one undo step; the table is then compiled and saved, and success is false, with save_error, when the save fails. A table with no columns is left as it is (note, saved false). Omit column_index (or pass -1) to remove the LAST column, matching remove_chooser_row's default.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable. |
column_index |
integer | no | Optional 0-based column index (default -1 = last column). |
Returns: { table_path, removed_column_index, previous_column_count, new_column_count, column_type, saved, save_error?, note? }
remove_chooser_row¶
Destructive
Remove one implicit row from a UChooserTable (inverse of add_chooser_row). A chooser row is not a real object: this shrinks EVERY column's RowValues array by one -- at row_index if given, else the last row -- and shrinks ResultsStructs to match, as one undo step, then compiles and saves the table like add_chooser_row; success is false, with save_error, when the save fails. A table with no rows is left as it is (note, saved false). Use remove_chooser_column to drop a column instead.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable. |
row_index |
integer | no | Optional 0-based row index to remove (default: last row). |
Returns: { table_path, removed_row_index, previous_row_count, new_row_count, saved, save_error?, note? }
set_chooser_cell¶
Destructive Idempotent
Set the cell of one existing row in one column of a UChooserTable -- a filter cell (FloatRange range, Bool match, Enum or Name comparison and value, Object or ObjectClass match) or an output cell -- as one undo step, then compile and save the table. It takes the same typed fields as set_chooser_column_default, which sets the value rows added LATER inherit; this one edits a row already there (set_chooser_row_outcome sets a row's result object). The fields that apply depend on the column type; default_value carries the cell of a Bool (MatchFalse|MatchTrue|MatchAny), OutputFloat, OutputBool, OutputName or Randomize column. A row or column index out of range, a missing or ill-typed field, or a column type no tool writes is an error and nothing changes; a cell already holding the value changes nothing (already_existed true, saved false). The reply re-reads the cell in the shape get_chooser_row_values gives; a failed save makes success false with save_error.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable. |
row_index |
integer | yes | 0-based row whose cell to set (get_chooser_table_info gives the row count). |
column_index |
integer | yes | 0-based column of the cell. |
min |
number | no | FloatRange column: lower bound of the row's float range. |
max |
number | no | FloatRange column: upper bound of the row's float range. |
b_no_min |
boolean | no | FloatRange column: when true, the range has no lower bound. |
b_no_max |
boolean | no | FloatRange column: when true, the range has no upper bound. |
default_value |
any | no | The cell value of a Bool column ("MatchFalse", "MatchTrue" or "MatchAny"), OutputFloat (a number), OutputBool (a bool), OutputName (a name string) or Randomize column (a probability weight). |
comparison |
string | no | Enum and Name columns: "MatchEqual", "MatchNotEqual", "MatchAny" or "Modulus"; ObjectClass column: "Equal", "NotEqual", "SubClassOf" (default), "NotSubClassOf" or "Any". Case-insensitive. |
value |
any | no | Enum and OutputEnum columns: enum ordinal (clamped to 0-255); Name column: the name string to compare; MultiEnum column: the bitmask as an integer. |
asset_path |
string | no | Object/OutputObject column: long package path of the UObject the cell holds. |
class_path |
string | no | ObjectClass column: path of the UClass to match, used with comparison (default SubClassOf). |
Returns: { table_path, row_index, column_index, column_type, <typed cell fields as get_chooser_row_values>, already_existed, saved, save_error? }
set_chooser_column_default¶
Destructive Idempotent
Set the DefaultRowValue of one UChooserTable column, the cell value rows appended by add_chooser_row inherit; set it before adding rows (a row already there: set_chooser_cell). The fields that apply depend on the column type (see the params); others are ignored. A change is one undo step and is compiled and saved, and success is false, with save_error, when the save fails; a value the column already holds changes nothing (already_existed true, saved false).
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable. |
column_index |
integer | yes | 0-based column index to update. |
min |
number | no | FloatRange column: default lower bound of the row's float range. |
max |
number | no | FloatRange column: default upper bound of the row's float range. |
b_no_min |
boolean | no | FloatRange column: when true, disables the lower bound (row matches any value <= max). |
b_no_max |
boolean | no | FloatRange column: when true, disables the upper bound (row matches any value >= min). |
default_value |
any | no | Bool column: "MatchFalse", "MatchTrue" or "MatchAny"; OutputFloat: a number; OutputBool: a bool; OutputName: a name string; Randomize: a probability weight. Ignored by other column types. |
comparison |
string | no | Enum and Name columns: "MatchEqual", "MatchNotEqual", "MatchAny" or "Modulus"; ObjectClass column: "Equal", "NotEqual", "SubClassOf" (default), "NotSubClassOf" or "Any". Case-insensitive. |
value |
any | no | Enum and OutputEnum columns: enum ordinal (clamped to 0-255); Name column: the name string to compare; MultiEnum column: the bitmask as an integer. |
asset_path |
string | no | Object/OutputObject column: long package path of the UObject bound as the default row value. |
class_path |
string | no | ObjectClass column: path of the UClass to match (e.g. "/Script/Engine.Pawn" or "/Game/BP_Enemy.BP_Enemy_C"), used with comparison (default SubClassOf). |
Returns: { table_path, column_index, column_type, default_value?, asset_path?, comparison?, already_existed, saved, save_error? }
set_chooser_row_outcome¶
Destructive Idempotent
Sets the result a Chooser Table row returns -- the row's entry in the table's results, which evaluate_chooser_table returns when that row is chosen: an Asset result holding asset_path on an Object table, or a Class result holding the class on a Class table (asset_path may then name a Blueprint, whose generated class is used). One undo step, then the table is compiled and saved; success is false, with save_error, when the save fails. Idempotent: a row already returning that asset or class is left as it is (already_existed true, saved false). Refused with nothing changed when row_index is out of range of the table's results, the asset does not load, the table returns no primary result (NoPrimaryResult), or the asset or class is not of the table's output_object_class. The row's filter and output-column cells are not touched: set_chooser_cell writes those (an OutputObject column included). Read the result back with evaluate_chooser_table; add rows with add_chooser_row; get_chooser_table_info gives the row count and result type.
| Parameter | Type | Required | Description |
|---|---|---|---|
table_path |
string | yes | Long package path of an existing UChooserTable (e.g. "/Game/Choosers/CT_Locomotion"), as list_chooser_tables lists it. |
row_index |
integer | yes | 0-based row index, below the table's result count (results_count in get_chooser_table_info). |
asset_path |
string | yes | Long package path (e.g. "/Game/Anims/AS_Run") or object path of the asset the row returns; on a Class table a class path or a Blueprint. It must load, or the call is refused. |
Returns: { table_path: string, row_index: int, asset_path: string, result_type: "Object"|"Class", result_struct: string, already_existed: bool, saved: bool, save_error?: string } -- asset_path is what the row now returns, read back from its result entry