Regression: Node group property 'bl_static_type' returns empty string #111142

Closed
opened 2023-08-15 16:30:08 +02:00 by Zach Eastin · 4 comments

System Information
Operating system: Windows-10-10.0.22621-SP0 64 Bits
Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.99

Blender Version
Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-08-14 21:32, hash: dd9a92785acc
Worked: 3.6.0

Caused by: f18c45eb69

Short description of error
Node groups no longer return 'GROUP' for any node tree type in the bpy API for the property bl_static_type. They all return an empty string. This was nice to have while programming so that I wouldn't have to have my addon check for all the different types of node group bl_idname's when looking for node groups. I believe all other nodes still work, though there might be some nodes my script didn't account for.

Script I used to test nodes:

import bpy

extra_nodes = (
    'NodeFrame',
    'NodeReroute',
    'NodeGroupInput',
    'NodeGroupOutput',
)

gnt = bpy.data.node_groups.new('GNT', 'GeometryNodeTree')
snt = bpy.data.node_groups.new('SNT', 'ShaderNodeTree')
tnt = bpy.data.node_groups.new('TNT', 'TextureNodeTree')
comp_nt = bpy.data.node_groups.new('CompNT', 'CompositorNodeTree')

type_names = dir(bpy.types)

gnd_types = [n for n in type_names if n.startswith('GeometryNode')]
snd_types = [n for n in type_names if n.startswith('ShaderNode')]
cnd_types = [n for n in type_names if n.startswith('CompositorNode')]
tnd_types = [n for n in type_names if n.startswith('TextureNode')]

def check_nodes(nd_types, label, nt):
    print(f"{label} Nodes:")
    for nd_type in nd_types:
        try:
            nd = nt.nodes.new(nd_type)
            if nd.bl_static_type == '':
                print(f"  - {nd_type}")
            nt.nodes.remove(nd)
        except Exception:
            pass

check_nodes(gnd_types, 'Geometry', gnt)
check_nodes(snd_types, 'Shader', snt)
check_nodes(tnd_types, 'Texture', tnt)
check_nodes(cnd_types, 'Compositor', comp_nt)

check_nodes(extra_nodes, 'Extras (Shader)', snt)
**System Information** Operating system: Windows-10-10.0.22621-SP0 64 Bits Graphics card: NVIDIA GeForce RTX 2080 Ti/PCIe/SSE2 NVIDIA Corporation 4.6.0 NVIDIA 536.99 **Blender Version** Broken: version: 4.0.0 Alpha, branch: main, commit date: 2023-08-14 21:32, hash: `dd9a92785acc` Worked: 3.6.0 Caused by: f18c45eb6968cf469e1e205e8cc2bf8ed8cb1ecf **Short description of error** Node groups no longer return `'GROUP'` for any node tree type in the bpy API for the property `bl_static_type`. They all return an empty string. This was nice to have while programming so that I wouldn't have to have my addon check for all the different types of node group `bl_idname`'s when looking for node groups. I believe all other nodes still work, though there might be some nodes my script didn't account for. Script I used to test nodes: ```py import bpy extra_nodes = ( 'NodeFrame', 'NodeReroute', 'NodeGroupInput', 'NodeGroupOutput', ) gnt = bpy.data.node_groups.new('GNT', 'GeometryNodeTree') snt = bpy.data.node_groups.new('SNT', 'ShaderNodeTree') tnt = bpy.data.node_groups.new('TNT', 'TextureNodeTree') comp_nt = bpy.data.node_groups.new('CompNT', 'CompositorNodeTree') type_names = dir(bpy.types) gnd_types = [n for n in type_names if n.startswith('GeometryNode')] snd_types = [n for n in type_names if n.startswith('ShaderNode')] cnd_types = [n for n in type_names if n.startswith('CompositorNode')] tnd_types = [n for n in type_names if n.startswith('TextureNode')] def check_nodes(nd_types, label, nt): print(f"{label} Nodes:") for nd_type in nd_types: try: nd = nt.nodes.new(nd_type) if nd.bl_static_type == '': print(f" - {nd_type}") nt.nodes.remove(nd) except Exception: pass check_nodes(gnd_types, 'Geometry', gnt) check_nodes(snd_types, 'Shader', snt) check_nodes(tnd_types, 'Texture', tnt) check_nodes(cnd_types, 'Compositor', comp_nt) check_nodes(extra_nodes, 'Extras (Shader)', snt) ```
Zach Eastin added the
Type
Report
Priority
Normal
Status
Needs Triage
labels 2023-08-15 16:30:09 +02:00
Iliya Katushenock added the
Interest
Nodes & Physics
Interest
Python API
labels 2023-08-15 17:17:31 +02:00
Member

As a note, I would advise against using Node.type because it is deprecated (as is bl_static_type).

As a note, I would advise against using [`Node.type`](https://docs.blender.org/api/current/bpy.types.Node.html#bpy.types.Node.type) because it is deprecated (as is `bl_static_type`).
Zach Eastin changed title from Node group property 'type' returns empty string to Node group property 'bl_static_type' returns empty string 2023-08-15 17:54:28 +02:00
Author

As a note, I would advise against using Node.type because it is deprecated (as is bl_static_type).

Okay I thought I had maybe saw this somewhere but couldn't remember or find it. Sorry, about that. Yeah bl_static_type also returns an empty string for groups alone. I'm going to modify the issue to reflect this. Also, Node.type in the docs recommends using Node.bl_static_type

> As a note, I would advise against using [`Node.type`](https://docs.blender.org/api/current/bpy.types.Node.html#bpy.types.Node.type) because it is deprecated (as is `bl_static_type`). Okay I thought I had maybe saw this somewhere but couldn't remember or find it. Sorry, about that. Yeah `bl_static_type` also returns an empty string for groups alone. I'm going to modify the issue to reflect this. Also, `Node.type` in the docs recommends using `Node.bl_static_type `
Zach Eastin changed title from Node group property 'bl_static_type' returns empty string to Node group property 'bl_static_type' returns empty string 2023-08-15 17:54:45 +02:00
Member

Both Node.type and Node.bl_static_type are deprecated, Node.bl_idname appears to be the intended replacement (should work better with custom nodes I think).

That's not to say there isn't a bug with the deprecated properties though.

Both `Node.type` and [`Node.bl_static_type`](https://docs.blender.org/api/current/bpy.types.Node.html#bpy.types.Node.bl_static_type) are deprecated, `Node.bl_idname` appears to be the intended replacement (should work better with custom nodes I think). That's not to say there isn't a bug with the deprecated properties though.
Author

Okay apparently I'm not reading well today. So both Node.type and Node.bl_static_type are deprecated and which I assume means this bug is not really important as they will be removed later on. This is somewhat a big deal as now in the bpy API it is more cumbersome to write universal node tree operators. Instead of checking if node.type == 'GROUP' you'll have to check for node.bl_idname in {'GeometryNodeGroup', 'ShaderNodeGroup', 'TextureNodeGroup', 'CompositorNodeGroup'} or a similar thing with isinstance(). Is this really the expected and wanted result?

Okay apparently I'm not reading well today. So both `Node.type` and `Node.bl_static_type` are deprecated and which I assume means this bug is not really important as they will be removed later on. This is somewhat a big deal as now in the bpy API it is more cumbersome to write universal node tree operators. Instead of checking if `node.type == 'GROUP'` you'll have to check for `node.bl_idname in {'GeometryNodeGroup', 'ShaderNodeGroup', 'TextureNodeGroup', 'CompositorNodeGroup'}` or a similar thing with `isinstance()`. Is this really the expected and wanted result?
Iliya Katushenock changed title from Node group property 'bl_static_type' returns empty string to Regression: Node group property 'bl_static_type' returns empty string 2023-08-15 22:59:09 +02:00
Iliya Katushenock self-assigned this 2023-08-15 22:59:34 +02:00
Blender Bot added
Status
Resolved
and removed
Status
Confirmed
labels 2023-08-16 09:30:45 +02: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
2 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#111142
No description provided.