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

Description​

Bridge to a running Blender that has the BlenderMCP addon connected (socket, default 127.0.0.1:9876; configured in Window > MCP for Unity > 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, place it in the open scene at position, and scale it so its largest dimension equals target_size meters (0 keeps the imported scale). 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.

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: final size in meters of the largest dimension; 0 keeps the imported scale.
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.
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: max pixels on the longest side (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).

Returns​

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

Examples​

No examples yet. Add usage examples here — they will be preserved across regenerations.