Page MenuHome

Geometry Nodes: Curve Primitive Quadrilateral
ClosedPublic

Authored by Johnny Matthews (guitargeek) on Jun 21 2021, 10:59 PM.
Tokens
"Love" token, awarded by monio."Love" token, awarded by duarteframos."Love" token, awarded by 14AUDDIN."Love" token, awarded by someuser."Like" token, awarded by GeorgiaPacific.

Details

Summary

A Curve Primitive node for creating squares, rectangles, trapezoids, kites, and parallelograms.

Diff Detail

Repository
rB Blender

Event Timeline

Johnny Matthews (guitargeek) requested review of this revision.Jun 21 2021, 10:59 PM
Johnny Matthews (guitargeek) created this revision.
Hans Goudey (HooglyBoogly) requested changes to this revision.Jun 23 2021, 5:16 AM

I'm curious, what did you base the inputs on? I've seen "shear" before, but never "pinch". (It's possible I've just never seen it!)

source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
43

How about using something like this:

spline->resize(4);
MutableSpan<float3> positions = spline->positions();

positions[0] = ...

Also, then you don't need to reallocate the spline attributes, resize does that for you.

This revision now requires changes to proceed.Jun 23 2021, 5:16 AM

I'm curious, what did you base the inputs on? I've seen "shear" before, but never "pinch". (It's possible I've just never seen it!)

It was the best word I could come up with for what it does. I wanted to make it easy to make a trapezoid and this was a shot in the dark. I'm open to suggestions.

I wonder if specifying an offset for the top from left to right would be a bit more intuitive. It could be called "Top Offset" or something similar.

I wonder if specifying an offset for the top from left to right would be a bit more intuitive. It could be called "Top Offset" or something similar.

So instead of shearing, we offset the top? Would that change make Top Size a better wording for "pinch" (which was in desperate need of a name change)

Yeah, right, I think the inputs could be: "Height", "Bottom", "Top", "Top Offset", or maybe with "Length" after "Bottom" and "Top". Does that make sense?

Updated Controls

Height
Bottom Length
Top Length
Top Offset

Added modes rather than all options.

source/blender/makesrna/intern/rna_nodetree.c
177

You can move this definition

9859

here, and rename it mode_items, like the line node above.

We talked about this one more time at the meeting today. We thought the changes made sense, but Simon suggested adding a "Points" mode, similar to the other primitives, where you could choose the points directly as vectors.

source/blender/makesrna/intern/rna_nodetree.c
9843

typo: Rectange -> Rectangle

Add "points" mode
fix typo

Hans Goudey (HooglyBoogly) requested changes to this revision.Jul 7 2021, 1:02 AM

The modes are a nice way to do this actually, I like it! Just one more review iteration.

source/blender/makesdna/DNA_node_types.h
1376

What about calling this NodeGeometryCurvePrimitiveQuad? Otherwise it's sort of absurdly long : P

1931

Same here, GeometryNodeCurvePrimitiveQuadMode is a bit shorter at least

source/blender/makesrna/intern/rna_nodetree.c
9952

Extra newline

9975

Extra newline

source/blender/nodes/geometry/nodes/node_geo_curve_primitive_quadrilateral.cc
50–51

Unused variable

95–98

It looks like mostly these are set to false. What about this:

loop through all input sockets with LISTBASE_FOREACH
   set their availability to false

switch (mode) {
for each mode, set the availability to true for the sockets it uses
}
192

All of the p[4] variables are unused in this file

256–262

It strikes me that all these functions except for choosing the position values are the same. Maybe we could move the common parts to the caller and be left with five functions that just take a MutableSpan<float3> and their options.

This revision now requires changes to proceed.Jul 7 2021, 1:02 AM
Johnny Matthews (guitargeek) marked 9 inline comments as done.

Code cleanup

Looks great, I will commit this tomorrow morning.

This revision is now accepted and ready to land.Jul 12 2021, 5:25 AM

Looks great, I will commit this tomorrow morning.

Thanks Hans!