Skip to content

Update API for Blender 4.1+ and 5.0 compatibility (v1.4.0)#23

Open
artryazanov wants to merge 2 commits intojohnzero7:masterfrom
thegamerbay:master
Open

Update API for Blender 4.1+ and 5.0 compatibility (v1.4.0)#23
artryazanov wants to merge 2 commits intojohnzero7:masterfrom
thegamerbay:master

Conversation

@artryazanov
Copy link

Description

This PR updates the addon to ensure full compatibility with modern Blender versions, specifically targeting Blender 5.0.1 (while addressing breaking API changes introduced in Blender 4.0 and 4.1).

The legacy APIs for mesh smoothing, custom split normals, and shader nodes have been heavily refactored or removed in recent Blender updates, causing the previous versions of this addon to fail. This update resolves these issues and bumps the addon version to 1.4.0.

Key Changes

1. Mesh & Custom Normals API Update (Blender 4.1+):

  • Removed deprecated use_auto_smooth: Blender 4.1 removed the use_auto_smooth and auto_smooth_angle properties from meshes. These have been disabled/removed during the import process (HaydeeImporter.py).
  • Custom Split Normals handling: Replaced the deprecated mesh.create_normals_split() and mesh.normals_split_custom_set_from_vertices() with the modern mesh.normals_split_custom_set() using loop indices for proper normal assignment on import.
  • Smoothing Groups: Bypassed the deprecated calc_smooth_groups function during export (HaydeeExporter.py), preventing export crashes. Replaced to_mesh_clear() with bpy.data.meshes.remove(mesh) for proper cleanup.

2. Shader Nodes & Principled BSDF Update (Blender 4.0+):

  • Principled BSDF: Updated the socket reference from 'Specular' to 'Specular IOR Level' to comply with the massive Principled BSDF overhaul in Blender 4.0 (HaydeeNodeMat.py).
  • Color Nodes: Replaced the legacy ShaderNodeSeparateRGB and ShaderNodeCombineRGB with their modern equivalents ShaderNodeSeparateColor and ShaderNodeCombineColor. Updated socket references from R, G, B to Red, Green, Blue.

3. Node Group Interface (Blender 4.0+):

  • Updated the creation of custom Node Groups (Haydee Normal). The legacy node_tree.inputs.new() method was replaced with the modern node_tree.interface.new_socket() API, including a fallback check to maintain stability.

4. Metadata & Cleanup:

  • Bumped addon version to 1.4.0 and minimum Blender version to 5.0.1 in __init__.py.
  • Updated README.md to reflect current version support.
  • Added .idea/ to .gitignore.

Testing

  • Tested on Blender 5.0.1.
  • Verified Import/Export functionality for meshes, materials, and skeletons without API attribute errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant