Studio Yotsuba
Back to Node List

List Filter

list_filter

Keeps only list items whose predicate evaluates to true

Reviewed
Guide available

Input Ports

NameTypeDescription
List
list
List<Any>
Required
Source list
X
x
Number
Optional number variable x
Y
y
Number
Optional number variable y
Z
z
Number
Optional number variable z
W
w
Number
Optional number variable w
Vec
vec
Vec2
Optional vec2 variable
Flag
flag
Bool
Optional bool variable

Output Ports

NameTypeDescription
List
list
List<Any>
Filtered list
Count
count
Int
Number of kept elements

Parameters

NameTypeDefaultRangeDescription / Options
Item Type
item_type
Enum
Any—

Expected type of incoming list items

  • NumberNumber
    Create a list of numbers (Float or Int)
  • FloatFloat
    Create a list of float values
  • IntInt
    Create a list of integer values
  • BoolBool
    Create a list of boolean values
  • ColorColor
    Create a list of colors
  • TextText
    Create a list of text values
  • ImageImage
    Create a list of images
  • PathPath
    Create a list of paths
  • PixelLinePixelLine
    Create a list of pixel lines
  • Vec2Vec2
    Create a list of 2D vectors
  • Vec3Vec3
    Create a list of 3D vectors
  • OklchAdjustOklchAdjust
    Create a list of OKLCH adjustment sets
  • PalettePalette
    Create a list of palettes
  • ListList
    Create a nested list (list of lists)
  • MapMap
    Create a list of maps
  • TextLayoutTextLayout
    Create a list of text layouts
  • PixelPatchPixelPatch
    Create a list of pixel patches
  • RecordedLayerRecordedLayer
    Create a list of recorded layers
  • AnimationClipAnimationClip
    Create a list of animation clips
  • AsepriteFileAsepriteFile
    Create a list of Aseprite documents
  • RuleGridSpecRuleGridSpec
    Create a list of rule grid specs
  • RuleTileSetRuleTileSet
    Create a list of rule tile sets
  • RuleTileAssetRuleTileAsset
    Create a list of rule tile assets
  • RuleSetRuleSet
    Create a list of rule sets
  • RuleCanvasRuleCanvas
    Create a list of rule canvases
  • RuleResolvedRuleResolved
    Create a list of resolved rule tile placements
  • RuleTileAtlasRuleTileAtlas
    Create a list of rule tile atlases
  • NineSliceNineSlice
    Create a list of nine-slice UI documents
  • FxState2DFxState2D
    Create a list of 2D FX states
  • SpriteSheetSpriteSheet
    Create a list of sprite sheets
  • VariantSnapshotVariantSnapshot
    Create a list of variant snapshots
  • VariantRecipeVariantRecipe
    Create a list of variant recipes
  • VariantRecordVariantRecord
    Create a list of variant records
  • IsoItemIsoItem
    Create a list of iso items
  • IsoSceneIsoScene
    Create a list of iso scenes
  • IsoWorldIsoWorld
    Create a list of iso worlds
  • TileAssetTileAsset
    Create a list of tile assets (e.g. to feed tile_palette_create)
  • TilePaletteTilePalette
    Create a list of tile palettes
  • TileCanvasTileCanvas
    Create a list of tile map canvases
  • TileResolvedTileResolved
    Create a list of resolved tile placements
  • AnyAny
    Advanced: allow any element type. Mixed lists may connect, but downstream nodes can fail if the extracted value type does not match what they expect.
Predicate
predicate
Text
true—

Keep items for which this expression becomes true. The default true is valid for every item type. Item names depend on type: item for Number/Float/Int/Bool; item_r/g/b/a for Color; item plus item_x/y for Vec2; item_x/y/z for Vec3. Other structured types expose no item-derived names. Map items expose valid non-reserved keys directly and every valid key as item_<key>. Standard names take priority over reserved Map keys: item, index, count, x, y, z, w, vec, vx, vy, flag, time, frame, total_frames. Connected input pins override Inspector fallback values. Examples: - item >= 0.75 - item_r > 0.5 - index % 2 == 0 - value < 0.5 && item_index == 0

X
x
Float
0-10000–10000 / step 0.01

Fallback value for x when the input pin is not connected

Y
y
Float
0-10000–10000 / step 0.01

Fallback value for y when the input pin is not connected

Z
z
Float
0-10000–10000 / step 0.01

Fallback value for z when the input pin is not connected

W
w
Float
0-10000–10000 / step 0.01

Fallback value for w when the input pin is not connected

Vec X
vec_x
Float
0-10000–10000 / step 0.01

Fallback X component for vec when the vec input pin is not connected

Vec Y
vec_y
Float
0-10000–10000 / step 0.01

Fallback Y component for vec when the vec input pin is not connected

Flag
flag
Bool
false—

Fallback bool value when the flag input pin is not connected

Overview

Selects elements from a list with a conditional expression. Only elements for which an expression such as item >= 0.75 evaluates to true remain. Use it to thin candidates, select by threshold, or extract a regular pattern such as "even positions only."

Usage tips

  • It is the counterpart to list_map (transformation): map processes every element, while filter selects elements. When using both, filter → map avoids unnecessary work.
  • Expose a threshold through the x input pin for interactive workflows where a slider adjusts how aggressively the candidates are filtered.
  • Remember that the count changes. When connecting to a downstream setup that expects a fixed count (such as list_unpack), check the count output.

Related nodes

  • list_map — transform instead of select
  • list_slice — extract by position instead of condition
  • expression_bool — single-value Bool version using the same expression engine
  • variant_range / cartesian_product — sources of candidates to filter

Read this first

  • predicate is evaluated once for every element.
  • The default predicate true is valid for every item type and initially keeps all elements.
  • An element remains when the result is true and is discarded when it is false.
  • Thus, with list = [0.25, 0.75, 1.25] and predicate = item >= 0.75:
    • 0.25 >= 0.75 is false, so it is discarded
    • 0.75 >= 0.75 is true, so it remains
    • 1.25 >= 0.75 is true, so it remains

Names available by item type

Names derived from the current item depend on its type. item is not available for every type.

Item type Names derived from the item
Number / Float / Int / Bool item
Color item_r, item_g, item_b, item_a
Vec2 item (Vec2), item_x, item_y
Vec3 item_x, item_y, item_z
Map Key names described below
Other structured types No item-derived expression variable

With Any, a runtime Number, Color, Vec2, Vec3, or Map item exposes the names for its actual type during evaluation. The following common names are available regardless of item type.

Name Meaning Example
index The zero-based position of the element index % 2 == 0
count Total number of elements index / max(count - 1, 1)
x, y, z, w Auxiliary input pins or numbers supplied in the Inspector item >= x
vec, vx, vy Auxiliary Vec2 input, or the Inspector's vec_x, vec_y length(vec) > 1
flag Auxiliary Bool input, or the Inspector default flag && index > 0
time, frame, total_frames Timing information at evaluation frame % 2 == 0

Map elements

When an element is a Map, a non-reserved key that is a valid identifier (such as value, a, or _seed) can be written directly in the condition. Every valid key is also exposed with the item_ prefix.

For example, if an element is:

{ "index": 0, "value": 0.25 }

You can write these directly in the condition:

value < 0.5
item_index == 0

index always means the current position in the list. Use item_index to read the Map's index key. The reserved names item, index, count, x, y, z, w, vec, vx, vy, flag, time, frame, and total_frames keep their standard meaning; use item_<key> for a Map value with one of those names. A valid identifier starts with an ASCII letter or _ and continues with ASCII letters, digits, or _; other keys are not exposed as expression variables.

How to read common inputs:

Input source Element shape Names available in the condition
Ordinary numeric list 0.25, 0.75, 1.25 item, index, count
List Enumerate { "index": 0, "item": 10 } Current position as index; Map values as item_index, item_item
List Zip { "index": 0, "a": 1, "b": 10 } a, b; the Map index as item_index
Cartesian Product Map with multiple keys Non-reserved keys directly, or each valid key as item_<key>

Common expressions

  • item >= 0.75
    • Retains only values at or above the threshold.
  • index % 2 == 0
    • Retains only even positions.
  • item >= x
    • Retains only elements at or above a threshold supplied from outside.
  • value < 0.5 && item_index == 0
    • Filters a Map with multiple conditions.
  • a * 10 == b
    • Filters by the relationship between two lists from List Zip.

Concrete examples

Example 1: Retain only values at or above 0.75

Input:

[0.25, 0.75, 1.25]

Settings:

  • item_type = Float
  • predicate = item >= 0.75

Output:

list = [0.75, 1.25]
count = 2

Example 2: Retain part of a List Zip result

Input:

[
  { "index": 0, "a": 1, "b": 10 },
  { "index": 1, "a": 2, "b": 20 }
]

Settings:

  • item_type = Map
  • predicate = a * 10 == b

Output:

list = [
  { "index": 0, "a": 1, "b": 10 },
  { "index": 1, "a": 2, "b": 20 }
]
count = 2

Example 3: Retain only even positions

Input:

[10, 20, 30, 40, 50]

Settings:

  • item_type = Number
  • predicate = index % 2 == 0

Output:

list = [10, 30, 50]
count = 3

Example 4: Use a variable or auxiliary input as the threshold

Input:

[0.25, 0.75, 1.25]

Settings:

  • item_type = Float
  • predicate = item >= x
  • x = 0.75

Output:

list = [0.75, 1.25]
count = 2

Enter x directly in the Inspector, or connect a Variable Ref to the x input pin.

When to use it

  • When you want to retain only batch-production candidates that meet a condition
  • When you want to reduce the number of candidates before sending them to Batch Render

Notes

  • v1 is based on constrained expressions.
  • It is not intended to run an arbitrary subgraph as a predicate.
  • Standard variables take priority over reserved Map keys. Read a same-named Map value through item_<key>.
Back to Node List