[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73BYMQDYZB9JFFJARD3YFMW":3,"skill-same:01M73BYMQDYZB9JFFJARD3YFMW":59},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":37,"commitSha":38,"skillDirectory":39,"forksCount":40,"repositoryHtmlUrl":41,"repositoryHomepageUrl":6,"ownerHtmlUrl":42,"ownerBlogUrl":43,"ownerDescription":6,"updatedAt":44,"install":45,"resources":58},"01M73BYMQDYZB9JFFJARD3YFMW","script-blender-automation",null,"Write Blender Python scripts for procedural modeling, animation, batch operations, and add-on development using advanced bpy API patterns. Use to automate repetitive modeling or animation tasks, generate procedural geometry from algorithms or data, create batch rendering pipelines with parameter variations, build custom operators or add-ons, or integrate Blender with external data pipelines and APIs.","roohe\u002Fagentic-super-skills","roohe","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F99054084?v=4","01M734WCDFP6RZVT5CNM00QR26","01M734WCE4BD0T4NZS5PCV9V5F",10,"MIT","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fscript-blender-automation\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: script-blender-automation\nlocale: caveman-lite\nsource_locale: en\nsource_commit: 82c77053\ntranslator: \"Julius Brussee homage — caveman\"\ntranslation_date: \"2026-05-03\"\ndescription: >\n  Write Blender Python scripts for procedural modeling, animation, batch\n  operations, and add-on development using advanced bpy API patterns. Use\n  to automate repetitive modeling or animation tasks, generate procedural\n  geometry from algorithms or data, create batch rendering pipelines with\n  parameter variations, build custom operators or add-ons, or integrate\n  Blender with external data pipelines and APIs.\nlicense: MIT\nallowed-tools: Read Write Edit Bash Grep Glob\nmetadata:\n  author: Philipp Thoss\n  version: \"1.0\"\n  domain: blender\n  complexity: advanced\n  language: Python\n  tags: blender, bpy, automation, procedural, animation, batch-processing, add-on\n---\n\n# Script Blender Automation\n\nAdvanced Blender Python scripting for procedural modeling, keyframe animation, batch operations, operator registration, and add-on development. Covers complex geometry generation, automated workflows, and integration with external data sources.\n\n## When to Use\n\n- Automating repetitive modeling or animation tasks\n- Generating procedural geometry from algorithms or data\n- Creating batch rendering pipelines with parameter variations\n- Building custom operators or add-ons for workflow enhancement\n- Integrating Blender with external data pipelines or APIs\n- Scripting complex animations with mathematical precision\n- Developing reusable tools for team workflows\n\n## Inputs\n\n| Input | Type | Description | Example |\n|-------|------|-------------|---------|\n| Automation requirements | Specification | Task description, parameters, constraints | Render 100 variations, animate path from data |\n| Data sources | Files\u002FAPIs | External data for procedural generation | CSV coordinates, JSON parameters, API responses |\n| Algorithm definitions | Code\u002FMath | Procedural generation logic | Fractal patterns, parametric curves, L-systems |\n| Operator specifications | Requirements | Custom tool behavior and UI | Tool name, properties, modal interaction |\n| Animation parameters | Keyframes\u002FData | Timing, easing, constraints | Frame ranges, interpolation curves |\n\n## Procedure\n\n### 1. Procedural Geometry Generation\n\nCreate mesh geometry programmatically using BMesh:\n\n```python\nimport bpy\nimport bmesh\nimport math\n\ndef create_parametric_surface(name, u_res=32, v_res=32):\n    \"\"\"Generate parametric surface using mathematical function.\"\"\"\n    mesh = bpy.data.meshes.new(name)\n    obj = bpy.data.objects.new(name, mesh)\n    bpy.context.collection.objects.link(obj)\n\n    bm = bmesh.new()\n\n    # Create vertices using parametric equations\n    verts = []\n    for i in range(u_res):\n        for j in range(v_res):\n            u = (i \u002F (u_res - 1)) * 2 * math.pi\n            v = (j \u002F (v_res - 1)) * math.pi\n\n            # Sphere parametric equations\n            x = math.sin(v) * math.cos(u)\n            y = math.sin(v) * math.sin(u)\n            z = math.cos(v)\n\n            vert = bm.verts.new((x, y, z))\n            verts.append(vert)\n\n    # Create faces\n    bm.verts.ensure_lookup_table()\n    for i in range(u_res - 1):\n        for j in range(v_res - 1):\n            v1 = verts[i * v_res + j]\n            v2 = verts[(i + 1) * v_res + j]\n            v3 = verts[(i + 1) * v_res + (j + 1)]\n            v4 = verts[i * v_res + (j + 1)]\n            bm.faces.new([v1, v2, v3, v4])\n\n    # Write to mesh\n    bm.to_mesh(mesh)\n    bm.free()\n\n    return obj\n```\n\n**Got:** Complex geometry generated from mathematical functions\n**If fail:** Check BMesh API calls, verify vertex indexing, ensure faces are manifold\n\n### 2. Keyframe Animation Automation\n\nScript animation keyframes and drivers:\n\n```python\ndef animate_rotation(obj, start_frame=1, end_frame=250, axis='Z', rotations=2):\n    \"\"\"Animate object rotation over time.\"\"\"\n    # Set initial keyframe\n    obj.rotation_euler[2] = 0  # Z axis\n    obj.keyframe_insert(data_path=\"rotation_euler\", index=2, frame=start_frame)\n\n    # Set end keyframe\n    obj.rotation_euler[2] = rotations * 2 * math.pi\n    obj.keyframe_insert(data_path=\"rotation_euler\", index=2, frame=end_frame)\n\n    # Set interpolation\n    if obj.animation_data and obj.animation_data.action:\n        for fcurve in obj.animation_data.action.fcurves:\n            if 'rotation_euler' in fcurve.data_path:\n                for keyframe in fcurve.keyframe_points:\n                    keyframe.interpolation = 'LINEAR'\n\ndef animate_material_property(mat, property_path, values, frames):\n    \"\"\"Animate material node values.\"\"\"\n    if not mat.node_tree:\n        return\n\n    # Example: animate emission strength\n    nodes = mat.node_tree.nodes\n    emission = nodes.get('Emission')\n    if emission:\n        for frame, value in zip(frames, values):\n            emission.inputs['Strength'].default_value = value\n            emission.inputs['Strength'].keyframe_insert(\n                data_path=\"default_value\",\n                frame=frame\n            )\n\ndef create_driver(obj, property_path, expression):\n    \"\"\"Create driver for automated animation.\"\"\"\n    driver = obj.driver_add(property_path)\n    driver.driver.type = 'SCRIPTED'\n    driver.driver.expression = expression\n\n    # Example: link rotation to frame number\n    # expression = \"frame \u002F 10\"\n```\n\n**Got:** Keyframes inserted, animation plays back correctly\n**If fail:** Check property paths, verify data_path syntax, ensure objects are keyable\n\n### 3. Batch Processing Operations\n\nProcess multiple objects or files in batch:\n\n```python\nimport os\nfrom pathlib import Path\n\ndef batch_import_and_render(input_dir, output_dir, file_pattern=\"*.obj\"):\n    \"\"\"Import multiple files and render each.\"\"\"\n    input_path = Path(input_dir)\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n\n    scene = bpy.context.scene\n\n    for obj_file in input_path.glob(file_pattern):\n        # Clear existing objects\n        bpy.ops.object.select_all(action='SELECT')\n        bpy.ops.object.delete()\n\n        # Import model\n        bpy.ops.import_scene.obj(filepath=str(obj_file))\n\n        # Setup camera and lighting (reuse setup functions)\n        setup_camera()\n        setup_lighting()\n\n        # Render\n        output_file = output_path \u002F f\"{obj_file.stem}.png\"\n        scene.render.filepath = str(output_file)\n        bpy.ops.render.render(write_still=True)\n\n        print(f\"Rendered: {output_file}\")\n\ndef batch_material_variation(base_object, colors, output_prefix):\n    \"\"\"Render object with multiple material colors.\"\"\"\n    mat = base_object.data.materials[0]\n    bsdf = mat.node_tree.nodes.get('Principled BSDF')\n\n    if not bsdf:\n        return\n\n    for i, color in enumerate(colors):\n        # Update material color\n        bsdf.inputs['Base Color'].default_value = color + (1.0,)\n\n        # Render\n        bpy.context.scene.render.filepath = f\"{output_prefix}_{i:03d}.png\"\n        bpy.ops.render.render(write_still=True)\n```\n\n**Got:** Multiple files processed, renders generated for each variant\n**If fail:** Check file paths exist, verify import operators, handle missing materials\n\n### 4. Custom Operator Development\n\nCreate custom operators for reusable tools:\n\n```python\nimport bpy\nfrom bpy.props import FloatProperty, IntProperty\n\nclass OBJECT_OT_generate_spiral(bpy.types.Operator):\n    \"\"\"Generate a spiral curve\"\"\"\n    bl_idname = \"object.generate_spiral\"\n    bl_label = \"Generate Spiral\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    # Operator properties\n    radius: FloatProperty(\n        name=\"Radius\",\n        description=\"Spiral radius\",\n        default=2.0,\n        min=0.1,\n        max=10.0\n    )\n\n    turns: IntProperty(\n        name=\"Turns\",\n        description=\"Number of spiral turns\",\n        default=5,\n        min=1,\n        max=20\n    )\n\n    resolution: IntProperty(\n        name=\"Resolution\",\n        description=\"Points per turn\",\n        default=32,\n        min=8,\n        max=128\n    )\n\n    def execute(self, context):\n        # Create curve\n        curve = bpy.data.curves.new('Spiral', 'CURVE')\n        curve.dimensions = '3D'\n\n        spline = curve.splines.new('NURBS')\n        num_points = self.turns * self.resolution\n\n        spline.points.add(num_points - 1)  # -1 because one point exists\n\n        for i in range(num_points):\n            t = i \u002F self.resolution\n            angle = t * 2 * math.pi\n\n            x = self.radius * math.cos(angle)\n            y = self.radius * math.sin(angle)\n            z = t * 0.5\n\n            spline.points[i].co = (x, y, z, 1.0)\n\n        # Create object\n        obj = bpy.data.objects.new('Spiral', curve)\n        context.collection.objects.link(obj)\n        obj.select_set(True)\n        context.view_layer.objects.active = obj\n\n        self.report({'INFO'}, f\"Generated spiral with {num_points} points\")\n        return {'FINISHED'}\n\ndef register():\n    bpy.utils.register_class(OBJECT_OT_generate_spiral)\n\ndef unregister():\n    bpy.utils.unregister_class(OBJECT_OT_generate_spiral)\n\nif __name__ == \"__main__\":\n    register()\n```\n\n**Got:** Operator appears in search, executes with proper undo support\n**If fail:** Check bl_idname format (lowercase with underscores), verify property types\n\n### 5. Modal Operator for Interactive Tools\n\nCreate interactive modal operators:\n\n```python\nclass OBJECT_OT_modal_scale(bpy.types.Operator):\n    \"\"\"Interactive scaling with mouse\"\"\"\n    bl_idname = \"object.modal_scale\"\n    bl_label = \"Modal Scale\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def __init__(self):\n        self.initial_mouse_x = 0\n        self.initial_scale = 1.0\n\n    def modal(self, context, event):\n        if event.type == 'MOUSEMOVE':\n            # Calculate scale based on mouse movement\n            delta = event.mouse_x - self.initial_mouse_x\n            scale = self.initial_scale + (delta \u002F 100.0)\n            scale = max(0.1, scale)  # Minimum scale\n\n            # Apply to active object\n            context.active_object.scale = (scale, scale, scale)\n\n        elif event.type == 'LEFTMOUSE':\n            return {'FINISHED'}\n\n        elif event.type in {'RIGHTMOUSE', 'ESC'}:\n            # Cancel - restore initial scale\n            context.active_object.scale = (\n                self.initial_scale,\n                self.initial_scale,\n                self.initial_scale\n            )\n            return {'CANCELLED'}\n\n        return {'RUNNING_MODAL'}\n\n    def invoke(self, context, event):\n        if context.active_object:\n            self.initial_mouse_x = event.mouse_x\n            self.initial_scale = context.active_object.scale[0]\n\n            context.window_manager.modal_handler_add(self)\n            return {'RUNNING_MODAL'}\n        else:\n            self.report({'WARNING'}, \"No active object\")\n            return {'CANCELLED'}\n```\n\n**Got:** Interactive operator responds to mouse, left-click confirms, ESC cancels\n**If fail:** Check event types, ensure modal handler is added, handle no active object\n\n### 6. Add-on Packaging\n\nStructure code as installable add-on:\n\n```python\nbl_info = {\n    \"name\": \"Custom Tools\",\n    \"author\": \"Your Name\",\n    \"version\": (1, 0, 0),\n    \"blender\": (3, 0, 0),\n    \"location\": \"View3D > Add > Mesh\",\n    \"description\": \"Collection of custom modeling tools\",\n    \"category\": \"Add Mesh\",\n}\n\nimport bpy\n\n# Import operator classes\nfrom .operators import OBJECT_OT_generate_spiral\n\nclasses = (\n    OBJECT_OT_generate_spiral,\n    # Add other classes\n)\n\ndef menu_func(self, context):\n    \"\"\"Add to menu.\"\"\"\n    self.layout.operator(OBJECT_OT_generate_spiral.bl_idname)\n\ndef register():\n    for cls in classes:\n        bpy.utils.register_class(cls)\n\n    bpy.types.VIEW3D_MT_mesh_add.append(menu_func)\n\ndef unregister():\n    bpy.types.VIEW3D_MT_mesh_add.remove(menu_func)\n\n    for cls in reversed(classes):\n        bpy.utils.unregister_class(cls)\n\nif __name__ == \"__main__\":\n    register()\n```\n\n**Got:** Add-on installs via Preferences, operators appear in menus\n**If fail:** Check bl_info format, verify Blender version requirement, ensure all classes listed\n\n### 7. Data-Driven Procedural Generation\n\nGenerate geometry from external data:\n\n```python\nimport csv\nimport json\n\ndef create_from_csv(filepath):\n    \"\"\"Generate objects from CSV data.\"\"\"\n    with open(filepath, 'r') as f:\n        reader = csv.DictReader(f)\n\n        for row in reader:\n            # Parse data\n            name = row['name']\n            x, y, z = float(row['x']), float(row['y']), float(row['z'])\n            scale = float(row.get('scale', 1.0))\n\n            # Create object\n            bpy.ops.mesh.primitive_uv_sphere_add(location=(x, y, z))\n            obj = bpy.context.active_object\n            obj.name = name\n            obj.scale = (scale, scale, scale)\n\ndef create_from_json(filepath):\n    \"\"\"Generate scene from JSON configuration.\"\"\"\n    with open(filepath, 'r') as f:\n        config = json.load(f)\n\n    # Process objects\n    for obj_config in config.get('objects', []):\n        obj_type = obj_config['type']\n        location = obj_config['location']\n\n        if obj_type == 'cube':\n            bpy.ops.mesh.primitive_cube_add(location=location)\n        elif obj_type == 'sphere':\n            bpy.ops.mesh.primitive_uv_sphere_add(location=location)\n\n        obj = bpy.context.active_object\n        obj.name = obj_config.get('name', 'Object')\n\n        # Apply material if specified\n        if 'material' in obj_config:\n            mat_name = obj_config['material']\n            mat = bpy.data.materials.get(mat_name)\n            if mat:\n                obj.data.materials.append(mat)\n```\n\n**Got:** Objects created based on external data files\n**If fail:** Validate file format, handle missing fields, provide default values\n\n## Validation Checklist\n\n- [ ] Scripts run without errors in Blender Python environment\n- [ ] Procedural geometry generates as expected\n- [ ] Animation keyframes inserted at correct frames\n- [ ] Batch operations process all files successfully\n- [ ] Custom operators appear in search and execute correctly\n- [ ] Modal operators respond to mouse\u002Fkeyboard events\n- [ ] Add-ons install and uninstall cleanly\n- [ ] External data files parsed correctly\n- [ ] Error handling covers edge cases\n- [ ] Code follows PEP 8 style guidelines\n\n## Pitfalls\n\n1. **Circular imports in add-ons**: Use relative imports, structure modules carefully\n2. **Operator naming**: bl_idname must be lowercase with single underscore (category.name)\n3. **Property types**: Use correct bpy.props types (FloatProperty, IntProperty, etc.)\n4. **Context access**: Not all operators work in all contexts (viewport vs render)\n5. **BMesh cleanup**: Always call `bm.free()` after `bm.to_mesh()` to prevent memory leaks\n6. **Animation keyframe timing**: Frame numbers start at 1, not 0\n7. **Driver expression errors**: Validate expressions, use safe namespace\n8. **Modal operator blocking**: Don't block in modal(), use non-blocking operations\n9. **Add-on installation paths**: Place in Blender's scripts\u002Faddons directory\n10. **Version compatibility**: API changes between Blender versions, document requirements\n\n## Related Skills\n\n- **[create-3d-scene](..\u002Fcreate-3d-scene\u002FSKILL.md)**: Basic scene setup and object creation\n- **[render-blender-output](..\u002Frender-blender-output\u002FSKILL.md)**: Rendering workflows for automated output\n- **[create-r-package](..\u002F..\u002Fr-packages\u002Fcreate-r-package\u002FSKILL.md)**: Similar packaging patterns for code distribution\n","# Script Blender Automation\n\nAdvanced Blender Python scripting for procedural modeling, keyframe animation, batch operations, operator registration, and add-on development. Covers complex geometry generation, automated workflows, and integration with external data sources.\n\n## When to Use\n\n- Automating repetitive modeling or animation tasks\n- Generating procedural geometry from algorithms or data\n- Creating batch rendering pipelines with parameter variations\n- Building custom operators or add-ons for workflow enhancement\n- Integrating Blender with external data pipelines or APIs\n- Scripting complex animations with mathematical precision\n- Developing reusable tools for team workflows\n\n## Inputs\n\n| Input | Type | Description | Example |\n|-------|------|-------------|---------|\n| Automation requirements | Specification | Task description, parameters, constraints | Render 100 variations, animate path from data |\n| Data sources | Files\u002FAPIs | External data for procedural generation | CSV coordinates, JSON parameters, API responses |\n| Algorithm definitions | Code\u002FMath | Procedural generation logic | Fractal patterns, parametric curves, L-systems |\n| Operator specifications | Requirements | Custom tool behavior and UI | Tool name, properties, modal interaction |\n| Animation parameters | Keyframes\u002FData | Timing, easing, constraints | Frame ranges, interpolation curves |\n\n## Procedure\n\n### 1. Procedural Geometry Generation\n\nCreate mesh geometry programmatically using BMesh:\n\n```python\nimport bpy\nimport bmesh\nimport math\n\ndef create_parametric_surface(name, u_res=32, v_res=32):\n    \"\"\"Generate parametric surface using mathematical function.\"\"\"\n    mesh = bpy.data.meshes.new(name)\n    obj = bpy.data.objects.new(name, mesh)\n    bpy.context.collection.objects.link(obj)\n\n    bm = bmesh.new()\n\n    # Create vertices using parametric equations\n    verts = []\n    for i in range(u_res):\n        for j in range(v_res):\n            u = (i \u002F (u_res - 1)) * 2 * math.pi\n            v = (j \u002F (v_res - 1)) * math.pi\n\n            # Sphere parametric equations\n            x = math.sin(v) * math.cos(u)\n            y = math.sin(v) * math.sin(u)\n            z = math.cos(v)\n\n            vert = bm.verts.new((x, y, z))\n            verts.append(vert)\n\n    # Create faces\n    bm.verts.ensure_lookup_table()\n    for i in range(u_res - 1):\n        for j in range(v_res - 1):\n            v1 = verts[i * v_res + j]\n            v2 = verts[(i + 1) * v_res + j]\n            v3 = verts[(i + 1) * v_res + (j + 1)]\n            v4 = verts[i * v_res + (j + 1)]\n            bm.faces.new([v1, v2, v3, v4])\n\n    # Write to mesh\n    bm.to_mesh(mesh)\n    bm.free()\n\n    return obj\n```\n\n**Got:** Complex geometry generated from mathematical functions\n**If fail:** Check BMesh API calls, verify vertex indexing, ensure faces are manifold\n\n### 2. Keyframe Animation Automation\n\nScript animation keyframes and drivers:\n\n```python\ndef animate_rotation(obj, start_frame=1, end_frame=250, axis='Z', rotations=2):\n    \"\"\"Animate object rotation over time.\"\"\"\n    # Set initial keyframe\n    obj.rotation_euler[2] = 0  # Z axis\n    obj.keyframe_insert(data_path=\"rotation_euler\", index=2, frame=start_frame)\n\n    # Set end keyframe\n    obj.rotation_euler[2] = rotations * 2 * math.pi\n    obj.keyframe_insert(data_path=\"rotation_euler\", index=2, frame=end_frame)\n\n    # Set interpolation\n    if obj.animation_data and obj.animation_data.action:\n        for fcurve in obj.animation_data.action.fcurves:\n            if 'rotation_euler' in fcurve.data_path:\n                for keyframe in fcurve.keyframe_points:\n                    keyframe.interpolation = 'LINEAR'\n\ndef animate_material_property(mat, property_path, values, frames):\n    \"\"\"Animate material node values.\"\"\"\n    if not mat.node_tree:\n        return\n\n    # Example: animate emission strength\n    nodes = mat.node_tree.nodes\n    emission = nodes.get('Emission')\n    if emission:\n        for frame, value in zip(frames, values):\n            emission.inputs['Strength'].default_value = value\n            emission.inputs['Strength'].keyframe_insert(\n                data_path=\"default_value\",\n                frame=frame\n            )\n\ndef create_driver(obj, property_path, expression):\n    \"\"\"Create driver for automated animation.\"\"\"\n    driver = obj.driver_add(property_path)\n    driver.driver.type = 'SCRIPTED'\n    driver.driver.expression = expression\n\n    # Example: link rotation to frame number\n    # expression = \"frame \u002F 10\"\n```\n\n**Got:** Keyframes inserted, animation plays back correctly\n**If fail:** Check property paths, verify data_path syntax, ensure objects are keyable\n\n### 3. Batch Processing Operations\n\nProcess multiple objects or files in batch:\n\n```python\nimport os\nfrom pathlib import Path\n\ndef batch_import_and_render(input_dir, output_dir, file_pattern=\"*.obj\"):\n    \"\"\"Import multiple files and render each.\"\"\"\n    input_path = Path(input_dir)\n    output_path = Path(output_dir)\n    output_path.mkdir(exist_ok=True)\n\n    scene = bpy.context.scene\n\n    for obj_file in input_path.glob(file_pattern):\n        # Clear existing objects\n        bpy.ops.object.select_all(action='SELECT')\n        bpy.ops.object.delete()\n\n        # Import model\n        bpy.ops.import_scene.obj(filepath=str(obj_file))\n\n        # Setup camera and lighting (reuse setup functions)\n        setup_camera()\n        setup_lighting()\n\n        # Render\n        output_file = output_path \u002F f\"{obj_file.stem}.png\"\n        scene.render.filepath = str(output_file)\n        bpy.ops.render.render(write_still=True)\n\n        print(f\"Rendered: {output_file}\")\n\ndef batch_material_variation(base_object, colors, output_prefix):\n    \"\"\"Render object with multiple material colors.\"\"\"\n    mat = base_object.data.materials[0]\n    bsdf = mat.node_tree.nodes.get('Principled BSDF')\n\n    if not bsdf:\n        return\n\n    for i, color in enumerate(colors):\n        # Update material color\n        bsdf.inputs['Base Color'].default_value = color + (1.0,)\n\n        # Render\n        bpy.context.scene.render.filepath = f\"{output_prefix}_{i:03d}.png\"\n        bpy.ops.render.render(write_still=True)\n```\n\n**Got:** Multiple files processed, renders generated for each variant\n**If fail:** Check file paths exist, verify import operators, handle missing materials\n\n### 4. Custom Operator Development\n\nCreate custom operators for reusable tools:\n\n```python\nimport bpy\nfrom bpy.props import FloatProperty, IntProperty\n\nclass OBJECT_OT_generate_spiral(bpy.types.Operator):\n    \"\"\"Generate a spiral curve\"\"\"\n    bl_idname = \"object.generate_spiral\"\n    bl_label = \"Generate Spiral\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    # Operator properties\n    radius: FloatProperty(\n        name=\"Radius\",\n        description=\"Spiral radius\",\n        default=2.0,\n        min=0.1,\n        max=10.0\n    )\n\n    turns: IntProperty(\n        name=\"Turns\",\n        description=\"Number of spiral turns\",\n        default=5,\n        min=1,\n        max=20\n    )\n\n    resolution: IntProperty(\n        name=\"Resolution\",\n        description=\"Points per turn\",\n        default=32,\n        min=8,\n        max=128\n    )\n\n    def execute(self, context):\n        # Create curve\n        curve = bpy.data.curves.new('Spiral', 'CURVE')\n        curve.dimensions = '3D'\n\n        spline = curve.splines.new('NURBS')\n        num_points = self.turns * self.resolution\n\n        spline.points.add(num_points - 1)  # -1 because one point exists\n\n        for i in range(num_points):\n            t = i \u002F self.resolution\n            angle = t * 2 * math.pi\n\n            x = self.radius * math.cos(angle)\n            y = self.radius * math.sin(angle)\n            z = t * 0.5\n\n            spline.points[i].co = (x, y, z, 1.0)\n\n        # Create object\n        obj = bpy.data.objects.new('Spiral', curve)\n        context.collection.objects.link(obj)\n        obj.select_set(True)\n        context.view_layer.objects.active = obj\n\n        self.report({'INFO'}, f\"Generated spiral with {num_points} points\")\n        return {'FINISHED'}\n\ndef register():\n    bpy.utils.register_class(OBJECT_OT_generate_spiral)\n\ndef unregister():\n    bpy.utils.unregister_class(OBJECT_OT_generate_spiral)\n\nif __name__ == \"__main__\":\n    register()\n```\n\n**Got:** Operator appears in search, executes with proper undo support\n**If fail:** Check bl_idname format (lowercase with underscores), verify property types\n\n### 5. Modal Operator for Interactive Tools\n\nCreate interactive modal operators:\n\n```python\nclass OBJECT_OT_modal_scale(bpy.types.Operator):\n    \"\"\"Interactive scaling with mouse\"\"\"\n    bl_idname = \"object.modal_scale\"\n    bl_label = \"Modal Scale\"\n    bl_options = {'REGISTER', 'UNDO'}\n\n    def __init__(self):\n        self.initial_mouse_x = 0\n        self.initial_scale = 1.0\n\n    def modal(self, context, event):\n        if event.type == 'MOUSEMOVE':\n            # Calculate scale based on mouse movement\n            delta = event.mouse_x - self.initial_mouse_x\n            scale = self.initial_scale + (delta \u002F 100.0)\n            scale = max(0.1, scale)  # Minimum scale\n\n            # Apply to active object\n            context.active_object.scale = (scale, scale, scale)\n\n        elif event.type == 'LEFTMOUSE':\n            return {'FINISHED'}\n\n        elif event.type in {'RIGHTMOUSE', 'ESC'}:\n            # Cancel - restore initial scale\n            context.active_object.scale = (\n                self.initial_scale,\n                self.initial_scale,\n                self.initial_scale\n            )\n            return {'CANCELLED'}\n\n        return {'RUNNING_MODAL'}\n\n    def invoke(self, context, event):\n        if context.active_object:\n            self.initial_mouse_x = event.mouse_x\n            self.initial_scale = context.active_object.scale[0]\n\n            context.window_manager.modal_handler_add(self)\n            return {'RUNNING_MODAL'}\n        else:\n            self.report({'WARNING'}, \"No active object\")\n            return {'CANCELLED'}\n```\n\n**Got:** Interactive operator responds to mouse, left-click confirms, ESC cancels\n**If fail:** Check event types, ensure modal handler is added, handle no active object\n\n### 6. Add-on Packaging\n\nStructure code as installable add-on:\n\n```python\nbl_info = {\n    \"name\": \"Custom Tools\",\n    \"author\": \"Your Name\",\n    \"version\": (1, 0, 0),\n    \"blender\": (3, 0, 0),\n    \"location\": \"View3D > Add > Mesh\",\n    \"description\": \"Collection of custom modeling tools\",\n    \"category\": \"Add Mesh\",\n}\n\nimport bpy\n\n# Import operator classes\nfrom .operators import OBJECT_OT_generate_spiral\n\nclasses = (\n    OBJECT_OT_generate_spiral,\n    # Add other classes\n)\n\ndef menu_func(self, context):\n    \"\"\"Add to menu.\"\"\"\n    self.layout.operator(OBJECT_OT_generate_spiral.bl_idname)\n\ndef register():\n    for cls in classes:\n        bpy.utils.register_class(cls)\n\n    bpy.types.VIEW3D_MT_mesh_add.append(menu_func)\n\ndef unregister():\n    bpy.types.VIEW3D_MT_mesh_add.remove(menu_func)\n\n    for cls in reversed(classes):\n        bpy.utils.unregister_class(cls)\n\nif __name__ == \"__main__\":\n    register()\n```\n\n**Got:** Add-on installs via Preferences, operators appear in menus\n**If fail:** Check bl_info format, verify Blender version requirement, ensure all classes listed\n\n### 7. Data-Driven Procedural Generation\n\nGenerate geometry from external data:\n\n```python\nimport csv\nimport json\n\ndef create_from_csv(filepath):\n    \"\"\"Generate objects from CSV data.\"\"\"\n    with open(filepath, 'r') as f:\n        reader = csv.DictReader(f)\n\n        for row in reader:\n            # Parse data\n            name = row['name']\n            x, y, z = float(row['x']), float(row['y']), float(row['z'])\n            scale = float(row.get('scale', 1.0))\n\n            # Create object\n            bpy.ops.mesh.primitive_uv_sphere_add(location=(x, y, z))\n            obj = bpy.context.active_object\n            obj.name = name\n            obj.scale = (scale, scale, scale)\n\ndef create_from_json(filepath):\n    \"\"\"Generate scene from JSON configuration.\"\"\"\n    with open(filepath, 'r') as f:\n        config = json.load(f)\n\n    # Process objects\n    for obj_config in config.get('objects', []):\n        obj_type = obj_config['type']\n        location = obj_config['location']\n\n        if obj_type == 'cube':\n            bpy.ops.mesh.primitive_cube_add(location=location)\n        elif obj_type == 'sphere':\n            bpy.ops.mesh.primitive_uv_sphere_add(location=location)\n\n        obj = bpy.context.active_object\n        obj.name = obj_config.get('name', 'Object')\n\n        # Apply material if specified\n        if 'material' in obj_config:\n            mat_name = obj_config['material']\n            mat = bpy.data.materials.get(mat_name)\n            if mat:\n                obj.data.materials.append(mat)\n```\n\n**Got:** Objects created based on external data files\n**If fail:** Validate file format, handle missing fields, provide default values\n\n## Validation Checklist\n\n- [ ] Scripts run without errors in Blender Python environment\n- [ ] Procedural geometry generates as expected\n- [ ] Animation keyframes inserted at correct frames\n- [ ] Batch operations process all files successfully\n- [ ] Custom operators appear in search and execute correctly\n- [ ] Modal operators respond to mouse\u002Fkeyboard events\n- [ ] Add-ons install and uninstall cleanly\n- [ ] External data files parsed correctly\n- [ ] Error handling covers edge cases\n- [ ] Code follows PEP 8 style guidelines\n\n## Pitfalls\n\n1. **Circular imports in add-ons**: Use relative imports, structure modules carefully\n2. **Operator naming**: bl_idname must be lowercase with single underscore (category.name)\n3. **Property types**: Use correct bpy.props types (FloatProperty, IntProperty, etc.)\n4. **Context access**: Not all operators work in all contexts (viewport vs render)\n5. **BMesh cleanup**: Always call `bm.free()` after `bm.to_mesh()` to prevent memory leaks\n6. **Animation keyframe timing**: Frame numbers start at 1, not 0\n7. **Driver expression errors**: Validate expressions, use safe namespace\n8. **Modal operator blocking**: Don't block in modal(), use non-blocking operations\n9. **Add-on installation paths**: Place in Blender's scripts\u002Faddons directory\n10. **Version compatibility**: API changes between Blender versions, document requirements\n\n## Related Skills\n\n- **[create-3d-scene](..\u002Fcreate-3d-scene\u002FSKILL.md)**: Basic scene setup and object creation\n- **[render-blender-output](..\u002Frender-blender-output\u002FSKILL.md)**: Rendering workflows for automated output\n- **[create-r-package](..\u002F..\u002Fr-packages\u002Fcreate-r-package\u002FSKILL.md)**: Similar packaging patterns for code distribution\n",{"name":5,"locale":23,"license":14,"metadata":24,"translator":31,"description":32,"allowed-tools":33,"source_commit":34,"source_locale":35,"translation_date":36},"caveman-lite",{"tags":25,"author":26,"domain":27,"version":28,"language":29,"complexity":30},"blender, bpy, automation, procedural, animation, batch-processing, add-on","Philipp Thoss","blender","1.0","Python","advanced","Julius Brussee homage — caveman","Write Blender Python scripts for procedural modeling, animation, batch operations, and add-on development using advanced bpy API patterns. Use to automate repetitive modeling or animation tasks, generate procedural geometry from algorithms or data, create batch rendering pipelines with parameter variations, build custom operators or add-ons, or integrate Blender with external data pipelines and APIs.\n","Read Write Edit Bash Grep Glob","82c77053","en","2026-05-03","master","f483e54f3ad5f202a77d45f2e57f8d970b71195f","skills_library\u002Fscript-blender-automation",2,"https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills","https:\u002F\u002Fgithub.com\u002Froohe","yoou.link","2026-05-19 15:56:07",{"source":8,"skillName":5,"commands":46,"prompt":56,"zipAvailable":57},[47,50,53],{"tool":48,"command":49},"npx","npx skills add roohe\u002Fagentic-super-skills --skill script-blender-automation",{"tool":51,"command":52},"bunx","bunx skills add roohe\u002Fagentic-super-skills --skill script-blender-automation",{"tool":54,"command":55},"pnpm","pnpm dlx skills add roohe\u002Fagentic-super-skills --skill script-blender-automation","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fscript-blender-automation\u002FSKILL.md",true,[],[60,67,74,81,88,95],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":18},"01M73D865CZME2FCMKA4PQM348","zarr-python","Chunked N-D arrays for cloud storage. Compressed arrays, parallel I\u002FO, S3\u002FGCS integration, NumPy\u002FDask\u002FXarray compatible, for large-scale scientific computing pipelines.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fzarr-python\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":18},"01M73D7Z64J4ABWZJD7P44XBBF","youtube-downloader","Download and process YouTube content for research. Use when: downloading competitor videos for analysis; extracting audio for podcasts; getting transcripts for content repurposing; archiving webinars; research content curation","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fyoutube-downloader\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M73D7K8778TGZV3GJFR3703D","yc-pitch-deck","Create a compelling startup pitch deck that follows the structure proven to raise billions from top investors. Master the YC and Sequoia formats that get founders funded. Use when: **Fundraising** to create investor pitch decks; **YC application** to structure your narrative; **Demo Day prep** to craft your 2-minute pitch; **Angel investors** to communicate your opportunity; **Partnership pitches** to structure compelling asks","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fyc-pitch-deck\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":18},"01M73D70KJSE0E8Z28YMNNRT04","x-twitter-scraper","Use when the user needs X (Twitter) data or confirmation-gated X actions through Xquik: tweet search, user lookup, follower extraction, media download, monitoring, webhooks, MCP, SDKs, posting, likes, DMs, and profile updates. Requires a Xquik API key. Never ask for X login material.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fx-twitter-scraper\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":18},"01M73D6ED01GV077R7K4NZNFZJ","write-vignette","Create R package vignettes using R Markdown or Quarto. Covers vignette setup, YAML configuration, code chunk options, building and testing, and CRAN requirements for vignettes. Use when adding a Getting Started tutorial, documenting complex workflows spanning multiple functions, creating domain-specific guides, or when CRAN submission requires user-facing documentation beyond function help pages.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fwrite-vignette\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":18},"01M73D69YJR0BK3NFHE0CYG3EF","write-validation-documentation","Write IQ\u002FOQ\u002FPQ validation documentation for computerized systems in regulated environments. Covers protocols, reports, test scripts, deviation handling, and approval workflows. Use when validating R or other software for regulated use, preparing for a regulatory audit, documenting qualification of computing environments, or creating and updating validation protocols and reports for new or re-qualified systems.","https:\u002F\u002Fgithub.com\u002Froohe\u002Fagentic-super-skills\u002Fblob\u002Fmaster\u002Fskills_library\u002Fwrite-validation-documentation\u002FSKILL.md",[],[]]