Page MenuHome

bpy.data.node_groups is not accessible via the Python console
Closed, ArchivedPublic

Description

System Information
Operating system: Debian 10
Graphics card: Intel HD 4000

Blender Version
Broken: v 2.81 Alpha, Date 2019-07-30 20:50, Hash: 5359b7a03307 (latest daily linux 64-bit)

The following expression in the python console produces a key not found error:

bpy.data.node_groups["Shader NodeTree"]

In the scripting workspace, the executed python expressions window displays the same map access working if you go in the shader editor and perform some sort of action that operates on the node_groups map, such as changing the default shader specular value. The case sensitivity does not seem to matter - sometimes the printout window shows the string as "Shader Nodetree", sometimes as "Shader NodeTree".

Exact steps for others to reproduce the error

  • Start default 2.81 scene
  • Go to scripting workspace
  • Type bpy.data.node_groups["Shader NodeTree"] in the console
  • Using the mouse, go in the Shader editor and perform some action on the default Principled BSDF shader and observe the map being accessed in the Python expression printout window using the identical string

Details

Type
Bug

Event Timeline

Philipp Oeser (lichtwerk) lowered the priority of this task from Needs Triage by Developer to Confirmed, Medium.Aug 1 2019, 11:10 AM

Confirmed, checking...

Bastien Montagne (mont29) closed this task as Archived.Aug 1 2019, 11:47 AM

That is not technically a bug, although it is confusing (and a pain to handle in C code as well), 'root' node trees *are not* regular data-blocks, and are not available from bpy.data. They are closer to some private data of their owner (material, light, scene data-blocks), and should only be accessed through them. Thanks for the report anyway.

@Bastien Montagne (mont29): should we tweak the data-path-reporting to their respective owner then? (or is this this even imposiible? -- havent checked code yet...)
(inclined to repoen as TODO with low prio for my desk -- this has been bugging me as well, just feels like a bug -- same goes for T68054...)