Class VelvetFilters
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Registry for user-defined UI Toolkit custom filters consumed by the filter-[name:args]
utility. Register a UnityEngine.UIElements.FilterFunctionDefinition under a name at startup (before the
consuming tree mounts), then reference it from any class string:
VelvetFilters.Register("dissolve", dissolveDefinition);
V.Div(className: "filter-[dissolve:0.4]");
Arguments after the name are colon-separated and fill the definition's declared parameters in
order, parsed by each slot's declared type — floats (filter-[dissolve:0.4], sign allowed)
for float slots and colors (filter-[glow:#ff0000:2]) for color slots; a missing tail is
padded from the declaration's defaults, so a bare name (filter-[dissolve]) applies the
declared defaults outright. Custom functions
compose into the same inline filter list as the built-in blur-/contrast-/…
utilities: built-ins first (canonical CSS order), then customs in class order.
Registration is not reactive: a class resolved before its name was registered stays inert until
the element's class list changes again.
Not thread-safe (main thread only).
public static class VelvetFilters
- Inheritance
-
objectVelvetFilters
Methods
- Register(string, FilterFunctionDefinition?)
Registers
definitionundernameforfilter-[name:args]resolution. Re-registering a live name logs a warning and overwrites; re-registering the identical definition under the same name is a silent no-op.
- Unregister(string)
Removes a registration. Returns true when the name was registered.