From 40a8334b9718ce208af6b9a497d8f122571e1df1 Mon Sep 17 00:00:00 2001 From: ahujasid Date: Thu, 13 Mar 2025 16:39:59 +0530 Subject: [PATCH] updated README --- README.md | 9 ++++++++- src/blender_mcp/server.py | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5bfe684..be1c05d 100644 --- a/README.md +++ b/README.md @@ -101,12 +101,16 @@ Once the config file has been set on Claude, and the addon is running on Blender - `delete_object` - Remove an object from the scene - `set_material` - Apply or create materials for objects - `execute_blender_code` - Run any Python code in Blender +- `get_polyhaven_categories` - Get a list of categories for PolyHaven assets (HDRIs, textures, models) +- `search_polyhaven_assets` - Search for assets on PolyHaven with optional category filtering +- `download_polyhaven_asset` - Download and import a PolyHaven asset into Blender ### Example Commands Here are some examples of what you can ask Claude to do: - "Create a low poly scene in a dungeon, with a dragon guarding a pot of gold" [Demo](https://www.youtube.com/watch?v=DqgKuLYUv00) +- "Create a beach vibe using HDRIs, textures, and models like rocks and vegatation from Poly Haven" - Give a reference image, and create a Blender scene out of it [Demo](https://www.youtube.com/watch?v=FDRb03XPiRo) - "Get information about the current scene, and make a threejs sketch from it" [Demo](https://www.youtube.com/watch?v=jxbNI5L7AH8) - "Make this car red and metallic" @@ -116,10 +120,12 @@ Here are some examples of what you can ask Claude to do: ## Troubleshooting -- **Connection issues**: Make sure the Blender addon server is running, and the MCP server is configured on Claude, DO NOT run the uvx command in the terminal +- **Connection issues**: Make sure the Blender addon server is running, and the MCP server is configured on Claude, DO NOT run the uvx command in the terminal. Sometimes, the first command won't go through but after that it starts working. - **Timeout errors**: Try simplifying your requests or breaking them into smaller steps +- **Poly Haven integration**: Claude is sometimes erratic with its behaviour - **Have you tried turning it off and on again?**: If you're still having connection errors, try restarting both Claude and the Blender server + ## Technical Details ### Communication Protocol @@ -132,6 +138,7 @@ The system uses a simple JSON-based protocol over TCP sockets: ## Limitations & Security Considerations - The `execute_blender_code` tool allows running arbitrary Python code in Blender, which can be powerful but potentially dangerous. Use with caution in production environments. ALWAYS save your work before using it. +- Poly Haven requires downloading models, textures, and HDRI images. If you do not want to use it, please turn it off in the checkbox in Blender. - Complex operations might need to be broken down into smaller steps diff --git a/src/blender_mcp/server.py b/src/blender_mcp/server.py index 46be803..8504b71 100644 --- a/src/blender_mcp/server.py +++ b/src/blender_mcp/server.py @@ -632,6 +632,26 @@ def set_texture( logger.error(f"Error applying texture: {str(e)}") return f"Error applying texture: {str(e)}" +@mcp.prompt() +def asset_creation_strategy() -> str: + """Defines the preferred strategy for creating assets in Blender""" + return """When creating 3D content in Blender, follow these priorities: + + 1. First, try to find and use appropriate PolyHaven assets: + - For objects/models: Use download_polyhaven_asset() with asset_type="models" + - For materials/textures: Use download_polyhaven_asset() with asset_type="textures" + - For environment lighting: Use download_polyhaven_asset() with asset_type="hdris" + + 2. Only fall back to basic creation tools when: + - A simple primitive is explicitly requested + - No suitable PolyHaven asset exists + - The task specifically requires a basic material/color + - Time or resource constraints make downloading assets impractical + + Basic creation tools to use as fallback: + - create_object() for basic primitives + - set_material() for basic colors and materials + """ # Main execution