Page MenuHome

Geometry Nodes: Initial socket visualization for fields.
ClosedPublic

Authored by Jacques Lucke (JacquesLucke) on Sep 21 2021, 1:50 PM.

Details

Summary

This implements the update logic for the fields visualization. The socket shapes may still have to be updated. That should be done separately, because it might be a bit more involved, because socket shapes are currently linked to keyframe shapes. Currently the circle and diamond shapes are used with the following meanings:

  • Input Sockets:
    • Circle: This input is required to be a single value. Connecting a field here is an error.
    • Diamond: This input supports fields.
  • Output Sockets:
    • Circle: This output is a single value.
    • Diamond: This output may be a field.

Those definitions have the benefits that they (1) only require two different socket shapes and (2) compose well when used with node groups.

Another video with three socket shapes. Also it shows improved support for sockets that have a field as input implicitly (Noise Texture and Set Position).

Diff Detail

Repository
rB Blender

Event Timeline

Jacques Lucke (JacquesLucke) requested review of this revision.Sep 21 2021, 1:50 PM
Jacques Lucke (JacquesLucke) created this revision.
Jacques Lucke (JacquesLucke) edited the summary of this revision. (Show Details)

Got a crash when testing, but probably caused by D12553: Geometry Nodes: Implicit Position input in Set Position node..

To reproduce:

  • Add a curve spiral node and connect it to the output
  • Drop a set position node on top of the link
  1. I find strange to have a node that changes its socket from circle to diamond. I wonder if the solution from the mockup (the semi-circle-semi-diamond) works better as the initial shape.
  1. I managed to get a memleak: "Error: Not freed memory blocks: 2, total unfreed memory 0.000000 MB"
  1. (low priority) Attribute sockets should show as diamonds in the Output lists

  1. In my setup I would expect the Greater Than node to have a diamond output (and also the Separate XYZ).

  1. The statistics node is not updated yet.

  • fix topological sorting
  • better support for fields in node declaration
  • use three socket shapes again
  • support implicit field inputs
  • better support for implicit inputs
Jacques Lucke (JacquesLucke) edited the summary of this revision. (Show Details)
  • fix non-field group outputs

Value input node output socket should be plain simple circle:

  • make dot circular
  • use diamond dot shape
  • fix Value node
  • Merge branch 'master' into temp-field-visualization
  • cleanup

I think that it may still make sense to have the socket to be a full circle when the circle is connected. I find it strange that we change the hybrid socket when we connect a diamond, but not when we connect a circle.

An input is a circle to indicate that this input is required to be data instead of a field. Just because data is connected, does not mean that data is suddenly required on the input.
How about we use four socket shapes:

  • Circle: This is data.
  • Diamond: This is a field.
  • Circle with dot: This is data, but is allowed to become a field.
  • Diamond with dot: This is a field, but is allowed to become data.
  • Split lambdas to separate functions
  • Fix a couple grammar mistakes
  • Fix issue with function nodes
  • Add NodeRef::declaration()
  • Merge branch 'master' into arcpatch-D12584
  • Add is_function_node to noise texture
  • Assert that node declaration is not null
  • Fix unused variable
  • Fixes for noise texture implicit field and group input and output

  1. Disconnect the output from "Greater Than" to the Set Position node.
  2. Issue #1 both outputs noodles from Position are red. I don't think either of them should be red, but if they are, there shouldn't be both, only the lower one.
  3. I can't make them go back to normal. No amount of reconnecting, save, load, ... can bring them back to normal.

Side bugs:

  • I would expect the "Separate XYZ" to output Fields if a field is connected to its input.
  • Same for "Greater Than"

Update: you don't even need to disconnect the output, just by trying to disconnect and cancelling it, already brings in the broken state.

  • fix node declarations
  • comments
  • cleanup and fix
  • fix for reroute nodes
This revision was not accepted when it landed; it landed in state Needs Review.Sep 23 2021, 10:22 PM
This revision was automatically updated to reflect the committed changes.

This looks good to me. I will commit it with a few very small tweaks, mostly to comments.

There are a couple points where some brief comments would make understanding the code much easier, and I didn't feel like I could write a great one.

  • dummy_socket_state
  • propagate_field_status_from_left_to_right
  • propagate_data_requirements_from_right_to_left
source/blender/blenkernel/intern/node.cc
4477

The idea is that it's cheaper to copy it than to recalculate it? Makes sense.

4958

Add a comment saying that this uses eNodeTreeUpdate. Eventually we could move that definition to BKE_node.h so it could be used directly.

source/blender/makesdna/DNA_node_types.h
488

The comment should mention that this is just runtime data based on the node declaration.

We should really split the runtime data from bNodeTree sooner rather than later.

I see my comment had several inline comments attached to it, I totally forgot about them. They're either already done, not finished, or not actionable, so they can just be disregarded.