← Web to Widget

Commandlet and CLI reference

Every entry point (editor menu, CLI, commandlet, tests) runs the same import service, so behaviour cannot differ between a human clicking a button and a build agent.

CLI

python Plugins/DigitalBunkerWebUMG/Tools/webumg.py import <file-or-dir> --project <Game.uproject> [options]
python Plugins/DigitalBunkerWebUMG/Tools/webumg.py lint   <file-or-dir> --project <Game.uproject> [options]
python Plugins/DigitalBunkerWebUMG/Tools/webumg.py reimport <file-or-dir> --project <Game.uproject> [options]

The engine is located from the project's EngineAssociation (launcher installs and registered source builds), UE_ENGINE_DIR, or --engine. Standard library only, no packages to install.

OptionDefaultMeaning
--dest/Game/UI/WebContent path for the Widget Blueprint(s)
--reportSaved/WebUMG/report.jsonMachine-readable report
--manifestautoauto writes <name>.webumg.json next to the source; none; or a path
--headers <dir>offGenerate <Widget>Base.h binding headers
--apiAPI macro for the header, e.g. MYGAME_API
--viewport1920Design width for responsive Tailwind variants
--darkoffApply dark: variants
--root-canvasoffWrap the root in a full-screen Canvas Panel
--no-string-tableoffLiteral text instead of a String Table
--no-texturesoffDo not import images
--parentRe-parent to a class, e.g. /Script/MyGame.MyHudBase
--nameOverride the Widget Blueprint name (single file)
--font/Engine/EngineFonts/RobotoFont asset for all text
--preflightautoTailwind Preflight defaults: auto-detect, on, off
--forceoffOverwrite a Widget Blueprint this importer did not create

Exit codes: 0 success, 2 one or more inputs failed (see report), 3 bad arguments, environment, or crash. The CLI derives its exit code from the report, not from the editor process, because Unreal returns 1 whenever any system logged an error during startup (an unrelated project setting, a port in use), even when the import succeeded.

Render (visual and geometric verification)

python Plugins/DigitalBunkerWebUMG/Tools/webumg.py render /Game/UI/Web/WBP_Hud --project <Game.uproject> [--out <file.png>] [--width 1920] [--height 1080] [--scale 1]

Renders the imported Widget Blueprint offscreen to a PNG and writes <file>.geometry.json with the absolute rectangle and visibility of every widget. Compare the rectangles with the browser's getBoundingClientRect() for the same ids to verify layout numerically; compare the PNG with a browser screenshot for colours and text. This needs a real graphics device, so it launches the editor process without NullRHI and takes a few seconds longer than an import. The equivalent console command is DBWebUMG.Render <Asset> <OutPng> [Width] [Height] [Scale].

Commandlet

UnrealEditor-Cmd.exe <Game.uproject> -run=DBWebUMGImport -Input=<file|dir> [-Dest=/Game/UI/Web] [-Lint]
    [-Report=<file.json>] [-Manifest=auto|none|<file>] [-Headers=<dir>] [-Api=MYGAME_API] [-Viewport=1920] [-Dark]
    [-RootCanvas] [-NoStringTable] [-NoTextures] [-NoSave] [-Font=/Path/To/Font] [-Parent=/Script/Module.Class]
    [-Name=WidgetName] [-Force] [-Preflight=auto|on|off]
    -unattended -nop4 -nosplash -NullRHI -NoSound

Same exit codes. Directories are scanned recursively for *.html and *.htm, sorted, and imported in order.

Report format

One object per input (an array under files when several). Fields:

See Docs/examples/hud.report.json.

Manifest format

The plan: schemaVersion, widgetName, title, sourceHash, tailwindMode, widgetCount, maxDepth, classCounts, bindings, texts, assets, and root, a tree of { name, class, variable, bind, event, sourceId, sourcePath, sourceLine, text, textKey, properties, slot, states, children }. Property values use a small typed grammar (linear(r,g,b,a), margin(l,t,r,b), vec2(x,y), vec4(x,y,z,w), anchors(minx,miny,maxx,maxy), asset(/Path), file(relative.png), list(a|b|c), numbers, booleans, enum names). Keys are sorted, so two imports of the same design produce identical text and the manifest diffs cleanly in code review.

See Docs/examples/hud.webumg.json.

Provenance

Each imported Widget Blueprint records DBWebUMG.SourceFile, DBWebUMG.SourceHash, DBWebUMG.PlanHash and DBWebUMG.ImporterVersion as package metadata. The Content Browser Reimport from HTML action and the foreign-overwrite refusal read these.