Page MenuHome

Drivers controlled by properties of node trees won't work, data paths are rejected
Closed, ResolvedPublic

Description

System Information
Win7 x64

Blender Version
All afaik.

Short description of error
I was trying to control a driver by a property of a node within a node setup. Apparently Blender rejects the data path of node properties but I couldn't found anything about such a limitation in the documentation so I suspect something went wrong here.

Other properties do work. For instance I can access all world properties except those stored in the node tree, it's the same for node based materials. I noticed the absolute data path for nodes is different from what is possibly expected by the set ID-type. Following examples are both properties of "World" from a users perspective:

bpy.data.worlds["World"].light_settings.distance
bpy.data.node_groups["Shader Nodetree"].nodes["Mapping.001"].rotation

But the latter one wouldn't work, neither as absolute path nor as relative one (when using "copy data path").

Exact steps for others to reproduce the error
The attached .blend file has two mapping nodes in the world shader, one of them has a driver added that should be controlled by the exact same property of the other mapping node but its data path is rejected.

Details

Type
Bug

Event Timeline

Kai Kostack (kaikostack) set Type to Bug.
Kai Kostack (kaikostack) created this task.
Kai Kostack (kaikostack) raised the priority of this task from to Needs Triage by Developer.
Brecht Van Lommel (brecht) claimed this task.

The shader nodes of a world are not an own datablock by part of the world. So you need the path:

bpy.data.worlds["World"].node_tree.nodes["Mapping.001"].rotation

Thanks but the driver still doesn't accept this path. It doesn't accept the full path and not 'node_tree.nodes["Mapping.001"].rotation' as sub-path, so how do I resolve the problem?

I can't get it work either, will look into it.

Brecht Van Lommel (brecht) triaged this task as Confirmed, Medium priority.

There are 2 mistakes in that example:

  • The path must include "node_tree" first:

    node_tree.nodes["Mapping.001"].rotation
  • Driven variables can only use single float values. This is a serious flaw with drivers in general, it makes working with vectors, quaternions and matrices really tedious. But anyway, for the Z rotation driver in this case you need to just access the same component:

    node_tree.nodes["Mapping.001"].rotation[2]

Ah indeed, the path node_tree.nodes["Mapping.001"].rotation[2] works, so this is not a bug strictly speaking, even though we would like to improve this system.

Could you at least make the "Copy Data Path" from the right click menu returning the correct path? This would certainly lower the barrier for users to actually use this feature. Thank you nonetheless.