1

i want to review the inputs and outputs of geometry nodes for debugging and to gain a deeper understanding what is going on.

I have read other questions on the topic but they are mostly very short, with a specific example and without the explanation i need.

Other resources Article1 Article2 Article3 . . .

So my naive approach, and i guess the approach of thousands of other people is to enable the python tooltips and go to the shown path like

bpy.data.node_groups['Geometry Nodes'].nodes['Vector Math']

then i add a dot and press tab to see what's inside

                                                                as_pointer(
                                                            bl_description
                                                            bl_height_default
                                                            bl_height_max
                                                            bl_height_min
                                                            bl_icon
                                                            bl_idname
                                                            bl_label
                                                            bl_rna
                                                            bl_rna_get_subclass(
                                                            bl_rna_get_subclass_py(
                                                            bl_static_type
                                                            bl_width_default
                                                            bl_width_max
                                                            bl_width_min
                                                            color
                                                            dimensions
                                                            draw_buttons(
                                                            draw_buttons_ext(
                                                            driver_add(
                                                            driver_remove(
                                                            get(
                                                            height
                                                            hide
                                                            id_data
                                                            id_properties_clear(
                                                            id_properties_ensure(
                                                            id_properties_ui(
                                                            input_template(
                                                            inputs
                                                            internal_links
                                                            is_property_hidden(
                                                            is_property_overridable_library(
                                                            is_property_readonly(
                                                            is_property_set(
                                                            is_registered_node_type(
                                                            items(
                                                            keyframe_delete(
                                                            keyframe_insert(
                                                            keys(
                                                            label
                                                            location
                                                            mute
                                                            name
                                                            operation
                                                            output_template(
                                                            outputs
                                                            parent
                                                            path_from_id(
                                                            path_resolve(
                                                            poll(
                                                            poll_instance(
                                                            pop(
                                                            property_overridable_library_set(
                                                            property_unset(
                                                            rna_type
                                                            select
                                                            show_options
                                                            show_preview
                                                            show_texture
                                                            socket_value_update(
                                                            type
                                                            type_recast(
                                                            update(
                                                            use_custom_color
                                                            values(
                                                            width
                                                            width_hidden

I then try to figure out what i want to see (please tell me if there is a better documented way). So there is a variable named inputs... sounds good. I'll have a look into

bpy.data.node_groups['Geometry Nodes'].nodes['Vector Math'].inputs.

and find

                                                                       as_bytes(
                                                                   bl_rna
                                                                   clear(
                                                                   data
                                                                   find(
                                                                   foreach_get(
                                                                   foreach_set(
                                                                   get(
                                                                   id_data
                                                                   items(
                                                                   keys(
                                                                   move(
                                                                   new(
                                                                   path_from_id(
                                                                   remove(
                                                                   rna_type
                                                                   update(
                                                                   values(

Then i try data or value but this leads me nowhere...

In the other articles people use

bpy.context.evaluated_depsgraph_get()

but i lack the understanding what that means. So any reference is welcome.

I'd really like to understand the concepts behind rather than finding a specific example that fixes this exact problem until i run into the next. Is there an article on how geometry nodes (or blender) store data and apply modifiers. I'm sorry for the very open question...

===== Follow Up Edit

As Crantisz pointed out you can access the "default inputs" with

>>> bpy.data.node_groups['Geometry Nodes'].nodes['Vector Math'].inputs[0].default_value[0]
1.0

>>> bpy.data.node_groups['Geometry Nodes'].nodes['Vector Math'].inputs[0].default_value[1] 0.0

>>> bpy.data.node_groups['Geometry Nodes'].nodes['Vector Math'].inputs[0].default_value[2] 1.0

>>> bpy.data.node_groups['Geometry Nodes'].nodes['Vector Math'].inputs[1].default_value[0] 0.0

>>> bpy.data.node_groups['Geometry Nodes'].nodes['Vector Math'].inputs[1].default_value[1] 1.0

>>> bpy.data.node_groups['Geometry Nodes'].nodes['Vector Math'].inputs[1].default_value[2] 0.0

enter image description here

So the "regulator inputs" can be adressed.

But when i attach another source (which is the realistic use case) enter image description here then i get the same outputs and NOT the ones coming from the real input that is attached (here Combine XYZ)

So, how do i get to the input that is currently active at the input?

========== Final Edit

As Crantisz points out: "This is not accessible" The data of a node does not appear to be accessible.

That is really a bad choice in my opinion. Following Viewer Node Discussion there was a statement that really made me jump of my chair ("The value without geometry doesn't make sense."). Hopefully there will be some overthinking of this statement, but i fear there is a deeper reason (how geometry nodes work deep inside).

I noticed the following: Value not computed

but when i connect to a geometry Value computed

So that brings me to two thoughts/observations:

  1. The Information i'm looking for (input / output data) must be somewhere as it was displayed in the tooltip
  2. Geometry Node does not compute nodes that are not connected to a geometry, which is sad mostly for debugging. I get that the whole point of a geometry node is to deal with geometry, but there are other sidecalculations that may need debugging until you hook it to a geometry eventually. The viewer node is cumbersome (and only knows values). Debugging vectors is a nightmare...

1 Answers1

2

If you don't enter dot, you will see a content of the dictionary:

enter image description here

You can also get item by index (in this case is important because of same names):

enter image description here

As for the connections - You can find them in links dictionary.

enter image description here

Crantisz
  • 35,244
  • 2
  • 37
  • 89
  • Thank you Crantisz. That helps but, it seems to work only for the inputs that come from the "regulators" (in the case of the vector math: the two xyz inputs). However if i attach e.g. a "Combine XYZ" to a Vector input the your method still shows the regulators setting and not what is actually attached to that channel via the Combine XYZ (if that is unclear i can also reply with some figures). For the Node Output it does not work at all (only get zeros) – ScientificBlender Jul 27 '22 at 16:47
  • 1
    It shows "default" value, of course. Connections can be found in links dictionary – Crantisz Jul 29 '22 at 08:39
  • i still dont get it, sorry. The links dictionary seems to tell me the source/target (from_ or to_) of the data (either socket or node), which is definitely good to know. However, i want to know what the actual data at the input or output is. – ScientificBlender Jul 29 '22 at 09:11
  • 1
    This is not accessible – Crantisz Jul 29 '22 at 09:15
  • sad... How do you debug complicated node trees when you have unexpected results? The viewer node is not a big help in my opinion... – ScientificBlender Jul 29 '22 at 09:27
  • 1
    https://blender.stackexchange.com/questions/259223/geometry-nodes-viewer-node-how-can-i-debug-a-value/259225#259225 – Crantisz Jul 29 '22 at 09:28