Skip to main content

blender_bridge

Auto-generated from the Python tool registry. Do not hand-edit outside <!-- examples:start --><!-- examples:end --> blocks — the generator (tools/generate_docs_reference.py) will overwrite them.

Group: asset_gen  ·  Module: services.tools.blender_bridge

Maturity: stable (support status; independent of enabled state, readiness and permissions).

Description​

Bridge to a running Blender that has the BlenderMCP addon connected (socket, default 127.0.0.1:9876; configured in Window > Unity MCP (ykh09242) > Generative > Blender Bridge). Unity talks to the addon directly, so no BlenderMCP client is needed.

Actions:

  • status: is Blender reachable, is the checkout configured, does the installed addon match it.
  • scene_info / object_info(object_name): read Blender scene / one object.
  • screenshot(max_size, output_folder): Blender viewport → PNG under Library/BlenderBridge (or copied under Assets/ when output_folder is given). Returns the path.
  • run_python(code): execute Python inside Blender; returns stdout.
  • import_model: export from Blender (object_names with their children, or selection_only, else the whole scene) as glb (default; keeps PBR, emission, animation) or fbx, import it through the shared model pipeline and place the resulting asset in the open scene at position. target_size sets the largest default-pose mesh-bounds dimension only when Auto-Normalize Imported Models is enabled; finite zero/negative values preserve imported scale. Placement applies no second scale. Normalized glTF can return a prefab variant that retains the original imported model. Set apply_modifiers=false for rigs / shape keys. animation_type applies to FBX only. auto_animate (default true) creates a looping AnimatorController for imported clips so the model actually moves; save_prefab stores the placed instance as a prefab; ensure_bloom adds a Bloom volume when the model has emissive materials. Returns asset_path, asset_guid, game_object, bounds, and animation / prefab_path / bloom when applicable.
  • compare_screenshot(game_object, max_size, output_folder): Blender viewport (left) and a Unity capture framed on the placed object (right) composited into one PNG, for eyeballing fidelity.
  • setup_bloom: enable post-processing on the main camera and add a Bloom override to the global volume.
  • check_updates: git fetch the blender-mcp checkout and report how far behind its remotes it is, plus whether Blender's installed addon.py matches the checkout.
  • sync_addon(force): copy the checkout's addon.py into Blender's addons folder (backs up the old file); restart Blender afterwards.

check_updates and sync_addon need the checkout path to be set; the other actions only need Blender running with the addon connected.

Cancellation closes local socket work and prevents later local stages once observed. Already-started Blender code or exports may continue, and an admitted synchronous Unity import may finish with its assets retained. Inspect state before retrying a mutation.

Parameters​

NameTypeRequiredDescription
actionLiteral['status', 'scene_info', 'object_info', 'screenshot', 'run_python', 'import_model', 'compare_screenshot', 'setup_bloom', 'check_updates', 'sync_addon']yesOperation to perform.
object_namestr | None—object_info: name of the Blender object to inspect.
object_nameslist[str] | None—import_model: Blender objects to export (children included). Omit for selection_only or the whole scene.
selection_onlybool | None—import_model: export only what is currently selected in Blender.
formatLiteral['glb', 'fbx'] | None—import_model: export format (default glb).
namestr | None—import_model: asset and GameObject name (defaults to the single exported object).
target_sizefloat | None—import_model: largest default-pose mesh-bounds dimension in meters when Auto-Normalize Imported Models is enabled; finite zero/negative values preserve scale. Omitted defaults to 0. Placement adds no scaling.
positionlist[float] | None—import_model: world position [x, y, z] for the placed instance.
place_in_scenebool | None—import_model: instantiate the imported asset into the open scene (default true).
apply_modifiersbool | None—import_model: bake modifiers on export (default true; false for skinned meshes / shape keys).
output_folderstr | None—import_model / screenshot: destination folder under Assets/.
animation_typeLiteral['none', 'generic', 'humanoid', 'legacy'] | None—import_model, FBX only: rig/animation import mode (FBX imports zero clips unless set).
auto_animatebool | None—import_model: create a looping AnimatorController for imported clips (default true).
save_prefabbool | None—import_model: save the placed instance as a prefab next to the asset.
ensure_bloombool | None—import_model: add a Bloom volume when the model has emissive materials.
verify_importbool | None—import_model: inspect imported metadata and bounded material/rig findings without another import.
game_objectstr | None—compare_screenshot: name of the placed GameObject to frame in Unity.
codestr | None—run_python: Python source to execute inside Blender.
max_sizeint | None—screenshot / compare_screenshot: max pixels on the longest side, 0..8192 (default 1000).
forcebool | None—sync_addon: overwrite even when the installed addon already matches.
timeout_secondsint | None—Seconds to wait for Blender (default 180; big exports can be slow).
unity_instancestr | int | None—Target Unity instance for this call: Name@hash or hash prefix; an integer selects only that exact port over stdio and is rejected over HTTP. Read mcpforunity://instances for available targets. Omit to use the legacy active selection or the sole available instance.

Returns​

A dict containing the Unity response. The exact shape depends on the action.

Examples​

Check the Blender add-on connection before requesting scene inspection or object import.

MCP arguments
{
"action": "status"
}