[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7707TDHMZKXCTWGZEVSZ73G":3,"skill-same:01M7707TDHMZKXCTWGZEVSZ73G":61},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":41,"repositoryHtmlUrl":42,"repositoryHomepageUrl":43,"ownerHtmlUrl":44,"ownerBlogUrl":6,"ownerDescription":45,"updatedAt":46,"install":47,"resources":60},"01M7707TDHMZKXCTWGZEVSZ73G","blender-bpy",null,"Comprehensive Blender automation via Python bpy API. Procedural modeling, material nodes, lighting, rendering, and asset generation. Includes verified gear\u002Fmechanical parts demo.","Lord1Egypt\u002Fawesome-skill-forge","Lord1Egypt","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99746359?v=4","01M7592YDNT0XK9WJ0T2MQVPDN","Mohamed Mounir Ali AL Keshita","01M75GRFNHC8VZNWEB8DKDE433",3,"MIT","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fb\u002Fblender-bpy-enhanced\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: blender-bpy\ntitle: Blender 3D Automation — Python bpy Scripting\ndescription: Comprehensive Blender automation via Python bpy API. Procedural modeling, material nodes, lighting, rendering, and asset generation. Includes verified gear\u002Fmechanical parts demo.\nversion: 2.2.0\nauthor: Approxima (via skillhub.cn)\ntags: [blender, 3d, modeling, rendering, bpy, procedural, automation, 3d-printing]\nrequires:\n  bins: [blender]\n---\n\n# Blender Python Automation (bpy) — v2.2.0\n\n## When to Use This Skill\n\nInvoke when the user wants to:\n- Create 3D objects procedurally (gears, mechanical parts, architectural elements)\n- Set up materials with node-based textures (metal, brushed, procedural)\n- Configure 3-point lighting and camera\n- Render still images or animations in headless mode\n- Batch process or automate Blender workflows\n- Export to GLB\u002FglTF for web or game engines\n\n## Prerequisites\n\n```bash\n# Install Blender\napt-get install blender   # Linux (Debian\u002FUbuntu)\n# Or: brew install blender  # macOS\n\n# Verify\nblender --version\n```\n\n## Core Patterns\n\n### 1. Headless Execution\n```bash\nblender --background --python script.py\n```\n\n### 2. Scene Setup\n```python\nimport bpy, math\n\n# Clear scene\nbpy.ops.object.select_all(action='SELECT')\nbpy.ops.object.delete(use_global=False)\nfor mat in list(bpy.data.materials):\n    bpy.data.materials.remove(mat)\n```\n\n### 3. Procedural Gear Creation\n```python\ndef create_gear(name, radius=2.0, teeth=16, thickness=0.8):\n    \"\"\"Create a gear with teeth and center hole\"\"\"\n    # Base cylinder\n    bpy.ops.mesh.primitive_cylinder_add(\n        vertices=teeth * 4,\n        radius=radius,\n        depth=thickness,\n        location=(0, 0, 0)\n    )\n    gear = bpy.context.object\n    gear.name = name\n    \n    # Edit mode: select vertices at tooth positions\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n    \n    for v in gear.data.vertices:\n        angle = math.atan2(v.co.y, v.co.x)\n        tooth_angle = 2 * math.pi \u002F teeth\n        angle_diff = abs((angle % tooth_angle) - tooth_angle \u002F 2)\n        if angle_diff \u003C tooth_angle * 0.35:\n            v.select = True\n    \n    # Extrude and scale for teeth\n    bpy.ops.mesh.extrude_region_move(\n        TRANSFORM_OT_translate={\"value\": (0, 0, 0)}\n    )\n    bpy.ops.transform.resize(\n        value=((radius + 0.4) \u002F radius,) * 2 + (1,),\n        orient_type='GLOBAL'\n    )\n    bpy.ops.object.mode_set(mode='OBJECT')\n    \n    # Center hole via Boolean\n    bpy.ops.mesh.primitive_cylinder_add(\n        vertices=32, radius=0.5,\n        depth=thickness * 1.5, location=(0, 0, 0)\n    )\n    cutter = bpy.context.object\n    bool_mod = gear.modifiers.new(name=\"Hole\", type='BOOLEAN')\n    bool_mod.operation = 'DIFFERENCE'\n    bool_mod.object = cutter\n    bpy.context.view_layer.objects.active = gear\n    gear.select_set(True)\n    bpy.ops.object.modifier_apply(modifier=\"Hole\")\n    bpy.data.objects.remove(cutter, do_unlink=True)\n    \n    # Modifier stack\n    bevel = gear.modifiers.new(name=\"Bevel\", type='BEVEL')\n    bevel.width = 0.05; bevel.segments = 2; bevel.limit_method = 'ANGLE'\n    subdiv = gear.modifiers.new(name=\"Subdivision\", type='SUBSURF')\n    subdiv.levels = 1; subdiv.render_levels = 2\n    \n    return gear\n```\n\n### 4. Procedural Metal Material (Node-based)\n```python\ndef create_metal_material(name, base_color, metallic=0.85, roughness=0.25,\n                          noise_scale=30.0, use_brushed=True):\n    \"\"\"Create a procedural metal material with optional brushed effect\"\"\"\n    mat = bpy.data.materials.new(name=name)\n    mat.use_nodes = True\n    nodes = mat.node_tree.nodes\n    links = mat.node_tree.links\n    nodes.clear()\n    \n    output = nodes.new(type='ShaderNodeOutputMaterial')\n    output.location = (400, 0)\n    \n    bsdf = nodes.new(type='ShaderNodeBsdfPrincipled')\n    bsdf.location = (0, 0)\n    bsdf.inputs['Base Color'].default_value = base_color\n    bsdf.inputs['Metallic'].default_value = metallic\n    bsdf.inputs['Roughness'].default_value = roughness\n    \n    if use_brushed:\n        tex = nodes.new(type='ShaderNodeTexCoord')\n        tex.location = (-400, 100)\n        noise = nodes.new(type='ShaderNodeTexNoise')\n        noise.location = (-200, 0)\n        noise.inputs['Scale'].default_value = noise_scale\n        noise.inputs['Detail'].default_value = 2.0\n        ramp = nodes.new(type='ShaderNodeValToRGB')\n        ramp.location = (0, 100)\n        ramp.color_ramp.elements[0].color = (\n            base_color[0]*0.8, base_color[1]*0.8, base_color[2]*0.8, 1.0)\n        ramp.color_ramp.elements[1].color = (\n            base_color[0]*1.1, base_color[1]*1.1, base_color[2]*1.1, 1.0)\n        \n        links.new(tex.outputs['Object'], noise.inputs['Vector'])\n        links.new(noise.outputs['Fac'], ramp.inputs['Fac'])\n        links.new(ramp.outputs['Color'], bsdf.inputs['Base Color'])\n    \n    links.new(bsdf.outputs['BSDF'], output.inputs['Surface'])\n    return mat\n```\n\n### 5. 3-Point Lighting Setup\n```python\ndef setup_lighting(base_intensity=600):\n    \"\"\"Standard 3-point lighting: key, fill, rim\"\"\"\n    # Key light (main)\n    key = bpy.ops.object.light_add(\n        type='AREA', location=(5, -4, 6),\n        rotation=(0.8, 0, 0.7))\n    key = bpy.context.object\n    key.data.energy = base_intensity\n    key.data.size = 4\n    \n    # Fill light\n    fill = bpy.ops.object.light_add(\n        type='AREA', location=(-4, 3, 3),\n        rotation=(0.5, 0, -1.0))\n    fill = bpy.context.object\n    fill.data.energy = base_intensity * 0.5\n    fill.data.size = 3\n    \n    # Rim\u002Fback light\n    rim = bpy.ops.object.light_add(\n        type='AREA', location=(0, 5, 5),\n        rotation=(0.5, 0, 1.57))\n    rim = bpy.context.object\n    rim.data.energy = base_intensity * 0.4\n    rim.data.size = 2\n```\n\n### 6. Camera Setup & Dynamic Look-At\n```python\ndef setup_camera(location=(5.5, -4.5, 3.5), target=(0, 0, 0)):\n    bpy.ops.object.camera_add(location=location)\n    cam = bpy.context.object\n    \n    # Point camera at target dynamically using quaternions (mathutils)\n    direction = mathutils.Vector(target) - cam.location\n    rot_quat = direction.to_track_quat('-Z', 'Y')\n    cam.rotation_euler = rot_quat.to_euler()\n    \n    bpy.context.scene.camera = cam\n    return cam\n```\n\n### 7. Rendering\n```python\ndef render(output_path=\"\u002Ftmp\u002Frender.png\", engine='CYCLES',\n           width=1080, height=1080, samples=64):\n    scene = bpy.context.scene\n    scene.render.engine = engine\n    scene.render.resolution_x = width\n    scene.render.resolution_y = height\n    scene.render.filepath = output_path\n    scene.render.image_settings.file_format = 'PNG'\n    \n    if engine == 'CYCLES':\n        scene.cycles.samples = samples\n        scene.cycles.use_denoising = True\n        \n        # Configure Metal GPU on macOS if available\n        try:\n            bpy.context.preferences.addons['cycles'].preferences.compute_device_type = 'METAL'\n            bpy.context.preferences.addons['cycles'].preferences.get_devices()\n            for d in bpy.context.preferences.addons['cycles'].preferences.devices:\n                if d.type == 'METAL':\n                    d.use = True\n        except Exception:\n            pass\n            \n    bpy.ops.render.render(write_still=True)\n```\n\n### 8. Solid Glass \u002F Ice Material\n```python\ndef create_glass_material(name=\"Glass\", color=(0.9, 0.95, 1.0, 1.0), roughness=0.1, ior=1.309):\n    \"\"\"Create refractive glass or ice material. IOR: 1.309 (ice), 1.5 (glass)\"\"\"\n    mat = bpy.data.materials.new(name=name)\n    mat.use_nodes = True\n    nodes = mat.node_tree.nodes\n    links = mat.node_tree.links\n    nodes.clear()\n    \n    bsdf = nodes.new(type='ShaderNodeBsdfPrincipled')\n    output = nodes.new(type='ShaderNodeOutputMaterial')\n    links.new(bsdf.outputs['BSDF'], output.inputs['Surface'])\n    \n    bsdf.inputs['Base Color'].default_value = color\n    bsdf.inputs['Roughness'].default_value = roughness\n    bsdf.inputs['IOR'].default_value = ior\n    \n    # Enable transparency (Transmission)\n    if 'Transmission Weight' in bsdf.inputs:\n        bsdf.inputs['Transmission Weight'].default_value = 1.0\n    elif 'Transmission' in bsdf.inputs:\n        bsdf.inputs['Transmission'].default_value = 1.0\n        \n    return mat\n```\n\n### 9. Advanced Boolean Modeling (One-by-One Carving & Overlaps)\nWhen carving grooves or features into a mesh:\n* **Avoid Bulk Cuts**: Subtracting a complex, self-intersecting mesh (e.g. intersecting tubes) all at once makes the `EXACT` solver delete the geometry (vertex count becomes 0). Carve individual loops **one-by-one** instead.\n* **Overlapping Geometry**: Always make cutter objects overlap the boundaries of the base object (e.g. extending slightly outside and deeper inside). Co-incident boundaries cause the `EXACT` solver to fail and skip subtraction.\n* **Capping Curves**: When converting curves to meshes for cutting, set `curve_data.use_fill_caps = True` before conversion. Combine with a `Subdivision Surface` modifier for clean rounded tips.\n\n### 10. 100% Procedural Coordinate Shader Seams (No Mesh Cuts)\nFor perfect geometry and flawless renderings on regular solids (like spheres), define seams directly in the shader nodes using object coordinates instead of modifying geometry:\n* **Basketball Curved Seams Formula**: \n  $$|x| = \\sqrt{1 - z^2} \\cos\\left(\\theta_d \\sqrt{1 - z^2}\\right)$$\n* **Map Range & Masking**: Map the resulting distance to a `SMOOTHERSTEP` mask from $[w, w+s]$ to $[0, 1]$. Use this mask to mix Colors (Black vs. Orange), Roughness, and normal Height inputs into a single Bump node.\n\n### 11. 3D Printing & Watertight Export (Solidify\u002FDecimate)\nWhen creating models intended for physical 3D printing (e.g. FDM\u002FSLA):\n* **Real-World Units**: Explicitly set the scene scale. Usually, 1 Blender unit represents 1 cm or 1 mm:\n  ```python\n  scene = bpy.context.scene\n  scene.unit_settings.system = 'METRIC'\n  scene.unit_settings.scale_length = 0.01  # 1 unit = 1 cm (Pop Mart standard)\n  ```\n* **Hollow\u002FWall Thickness**: 3D models cannot have zero-thickness surfaces. Use the `Solidify` modifier to give surfaces a physical thickness (typically 1.2mm to 2.0mm):\n  ```python\n  solid = obj.modifiers.new(name=\"Solidify\", type='SOLIDIFY')\n  solid.thickness = 0.12  # 1.2 mm (if 1 unit = 1 cm)\n  solid.offset = -1.0     # Solidify inward\n  ```\n* **Poly Count Optimization**: Large vertex counts slow down slicers. Use a `Decimate` modifier to reduce poly count prior to export:\n  ```python\n  decimate = obj.modifiers.new(name=\"Decimate\", type='DECIMATE')\n  decimate.ratio = 0.15   # Keep 15% of faces\n  ```\n* **Watertight STL Export**: Ensure geometry is manifold, then export using standard operators:\n  ```python\n  # Blender 4.0+ uses standard wm operators for STL export\n  bpy.ops.wm.stl_export(filepath=\"model.stl\", export_selected=True)\n  # Older Blender (\u003C4.0):\n  # bpy.ops.export_mesh.stl(filepath=\"model.stl\", use_selection=True)\n  ```\n\n### 12. Loading Background Reference Image Planes\nTo align procedural elements to concept art (front\u002Fside\u002Ftop views), programmatically load images as background planes:\n```python\ndef load_reference_image(filepath, name=\"ReferenceImage\", location=(0, 0, 0), rotation=(1.5708, 0, 0)):\n    # Create an empty object of type IMAGE\n    bpy.ops.object.empty_add(type='IMAGE', location=location, rotation=rotation)\n    empty = bpy.context.object\n    empty.name = name\n    \n    # Load and assign the image data\n    try:\n        img = bpy.data.images.load(filepath)\n        empty.data = img\n        empty.empty_display_size = 5.0  # scale size\n        # Optional: set opacity\n        empty.use_empty_image_alpha = True\n        empty.empty_image_depth = 'BACK'  # display behind mesh\n    except Exception as e:\n        print(f\"Error loading reference image: {e}\")\n```\n\n## Render Engines\n\n| Engine | Best For | Notes |\n|--------|----------|-------|\n| `BLENDER_EEVEE` | Fast preview, real-time | No denoiser needed, good for quick checks |\n| `CYCLES` | Photorealistic | Essential for glass reflection and refraction. Use `samples=64` or `128` with Denoising. |\n\n## Common Pitfalls\n\n* **Boolean Exact solver deletes mesh (Vertices = 0)** → Check for self-intersections or co-incident surfaces in the cutter. Switch to `'FLOAT'` (called `'FAST'` in Blender \u003C4.0), ensure cutter overlapping boundaries, or perform Boolean carving one-by-one.\n* **Hollow tubes when converting curves to mesh** → Enable caps before converting: `curve_data.use_fill_caps = True`.\n* **Glass rendering looks flat or dark** → Glass requires light reflections to look realistic. Add a dark reflective metallic ground plane (`Roughness=0.3, Metallic=0.85`), a high-contrast rim\u002Fback light, and use the `CYCLES` render engine.\n* **Deprecation warning on Material.use_nodes** → In Blender 6.0+, `use_nodes` will be removed as nodes are always enabled. Check compatibility but safely use it for current versions.\n","# Blender Python Automation (bpy) — v2.2.0\n\n## When to Use This Skill\n\nInvoke when the user wants to:\n- Create 3D objects procedurally (gears, mechanical parts, architectural elements)\n- Set up materials with node-based textures (metal, brushed, procedural)\n- Configure 3-point lighting and camera\n- Render still images or animations in headless mode\n- Batch process or automate Blender workflows\n- Export to GLB\u002FglTF for web or game engines\n\n## Prerequisites\n\n```bash\n# Install Blender\napt-get install blender   # Linux (Debian\u002FUbuntu)\n# Or: brew install blender  # macOS\n\n# Verify\nblender --version\n```\n\n## Core Patterns\n\n### 1. Headless Execution\n```bash\nblender --background --python script.py\n```\n\n### 2. Scene Setup\n```python\nimport bpy, math\n\n# Clear scene\nbpy.ops.object.select_all(action='SELECT')\nbpy.ops.object.delete(use_global=False)\nfor mat in list(bpy.data.materials):\n    bpy.data.materials.remove(mat)\n```\n\n### 3. Procedural Gear Creation\n```python\ndef create_gear(name, radius=2.0, teeth=16, thickness=0.8):\n    \"\"\"Create a gear with teeth and center hole\"\"\"\n    # Base cylinder\n    bpy.ops.mesh.primitive_cylinder_add(\n        vertices=teeth * 4,\n        radius=radius,\n        depth=thickness,\n        location=(0, 0, 0)\n    )\n    gear = bpy.context.object\n    gear.name = name\n    \n    # Edit mode: select vertices at tooth positions\n    bpy.ops.object.mode_set(mode='EDIT')\n    bpy.ops.mesh.select_all(action='DESELECT')\n    \n    for v in gear.data.vertices:\n        angle = math.atan2(v.co.y, v.co.x)\n        tooth_angle = 2 * math.pi \u002F teeth\n        angle_diff = abs((angle % tooth_angle) - tooth_angle \u002F 2)\n        if angle_diff \u003C tooth_angle * 0.35:\n            v.select = True\n    \n    # Extrude and scale for teeth\n    bpy.ops.mesh.extrude_region_move(\n        TRANSFORM_OT_translate={\"value\": (0, 0, 0)}\n    )\n    bpy.ops.transform.resize(\n        value=((radius + 0.4) \u002F radius,) * 2 + (1,),\n        orient_type='GLOBAL'\n    )\n    bpy.ops.object.mode_set(mode='OBJECT')\n    \n    # Center hole via Boolean\n    bpy.ops.mesh.primitive_cylinder_add(\n        vertices=32, radius=0.5,\n        depth=thickness * 1.5, location=(0, 0, 0)\n    )\n    cutter = bpy.context.object\n    bool_mod = gear.modifiers.new(name=\"Hole\", type='BOOLEAN')\n    bool_mod.operation = 'DIFFERENCE'\n    bool_mod.object = cutter\n    bpy.context.view_layer.objects.active = gear\n    gear.select_set(True)\n    bpy.ops.object.modifier_apply(modifier=\"Hole\")\n    bpy.data.objects.remove(cutter, do_unlink=True)\n    \n    # Modifier stack\n    bevel = gear.modifiers.new(name=\"Bevel\", type='BEVEL')\n    bevel.width = 0.05; bevel.segments = 2; bevel.limit_method = 'ANGLE'\n    subdiv = gear.modifiers.new(name=\"Subdivision\", type='SUBSURF')\n    subdiv.levels = 1; subdiv.render_levels = 2\n    \n    return gear\n```\n\n### 4. Procedural Metal Material (Node-based)\n```python\ndef create_metal_material(name, base_color, metallic=0.85, roughness=0.25,\n                          noise_scale=30.0, use_brushed=True):\n    \"\"\"Create a procedural metal material with optional brushed effect\"\"\"\n    mat = bpy.data.materials.new(name=name)\n    mat.use_nodes = True\n    nodes = mat.node_tree.nodes\n    links = mat.node_tree.links\n    nodes.clear()\n    \n    output = nodes.new(type='ShaderNodeOutputMaterial')\n    output.location = (400, 0)\n    \n    bsdf = nodes.new(type='ShaderNodeBsdfPrincipled')\n    bsdf.location = (0, 0)\n    bsdf.inputs['Base Color'].default_value = base_color\n    bsdf.inputs['Metallic'].default_value = metallic\n    bsdf.inputs['Roughness'].default_value = roughness\n    \n    if use_brushed:\n        tex = nodes.new(type='ShaderNodeTexCoord')\n        tex.location = (-400, 100)\n        noise = nodes.new(type='ShaderNodeTexNoise')\n        noise.location = (-200, 0)\n        noise.inputs['Scale'].default_value = noise_scale\n        noise.inputs['Detail'].default_value = 2.0\n        ramp = nodes.new(type='ShaderNodeValToRGB')\n        ramp.location = (0, 100)\n        ramp.color_ramp.elements[0].color = (\n            base_color[0]*0.8, base_color[1]*0.8, base_color[2]*0.8, 1.0)\n        ramp.color_ramp.elements[1].color = (\n            base_color[0]*1.1, base_color[1]*1.1, base_color[2]*1.1, 1.0)\n        \n        links.new(tex.outputs['Object'], noise.inputs['Vector'])\n        links.new(noise.outputs['Fac'], ramp.inputs['Fac'])\n        links.new(ramp.outputs['Color'], bsdf.inputs['Base Color'])\n    \n    links.new(bsdf.outputs['BSDF'], output.inputs['Surface'])\n    return mat\n```\n\n### 5. 3-Point Lighting Setup\n```python\ndef setup_lighting(base_intensity=600):\n    \"\"\"Standard 3-point lighting: key, fill, rim\"\"\"\n    # Key light (main)\n    key = bpy.ops.object.light_add(\n        type='AREA', location=(5, -4, 6),\n        rotation=(0.8, 0, 0.7))\n    key = bpy.context.object\n    key.data.energy = base_intensity\n    key.data.size = 4\n    \n    # Fill light\n    fill = bpy.ops.object.light_add(\n        type='AREA', location=(-4, 3, 3),\n        rotation=(0.5, 0, -1.0))\n    fill = bpy.context.object\n    fill.data.energy = base_intensity * 0.5\n    fill.data.size = 3\n    \n    # Rim\u002Fback light\n    rim = bpy.ops.object.light_add(\n        type='AREA', location=(0, 5, 5),\n        rotation=(0.5, 0, 1.57))\n    rim = bpy.context.object\n    rim.data.energy = base_intensity * 0.4\n    rim.data.size = 2\n```\n\n### 6. Camera Setup & Dynamic Look-At\n```python\ndef setup_camera(location=(5.5, -4.5, 3.5), target=(0, 0, 0)):\n    bpy.ops.object.camera_add(location=location)\n    cam = bpy.context.object\n    \n    # Point camera at target dynamically using quaternions (mathutils)\n    direction = mathutils.Vector(target) - cam.location\n    rot_quat = direction.to_track_quat('-Z', 'Y')\n    cam.rotation_euler = rot_quat.to_euler()\n    \n    bpy.context.scene.camera = cam\n    return cam\n```\n\n### 7. Rendering\n```python\ndef render(output_path=\"\u002Ftmp\u002Frender.png\", engine='CYCLES',\n           width=1080, height=1080, samples=64):\n    scene = bpy.context.scene\n    scene.render.engine = engine\n    scene.render.resolution_x = width\n    scene.render.resolution_y = height\n    scene.render.filepath = output_path\n    scene.render.image_settings.file_format = 'PNG'\n    \n    if engine == 'CYCLES':\n        scene.cycles.samples = samples\n        scene.cycles.use_denoising = True\n        \n        # Configure Metal GPU on macOS if available\n        try:\n            bpy.context.preferences.addons['cycles'].preferences.compute_device_type = 'METAL'\n            bpy.context.preferences.addons['cycles'].preferences.get_devices()\n            for d in bpy.context.preferences.addons['cycles'].preferences.devices:\n                if d.type == 'METAL':\n                    d.use = True\n        except Exception:\n            pass\n            \n    bpy.ops.render.render(write_still=True)\n```\n\n### 8. Solid Glass \u002F Ice Material\n```python\ndef create_glass_material(name=\"Glass\", color=(0.9, 0.95, 1.0, 1.0), roughness=0.1, ior=1.309):\n    \"\"\"Create refractive glass or ice material. IOR: 1.309 (ice), 1.5 (glass)\"\"\"\n    mat = bpy.data.materials.new(name=name)\n    mat.use_nodes = True\n    nodes = mat.node_tree.nodes\n    links = mat.node_tree.links\n    nodes.clear()\n    \n    bsdf = nodes.new(type='ShaderNodeBsdfPrincipled')\n    output = nodes.new(type='ShaderNodeOutputMaterial')\n    links.new(bsdf.outputs['BSDF'], output.inputs['Surface'])\n    \n    bsdf.inputs['Base Color'].default_value = color\n    bsdf.inputs['Roughness'].default_value = roughness\n    bsdf.inputs['IOR'].default_value = ior\n    \n    # Enable transparency (Transmission)\n    if 'Transmission Weight' in bsdf.inputs:\n        bsdf.inputs['Transmission Weight'].default_value = 1.0\n    elif 'Transmission' in bsdf.inputs:\n        bsdf.inputs['Transmission'].default_value = 1.0\n        \n    return mat\n```\n\n### 9. Advanced Boolean Modeling (One-by-One Carving & Overlaps)\nWhen carving grooves or features into a mesh:\n* **Avoid Bulk Cuts**: Subtracting a complex, self-intersecting mesh (e.g. intersecting tubes) all at once makes the `EXACT` solver delete the geometry (vertex count becomes 0). Carve individual loops **one-by-one** instead.\n* **Overlapping Geometry**: Always make cutter objects overlap the boundaries of the base object (e.g. extending slightly outside and deeper inside). Co-incident boundaries cause the `EXACT` solver to fail and skip subtraction.\n* **Capping Curves**: When converting curves to meshes for cutting, set `curve_data.use_fill_caps = True` before conversion. Combine with a `Subdivision Surface` modifier for clean rounded tips.\n\n### 10. 100% Procedural Coordinate Shader Seams (No Mesh Cuts)\nFor perfect geometry and flawless renderings on regular solids (like spheres), define seams directly in the shader nodes using object coordinates instead of modifying geometry:\n* **Basketball Curved Seams Formula**: \n  $$|x| = \\sqrt{1 - z^2} \\cos\\left(\\theta_d \\sqrt{1 - z^2}\\right)$$\n* **Map Range & Masking**: Map the resulting distance to a `SMOOTHERSTEP` mask from $[w, w+s]$ to $[0, 1]$. Use this mask to mix Colors (Black vs. Orange), Roughness, and normal Height inputs into a single Bump node.\n\n### 11. 3D Printing & Watertight Export (Solidify\u002FDecimate)\nWhen creating models intended for physical 3D printing (e.g. FDM\u002FSLA):\n* **Real-World Units**: Explicitly set the scene scale. Usually, 1 Blender unit represents 1 cm or 1 mm:\n  ```python\n  scene = bpy.context.scene\n  scene.unit_settings.system = 'METRIC'\n  scene.unit_settings.scale_length = 0.01  # 1 unit = 1 cm (Pop Mart standard)\n  ```\n* **Hollow\u002FWall Thickness**: 3D models cannot have zero-thickness surfaces. Use the `Solidify` modifier to give surfaces a physical thickness (typically 1.2mm to 2.0mm):\n  ```python\n  solid = obj.modifiers.new(name=\"Solidify\", type='SOLIDIFY')\n  solid.thickness = 0.12  # 1.2 mm (if 1 unit = 1 cm)\n  solid.offset = -1.0     # Solidify inward\n  ```\n* **Poly Count Optimization**: Large vertex counts slow down slicers. Use a `Decimate` modifier to reduce poly count prior to export:\n  ```python\n  decimate = obj.modifiers.new(name=\"Decimate\", type='DECIMATE')\n  decimate.ratio = 0.15   # Keep 15% of faces\n  ```\n* **Watertight STL Export**: Ensure geometry is manifold, then export using standard operators:\n  ```python\n  # Blender 4.0+ uses standard wm operators for STL export\n  bpy.ops.wm.stl_export(filepath=\"model.stl\", export_selected=True)\n  # Older Blender (\u003C4.0):\n  # bpy.ops.export_mesh.stl(filepath=\"model.stl\", use_selection=True)\n  ```\n\n### 12. Loading Background Reference Image Planes\nTo align procedural elements to concept art (front\u002Fside\u002Ftop views), programmatically load images as background planes:\n```python\ndef load_reference_image(filepath, name=\"ReferenceImage\", location=(0, 0, 0), rotation=(1.5708, 0, 0)):\n    # Create an empty object of type IMAGE\n    bpy.ops.object.empty_add(type='IMAGE', location=location, rotation=rotation)\n    empty = bpy.context.object\n    empty.name = name\n    \n    # Load and assign the image data\n    try:\n        img = bpy.data.images.load(filepath)\n        empty.data = img\n        empty.empty_display_size = 5.0  # scale size\n        # Optional: set opacity\n        empty.use_empty_image_alpha = True\n        empty.empty_image_depth = 'BACK'  # display behind mesh\n    except Exception as e:\n        print(f\"Error loading reference image: {e}\")\n```\n\n## Render Engines\n\n| Engine | Best For | Notes |\n|--------|----------|-------|\n| `BLENDER_EEVEE` | Fast preview, real-time | No denoiser needed, good for quick checks |\n| `CYCLES` | Photorealistic | Essential for glass reflection and refraction. Use `samples=64` or `128` with Denoising. |\n\n## Common Pitfalls\n\n* **Boolean Exact solver deletes mesh (Vertices = 0)** → Check for self-intersections or co-incident surfaces in the cutter. Switch to `'FLOAT'` (called `'FAST'` in Blender \u003C4.0), ensure cutter overlapping boundaries, or perform Boolean carving one-by-one.\n* **Hollow tubes when converting curves to mesh** → Enable caps before converting: `curve_data.use_fill_caps = True`.\n* **Glass rendering looks flat or dark** → Glass requires light reflections to look realistic. Add a dark reflective metallic ground plane (`Roughness=0.3, Metallic=0.85`), a high-contrast rim\u002Fback light, and use the `CYCLES` render engine.\n* **Deprecation warning on Material.use_nodes** → In Blender 6.0+, `use_nodes` will be removed as nodes are always enabled. Check compatibility but safely use it for current versions.\n",{"name":5,"tags":24,"title":33,"author":34,"version":35,"requires":36,"description":7},[25,26,27,28,29,30,31,32],"blender","3d","modeling","rendering","bpy","procedural","automation","3d-printing","Blender 3D Automation — Python bpy Scripting","Approxima (via skillhub.cn)","2.2.0",{"bins":37},[25],"master","4aa004da461d820f4ea5499e58eb8d196cf99016","community\u002Fclawhub\u002Fb\u002Fblender-bpy-enhanced",0,"https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge","https:\u002F\u002Fskill-explorer-rho.vercel.app","https:\u002F\u002Fgithub.com\u002FLord1Egypt","Unbreakable. Unstoppable. Unmatched⚡.\r\n Speaker of machine tongues 🤖  | World-builder of decentralized dreams 🌐 | Defender of the digital realm🛡️.","2026-06-10 08:21:01",{"source":8,"skillName":5,"commands":48,"prompt":58,"zipAvailable":59},[49,52,55],{"tool":50,"command":51},"npx","npx skills add Lord1Egypt\u002Fawesome-skill-forge --skill blender-bpy",{"tool":53,"command":54},"bunx","bunx skills add Lord1Egypt\u002Fawesome-skill-forge --skill blender-bpy",{"tool":56,"command":57},"pnpm","pnpm dlx skills add Lord1Egypt\u002Fawesome-skill-forge --skill blender-bpy","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fcommunity\u002Fclawhub\u002Fb\u002Fblender-bpy-enhanced\u002FSKILL.md",true,[],[62,70,77,84,91,98],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":69},"01M785WKJB99G3STR1NF9NRTJW","youtube-content","YouTube transcripts to summaries, threads, blogs.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fyoutube-content\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":69},"01M785WEFHB0G2S9YA6EPR3H0E","xurl","X\u002FTwitter via xurl CLI: post, search, DM, media, v2 API.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fxurl\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":69},"01M785W98EDN4EFJXJPMQEHCRC","touchdesigner-mcp","Control a running TouchDesigner instance via twozero MCP — create operators, set parameters, wire connections, execute Python, build real-time visuals. 36 native tools.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftouchdesigner-mcp\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":69},"01M785W5S9FP3QBH2V191E025P","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":69},"01M785W2AS08NSSH9YATCV6FJB","teams-meeting-pipeline","Operate the Teams meeting summary pipeline via Hermes CLI — summarize meetings, inspect pipeline status, replay jobs, manage Microsoft Graph subscriptions.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fteams-meeting-pipeline\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":69},"01M785VXKW4T34BTP1SCHW1R7F","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002FLord1Egypt\u002Fawesome-skill-forge\u002Fblob\u002Fmaster\u002Fskills\u002Fsystematic-debugging\u002FSKILL.md",[],[]]