I have read the answers to this question, so see you can access Geometry Nodes-generated attributes on an evaluated object using Python.
I'm attempting to access a mesh-wide vector-attribute in a driver. For testing purposes, a fixed vector value is plugged straight into the output node of a Geometry Nodes tree.
However, if I attempt to run
v_attr(), a driver-namespace function, as defined below..
import bpy def v_attr(obj_name, attr_name): C = bpy.context ob = bpy.data.objects [obj_name] ev_dg = C.evaluated_depsgraph_get() ev_me = ob.evaluated_get(ev_dg).data return ev_me.attributes[attr_name].data.vector bpy.app.driver_namespace['v_attr'] = v_attr #print(v_attr('Plane', 'v_test').y)
.. inside a driver, Blender 3.0b freezes.
Run from the Python console,
v_attr() returns correct values, as a vector, or its components. Permission to auto-run scripts has been granted in Preferences.
I apologise if this is a premature question on a beta-bug, but I doubt that it is.. it's much more likely to be me, maybe misunderstanding the depsgraph altogether? Or permissions?
If there are better ways to store a mesh-wide attribute than duplicated on every point, that would be good...