Poly Haven integration is buggy, want me to fix it?
Hi :)
I run Poly Haven - I sent the User-Agent PR (#147) a while back. I went through the integration properly for the first time recently, and a few things are broken in ways that make our assets look bad rather than just being inconvenient:
- Normal and displacement maps are downloaded but never connected, so every texture imports flat. The map names being checked for don't match ours - neither branch fires for any of our 860 textures.
- HDRIs are never packed, and the temp file cleanup calls
tempfile._cleanup(), which doesn't exist in Python 3. Reopen the file and the world renders magenta. - The HDRI overwrites
bpy.data.worlds[0]rather than the scene's actual world (overwriting user's work with no undo, or just appearing to do nothing). - Every map is downloaded whether it's used or not. A 1k texture pulls 7.4MB, 5.5MB of which is connected to nothing - 75% of the transfer across the whole library.
search_polyhaven_assetstruncates to 20 before ranking, and the list arrives sorted by slug, soasset_type="all"returns 20 models and can't return an HDRI or a texture at all, or otherwise search results are just generally poor.- A downloaded texture doesn't survive a save unless something uses it, after which
set_texturecan't find it and the agent re-downloads. Maybe that's by design, let me know.
I think that's most of the "Claude is sometimes erratic with its behaviour" line in your README.
All of it is fixed on my end with tests, verified in Blender 5.2.1 against the live API. One ask that's easy to drop if you'd rather not: I'd like the tool's success message to name Poly Haven and include the asset's URL, since in an agentic session that's the only place a user actually sees where an asset came from. Having this small attribution helps users know what they just downloaded and what their rights are, adding some trust. The assets themselves are CC0 and need no attribution, and our API doesn't strictly require attribution like this, but I feel better visibility would be beneficial to our sustainability (and therefore in the long run to your users).
Our API is also capable of much more if you're interested, there's a semantic search endpoint and complete category & attribute taxonomy which could be very helpful in finding what people want quicker.
Would you like it as one PR, or just the correctness fixes to start?
Source: ahujasid/blender-mcp