apply_widget_style_preset
Apply one block of style properties to every widget in a Widget Blueprint matching a filter, in one compile and save.
Instructions
Apply ONE block of style properties to EVERY widget of a Widget Blueprint that matches a filter, in a single pass with ONE compile + ONE save -- the multi-widget companion to set_widget_property's multi-path form. Selection is target_widgets (explicit names, wins over everything) OR target_class (matched with IsA, so subclasses count) AND/OR name_pattern (wildcard). At least one selector is required: to hit every widget in the tree say so explicitly with name_pattern="*". Every value goes through the same honest applier, so the per-widget report distinguishes what landed from what was ignored; dry_run=true resolves the match and reports it WITHOUT writing, which is the cheap way to check a filter before it touches 40 widgets.
Returns: { widget_bp_path: string, selector_used: string, matched: [string], matched_count: int, dry_run: bool, results: [{widget_name, widget_class, applied, ignored, errors, failed_paths, applied_count, all_applied}], widgets_fully_applied: int, widgets_with_failures: int, saved: bool, save_error: string }
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| save | No | Compile + save the Widget Blueprint when done (default true; a dry run never saves). | |
| force | No | Optional. This command is REFUSED while a Play-in-Editor session is running: it either compiles a Blueprint (the reinstancer can retain a world, and CheckForWorldGCLeaks is Fatal -- it KILLS the editor) or writes to disk (Editor.AllowSavingAssetsDuringPIE=0 makes the engine refuse the write, so it would report success without writing a byte). Stop PIE and retry instead; force=true runs it anyway, at your own risk. | |
| preset | No | Dict of {"<property or dotted path>": <value>} applied to each matched widget, e.g. {"WidgetStyle.Normal.TintColor":"#1B1B1BFF"}. Optional when the source_* params are used; when both are given the inline values WIN, so you can say "the theme, but this one in red". A path that does not exist on a given matched widget lands in that widget's ignored[] instead of failing the whole call. | |
| dry_run | No | Resolve the match and report it without writing anything (default false). | |
| pattern | No | Alias of `name_pattern` (same value, same meaning). Accepted because sibling tools spell this parameter differently; prefer `name_pattern`. | |
| name_pattern | No | Wildcard on the widget's name (Btn_*, *_Title, or * for every widget). Combined with target_class as AND. | |
| target_class | No | Class filter matched with IsA: a curated name (Button, TextBlock), a native class path (/Script/UMG.Button) or a Widget Blueprint asset path. Subclasses match too. | |
| source_bp_path | No | THEME MODE: /Game path of a Widget Blueprint holding a REFERENCE widget to copy the style from, instead of writing the values inline. This is what makes one widget the single source of truth rather than scattering the same colour across 40 calls. | |
| target_widgets | No | Explicit widget names. When present, target_class and name_pattern are IGNORED and only these are touched (reported in selector_used). | |
| widget_bp_path | Yes | /Game path of the Widget Blueprint asset | |
| source_widget_name | No | Name of the reference widget inside source_bp_path. Required with source_bp_path. | |
| source_property_paths | No | Which paths to copy off the reference widget, e.g. ["WidgetStyle.Normal.TintColor","WidgetStyle.NormalPadding"]. A path that does not resolve on the REFERENCE is an error, not a silent skip: an incomplete theme that says nothing is worse than a refusal. Use audit_widget_style with the same reference + paths to find what has drifted before fixing it. |