Nodes: remove "Use Nodes" in Shader Editor for Object Materials

"Use Nodes" was removed in the compositor to simplify the compositing
workflow. This introduced a slight inconsistency with the Shader Node
Editor.

This PR removes "Use Nodes" for object materials.

For Line Style, no changes are planned (not sure how to preserve
compatibility yet).
This simplifies the state of objects; either they have a material or
they don't.

Backward compatibility:
- If Use Nodes is turned Off, new nodes are added to the node tree to
simulate the same material:
- DNA: Only `use_nodes` is marked deprecated
- Python API:
  - `material.use_nodes` is marked deprecated and will be removed in
6.0. Reading it always returns `True` and setting it has no effect.
  - `material.diffuse_color`, `material.specular` etc.. Are not used by
EEVEE anymore but are kept because they are used by Workbench.

Forward compatibility:
Always enable 'Use Nodes' when writing blend files.

Known Issues:
Some UI tests are failing on macOS

Pull Request: https://projects.blender.org/blender/blender/pulls/141278
This commit is contained in:
Habib Gahbiche
2025-09-14 17:53:54 +02:00
parent 62d791c8d6
commit 1b4daf9d2e
44 changed files with 363 additions and 297 deletions

View File

@@ -1080,15 +1080,14 @@ def main():
# Setup materials.
material = bpy.data.materials.new("Flat Black")
material.use_nodes = False
material.specular_intensity = 0.0
material.diffuse_color = (0.0, 0.0, 0.0, 1.0)
MATERIAL_FROM_COLOR["black"] = material
del material
material = bpy.data.materials.new("Flat Grey")
material.use_nodes = False
material.specular_intensity = 0.0
material.diffuse_color = (0.4, 0.4, 0.4, 1.0)
nodes = material.node_tree.nodes
bsdf = nodes.new("ShaderNodeBsdfPrincipled")
output = nodes.new("ShaderNodeOutputMaterial")
material.node_tree.links.new(bsdf.outputs["BSDF"], output.inputs["Surface"])
bsdf.inputs['Base Color'].default_value = (0.4, 0.4, 0.4, 1.0)
MATERIAL_FROM_COLOR["grey"] = material
del material