Fix: replace removed ShaderNodeSeparateRGB with ShaderNodeSeparateColor (Blender 4.0+)#236
Conversation
Blender 4.0 removed ShaderNodeSeparateRGB in favor of the unified
ShaderNodeSeparateColor (added in 3.3) which exposes a `mode` property
('RGB' / 'HSV' / 'HSL'). The old node still appears in scenes loaded
from older .blend files via legacy compatibility, but
`nodes.new(type='ShaderNodeSeparateRGB')` raises:
Node type ShaderNodeSeparateRGB undefined
This makes set_texture fail for any PolyHaven texture set that ships
an ARM map, which is most of them.
Changes (addon.py, ARM-handling block ~line 994):
- type='ShaderNodeSeparateRGB' -> 'ShaderNodeSeparateColor' + mode='RGB'
- input socket: 'Image' -> 'Color'
- output sockets: 'R'/'G'/'B' -> 'Red'/'Green'/'Blue'
Backward compatible with Blender 3.3+ (ShaderNodeSeparateColor exists);
verified working in Blender 5.1.1.
📝 WalkthroughWalkthroughUpdates Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Review Summary by QodoReplace ShaderNodeSeparateRGB with ShaderNodeSeparateColor for Blender 4.0+
WalkthroughsDescription• Replace deprecated ShaderNodeSeparateRGB with ShaderNodeSeparateColor • Update node input/output socket names for Blender 4.0+ compatibility • Set mode='RGB' on new node to maintain ARM channel separation • Maintain backward compatibility with Blender 3.3+ Diagramflowchart LR
A["ShaderNodeSeparateRGB<br/>Removed in Blender 4.0"] -->|"Replaced with"| B["ShaderNodeSeparateColor<br/>mode=RGB"]
B -->|"Input: Color"| C["ARM Texture Map"]
B -->|"Outputs: Red/Green/Blue"| D["Principled BSDF<br/>AO/Roughness/Metallic"]
File Changes1. addon.py
|
Code Review by Qodo
1. Breaks Blender 3.0-3.2
|
| # Blender 4.0+ removed ShaderNodeSeparateRGB. Use ShaderNodeSeparateColor | ||
| # (mode='RGB'); outputs are now Red/Green/Blue, input is Color. | ||
| separate_rgb = nodes.new(type='ShaderNodeSeparateColor') | ||
| separate_rgb.mode = 'RGB' | ||
| separate_rgb.location = (-200, -100) | ||
| links.new(texture_nodes['arm'].outputs['Color'], separate_rgb.inputs['Image']) | ||
| links.new(texture_nodes['arm'].outputs['Color'], separate_rgb.inputs['Color']) |
There was a problem hiding this comment.
1. Breaks blender 3.0-3.2 🐞 Bug ≡ Correctness
set_texture now unconditionally creates ShaderNodeSeparateColor, which is unavailable in Blender 3.0–3.2, causing ARM texture setup to fail at runtime on those versions. This conflicts with bl_info declaring Blender >= 3.0.0 support, turning the prior Blender-4-only failure into a Blender-3.0–3.2 failure for ARM maps.
Agent Prompt
## Issue description
`set_texture()` now always creates `ShaderNodeSeparateColor` for ARM maps. This will break Blender 3.0–3.2 because that node type does not exist there, while `bl_info` currently declares support for Blender >= 3.0.0.
## Issue Context
- Blender 4.0+ requires `ShaderNodeSeparateColor` (since `ShaderNodeSeparateRGB` is removed).
- Blender 3.0–3.2 requires `ShaderNodeSeparateRGB` (since `ShaderNodeSeparateColor` is not available).
- The addon already uses `bpy.app.version` checks elsewhere, so follow the same pattern here.
## Fix Focus Areas
- addon.py[23-31]
- addon.py[995-1036]
## Suggested implementation outline
1. Choose node type based on `bpy.app.version` (or via `try/except` around `nodes.new`).
2. Use a small mapping for socket names:
- SeparateRGB: input `Image`, outputs `R/G/B`
- SeparateColor: input `Color`, outputs `Red/Green/Blue` and set `mode='RGB'`
3. Alternatively, if you intentionally drop Blender 3.0–3.2 support, bump `bl_info['blender']` to `(3, 3, 0)` and ensure release notes/docs reflect it.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@addon.py`:
- Around line 995-1002: The code uses ShaderNodeSeparateColor (separate_rgb)
which only exists in Blender 3.3+, but the add-on currently claims a 3.0
minimum; either update bl_info["blender"] to "3.3" or add a runtime fallback:
check bpy.app.version (or bpy.app.version >= (3,3,0)) before creating
ShaderNodeSeparateColor and otherwise create the legacy ShaderNodeSeparateRGB
node and wire texture_nodes['arm'].outputs[...] to its appropriate inputs;
update references to separate_rgb accordingly so both branches produce the same
Red/Green/Blue outputs for later links.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
| # Handle ARM texture (Ambient Occlusion, Roughness, Metallic) | ||
| if 'arm' in texture_nodes: | ||
| separate_rgb = nodes.new(type='ShaderNodeSeparateRGB') | ||
| # Blender 4.0+ removed ShaderNodeSeparateRGB. Use ShaderNodeSeparateColor | ||
| # (mode='RGB'); outputs are now Red/Green/Blue, input is Color. | ||
| separate_rgb = nodes.new(type='ShaderNodeSeparateColor') | ||
| separate_rgb.mode = 'RGB' | ||
| separate_rgb.location = (-200, -100) | ||
| links.new(texture_nodes['arm'].outputs['Color'], separate_rgb.inputs['Image']) | ||
| links.new(texture_nodes['arm'].outputs['Color'], separate_rgb.inputs['Color']) |
There was a problem hiding this comment.
Align the Blender version floor with this API change.
ShaderNodeSeparateColor is available in Blender 3.3+; the 3.2 shader-node docs still only show the older separate-node family, so this path will break on the add-on’s current 3.0 minimum. Either bump bl_info["blender"] to 3.3+ or add a fallback for 3.0–3.2. (docs.blender.org)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@addon.py` around lines 995 - 1002, The code uses ShaderNodeSeparateColor
(separate_rgb) which only exists in Blender 3.3+, but the add-on currently
claims a 3.0 minimum; either update bl_info["blender"] to "3.3" or add a runtime
fallback: check bpy.app.version (or bpy.app.version >= (3,3,0)) before creating
ShaderNodeSeparateColor and otherwise create the legacy ShaderNodeSeparateRGB
node and wire texture_nodes['arm'].outputs[...] to its appropriate inputs;
update references to separate_rgb accordingly so both branches produce the same
Red/Green/Blue outputs for later links.
Summary
Fixes
set_texturefailing in Blender 4.0+ with:ShaderNodeSeparateRGBwas removed in Blender 4.0 in favor of the unifiedShaderNodeSeparateColor(added in 3.3) which exposes amodeproperty (RGB/HSV/HSL). The old node still appears in scenes loaded from older.blendfiles via legacy compatibility, butnodes.new(type='ShaderNodeSeparateRGB')raises the error above.This breaks
set_texturefor any PolyHaven texture set that ships an ARM map — which is most of them.Changes
addon.py, ARM-handling block (~line 994):nodes.new(type='ShaderNodeSeparateRGB')nodes.new(type='ShaderNodeSeparateColor')+mode='RGB'inputs['Image']inputs['Color']outputs['R']/'G'/'B'outputs['Red']/'Green'/'Blue'Compatibility
ShaderNodeSeparateColorwas introduced in 3.3)brick_wall_003,clay_roof_tiles_03,dark_wooden_planks,aerial_grass_rock) — full ARM channel routing confirmed (AO → Base Color multiply, Roughness from Green, Metallic from Blue)Test plan
set_textureno longer raisesNode type ShaderNodeSeparateRGB undefinedin Blender 5.1.1Summary by CodeRabbit