Node input and output "bpy_prop_collection[key]" key is dropped after enabled=False in 4.0 #114389

Closed
opened 2023-11-02 06:24:51 +01:00 by Rodge · 3 comments

System Information
Operating system: Linux-6.5.9-arch2-1-x86_64-with-glibc2.38 64 Bits, X11 UI
Graphics card: NVIDIA GeForce GT 1030/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 535.113.01

Blender Version
Broken: version: 4.0.0 Beta, branch: blender-v4.0-release, commit date: 2023-11-01 18:27, hash: 0b81a163e256
Worked: version: 4.0.0 Beta, branch: blender-v4.0-release, commit date: 2023-10-23 19:29, hash: 312d8b1d6633

Short description of error
Once a node's input or output is enabled == False, then I get a 'key cannot be found 'error.
Though I can re-enable the key by using the index number of the key. [Shown in the picture]

image

Exact steps for others to reproduce the error
You can do this with any node; "Shader","Compositor","Geometry", etc.. Follow along by entering or pasting in the commands in the Python Console Editor.

  1. Open blender using factory settings.

  2. Switch over to the Scripting workspace

  3. Go to the Python Console Editor image. Copy and Paste in the commands from the next following steps inside the Python Console Editor.

  4. Get node input name. Type in the editor and then press enter: bpy.context.object.active_material.node_tree.nodes.active.inputs[0].name
    image

  5. Using name as a key. Now type in the editor and then press enter.: bpy.context.object.active_material.node_tree.nodes.active.inputs['Base Color'].
    image

  6. Disable input. Now type in the editor and then press enter: bpy.context.object.active_material.node_tree.nodes.active.inputs['Base Color'].enabled=False

  7. Disabling input will now throw a key not found error. Type this: bpy.context.object.active_material.node_tree.nodes.active.inputs['Base Color']
    image

  8. However, name 'Base Color' is still referenced. Now type this: bpy.context.object.active_material.node_tree.nodes.active.inputs[0].name
    image

  9. Re-enable input. Type in and Enter: bpy.context.object.active_material.node_tree.nodes.active.inputs[0].enabled=True

  10. By re-enabling input, error is gone. bpy.context.object.active_material.node_tree.nodes.active.inputs['Base Color']
    image

**System Information** Operating system: Linux-6.5.9-arch2-1-x86_64-with-glibc2.38 64 Bits, X11 UI Graphics card: NVIDIA GeForce GT 1030/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 535.113.01 **Blender Version** Broken: version: 4.0.0 Beta, branch: blender-v4.0-release, commit date: 2023-11-01 18:27, hash: `0b81a163e256` Worked: version: 4.0.0 Beta, branch: blender-v4.0-release, commit date: 2023-10-23 19:29, hash: `312d8b1d6633` **Short description of error** Once a node's input or output is enabled == False, then I get a 'key cannot be found 'error. Though I can re-enable the key by using the index number of the key. [Shown in the picture] ![image](/attachments/bd9fa894-76d0-47a4-9ff5-48c0e2b14a19) **Exact steps for others to reproduce the error** You can do this with any node; "Shader","Compositor","Geometry", etc.. Follow along by entering or pasting in the commands in the **Python Console Editor**. 1. Open blender using factory settings. 2. Switch over to the **Scripting** workspace 3. Go to the **Python Console Editor** ![image](/attachments/4289173d-d2eb-4ca0-b841-90272e62ceba). Copy and Paste in the commands from the next following steps inside the **Python Console Editor**. 4. **Get node input name.** Type in the editor and then press enter: `bpy.context.object.active_material.node_tree.nodes.active.inputs[0].name` ![image](/attachments/a68d97fb-17b9-46e7-862e-d8f4d2afd1bb) 5. **Using name as a key.** Now type in the editor and then press enter.: `bpy.context.object.active_material.node_tree.nodes.active.inputs['Base Color']`. ![image](/attachments/c41b5e34-3cc2-42a2-805e-22d3dc979a71) 6. **Disable input.** Now type in the editor and then press enter: `bpy.context.object.active_material.node_tree.nodes.active.inputs['Base Color'].enabled=False` 7. **Disabling input will now throw a key not found error.** Type this: `bpy.context.object.active_material.node_tree.nodes.active.inputs['Base Color']` ![image](/attachments/a6819f1e-91c4-430c-b3c0-dfab7bcdec42) 8. **However, name 'Base Color' is still referenced.** Now type this: `bpy.context.object.active_material.node_tree.nodes.active.inputs[0].name` ![image](/attachments/6ae67968-c0db-40b8-a243-eb4744413412) 9. **Re-enable input.** Type in and Enter: `bpy.context.object.active_material.node_tree.nodes.active.inputs[0].enabled=True` 10. **By re-enabling input, error is gone.** `bpy.context.object.active_material.node_tree.nodes.active.inputs['Base Color']` ![image](/attachments/df4ba780-6a35-4c1a-855f-a8c69310d570)
Rodge added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-11-02 06:24:52 +01:00
Member

Hi, thanks for the report. Can confirm the regression, bisecting

Hi, thanks for the report. Can confirm the regression, bisecting
Member

Git bisect points to e4ad58114b
@JacquesLucke ^

Git bisect points to e4ad58114b9d56fe838396a97fe09aff32c79c6a @JacquesLucke ^
Member

This behavior was changed intentionally. This is also mentioned in the release notes: https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Python_API#Nodes

You can still find all the sockets by iterating over them manually, but I recommend trying to avoid working with disabled sockets. Disabling sockets of built-in nodes can also cause problems, I'm somewhat surprised you are even allowed to do that.

This behavior was changed intentionally. This is also mentioned in the release notes: https://wiki.blender.org/wiki/Reference/Release_Notes/4.0/Python_API#Nodes You can still find all the sockets by iterating over them manually, but I recommend trying to avoid working with disabled sockets. Disabling sockets of built-in nodes can also cause problems, I'm somewhat surprised you are even allowed to do that.
Blender Bot added
Status
Archived
and removed
Status
Confirmed
labels 2023-11-02 13:08:27 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#114389
No description provided.