EL4CTEO/blender-skills / skills/blender-export-pipelines
blender-export-pipelines
VerifiedExport from Blender 5.3 with verified presets - Roblox (FBX/glTF, cages, R15, SurfaceAppearance), Unity (FBX, Humanoid), Unreal (FBX skeletal, Nanite, UCX), Godot/web (GLB, meshopt/Draco, WebP), USD. Scale/axes, smoothing, tangents, leaf bones, clips, batch export, post-export verification. Use whenever an asset leaves Blender.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.3 KB |
| references/godot-web.md | markdown | 3.0 KB |
| references/roblox.md | markdown | 3.9 KB |
| references/unity.md | markdown | 2.3 KB |
| references/unreal.md | markdown | 3.1 KB |
| scripts/_bpyx.py | script | 4.4 KB |
| scripts/export_asset.py | script | 9.4 KB |
scripts/export_asset.py
View on GitHub"""Export objects/collections with engine presets, then verify the file.
Presets: roblox (FBX), roblox_gltf, unity (FBX), unity_skeletal, unreal (FBX), unreal_skeletal,
godot (GLB), web (GLB + meshopt + WebP), gltf (plain GLB), usd (USDZ/USD).
Selection: --objects (children included) or --collection; default = selected/visible meshes+armatures.
--batch exports each top-level object to its own file at the world origin.
Usage:
blender -b f.blend -P export_asset.py -- --preset unreal --objects SM_Crate --out //export/SM_Crate.fbx
[--collection Export] [--batch] [--no-anim] [--draco] [--set key=value ...]
MCP: import export_asset; print(export_asset.run(preset="godot", objects=["Hero"], out="//export/Hero.glb"))
GLB results include a parsed summary (meshes, materials, images, animations, skins, extensions).
"""
import json
import os
import struct
import sys
import bpy
from mathutils import Vector
sys.path.insert(0, os.path.dirname(__file__))
import _bpyx as bx # noqa: E402
FBX_BASE = dict(use_selection=True, object_types={"MESH", "ARMATURE", "EMPTY"}, use_mesh_modifiers=True,
mesh_smooth_type="FACE", add_leaf_bones=False, use_armature_deform_only=True,
armature_nodetype="NULL", use_triangles=True, use_tspace=True, use_custom_props=False,
bake_anim=True, bake_anim_use_all_actions=False, bake_anim_use_nla_strips=False,
bake_anim_force_startend_keying=True, bake_anim_simplify_factor=0.0, path_mode="AUTO")
GLTF_BASE = dict(use_selection=True, export_format="GLB", export_yup=True, export_apply=True,
export_texcoords=True, export_normals=True, export_tangents=False,
export_materials="EXPORT", export_image_format="AUTO", export_animations=True,
export_animation_mode="ACTIONS", export_skins=True, export_morph=True,
export_influence_nb=4, export_def_bones=True, export_leaf_bone=False,
export_extras=False, export_cameras=False, export_lights=False)
PRESETS = {
# Roblox: FBX Unit Scale imports at the same scale (Creator Hub); embed textures; no leaf bones
"roblox": ("fbx", dict(apply_scale_options="FBX_SCALE_UNITS", path_mode="COPY", embed_textures=True,
use_tspace=False)),
"roblox_gltf": ("gltf", dict(export_influence_nb=4)),
# Unity: FBX All + Apply Transform -> scale 1, no -90 X rotation on import
"unity": ("fbx", dict(apply_scale_options="FBX_SCALE_ALL", bake_space_transform=True,
axis_forward="-Z", axis_up="Y")),
"unity_skeletal": ("fbx", dict(apply_scale_options="FBX_SCALE_ALL", bake_space_transform=False,
axis_forward="-Z", axis_up="Y")),
# Unreal: unit scale in the FBX header (no 100x root scale); smoothing groups; deform bones only
"unreal": ("fbx", dict(apply_scale_options="FBX_SCALE_UNITS", axis_forward="-Z", axis_up="Y")),
"unreal_skeletal": ("fbx", dict(apply_scale_options="FBX_SCALE_UNITS", axis_forward="-Z", axis_up="Y",
primary_bone_axis="Y", secondary_bone_axis="X")),
"godot": ("gltf", dict(export_extras=True)),
"web": ("gltf", dict(export_image_format="WEBP", export_image_quality=85,
export_meshopt_compression_enable=True)),
"gltf": ("gltf", {}),
"usd": ("usd", dict(selected_objects_only=True, export_materials=True, generate_preview_surface=True,
export_armatures=True, only_deform_bones=True, export_shapekeys=True,
export_textures_mode="NEW", relative_paths=True, convert_orientation=False)),
}
EXT = {"fbx": ".fbx", "gltf": ".glb", "usd": ".usdz"}
def glb_summary(path):
"""Parse the JSON chunk of a .glb (no import needed)."""
with open(path, "rb") as f:
magic, _, _ = struct.unpack("<4sII", f.read(12))
if magic != b"glTF":
return {"error": "not a GLB"}
clen, ctype = struct.unpack("<II", f.read(8))
doc = json.loads(f.read(clen))
tris = 0
for m in doc.get("meshes", []):
for p in m.get("primitives", []):
acc = doc["accessors"][p["indices"]] if "indices" in p else None
tris += (acc["count"] // 3) if acc else 0
return {k: len(doc.get(k, [])) for k in ("nodes", "meshes", "materials", "images", "animations", "skins")} | {
"tris": tris, "extensions": doc.get("extensionsUsed", []),
"animation_names": [a.get("name") for a in doc.get("animations", [])][:20]}
def _gather(objects, collection):
if collection:
col = bpy.data.collections[collection]
return [o for o in col.all_objects if o.type in {"MESH", "ARMATURE", "EMPTY", "CURVE"}]
obs = bx.objects(objects, types=("MESH", "ARMATURE", "EMPTY"))
out = []
for o in obs:
out.append(o)
out += [c for c in o.children_recursive if c.type in {"MESH", "ARMATURE", "EMPTY"}]
if o.parent and o.parent.type == "ARMATURE":
out.append(o.parent)
return list(dict.fromkeys(out))
def _export(fmt, path, kw):
if fmt == "fbx":
return bpy.ops.export_scene.fbx(filepath=path, **kw)
if fmt == "gltf":
return bpy.ops.export_scene.gltf(filepath=path, **kw)
return bpy.ops.wm.usd_export(filepath=path, **kw)
def _coerce(v):
for t in (int, float):
try:
return t(v)
except ValueError:
pass
return {"true": True, "false": False}.get(v.lower(), v)
def run(preset="gltf", objects=None, collection=None, out="", batch=False, no_anim=False,
draco=False, set=None, **_): # noqa: A002
bx.object_mode()
fmt, extra = PRESETS[preset]
kw = dict(FBX_BASE if fmt == "fbx" else GLTF_BASE if fmt == "gltf" else {})
kw.update(extra)
if no_anim:
kw.update({"bake_anim": False} if fmt == "fbx" else {"export_animations": False} if fmt == "gltf"
else {"export_animation": False})
if draco and fmt == "gltf":
kw.update(export_draco_mesh_compression_enable=True, export_meshopt_compression_enable=False)
for item in set or []:
k, v = item.split("=", 1)
kw[k] = _coerce(v)
obs = _gather(objects, collection)
if not obs:
raise ValueError("nothing to export")
warn = [f"{o.name}: unapplied scale {tuple(round(s, 3) for s in o.scale)}" for o in obs
if o.type == "MESH" and any(abs(s - 1) > 1e-4 for s in o.scale)]
warn += [f"{o.name}: n-gons present; tangents need tris/quads" for o in obs
if o.type == "MESH" and fmt == "fbx" and kw.get("use_tspace") and not kw.get("use_triangles")
and any(len(p.vertices) > 4 for p in o.data.polygons)]
# glTF single-armature mode adds EVERY armature action in the file, even ones driving other rigs
# (e.g. the Rigify control rig's clip baked onto GAME_*): it lands as a bogus extra clip.
if fmt == "gltf" and kw.get("export_animations") and "export_anim_single_armature" not in kw:
names = {o.name for o in obs}
foreign = []
for a in bpy.data.actions:
users = [u.name for s in a.slots if s.target_id_type == "OBJECT" for u in s.users()]
if users and not names.intersection(users):
foreign.append(a.name)
if foreign:
kw["export_anim_single_armature"] = False
warn.append(f"skipped actions that animate non-exported objects: {foreign[:10]}; only the "
"exported objects' active action + NLA strips are exported (bake_action adds strips)")
out = bpy.path.abspath(out) if out else os.path.join(
os.path.dirname(bpy.data.filepath) or os.getcwd(), "export", f"{obs[0].name}{EXT[fmt]}")
if fmt == "usd" and not out.endswith((".usd", ".usda", ".usdc", ".usdz")):
out += ".usdz"
os.makedirs(os.path.dirname(out), exist_ok=True)
jobs = []
if batch:
roots = [o for o in obs if o.parent is None or o.parent not in obs]
for r in roots:
members = [r] + [c for c in r.children_recursive if c in obs]
jobs.append((os.path.join(os.path.dirname(out), f"{r.name}{EXT[fmt]}"), members, r))
else:
jobs.append((out, obs, None))
files = []
for path, members, root in jobs:
bx.select_only(members, active=members[0])
loc = None
if root is not None:
loc = root.location.copy()
root.location = Vector()
try:
res = _export(fmt, path, kw)
finally:
if loc is not None:
root.location = loc
rec = {"file": path, "ok": res == {"FINISHED"} and os.path.exists(path),
"kb": round(os.path.getsize(path) / 1024, 1) if os.path.exists(path) else 0,
"objects": [m.name for m in members]}
if path.endswith(".glb") and rec["ok"]:
rec["summary"] = glb_summary(path)
files.append(rec)
return {"ok": all(f["ok"] for f in files), "preset": preset, "format": fmt, "files": files,
"warnings": warn}
if __name__ == "__main__":
p = bx.add_common(bx.parser(__doc__), save=False)
p.add_argument("--preset", default="gltf", choices=list(PRESETS))
p.add_argument("--collection", default=None)
p.add_argument("--out", default="")
p.add_argument("--batch", action="store_true")
p.add_argument("--no-anim", action="store_true")
p.add_argument("--draco", action="store_true")
p.add_argument("--set", nargs="*", default=None, help="extra exporter kwargs key=value")
bx.cli(run, p)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |