Skip to content

Fix: replace removed ShaderNodeSeparateRGB with ShaderNodeSeparateColor (Blender 4.0+)#236

Closed
MickeyBadBad wants to merge 1 commit intoahujasid:mainfrom
MickeyBadBad:fix/blender-4x-separate-color-node
Closed

Fix: replace removed ShaderNodeSeparateRGB with ShaderNodeSeparateColor (Blender 4.0+)#236
MickeyBadBad wants to merge 1 commit intoahujasid:mainfrom
MickeyBadBad:fix/blender-4x-separate-color-node

Conversation

@MickeyBadBad
Copy link
Copy Markdown

@MickeyBadBad MickeyBadBad commented Apr 27, 2026

Summary

Fixes set_texture failing in Blender 4.0+ with:

Error: Failed to apply texture: Error: Node type ShaderNodeSeparateRGB undefined

ShaderNodeSeparateRGB was removed in Blender 4.0 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 the error above.

This breaks set_texture for any PolyHaven texture set that ships an ARM map — which is most of them.

Changes

addon.py, ARM-handling block (~line 994):

Before After
nodes.new(type='ShaderNodeSeparateRGB') nodes.new(type='ShaderNodeSeparateColor') + mode='RGB'
inputs['Image'] inputs['Color']
outputs['R'] / 'G' / 'B' outputs['Red'] / 'Green' / 'Blue'

Compatibility

  • Backward compatible with Blender 3.3+ (ShaderNodeSeparateColor was introduced in 3.3)
  • Verified working in Blender 5.1.1 with PolyHaven textures (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_texture no longer raises Node type ShaderNodeSeparateRGB undefined in Blender 5.1.1
  • Resulting material correctly routes ARM channels (AO/Roughness/Metallic) to Principled BSDF
  • Diffuse, Normal (gl/dx), Roughness, and Displacement maps still wire correctly
  • Should be re-tested in Blender 3.x to confirm 3.3+ backward compatibility (I only have 5.1.1 locally)

Summary by CodeRabbit

  • Bug Fixes
    • Improved texture handling compatibility with Blender 4.0 and later versions.

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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 27, 2026

📝 Walkthrough

Walkthrough

Updates BlenderMCPServer.set_texture method in addon.py to support Blender 4.0+ by replacing the deprecated ShaderNodeSeparateRGB with ShaderNodeSeparateColor and adjusting corresponding input/output socket names and connections accordingly.

Changes

Cohort / File(s) Summary
Blender 4.0+ Shader Node Compatibility
addon.py
Replaced deprecated ShaderNodeSeparateRGB with ShaderNodeSeparateColor (mode='RGB'), updated input socket from 'Image' to 'Color', and adjusted output routing for roughness, metallic, and AO channels.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A shader node dance, old steps discarded,
RGB separated, Blender's heart retarded,
Color flows through, green, blue, red arrayed,
ARM channels shimmer in the upgrade's cascade,
Four-point-oh shines! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: replacing the deprecated ShaderNodeSeparateRGB with ShaderNodeSeparateColor for Blender 4.0+ compatibility.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@qodo-code-review
Copy link
Copy Markdown

Review Summary by Qodo

Replace ShaderNodeSeparateRGB with ShaderNodeSeparateColor for Blender 4.0+

🐞 Bug fix

Grey Divider

Walkthroughs

Description
• 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+
Diagram
flowchart 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"]
Loading

Grey Divider

File Changes

1. addon.py 🐞 Bug fix +8/-5

Update ARM texture node for Blender 4.0+ compatibility

• Changed node type from ShaderNodeSeparateRGB to ShaderNodeSeparateColor with mode='RGB'
• Updated input socket name from 'Image' to 'Color'
• Updated output socket names from 'R', 'G', 'B' to 'Red', 'Green', 'Blue'
• Added explanatory comment about Blender 4.0+ compatibility change

addon.py


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Copy Markdown

qodo-code-review Bot commented Apr 27, 2026

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0)

Grey Divider


Action required

1. Breaks Blender 3.0-3.2 🐞 Bug ≡ Correctness
Description
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.
Code

addon.py[R997-1002]

+                # 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'])
Evidence
The addon metadata declares Blender 3.0.0 as the minimum supported version, but the modified ARM
handling path now depends on ShaderNodeSeparateColor (introduced later than 3.0) and its sockets.
The codebase already uses bpy.app.version gating for Blender API differences elsewhere, indicating
this ARM-node creation should be version-gated (or the minimum version should be raised).

addon.py[23-31]
addon.py[995-1006]
addon.py[2287-2290]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## 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


Grey Divider

Qodo Logo

Comment thread addon.py
Comment on lines +997 to +1002
# 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'])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a4be193e-9e54-4090-909d-f64f85a9c5ca

📥 Commits

Reviewing files that changed from the base of the PR and between 7636d13 and 3c79ad6.

📒 Files selected for processing (1)
  • addon.py

Comment thread addon.py
Comment on lines 995 to +1002
# 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'])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

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.

@MickeyBadBad MickeyBadBad deleted the fix/blender-4x-separate-color-node branch April 28, 2026 21:02
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