25 .description(
"The X axis size of the shape")
31 .description(
"The Y axis size of the shape")
33 auto &bottom =
b.add_input<
decl::Float>(
"Bottom Width"_ustr)
37 .description(
"The X axis size of the shape")
43 .description(
"The X axis size of the shape")
50 "For Parallelogram, the relative X difference between the top and bottom edges. For "
51 "Trapezoid, the amount to move the top edge in the positive X axis")
53 auto &bottom_height =
b.add_input<
decl::Float>(
"Bottom Height"_ustr)
57 .description(
"The distance between the bottom point and the X axis")
59 auto &top_height =
b.add_input<
decl::Float>(
"Top Height"_ustr)
62 .description(
"The distance between the top point and the X axis")
67 .description(
"The exact location of the point to use")
72 .description(
"The exact location of the point to use")
77 .description(
"The exact location of the point to use")
82 .description(
"The exact location of the point to use")
87 if (
node !=
nullptr) {
91 width.available(
true);
92 height.available(
true);
95 width.available(
true);
96 height.available(
true);
97 offset.available(
true);
100 bottom.available(
true);
102 offset.available(
true);
103 height.available(
true);
106 width.available(
true);
107 bottom_height.available(
true);
108 top_height.available(
true);
173 positions[0] =
float3(width / 2.0f, height / 2.0f, 0.0f);
174 positions[1] =
float3(-width / 2.0f, height / 2.0f, 0.0f);
175 positions[2] =
float3(-width / 2.0f, -height / 2.0f, 0.0f);
176 positions[3] =
float3(width / 2.0f, -height / 2.0f, 0.0f);
196 positions[0] =
float3(width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
197 positions[1] =
float3(-width / 2.0f + offset / 2.0f, height / 2.0f, 0.0f);
198 positions[2] =
float3(-width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
199 positions[3] =
float3(width / 2.0f - offset / 2.0f, -height / 2.0f, 0.0f);
207 positions[0] =
float3(top / 2.0f + offset, height / 2.0f, 0.0f);
208 positions[1] =
float3(-top / 2.0f + offset, height / 2.0f, 0.0f);
209 positions[2] =
float3(-bottom / 2.0f, -height / 2.0f, 0.0f);
210 positions[3] =
float3(bottom / 2.0f, -height / 2.0f, 0.0f);
215 const float bottom_height,
216 const float top_height)
218 positions[0] =
float3(0, -bottom_height, 0);
219 positions[1] =
float3(width / 2, 0, 0);
220 positions[2] =
float3(0, top_height, 0);
221 positions[3] =
float3(-width / 2.0f, 0, 0);
231 curves.cyclic_for_write().first() =
true;
250 std::max(params.
extract_input<
float>(
"Bottom Width"_ustr), 0.0f),
251 std::max(params.
extract_input<
float>(
"Top Width"_ustr), 0.0f),
258 std::max(params.
extract_input<
float>(
"Bottom Height"_ustr), 0.0f),
283 "Create a rectangle"},
288 "Create a parallelogram"},
293 "Create a trapezoid"},
299 "Create a quadrilateral from four points"},
300 {0,
nullptr, 0,
nullptr,
nullptr},
316 "GeometryNodeCurvePrimitiveQuadrilateral"_ustr,
318 ntype.
ui_name =
"Quadrilateral";
327 "NodeGeometryCurvePrimitiveQuad",
Low-level operations for curves.
#define NODE_STORAGE_FUNCS(StorageT)
#define NODE_CLASS_GEOMETRY
#define GEO_NODE_CURVE_PRIMITIVE_QUADRILATERAL
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define NOD_storage_enum_accessors(member)
const bke::bNodeType & node_type() const
void add_item(std::string socket_name, SocketLinkOperation::LinkSocketFn fn, int weight=0)
const bNodeTree & node_tree() const
const bNodeSocket & other_socket() const
eNodeSocketInOut in_out() const
T extract_input(const UString identifier)
const bNode & node() const
void set_default_remaining_outputs()
void set_output(const UString identifier, T &&value)
void update_and_connect_available_socket(bNode &new_node, UString socket_name)
bNode & add_node(UString idname)
Vector< SocketDeclaration * > outputs
GeometryNodeCurvePrimitiveQuadMode quad_mode
void operator()(LinkSearchOpParams ¶ms)
#define storage(slot, qualifiers)
void node_register_type(bNodeType &ntype)
Curves * curves_new_nomain_single(int points_num, CurveType type)
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
static void node_init(bNodeTree *, bNode *node)
static void create_kite_curve(MutableSpan< float3 > positions, const float width, const float bottom_height, const float top_height)
static void create_rectangle_curve(MutableSpan< float3 > positions, const float height, const float width)
static void node_register()
static void create_parallelogram_curve(MutableSpan< float3 > positions, const float height, const float width, const float offset)
static void create_points_curve(MutableSpan< float3 > positions, const float3 &p1, const float3 &p2, const float3 &p3, const float3 &p4)
static void node_declare(NodeDeclarationBuilder &b)
static void create_trapezoid_curve(MutableSpan< float3 > positions, const float bottom, const float top, const float offset, const float height)
static void node_layout(ui::Layout &layout, bContext *, PointerRNA *ptr)
static void node_gather_link_searches(GatherLinkSearchOpParams ¶ms)
static void node_rna(StructRNA *srna)
static void node_geo_exec(GeoNodeExecParams params)
void search_link_ops_for_declarations(GatherLinkSearchOpParams ¶ms, Span< SocketDeclaration * > declarations)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
GeometryNodeCurvePrimitiveQuadMode
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_PARALLELOGRAM
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_TRAPEZOID
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_POINTS
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_KITE
@ GEO_NODE_CURVE_PRIMITIVE_QUAD_MODE_RECTANGLE
BMesh const char void * data
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
void node_free_standard_storage(bNode *node)
VecBase< float, 3 > float3
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
bke::bNodeTreeType * typeinfo
bool(*) validate_link(eNodeSocketDatatype from, eNodeSocketDatatype to)
void(*) draw_buttons(ui::Layout &, bContext *C, PointerRNA *ptr)
std::string ui_description
NodeGeometryExecFunction geometry_node_execute
void(*) initfunc(bNodeTree *ntree, bNode *node)
const char * enum_name_legacy
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
NodeDeclareFunction declare
nodes::NodeDeclaration * static_declaration
static GeometrySet from_curves(Curves *curves, GeometryOwnershipType ownership=GeometryOwnershipType::Owned)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)