diff options
author | Hans Goudey <h.goudey@me.com> | 2022-09-28 22:38:27 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-09-28 22:38:27 +0300 |
commit | 482d431bb6735e8206961bd1115d2be7e63572b1 (patch) | |
tree | f47f10616f1f943def2bff975a6a869534feccc1 /release | |
parent | 25533dbe219f8bbcb3f04ffe2ff1e57599addf3f (diff) |
Geometry Nodes: Curve and mesh topology access nodes
This patch contains an initial set of nodes to access basic
mesh topology information, as explored in T100020.
The nodes allow six direct topology mappings for meshes:
- **Corner -> Face** The face a corner is in, the index in the face
- **Vertex -> Edge** Choose an edge attached to the vertex
- **Vertex -> Corner** Choose a corner attached to the vertex
- **Corner -> Edge** The next and previous edge at each face corner
- **Corner -> Vertex** The vertex associated with a corner
- **Corner -> Corner** Offset a corner index within a face
And two new topology mappings for curves:
- **Curve -> Points** Choose a point within a curve
- **Point -> Curve** The curve a point is in, the index in the curve
The idea is that some of the 16 possible mesh mappings are more
important, and that this is a useful set of nodes to start exploring
this area. For mappings with an arbitrary number of connections, we
must sort them and use an index to choose a single element, because
geometry nodes does not support list fields. Note that the sort
index has repeating behavior as it goes over the "Total" number of
connections, and negative sort indices choose from the end.
Currently which of the "start" elements is used is determined by the
field context, so the "Field at Index" and "Interpolate Domain" nodes
will be quite important. Also, currently the "Sort Index" inputs are
clamped to the number of connections.
One important feature that isn't implemented here is using the winding
order for the output elements. This can be a separate mode for some
of these nodes. It will be optional because of the performance impact.
There are several todos for separate commits after this:
- Rename "Control Point Neighbors" to be consistent with this naming
- Version away the "Vertex Neighbors" node which is fully redundant now
- Implement a special case for when no weights are used for performance
- De-duplicating some of the sorting logic between the nodes
- Improve performance and memory use of topology mappings
- Look into caching some of the mappings on meshes
Differential Revision: https://developer.blender.org/D16029
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_ui/node_add_menu_geometry.py | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/node_add_menu_geometry.py b/release/scripts/startup/bl_ui/node_add_menu_geometry.py index b29e607d413..73763c3d72c 100644 --- a/release/scripts/startup/bl_ui/node_add_menu_geometry.py +++ b/release/scripts/startup/bl_ui/node_add_menu_geometry.py @@ -52,7 +52,6 @@ class NODE_MT_geometry_node_GEO_CURVE(Menu): node_add_menu.add_node_type(layout, "GeometryNodeSubdivideCurve") node_add_menu.add_node_type(layout, "GeometryNodeTrimCurve") layout.separator() - node_add_menu.add_node_type(layout, "GeometryNodeInputControlPointNeighbors") node_add_menu.add_node_type(layout, "GeometryNodeInputCurveHandlePositions") node_add_menu.add_node_type(layout, "GeometryNodeInputTangent") node_add_menu.add_node_type(layout, "GeometryNodeInputCurveTilt") @@ -88,6 +87,17 @@ class NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE(Menu): node_add_menu.add_node_type(layout, "GeometryNodeCurvePrimitiveBezierSegment") +class NODE_MT_geometry_node_curve_topology(Menu): + bl_idname = "NODE_MT_geometry_node_curve_topology" + bl_label = "Curve Topology" + + def draw(self, _context): + layout = self.layout + node_add_menu.add_node_type(layout, "GeometryNodeCurveOfPoint") + node_add_menu.add_node_type(layout, "GeometryNodePointsOfCurve") + node_add_menu.add_node_type(layout, "GeometryNodeInputControlPointNeighbors") + + class NODE_MT_geometry_node_GEO_GEOMETRY(Menu): bl_idname = "NODE_MT_geometry_node_GEO_GEOMETRY" bl_label = "Geometry" @@ -224,6 +234,21 @@ class NODE_MT_category_PRIMITIVES_MESH(Menu): node_add_menu.add_node_type(layout, "GeometryNodeMeshLine") +class NODE_MT_geometry_node_mesh_topology(Menu): + bl_idname = "NODE_MT_geometry_node_mesh_topology" + bl_label = "Mesh Topology" + + def draw(self, _context): + layout = self.layout + node_add_menu.add_node_type(layout, "GeometryNodeCornersOfFace"), + node_add_menu.add_node_type(layout, "GeometryNodeCornersOfVertex"), + node_add_menu.add_node_type(layout, "GeometryNodeEdgesOfCorner"), + node_add_menu.add_node_type(layout, "GeometryNodeEdgesOfVertex"), + node_add_menu.add_node_type(layout, "GeometryNodeFaceOfCorner"), + node_add_menu.add_node_type(layout, "GeometryNodeOffsetCornerInFace"), + node_add_menu.add_node_type(layout, "GeometryNodeVertexOfCorner"), + + class NODE_MT_category_GEO_OUTPUT(Menu): bl_idname = "NODE_MT_category_GEO_OUTPUT" bl_label = "Output" @@ -367,12 +392,14 @@ class NODE_MT_geometry_node_add_all(Menu): layout.menu("NODE_MT_geometry_node_GEO_COLOR") layout.menu("NODE_MT_geometry_node_GEO_CURVE") layout.menu("NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE") + layout.menu("NODE_MT_geometry_node_curve_topology") layout.menu("NODE_MT_geometry_node_GEO_GEOMETRY") layout.menu("NODE_MT_geometry_node_GEO_INPUT") layout.menu("NODE_MT_geometry_node_GEO_INSTANCE") layout.menu("NODE_MT_geometry_node_GEO_MATERIAL") layout.menu("NODE_MT_geometry_node_GEO_MESH") layout.menu("NODE_MT_category_PRIMITIVES_MESH") + layout.menu("NODE_MT_geometry_node_mesh_topology") layout.menu("NODE_MT_category_GEO_OUTPUT") layout.menu("NODE_MT_category_GEO_POINT") layout.menu("NODE_MT_category_GEO_TEXT") @@ -391,12 +418,14 @@ classes = ( NODE_MT_geometry_node_GEO_COLOR, NODE_MT_geometry_node_GEO_CURVE, NODE_MT_geometry_node_GEO_PRIMITIVES_CURVE, + NODE_MT_geometry_node_curve_topology, NODE_MT_geometry_node_GEO_GEOMETRY, NODE_MT_geometry_node_GEO_INPUT, NODE_MT_geometry_node_GEO_INSTANCE, NODE_MT_geometry_node_GEO_MATERIAL, NODE_MT_geometry_node_GEO_MESH, NODE_MT_category_PRIMITIVES_MESH, + NODE_MT_geometry_node_mesh_topology, NODE_MT_category_GEO_OUTPUT, NODE_MT_category_GEO_POINT, NODE_MT_category_GEO_TEXT, |