Geometry Nodes: add more details about field handling to node declaration

This is part of D16858 but is also useful for other purposes.

The changes to the node declaration in this commit allow us to figure
out which fields might be evaluated on which geometries statically (without
executing the node tree). This allows for deterministic anonymous attribute
handling, which will be committed separately. Furthermore, this is necessary
for usability features that help the user to avoid creating links that don't
make sense (e.g. because a field can't be evaluated on a certain geometry).
This also allows us to better separate fields which depend or don't depend
on anonymous attributes.

The main idea is that each node defines some relations between its sockets.
There are four relations:
* Propagate relation: Indicates that attributes on a geometry input can be
  propagated to a geometry output.
* Reference relation: Indicates that an output field references an inputs field.
  So if the input field depends on an anonymous attribute, the output field
  does as well.
* Eval relation: Indicates that an input field is evaluated on an input geometry.
* Available relation: Indicates that an output field has anonymous attributes
  that are available on an output geometry.

These relations can also be computed for node groups automatically, but that
is not part of this commit.
This commit is contained in:
Jacques Lucke 2023-01-03 12:24:00 +01:00
parent 101d04f41f
commit 0f8487f640
Notes: blender-bot 2023-03-28 09:39:04 +02:00
Referenced by commit 86a471efe7, Fix: field socket not showing as field socket
Referenced by issue #106198, Realize instances node affects UVs (texture coordinate)
96 changed files with 615 additions and 289 deletions

View File

@ -65,6 +65,76 @@ struct FieldInferencingInterface {
Vector<OutputFieldDependency> outputs;
};
namespace anonymous_attribute_lifetime {
/**
* Attributes can be propagated from an input geometry to an output geometry.
*/
struct PropagateRelation {
int from_geometry_input;
int to_geometry_output;
friend bool operator==(const PropagateRelation &a, const PropagateRelation &b)
{
return a.from_geometry_input == b.from_geometry_input &&
a.to_geometry_output == b.to_geometry_output;
}
};
/**
* References to attributes can be propagated from an input field to an output field.
*/
struct ReferenceRelation {
int from_field_input;
int to_field_output;
friend bool operator==(const ReferenceRelation &a, const ReferenceRelation &b)
{
return a.from_field_input == b.from_field_input && a.to_field_output == b.to_field_output;
}
};
/**
* An input field is evaluated on an input geometry.
*/
struct EvalRelation {
int field_input;
int geometry_input;
friend bool operator==(const EvalRelation &a, const EvalRelation &b)
{
return a.field_input == b.field_input && a.geometry_input == b.geometry_input;
}
};
/**
* An output field is available on an output geometry.
*/
struct AvailableRelation {
int field_output;
int geometry_output;
friend bool operator==(const AvailableRelation &a, const AvailableRelation &b)
{
return a.field_output == b.field_output && a.geometry_output == b.geometry_output;
}
};
struct RelationsInNode {
Vector<PropagateRelation> propagate_relations;
Vector<ReferenceRelation> reference_relations;
Vector<EvalRelation> eval_relations;
Vector<AvailableRelation> available_relations;
Vector<int> available_on_none;
};
bool operator==(const RelationsInNode &a, const RelationsInNode &b);
bool operator!=(const RelationsInNode &a, const RelationsInNode &b);
std::ostream &operator<<(std::ostream &stream, const RelationsInNode &relations);
} // namespace anonymous_attribute_lifetime
namespace aal = anonymous_attribute_lifetime;
using ImplicitInputValueFn = std::function<void(const bNode &node, void *r_value)>;
/**
@ -146,9 +216,23 @@ class SocketDeclaration {
bool matches_common_data(const bNodeSocket &socket) const;
};
class NodeDeclarationBuilder;
class BaseSocketDeclarationBuilder {
protected:
int index_ = -1;
bool reference_pass_all_ = false;
bool field_on_all_ = false;
bool propagate_from_all_ = false;
NodeDeclarationBuilder *node_decl_builder_ = nullptr;
friend class NodeDeclarationBuilder;
public:
virtual ~BaseSocketDeclarationBuilder() = default;
protected:
virtual SocketDeclaration *declaration() = 0;
};
/**
@ -225,6 +309,26 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
return *(Self *)this;
}
/**
* For inputs this means that the input field is evaluated on all geometry inputs. For outputs
* it means that this contains an anonymous attribute reference that is available on all geometry
* outputs.
*/
Self &field_on_all()
{
if (decl_->in_out == SOCK_IN) {
this->supports_field();
}
else {
this->field_source();
}
field_on_all_ = true;
return *(Self *)this;
}
/** For inputs that are evaluated or available on a subset of the geometry sockets. */
Self &field_on(Span<int> indices);
/** The input supports a field and is a field by default when nothing is connected. */
Self &implicit_field(ImplicitInputValueFn fn)
{
@ -234,6 +338,22 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
return *(Self *)this;
}
/** The input is an implicit field that is evaluated on all geometry inputs. */
Self &implicit_field_on_all(ImplicitInputValueFn fn)
{
this->implicit_field(fn);
field_on_all_ = true;
return *(Self *)this;
}
/** The input is evaluated on a subset of the geometry inputs. */
Self &implicit_field_on(ImplicitInputValueFn fn, const Span<int> input_indices)
{
this->implicit_field(fn);
this->field_on(input_indices);
return *(Self *)this;
}
/** The output is always a field, regardless of any inputs. */
Self &field_source()
{
@ -241,21 +361,55 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
return *(Self *)this;
}
/** The output is a field if any of the inputs is a field. */
/** The output is a field if any of the inputs are a field. */
Self &dependent_field()
{
decl_->output_field_dependency = OutputFieldDependency::ForDependentField();
this->reference_pass_all();
return *(Self *)this;
}
/** The output is a field if any of the inputs with indices in the given list is a field. */
Self &dependent_field(Vector<int> input_dependencies)
{
this->reference_pass(input_dependencies);
decl_->output_field_dependency = OutputFieldDependency::ForPartiallyDependentField(
std::move(input_dependencies));
return *(Self *)this;
}
/**
* For outputs that combine all input fields into a new field. The output is a field even if none
* of the inputs is a field.
*/
Self &field_source_reference_all()
{
this->field_source();
this->reference_pass_all();
return *(Self *)this;
}
/**
* For outputs that combine a subset of input fields into a new field.
*/
Self &reference_pass(Span<int> input_indices);
/**
* For outputs that combine all input fields into a new field.
*/
Self &reference_pass_all()
{
reference_pass_all_ = true;
return *(Self *)this;
}
/** Attributes from the all geometry inputs can be propagated. */
Self &propagate_all()
{
propagate_from_all_ = true;
return *(Self *)this;
}
/** The priority of the input for determining the domain of the node. See
* realtime_compositor::InputDescriptor for more information. */
Self &compositor_domain_priority(int priority)
@ -291,6 +445,12 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder {
decl_->make_available_fn_ = std::move(fn);
return *(Self *)this;
}
protected:
SocketDeclaration *declaration() override
{
return decl_;
}
};
using SocketDeclarationPtr = std::unique_ptr<SocketDeclaration>;
@ -299,19 +459,26 @@ class NodeDeclaration {
public:
Vector<SocketDeclarationPtr> inputs;
Vector<SocketDeclarationPtr> outputs;
std::unique_ptr<aal::RelationsInNode> anonymous_attribute_relations_;
friend NodeDeclarationBuilder;
bool matches(const bNode &node) const;
Span<SocketDeclarationPtr> sockets(eNodeSocketInOut in_out) const;
const aal::RelationsInNode *anonymous_attribute_relations() const
{
return anonymous_attribute_relations_.get();
}
MEM_CXX_CLASS_ALLOC_FUNCS("NodeDeclaration")
};
class NodeDeclarationBuilder {
private:
NodeDeclaration &declaration_;
Vector<std::unique_ptr<BaseSocketDeclarationBuilder>> builders_;
Vector<std::unique_ptr<BaseSocketDeclarationBuilder>> input_builders_;
Vector<std::unique_ptr<BaseSocketDeclarationBuilder>> output_builders_;
bool is_function_node_ = false;
public:
@ -333,6 +500,14 @@ class NodeDeclarationBuilder {
template<typename DeclType>
typename DeclType::Builder &add_output(StringRef name, StringRef identifier = "");
aal::RelationsInNode &get_anonymous_attribute_relations()
{
if (!declaration_.anonymous_attribute_relations_) {
declaration_.anonymous_attribute_relations_ = std::make_unique<aal::RelationsInNode>();
}
return *declaration_.anonymous_attribute_relations_;
}
private:
template<typename DeclType>
typename DeclType::Builder &add_socket(StringRef name,
@ -349,6 +524,44 @@ void id_or_index(const bNode &node, void *r_value);
void build_node_declaration(const bNodeType &typeinfo, NodeDeclaration &r_declaration);
template<typename SocketDecl>
typename SocketDeclarationBuilder<SocketDecl>::Self &SocketDeclarationBuilder<
SocketDecl>::reference_pass(const Span<int> input_indices)
{
aal::RelationsInNode &relations = node_decl_builder_->get_anonymous_attribute_relations();
for (const int from_input : input_indices) {
aal::ReferenceRelation relation;
relation.from_field_input = from_input;
relation.to_field_output = index_;
relations.reference_relations.append(relation);
}
return *(Self *)this;
}
template<typename SocketDecl>
typename SocketDeclarationBuilder<SocketDecl>::Self &SocketDeclarationBuilder<
SocketDecl>::field_on(const Span<int> indices)
{
aal::RelationsInNode &relations = node_decl_builder_->get_anonymous_attribute_relations();
if (decl_->in_out == SOCK_IN) {
for (const int input_index : indices) {
aal::EvalRelation relation;
relation.field_input = index_;
relation.geometry_input = input_index;
relations.eval_relations.append(relation);
}
}
else {
for (const int output_index : indices) {
aal::AvailableRelation relation;
relation.field_output = index_;
relation.geometry_output = output_index;
relations.available_relations.append(relation);
}
}
return *(Self *)this;
}
/* -------------------------------------------------------------------- */
/** \name #OutputFieldDependency Inline Methods
* \{ */
@ -490,12 +703,15 @@ inline typename DeclType::Builder &NodeDeclarationBuilder::add_socket(StringRef
std::unique_ptr<DeclType> socket_decl = std::make_unique<DeclType>();
std::unique_ptr<Builder> socket_decl_builder = std::make_unique<Builder>();
socket_decl_builder->decl_ = &*socket_decl;
socket_decl_builder->node_decl_builder_ = this;
socket_decl->name = name;
socket_decl->identifier = identifier.is_empty() ? name : identifier;
socket_decl->in_out = in_out;
declarations.append(std::move(socket_decl));
socket_decl_builder->index_ = declarations.append_and_get_index(std::move(socket_decl));
Builder &socket_decl_builder_ref = *socket_decl_builder;
builders_.append(std::move(socket_decl_builder));
((in_out == SOCK_IN) ? input_builders_ : output_builders_)
.append(std::move(socket_decl_builder));
return socket_decl_builder_ref;
}

View File

@ -40,33 +40,33 @@ static void node_declare(NodeDeclarationBuilder &b)
N_("An index used to group values together for multiple separate accumulations"));
b.add_output<decl::Vector>(N_("Leading"), "Leading Vector")
.field_source()
.field_source_reference_all()
.description(N_(leading_out_description));
b.add_output<decl::Float>(N_("Leading"), "Leading Float")
.field_source()
.field_source_reference_all()
.description(N_(leading_out_description));
b.add_output<decl::Int>(N_("Leading"), "Leading Int")
.field_source()
.field_source_reference_all()
.description(N_(leading_out_description));
b.add_output<decl::Vector>(N_("Trailing"), "Trailing Vector")
.field_source()
.field_source_reference_all()
.description(N_(trailing_out_description));
b.add_output<decl::Float>(N_("Trailing"), "Trailing Float")
.field_source()
.field_source_reference_all()
.description(N_(trailing_out_description));
b.add_output<decl::Int>(N_("Trailing"), "Trailing Int")
.field_source()
.field_source_reference_all()
.description(N_(trailing_out_description));
b.add_output<decl::Vector>(N_("Total"), "Total Vector")
.field_source()
.field_source_reference_all()
.description(N_(total_out_description));
b.add_output<decl::Float>(N_("Total"), "Total Float")
.field_source()
.field_source_reference_all()
.description(N_(total_out_description));
b.add_output<decl::Int>(N_("Total"), "Total Int")
.field_source()
.field_source_reference_all()
.description(N_(total_out_description));
}

View File

@ -16,18 +16,18 @@ NODE_STORAGE_FUNCS(NodeGeometryAttributeCapture)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Vector>(N_("Value")).supports_field();
b.add_input<decl::Float>(N_("Value"), "Value_001").supports_field();
b.add_input<decl::Color>(N_("Value"), "Value_002").supports_field();
b.add_input<decl::Bool>(N_("Value"), "Value_003").supports_field();
b.add_input<decl::Int>(N_("Value"), "Value_004").supports_field();
b.add_input<decl::Vector>(N_("Value")).field_on_all();
b.add_input<decl::Float>(N_("Value"), "Value_001").field_on_all();
b.add_input<decl::Color>(N_("Value"), "Value_002").field_on_all();
b.add_input<decl::Bool>(N_("Value"), "Value_003").field_on_all();
b.add_input<decl::Int>(N_("Value"), "Value_004").field_on_all();
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Vector>(N_("Attribute")).field_source();
b.add_output<decl::Float>(N_("Attribute"), "Attribute_001").field_source();
b.add_output<decl::Color>(N_("Attribute"), "Attribute_002").field_source();
b.add_output<decl::Bool>(N_("Attribute"), "Attribute_003").field_source();
b.add_output<decl::Int>(N_("Attribute"), "Attribute_004").field_source();
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
b.add_output<decl::Vector>(N_("Attribute")).field_on_all();
b.add_output<decl::Float>(N_("Attribute"), "Attribute_001").field_on_all();
b.add_output<decl::Color>(N_("Attribute"), "Attribute_002").field_on_all();
b.add_output<decl::Bool>(N_("Attribute"), "Attribute_003").field_on_all();
b.add_output<decl::Int>(N_("Attribute"), "Attribute_004").field_on_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -17,9 +17,9 @@ namespace blender::nodes::node_geo_attribute_statistic_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
b.add_input<decl::Float>(N_("Attribute")).hide_value().supports_field();
b.add_input<decl::Vector>(N_("Attribute"), "Attribute_001").hide_value().supports_field();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on_all().hide_value();
b.add_input<decl::Float>(N_("Attribute")).hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Attribute"), "Attribute_001").hide_value().field_on_all();
b.add_output<decl::Float>(N_("Mean"));
b.add_output<decl::Float>(N_("Median"));

View File

@ -58,10 +58,16 @@ static void node_declare(NodeDeclarationBuilder &b)
.supports_field()
.description(N_("Relative mix weight of neighboring elements"));
b.add_output<decl::Float>(N_("Value"), "Value_Float").field_source().dependent_field();
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source().dependent_field();
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").field_source().dependent_field();
b.add_output<decl::Color>(N_("Value"), "Value_Color").field_source().dependent_field();
b.add_output<decl::Float>(N_("Value"), "Value_Float")
.field_source_reference_all()
.dependent_field();
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source_reference_all().dependent_field();
b.add_output<decl::Vector>(N_("Value"), "Value_Vector")
.field_source_reference_all()
.dependent_field();
b.add_output<decl::Color>(N_("Value"), "Value_Color")
.field_source_reference_all()
.dependent_field();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -20,8 +20,8 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Geometry>(N_("Mesh 2")).multi_input().supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Self Intersection"));
b.add_input<decl::Bool>(N_("Hole Tolerant"));
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Bool>(N_("Intersecting Edges")).field_source();
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
b.add_output<decl::Bool>(N_("Intersecting Edges")).field_on_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -22,7 +22,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.supports_field()
.description(N_("The amount of points to select from the end of each spline"));
b.add_output<decl::Bool>(N_("Selection"))
.field_source()
.field_source_reference_all()
.description(
N_("The selection from the start and end of the splines based on the input sizes"));
}

View File

@ -18,18 +18,18 @@ static void node_declare(NodeDeclarationBuilder &b)
.default_value(1)
.min(1)
.max(1000)
.supports_field()
.field_on_all()
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_FILLET_POLY; });
b.add_input<decl::Float>(N_("Radius"))
.min(0.0f)
.max(FLT_MAX)
.subtype(PropertySubType::PROP_DISTANCE)
.default_value(0.25f)
.supports_field();
.field_on_all();
b.add_input<decl::Bool>(N_("Limit Radius"))
.description(
N_("Limit the maximum value of the radius in order to avoid overlapping fillets"));
b.add_output<decl::Geometry>(N_("Curve"));
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -29,7 +29,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.description(N_("The counterclockwise rotation of the inner set of points"));
b.add_output<decl::Geometry>(N_("Curve"));
b.add_output<decl::Bool>(N_("Outer Points"))
.field_source()
.field_on_all()
.description(N_("An attribute field with a selection of the outer points"));
}

View File

@ -16,14 +16,14 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveResample)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
b.add_input<decl::Int>(N_("Count")).default_value(10).min(1).max(100000).supports_field();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on_all().hide_value();
b.add_input<decl::Int>(N_("Count")).default_value(10).min(1).max(100000).field_on_all();
b.add_input<decl::Float>(N_("Length"))
.default_value(0.1f)
.min(0.01f)
.supports_field()
.field_on_all()
.subtype(PROP_DISTANCE);
b.add_output<decl::Geometry>(N_("Curve"));
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -11,8 +11,8 @@ namespace blender::nodes::node_geo_curve_reverse_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_output<decl::Geometry>(N_("Curve"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -23,24 +23,24 @@ static void node_declare(NodeDeclarationBuilder &b)
.only_realized_data()
.supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().supports_field();
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().supports_field();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().supports_field();
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().supports_field();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().supports_field();
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().field_on_all();
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().field_on_all();
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().field_on_all();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().field_on_all();
b.add_input<decl::Float>(N_("Factor"))
.min(0.0f)
.max(1.0f)
.subtype(PROP_FACTOR)
.supports_field()
.field_on_all()
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_FACTOR; });
b.add_input<decl::Float>(N_("Length"))
.min(0.0f)
.subtype(PROP_DISTANCE)
.supports_field()
.field_on_all()
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_LENGTH; });
b.add_input<decl::Int>(N_("Curve Index")).supports_field().make_available([](bNode &node) {
b.add_input<decl::Int>(N_("Curve Index")).field_on_all().make_available([](bNode &node) {
node_storage(node).use_all_curves = false;
});

View File

@ -16,8 +16,8 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveSetHandles)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_output<decl::Geometry>(N_("Curve"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -16,8 +16,8 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveSplineType)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_output<decl::Geometry>(N_("Curve"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -18,10 +18,10 @@ static void node_declare(NodeDeclarationBuilder &b)
.default_value(1)
.min(0)
.max(1000)
.supports_field()
.field_on_all()
.description(
N_("The number of control points to create on the segment following each point"));
b.add_output<decl::Geometry>(N_("Curve"));
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -20,7 +20,7 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Bool>(N_("Fill Caps"))
.description(
N_("If the profile spline is cyclic, fill the ends of the generated mesh with N-gons"));
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
}
static void geometry_set_curve_to_mesh(GeometrySet &geometry_set,

View File

@ -34,10 +34,10 @@ static void node_declare(NodeDeclarationBuilder &b)
.subtype(PROP_DISTANCE)
.make_available(
[](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_RESAMPLE_LENGTH; });
b.add_output<decl::Geometry>(N_("Points"));
b.add_output<decl::Vector>(N_("Tangent")).field_source();
b.add_output<decl::Vector>(N_("Normal")).field_source();
b.add_output<decl::Vector>(N_("Rotation")).field_source();
b.add_output<decl::Geometry>(N_("Points")).propagate_all();
b.add_output<decl::Vector>(N_("Tangent")).field_on_all();
b.add_output<decl::Vector>(N_("Normal")).field_on_all();
b.add_output<decl::Vector>(N_("Rotation")).field_on_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -12,10 +12,10 @@ static void node_declare(NodeDeclarationBuilder &b)
.implicit_field(implicit_field_inputs::index)
.description(N_("The control point to retrieve data from"));
b.add_output<decl::Int>(N_("Curve Index"))
.dependent_field()
.field_source_reference_all()
.description(N_("The curve the control point is part of"));
b.add_output<decl::Int>(N_("Index in Curve"))
.dependent_field()
.field_source_reference_all()
.description(N_("How far along the control point is along its curve"));
}

View File

@ -22,10 +22,11 @@ static void node_declare(NodeDeclarationBuilder &b)
.supports_field()
.description(N_("Which of the sorted points to output"));
b.add_output<decl::Int>(N_("Point Index"))
.dependent_field()
.field_source_reference_all()
.description(N_("A point of the curve, chosen by the sort index"));
b.add_output<decl::Int>(N_("Total"))
.dependent_field()
.field_source()
.reference_pass({0})
.description(N_("The number of points in the curve"));
}

View File

@ -25,26 +25,26 @@ static void node_declare(NodeDeclarationBuilder &b)
.max(1.0f)
.subtype(PROP_FACTOR)
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_FACTOR; })
.supports_field();
.field_on_all();
b.add_input<decl::Float>(N_("End"))
.min(0.0f)
.max(1.0f)
.default_value(1.0f)
.subtype(PROP_FACTOR)
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_FACTOR; })
.supports_field();
.field_on_all();
b.add_input<decl::Float>(N_("Start"), "Start_001")
.min(0.0f)
.subtype(PROP_DISTANCE)
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_LENGTH; })
.supports_field();
.field_on_all();
b.add_input<decl::Float>(N_("End"), "End_001")
.min(0.0f)
.default_value(1.0f)
.subtype(PROP_DISTANCE)
.make_available([](bNode &node) { node_storage(node).mode = GEO_NODE_CURVE_SAMPLE_LENGTH; })
.supports_field();
b.add_output<decl::Geometry>(N_("Curve"));
.field_on_all();
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -38,7 +38,7 @@ NODE_STORAGE_FUNCS(NodeGeometryCurveTrim)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curves")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_output<decl::Geometry>(N_("Curves"));
b.add_output<decl::Geometry>(N_("Curves")).propagate_all();
}
static void deform_curves(const CurvesGeometry &curves,

View File

@ -1130,9 +1130,9 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Bool>(N_("Selection"))
.default_value(true)
.hide_value()
.supports_field()
.field_on_all()
.description(N_("The parts of the geometry to be deleted"));
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -46,7 +46,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.min(0.0f)
.max(FLT_MAX)
.description(N_("Minimum density of a volume cell to contain a grid point"));
b.add_output<decl::Geometry>(N_("Points"));
b.add_output<decl::Geometry>(N_("Points")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -34,7 +34,7 @@ static void node_declare(NodeDeclarationBuilder &b)
};
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Float>(N_("Distance Min"))
.min(0.0f)
.subtype(PROP_DISTANCE)
@ -46,20 +46,20 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Float>(N_("Density"))
.default_value(10.0f)
.min(0.0f)
.supports_field()
.field_on_all()
.make_available(enable_random);
b.add_input<decl::Float>(N_("Density Factor"))
.default_value(1.0f)
.min(0.0f)
.max(1.0f)
.subtype(PROP_FACTOR)
.supports_field()
.field_on_all()
.make_available(enable_poisson);
b.add_input<decl::Int>(N_("Seed"));
b.add_output<decl::Geometry>(N_("Points"));
b.add_output<decl::Vector>(N_("Normal")).field_source();
b.add_output<decl::Vector>(N_("Rotation")).subtype(PROP_EULER).field_source();
b.add_output<decl::Geometry>(N_("Points")).propagate_all();
b.add_output<decl::Vector>(N_("Normal")).field_on_all();
b.add_output<decl::Vector>(N_("Rotation")).subtype(PROP_EULER).field_on_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -22,7 +22,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.description(
"Keep non-manifold boundaries of the input mesh in place by avoiding the dual "
"transformation there");
b.add_output<decl::Geometry>("Dual Mesh");
b.add_output<decl::Geometry>("Dual Mesh").propagate_all();
}
enum class EdgeType : int8_t {

View File

@ -28,17 +28,18 @@ NODE_STORAGE_FUNCS(NodeGeometryDuplicateElements);
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).hide_value().default_value(true).supports_field();
b.add_input<decl::Bool>(N_("Selection")).hide_value().default_value(true).field_on_all();
b.add_input<decl::Int>(N_("Amount"))
.min(0)
.default_value(1)
.supports_field()
.field_on_all()
.description(N_("The number of duplicates to create for each element"));
b.add_output<decl::Geometry>(N_("Geometry"))
.propagate_all()
.description(N_("The duplicated geometry, not including the original geometry"));
b.add_output<decl::Int>(N_("Duplicate Index"))
.field_source()
.field_on_all()
.description(N_("The indices of the duplicates for each element"));
}

View File

@ -13,9 +13,9 @@ namespace blender::nodes::node_geo_edge_paths_to_curves_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Start Vertices")).default_value(true).hide_value().supports_field();
b.add_input<decl::Int>(N_("Next Vertex Index")).default_value(-1).hide_value().supports_field();
b.add_output<decl::Geometry>(N_("Curves"));
b.add_input<decl::Bool>(N_("Start Vertices")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Int>(N_("Next Vertex Index")).default_value(-1).hide_value().field_on_all();
b.add_output<decl::Geometry>(N_("Curves")).propagate_all();
}
static Curves *edge_paths_to_curves_convert(const Mesh &mesh,

View File

@ -17,7 +17,7 @@ static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Bool>(N_("Start Vertices")).default_value(true).hide_value().supports_field();
b.add_input<decl::Int>(N_("Next Vertex Index")).default_value(-1).hide_value().supports_field();
b.add_output<decl::Bool>(N_("Selection")).field_source();
b.add_output<decl::Bool>(N_("Selection")).field_source_reference_all();
}
static void edge_paths_to_selection(const Mesh &src_mesh,

View File

@ -11,8 +11,8 @@ namespace blender::nodes::node_geo_edge_split_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -24,16 +24,16 @@ NODE_STORAGE_FUNCS(NodeGeometryExtrudeMesh)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>("Mesh").supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on_all().hide_value();
b.add_input<decl::Vector>(N_("Offset"))
.subtype(PROP_TRANSLATION)
.implicit_field(implicit_field_inputs::normal)
.hide_value();
b.add_input<decl::Float>(N_("Offset Scale")).default_value(1.0f).supports_field();
b.add_input<decl::Float>(N_("Offset Scale")).default_value(1.0f).field_on_all();
b.add_input<decl::Bool>(N_("Individual")).default_value(true);
b.add_output<decl::Geometry>("Mesh");
b.add_output<decl::Bool>(N_("Top")).field_source();
b.add_output<decl::Bool>(N_("Side")).field_source();
b.add_output<decl::Geometry>("Mesh").propagate_all();
b.add_output<decl::Bool>(N_("Top")).field_on_all();
b.add_output<decl::Bool>(N_("Side")).field_on_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -80,11 +80,11 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().supports_field();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().supports_field();
b.add_output<decl::Float>(N_("Value"), "Value_Float").field_source();
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source();
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").field_source();
b.add_output<decl::Color>(N_("Value"), "Value_Color").field_source();
b.add_output<decl::Bool>(N_("Value"), "Value_Bool").field_source();
b.add_output<decl::Float>(N_("Value"), "Value_Float").field_source_reference_all();
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source_reference_all();
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").field_source_reference_all();
b.add_output<decl::Color>(N_("Value"), "Value_Color").field_source_reference_all();
b.add_output<decl::Bool>(N_("Value"), "Value_Bool").field_source_reference_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -15,8 +15,8 @@ namespace blender::nodes::node_geo_flip_faces_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
}
static void mesh_flip_faces(Mesh &mesh, const Field<bool> &selection_field)

View File

@ -9,7 +9,7 @@ namespace blender::nodes::node_geo_geometry_to_instance_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry")).multi_input();
b.add_output<decl::Geometry>(N_("Instances"));
b.add_output<decl::Geometry>(N_("Instances")).propagate_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -27,8 +27,8 @@ static void node_declare(NodeDeclarationBuilder &b)
.implicit_field(implicit_field_inputs::position)
.description("Texture coordinates from 0 to 1");
b.add_input<decl::Int>(N_("Frame")).min(0).max(MAXFRAMEF);
b.add_output<decl::Color>(N_("Color")).no_muted_links().dependent_field();
b.add_output<decl::Float>(N_("Alpha")).no_muted_links().dependent_field();
b.add_output<decl::Color>(N_("Color")).no_muted_links().dependent_field().reference_pass_all();
b.add_output<decl::Float>(N_("Alpha")).no_muted_links().dependent_field().reference_pass_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -13,8 +13,8 @@ static void node_declare(NodeDeclarationBuilder &b)
.supports_field()
.description(N_("Output the handle positions relative to the corresponding control point "
"instead of in the local space of the geometry"));
b.add_output<decl::Vector>(N_("Left")).field_source();
b.add_output<decl::Vector>(N_("Right")).field_source();
b.add_output<decl::Vector>(N_("Left")).field_source_reference_all();
b.add_output<decl::Vector>(N_("Right")).field_source_reference_all();
}
class HandlePositionFieldInput final : public bke::CurvesFieldInput {

View File

@ -19,29 +19,29 @@ namespace blender::nodes::node_geo_instance_on_points_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Points")).description(N_("Points to instance on"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on({0}).hide_value();
b.add_input<decl::Geometry>(N_("Instance"))
.description(N_("Geometry that is instanced on the points"));
b.add_input<decl::Bool>(N_("Pick Instance"))
.supports_field()
.field_on({0})
.description(N_("Choose instances from the \"Instance\" input at each point instead of "
"instancing the entire geometry"));
b.add_input<decl::Int>(N_("Instance Index"))
.implicit_field(implicit_field_inputs::id_or_index)
.implicit_field_on(implicit_field_inputs::id_or_index, {0})
.description(
N_("Index of the instance used for each point. This is only used when Pick Instances "
"is on. By default the point index is used"));
b.add_input<decl::Vector>(N_("Rotation"))
.subtype(PROP_EULER)
.supports_field()
.field_on({0})
.description(N_("Rotation of the instances"));
b.add_input<decl::Vector>(N_("Scale"))
.default_value({1.0f, 1.0f, 1.0f})
.subtype(PROP_XYZ)
.supports_field()
.field_on({0})
.description(N_("Scale of the instances"));
b.add_output<decl::Geometry>(N_("Instances"));
b.add_output<decl::Geometry>(N_("Instances")).propagate_all();
}
static void add_instances_from_component(

View File

@ -13,14 +13,14 @@ namespace blender::nodes::node_geo_instances_to_points_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Instances")).only_instances();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Vector>(N_("Position")).implicit_field(implicit_field_inputs::position);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Position")).implicit_field_on_all(implicit_field_inputs::position);
b.add_input<decl::Float>(N_("Radius"))
.default_value(0.05f)
.min(0.0f)
.subtype(PROP_DISTANCE)
.supports_field();
b.add_output<decl::Geometry>(N_("Points"));
.field_on_all();
b.add_output<decl::Geometry>(N_("Points")).propagate_all();
}
static void convert_instances_to_points(GeometrySet &geometry_set,

View File

@ -21,11 +21,11 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Color>(N_("Value"), "Value_Color").supports_field();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").supports_field();
b.add_output<decl::Float>(N_("Value"), "Value_Float").field_source();
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source();
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").field_source();
b.add_output<decl::Color>(N_("Value"), "Value_Color").field_source();
b.add_output<decl::Bool>(N_("Value"), "Value_Bool").field_source();
b.add_output<decl::Float>(N_("Value"), "Value_Float").field_source_reference_all();
b.add_output<decl::Int>(N_("Value"), "Value_Int").field_source_reference_all();
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").field_source_reference_all();
b.add_output<decl::Color>(N_("Value"), "Value_Color").field_source_reference_all();
b.add_output<decl::Bool>(N_("Value"), "Value_Bool").field_source_reference_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -11,7 +11,7 @@ namespace blender::nodes::node_geo_join_geometry_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry")).multi_input();
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
template<typename Component>

View File

@ -17,7 +17,7 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Geometry>(N_("Geometry")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Material>(N_("Old"));
b.add_input<decl::Material>(N_("New"));
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -19,9 +19,9 @@ static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"))
.supported_type({GEO_COMPONENT_TYPE_POINT_CLOUD, GEO_COMPONENT_TYPE_MESH});
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Float>(N_("Distance")).default_value(0.001f).min(0.0f).subtype(PROP_DISTANCE);
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -18,7 +18,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.description(N_("An identifier for the group of each face. All contiguous faces with the "
"same value are in the same region"));
b.add_output<decl::Bool>(N_("Boundary Edges"))
.field_source()
.field_source_reference_all()
.description(N_("The edges that lie on the boundaries between the different face sets"));
}

View File

@ -748,10 +748,10 @@ static void node_declare(NodeDeclarationBuilder &b)
.subtype(PROP_DISTANCE)
.description(N_("Height of the generated cone"));
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Bool>(N_("Top")).field_source();
b.add_output<decl::Bool>(N_("Bottom")).field_source();
b.add_output<decl::Bool>(N_("Side")).field_source();
b.add_output<decl::Vector>(N_("UV Map")).field_source();
b.add_output<decl::Bool>(N_("Top")).field_on_all();
b.add_output<decl::Bool>(N_("Bottom")).field_on_all();
b.add_output<decl::Bool>(N_("Side")).field_on_all();
b.add_output<decl::Vector>(N_("UV Map")).field_on_all();
}
static void node_init(bNodeTree * /*tree*/, bNode *node)

View File

@ -35,7 +35,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.max(1000)
.description(N_("Number of vertices for the Z side of the shape"));
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Vector>(N_("UV Map")).field_source();
b.add_output<decl::Vector>(N_("UV Map")).field_on_all();
}
static Mesh *create_cuboid_mesh(const float3 &size,

View File

@ -43,10 +43,10 @@ static void node_declare(NodeDeclarationBuilder &b)
.subtype(PROP_DISTANCE)
.description(N_("The height of the cylinder"));
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Bool>(N_("Top")).field_source();
b.add_output<decl::Bool>(N_("Side")).field_source();
b.add_output<decl::Bool>(N_("Bottom")).field_source();
b.add_output<decl::Vector>(N_("UV Map")).field_source();
b.add_output<decl::Bool>(N_("Top")).field_on_all();
b.add_output<decl::Bool>(N_("Side")).field_on_all();
b.add_output<decl::Bool>(N_("Bottom")).field_on_all();
b.add_output<decl::Vector>(N_("UV Map")).field_on_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -180,7 +180,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.max(1000)
.description(N_("Number of vertices in the Y direction"));
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Vector>(N_("UV Map")).field_source();
b.add_output<decl::Vector>(N_("UV Map")).field_on_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -25,7 +25,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.max(7)
.description(N_("Number of subdivisions on top of the basic icosahedron"));
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Vector>(N_("UV Map")).field_source();
b.add_output<decl::Vector>(N_("UV Map")).field_on_all();
}
static Mesh *create_ico_sphere_mesh(const int subdivisions,

View File

@ -33,7 +33,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.subtype(PROP_DISTANCE)
.description(N_("Distance from the generated points to the origin"));
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Vector>(N_("UV Map")).field_source();
b.add_output<decl::Vector>(N_("UV Map")).field_on_all();
}
static int sphere_vert_total(const int segments, const int rings)

View File

@ -15,7 +15,7 @@ static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Int>(N_("Level")).default_value(1).min(0).max(6);
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
}
static void geometry_set_mesh_subdivide(GeometrySet &geometry_set, const int level)

View File

@ -11,8 +11,8 @@ namespace blender::nodes::node_geo_mesh_to_curve_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_output<decl::Geometry>(N_("Curve"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -23,14 +23,14 @@ NODE_STORAGE_FUNCS(NodeGeometryMeshToPoints)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on_all().hide_value();
b.add_input<decl::Vector>(N_("Position")).implicit_field(implicit_field_inputs::position);
b.add_input<decl::Float>(N_("Radius"))
.default_value(0.05f)
.min(0.0f)
.subtype(PROP_DISTANCE)
.supports_field();
b.add_output<decl::Geometry>(N_("Points"));
.field_on_all();
b.add_output<decl::Geometry>(N_("Points")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -22,10 +22,11 @@ static void node_declare(NodeDeclarationBuilder &b)
.supports_field()
.description(N_("Which of the sorted corners to output"));
b.add_output<decl::Int>(N_("Corner Index"))
.dependent_field()
.field_source_reference_all()
.description(N_("A corner of the face, chosen by the sort index"));
b.add_output<decl::Int>(N_("Total"))
.dependent_field()
.field_source()
.reference_pass({0})
.description(N_("The number of corners in the face"));
}

View File

@ -25,10 +25,11 @@ static void node_declare(NodeDeclarationBuilder &b)
.supports_field()
.description(N_("Which of the sorted corners to output"));
b.add_output<decl::Int>(N_("Corner Index"))
.dependent_field()
.field_source_reference_all()
.description(N_("A corner connected to the face, chosen by the sort index"));
b.add_output<decl::Int>(N_("Total"))
.dependent_field()
.field_source()
.reference_pass({0})
.description(N_("The number of faces or corners connected to each vertex"));
}

View File

@ -16,11 +16,11 @@ static void node_declare(NodeDeclarationBuilder &b)
.description(
N_("The corner to retrieve data from. Defaults to the corner from the context"));
b.add_output<decl::Int>(N_("Next Edge Index"))
.dependent_field()
.field_source_reference_all()
.description(
N_("The edge after the corner in the face, in the direction of increasing indices"));
b.add_output<decl::Int>(N_("Previous Edge Index"))
.dependent_field()
.field_source_reference_all()
.description(
N_("The edge before the corner in the face, in the direction of decreasing indices"));
}

View File

@ -25,10 +25,11 @@ static void node_declare(NodeDeclarationBuilder &b)
.supports_field()
.description(N_("Which of the sorted edges to output"));
b.add_output<decl::Int>(N_("Edge Index"))
.dependent_field()
.field_source_reference_all()
.description(N_("An edge connected to the face, chosen by the sort index"));
b.add_output<decl::Int>(N_("Total"))
.dependent_field()
.field_source()
.reference_pass({0})
.description(N_("The number of edges connected to each vertex"));
}

View File

@ -14,10 +14,10 @@ static void node_declare(NodeDeclarationBuilder &b)
.description(
N_("The corner to retrieve data from. Defaults to the corner from the context"));
b.add_output<decl::Int>(N_("Face Index"))
.dependent_field()
.field_source_reference_all()
.description(N_("The index of the face the corner is a part of"));
b.add_output<decl::Int>(N_("Index in Face"))
.dependent_field()
.field_source_reference_all()
.description(N_("The index of the corner starting from the first corner in the face"));
}

View File

@ -20,7 +20,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.description(N_("The number of corners to move around the face before finding the result, "
"circling around the start of the face if necessary"));
b.add_output<decl::Int>(N_("Corner Index"))
.dependent_field()
.field_source_reference_all()
.description(N_("The index of the offset corner"));
}

View File

@ -15,7 +15,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.description(
N_("The corner to retrieve data from. Defaults to the corner from the context"));
b.add_output<decl::Int>(N_("Vertex Index"))
.dependent_field()
.field_source_reference_all()
.description(N_("The vertex the corner is attached to"));
}

View File

@ -34,11 +34,11 @@ static void node_declare(NodeDeclarationBuilder &b)
.supports_field()
.description(N_("The number of control points along the curve to traverse"));
b.add_output<decl::Bool>(N_("Is Valid Offset"))
.dependent_field()
.field_source_reference_all()
.description(N_("Whether the input control point plus the offset is a valid index of the "
"original curve"));
b.add_output<decl::Int>(N_("Point Index"))
.dependent_field()
.field_source_reference_all()
.description(N_("The index of the control point plus the offset within the entire "
"curves data-block"));
}

View File

@ -16,8 +16,8 @@ using blender::Array;
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Points")).supported_type(GEO_COMPONENT_TYPE_POINT_CLOUD);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on_all().hide_value();
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
}
/* One improvement would be to move the attribute arrays directly to the mesh when possible. */

View File

@ -41,7 +41,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.default_value(0.5f)
.min(0.0f)
.subtype(PROP_DISTANCE)
.supports_field();
.field_on_all();
b.add_output<decl::Geometry>(N_("Volume"));
}

View File

@ -23,8 +23,8 @@ static void node_declare(NodeDeclarationBuilder &b)
.only_realized_data()
.supported_type({GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_POINT_CLOUD});
b.add_input<decl::Vector>(N_("Source Position")).implicit_field(implicit_field_inputs::position);
b.add_output<decl::Vector>(N_("Position")).dependent_field();
b.add_output<decl::Float>(N_("Distance")).dependent_field();
b.add_output<decl::Vector>(N_("Position")).dependent_field().reference_pass_all();
b.add_output<decl::Float>(N_("Distance")).dependent_field().reference_pass_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -25,11 +25,11 @@ static void node_declare(NodeDeclarationBuilder &b)
.only_realized_data()
.supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Vector>(N_("Attribute")).hide_value().supports_field();
b.add_input<decl::Float>(N_("Attribute"), "Attribute_001").hide_value().supports_field();
b.add_input<decl::Color>(N_("Attribute"), "Attribute_002").hide_value().supports_field();
b.add_input<decl::Bool>(N_("Attribute"), "Attribute_003").hide_value().supports_field();
b.add_input<decl::Int>(N_("Attribute"), "Attribute_004").hide_value().supports_field();
b.add_input<decl::Vector>(N_("Attribute")).hide_value().field_on_all();
b.add_input<decl::Float>(N_("Attribute"), "Attribute_001").hide_value().field_on_all();
b.add_input<decl::Color>(N_("Attribute"), "Attribute_002").hide_value().field_on_all();
b.add_input<decl::Bool>(N_("Attribute"), "Attribute_003").hide_value().field_on_all();
b.add_input<decl::Int>(N_("Attribute"), "Attribute_004").hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Source Position")).implicit_field(implicit_field_inputs::position);
b.add_input<decl::Vector>(N_("Ray Direction"))

View File

@ -12,7 +12,7 @@ namespace blender::nodes::node_geo_realize_instances_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -10,7 +10,7 @@ static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Name")).is_attribute_name();
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -11,11 +11,11 @@ namespace blender::nodes::node_geo_rotate_instances_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Instances")).only_instances();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER).supports_field();
b.add_input<decl::Vector>(N_("Pivot Point")).subtype(PROP_TRANSLATION).supports_field();
b.add_input<decl::Bool>(N_("Local Space")).default_value(true).supports_field();
b.add_output<decl::Geometry>(N_("Instances"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER).field_on_all();
b.add_input<decl::Vector>(N_("Pivot Point")).subtype(PROP_TRANSLATION).field_on_all();
b.add_input<decl::Bool>(N_("Local Space")).default_value(true).field_on_all();
b.add_output<decl::Geometry>(N_("Instances")).propagate_all();
}
static void rotate_instances(GeoNodeExecParams &params, bke::Instances &instances)

View File

@ -23,11 +23,11 @@ static void node_declare(NodeDeclarationBuilder &b)
GEO_COMPONENT_TYPE_CURVE,
GEO_COMPONENT_TYPE_INSTANCES});
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().supports_field();
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().supports_field();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().supports_field();
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().supports_field();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().supports_field();
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().field_on_all();
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().field_on_all();
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().field_on_all();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().field_on_all();
b.add_input<decl::Int>(N_("Index"))
.supports_field()
.description(N_("Which element to retrieve a value from on the geometry"));

View File

@ -23,11 +23,11 @@ static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().supports_field();
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().supports_field();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().supports_field();
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().supports_field();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().supports_field();
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().field_on_all();
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().field_on_all();
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().field_on_all();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Sample Position")).implicit_field(implicit_field_inputs::position);

View File

@ -21,15 +21,15 @@ static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().supports_field();
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().supports_field();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().supports_field();
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().supports_field();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().supports_field();
b.add_input<decl::Float>(N_("Value"), "Value_Float").hide_value().field_on_all();
b.add_input<decl::Int>(N_("Value"), "Value_Int").hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").hide_value().field_on_all();
b.add_input<decl::Color>(N_("Value"), "Value_Color").hide_value().field_on_all();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Source UV Map"))
.hide_value()
.supports_field()
.field_on_all()
.description(N_("The mesh UV map to sample. Should not have overlapping faces"));
b.add_input<decl::Vector>(N_("Sample UV"))
.supports_field()

View File

@ -21,19 +21,19 @@ namespace blender::nodes::node_geo_scale_elements_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Float>(N_("Scale"), "Scale").default_value(1.0f).min(0.0f).supports_field();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Float>(N_("Scale"), "Scale").default_value(1.0f).min(0.0f).field_on_all();
b.add_input<decl::Vector>(N_("Center"))
.subtype(PROP_TRANSLATION)
.implicit_field(implicit_field_inputs::position)
.implicit_field_on_all(implicit_field_inputs::position)
.description(N_("Origin of the scaling for each element. If multiple elements are "
"connected, their center is averaged"));
b.add_input<decl::Vector>(N_("Axis"))
.default_value({1.0f, 0.0f, 0.0f})
.supports_field()
.field_on_all()
.description(N_("Direction in which to scale the element"))
.make_available([](bNode &node) { node.custom2 = GEO_NODE_SCALE_ELEMENTS_SINGLE_AXIS; });
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
};
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -11,14 +11,11 @@ namespace blender::nodes::node_geo_scale_instances_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Instances")).only_instances();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Vector>(N_("Scale"))
.subtype(PROP_XYZ)
.default_value({1, 1, 1})
.supports_field();
b.add_input<decl::Vector>(N_("Center")).subtype(PROP_TRANSLATION).supports_field();
b.add_input<decl::Bool>(N_("Local Space")).default_value(true).supports_field();
b.add_output<decl::Geometry>(N_("Instances"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Scale")).subtype(PROP_XYZ).default_value({1, 1, 1}).field_on_all();
b.add_input<decl::Vector>(N_("Center")).subtype(PROP_TRANSLATION).field_on_all();
b.add_input<decl::Bool>(N_("Local Space")).default_value(true).field_on_all();
b.add_output<decl::Geometry>(N_("Instances")).propagate_all();
}
static void scale_instances(GeoNodeExecParams &params, bke::Instances &instances)

View File

@ -7,11 +7,11 @@ namespace blender::nodes::node_geo_separate_components_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Geometry>(N_("Point Cloud"));
b.add_output<decl::Geometry>(N_("Curve"));
b.add_output<decl::Geometry>(N_("Volume"));
b.add_output<decl::Geometry>(N_("Instances"));
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
b.add_output<decl::Geometry>(N_("Point Cloud")).propagate_all();
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
b.add_output<decl::Geometry>(N_("Volume")).propagate_all();
b.add_output<decl::Geometry>(N_("Instances")).propagate_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -15,11 +15,13 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Bool>(N_("Selection"))
.default_value(true)
.hide_value()
.supports_field()
.field_on_all()
.description(N_("The parts of the geometry that go into the first output"));
b.add_output<decl::Geometry>(N_("Selection"))
.propagate_all()
.description(N_("The parts of the geometry in the selection"));
b.add_output<decl::Geometry>(N_("Inverted"))
.propagate_all()
.description(N_("The parts of the geometry not in the selection"));
}

View File

@ -16,14 +16,16 @@ NODE_STORAGE_FUNCS(NodeGeometrySetCurveHandlePositions)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Vector>(N_("Position")).implicit_field([](const bNode &node, void *r_value) {
const StringRef side = node_storage(node).mode == GEO_NODE_CURVE_HANDLE_LEFT ? "handle_left" :
"handle_right";
new (r_value) ValueOrField<float3>(bke::AttributeFieldInput::Create<float3>(side));
});
b.add_input<decl::Vector>(N_("Offset")).default_value(float3(0.0f, 0.0f, 0.0f)).supports_field();
b.add_output<decl::Geometry>(N_("Curve"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Position"))
.implicit_field_on_all([](const bNode &node, void *r_value) {
const StringRef side = node_storage(node).mode == GEO_NODE_CURVE_HANDLE_LEFT ?
"handle_left" :
"handle_right";
new (r_value) ValueOrField<float3>(bke::AttributeFieldInput::Create<float3>(side));
});
b.add_input<decl::Vector>(N_("Offset")).default_value(float3(0.0f, 0.0f, 0.0f)).field_on_all();
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -12,8 +12,8 @@ namespace blender::nodes::node_geo_set_curve_normal_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_output<decl::Geometry>(N_("Curve"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -9,13 +9,13 @@ namespace blender::nodes::node_geo_set_curve_radius_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Float>(N_("Radius"))
.min(0.0f)
.default_value(0.005f)
.supports_field()
.subtype(PROP_DISTANCE);
b.add_output<decl::Geometry>(N_("Curve"));
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void set_radius(bke::CurvesGeometry &curves,

View File

@ -9,9 +9,9 @@ namespace blender::nodes::node_geo_set_curve_tilt_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Curve")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Float>(N_("Tilt")).subtype(PROP_ANGLE).supports_field();
b.add_output<decl::Geometry>(N_("Curve"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Float>(N_("Tilt")).subtype(PROP_ANGLE).field_on_all();
b.add_output<decl::Geometry>(N_("Curve")).propagate_all();
}
static void set_tilt(bke::CurvesGeometry &curves,

View File

@ -7,9 +7,9 @@ namespace blender::nodes::node_geo_set_id_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Int>(N_("ID")).implicit_field(implicit_field_inputs::index);
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Int>(N_("ID")).implicit_field_on_all(implicit_field_inputs::index);
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void set_id_in_component(GeometryComponent &component,

View File

@ -23,9 +23,9 @@ static void node_declare(NodeDeclarationBuilder &b)
GEO_COMPONENT_TYPE_VOLUME,
GEO_COMPONENT_TYPE_POINT_CLOUD,
GEO_COMPONENT_TYPE_CURVE});
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Material>(N_("Material")).hide_label();
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void assign_material_to_faces(Mesh &mesh, const IndexMask selection, Material *material)

View File

@ -7,9 +7,9 @@ namespace blender::nodes::node_geo_set_material_index_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Int>(N_("Material Index")).supports_field().min(0);
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Int>(N_("Material Index")).field_on_all().min(0);
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void set_material_index_in_component(GeometryComponent &component,

View File

@ -9,13 +9,13 @@ namespace blender::nodes::node_geo_set_point_radius_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Points")).supported_type(GEO_COMPONENT_TYPE_POINT_CLOUD);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Float>(N_("Radius"))
.default_value(0.05f)
.min(0.0f)
.supports_field()
.field_on_all()
.subtype(PROP_DISTANCE);
b.add_output<decl::Geometry>(N_("Points"));
b.add_output<decl::Geometry>(N_("Points")).propagate_all();
}
static void set_radius_in_component(PointCloud &pointcloud,

View File

@ -17,10 +17,10 @@ namespace blender::nodes::node_geo_set_position_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Vector>(N_("Position")).implicit_field(implicit_field_inputs::position);
b.add_input<decl::Vector>(N_("Offset")).supports_field().subtype(PROP_TRANSLATION);
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Position")).implicit_field_on_all(implicit_field_inputs::position);
b.add_input<decl::Vector>(N_("Offset")).field_on_all().subtype(PROP_TRANSLATION);
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void set_computed_position_and_offset(GeometryComponent &component,

View File

@ -9,9 +9,9 @@ namespace blender::nodes::node_geo_set_shade_smooth_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Bool>(N_("Shade Smooth")).supports_field().default_value(true);
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Bool>(N_("Shade Smooth")).field_on_all().default_value(true);
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void set_smooth(Mesh &mesh,

View File

@ -9,9 +9,9 @@ namespace blender::nodes::node_geo_set_spline_cyclic_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Bool>(N_("Cyclic")).supports_field();
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Bool>(N_("Cyclic")).field_on_all();
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void set_cyclic(bke::CurvesGeometry &curves,

View File

@ -9,9 +9,9 @@ namespace blender::nodes::node_geo_set_spline_resolution_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry")).supported_type(GEO_COMPONENT_TYPE_CURVE);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Int>(N_("Resolution")).min(1).default_value(12).supports_field();
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Int>(N_("Resolution")).min(1).default_value(12).field_on_all();
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void set_resolution(bke::CurvesGeometry &curves,

View File

@ -21,13 +21,13 @@ static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::String>(N_("Name")).is_attribute_name();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").supports_field();
b.add_input<decl::Float>(N_("Value"), "Value_Float").supports_field();
b.add_input<decl::Color>(N_("Value"), "Value_Color").supports_field();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").supports_field();
b.add_input<decl::Int>(N_("Value"), "Value_Int").supports_field();
b.add_input<decl::Vector>(N_("Value"), "Value_Vector").field_on_all();
b.add_input<decl::Float>(N_("Value"), "Value_Float").field_on_all();
b.add_input<decl::Color>(N_("Value"), "Value_Color").field_on_all();
b.add_input<decl::Bool>(N_("Value"), "Value_Bool").field_on_all();
b.add_input<decl::Int>(N_("Value"), "Value_Int").field_on_all();
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -54,8 +54,8 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_output<decl::String>(N_("Remainder")).make_available([](bNode &node) {
node_storage(node).overflow = GEO_NODE_STRING_TO_CURVES_MODE_TRUNCATE;
});
b.add_output<decl::Int>(N_("Line")).field_source();
b.add_output<decl::Vector>(N_("Pivot Point")).field_source();
b.add_output<decl::Int>(N_("Line")).field_on_all();
b.add_output<decl::Vector>(N_("Pivot Point")).field_on_all();
}
static void node_layout(uiLayout *layout, struct bContext *C, PointerRNA *ptr)

View File

@ -28,15 +28,15 @@ static void node_declare(NodeDeclarationBuilder &b)
.default_value(0.0f)
.min(0.0f)
.max(1.0f)
.supports_field()
.field_on_all()
.subtype(PROP_FACTOR);
b.add_input<decl::Float>(N_("Vertex Crease"))
.default_value(0.0f)
.min(0.0f)
.max(1.0f)
.supports_field()
.field_on_all()
.subtype(PROP_FACTOR);
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -59,13 +59,13 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Image>(N_("False"), "False_011");
b.add_input<decl::Image>(N_("True"), "True_011");
b.add_output<decl::Float>(N_("Output")).dependent_field();
b.add_output<decl::Int>(N_("Output"), "Output_001").dependent_field();
b.add_output<decl::Bool>(N_("Output"), "Output_002").dependent_field();
b.add_output<decl::Vector>(N_("Output"), "Output_003").dependent_field();
b.add_output<decl::Color>(N_("Output"), "Output_004").dependent_field();
b.add_output<decl::String>(N_("Output"), "Output_005").dependent_field();
b.add_output<decl::Geometry>(N_("Output"), "Output_006");
b.add_output<decl::Float>(N_("Output")).dependent_field().reference_pass_all();
b.add_output<decl::Int>(N_("Output"), "Output_001").dependent_field().reference_pass_all();
b.add_output<decl::Bool>(N_("Output"), "Output_002").dependent_field().reference_pass_all();
b.add_output<decl::Vector>(N_("Output"), "Output_003").dependent_field().reference_pass_all();
b.add_output<decl::Color>(N_("Output"), "Output_004").dependent_field().reference_pass_all();
b.add_output<decl::String>(N_("Output"), "Output_005").dependent_field().reference_pass_all();
b.add_output<decl::Geometry>(N_("Output"), "Output_006").propagate_all();
b.add_output<decl::Object>(N_("Output"), "Output_007");
b.add_output<decl::Collection>(N_("Output"), "Output_008");
b.add_output<decl::Texture>(N_("Output"), "Output_009");

View File

@ -256,7 +256,7 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Vector>(N_("Translation")).subtype(PROP_TRANSLATION);
b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER);
b.add_input<decl::Vector>(N_("Scale")).default_value({1, 1, 1}).subtype(PROP_XYZ);
b.add_output<decl::Geometry>(N_("Geometry"));
b.add_output<decl::Geometry>(N_("Geometry")).propagate_all();
}
static void node_geo_exec(GeoNodeExecParams params)

View File

@ -11,10 +11,10 @@ namespace blender::nodes::node_geo_translate_instances_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Instances")).only_instances();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().supports_field();
b.add_input<decl::Vector>(N_("Translation")).subtype(PROP_TRANSLATION).supports_field();
b.add_input<decl::Bool>(N_("Local Space")).default_value(true).supports_field();
b.add_output<decl::Geometry>(N_("Instances"));
b.add_input<decl::Bool>(N_("Selection")).default_value(true).hide_value().field_on_all();
b.add_input<decl::Vector>(N_("Translation")).subtype(PROP_TRANSLATION).field_on_all();
b.add_input<decl::Bool>(N_("Local Space")).default_value(true).field_on_all();
b.add_output<decl::Geometry>(N_("Instances")).propagate_all();
}
static void translate_instances(GeoNodeExecParams &params, bke::Instances &instances)

View File

@ -18,9 +18,9 @@ namespace blender::nodes::node_geo_triangulate_cc {
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Mesh")).supported_type(GEO_COMPONENT_TYPE_MESH);
b.add_input<decl::Bool>(N_("Selection")).default_value(true).supports_field().hide_value();
b.add_input<decl::Bool>(N_("Selection")).default_value(true).field_on_all().hide_value();
b.add_input<decl::Int>(N_("Minimum Vertices")).default_value(4).min(4).max(10000);
b.add_output<decl::Geometry>(N_("Mesh"));
b.add_output<decl::Geometry>(N_("Mesh")).propagate_all();
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -27,7 +27,7 @@ static void node_declare(NodeDeclarationBuilder &b)
b.add_input<decl::Bool>(N_("Rotate"))
.default_value(true)
.description(N_("Rotate islands for best fit"));
b.add_output<decl::Vector>(N_("UV")).field_source();
b.add_output<decl::Vector>(N_("UV")).field_source_reference_all();
}
static VArray<float3> construct_uv_gvarray(const Mesh &mesh,

View File

@ -36,7 +36,7 @@ static void node_declare(NodeDeclarationBuilder &b)
.default_value(true)
.description(N_("Virtually fill holes in mesh before unwrapping, to better avoid overlaps "
"and preserve symmetry"));
b.add_output<decl::Vector>(N_("UV")).field_source().description(
b.add_output<decl::Vector>(N_("UV")).field_source_reference_all().description(
N_("UV coordinates between 0 and 1 for each face corner in the selected faces"));
}

View File

@ -19,11 +19,11 @@ NODE_STORAGE_FUNCS(NodeGeometryViewer)
static void node_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Geometry>(N_("Geometry"));
b.add_input<decl::Float>(N_("Value")).supports_field().hide_value();
b.add_input<decl::Vector>(N_("Value"), "Value_001").supports_field().hide_value();
b.add_input<decl::Color>(N_("Value"), "Value_002").supports_field().hide_value();
b.add_input<decl::Int>(N_("Value"), "Value_003").supports_field().hide_value();
b.add_input<decl::Bool>(N_("Value"), "Value_004").supports_field().hide_value();
b.add_input<decl::Float>(N_("Value")).field_on_all().hide_value();
b.add_input<decl::Vector>(N_("Value"), "Value_001").field_on_all().hide_value();
b.add_input<decl::Color>(N_("Value"), "Value_002").field_on_all().hide_value();
b.add_input<decl::Int>(N_("Value"), "Value_003").field_on_all().hide_value();
b.add_input<decl::Bool>(N_("Value"), "Value_004").field_on_all().hide_value();
}
static void node_init(bNodeTree * /*tree*/, bNode *node)

View File

@ -1,6 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include "NOD_node_declaration.hh"
#include "NOD_socket_declarations.hh"
#include "NOD_socket_declarations_geometry.hh"
#include "BKE_geometry_fields.hh"
#include "BKE_node.h"
@ -17,17 +19,113 @@ void build_node_declaration(const bNodeType &typeinfo, NodeDeclaration &r_declar
void NodeDeclarationBuilder::finalize()
{
if (is_function_node_) {
for (SocketDeclarationPtr &socket_decl : declaration_.inputs) {
if (socket_decl->input_field_type != InputSocketFieldType::Implicit) {
socket_decl->input_field_type = InputSocketFieldType::IsSupported;
for (std::unique_ptr<BaseSocketDeclarationBuilder> &socket_builder : input_builders_) {
SocketDeclaration &socket_decl = *socket_builder->declaration();
if (socket_decl.input_field_type != InputSocketFieldType::Implicit) {
socket_decl.input_field_type = InputSocketFieldType::IsSupported;
}
}
for (SocketDeclarationPtr &socket_decl : declaration_.outputs) {
socket_decl->output_field_dependency = OutputFieldDependency::ForDependentField();
for (std::unique_ptr<BaseSocketDeclarationBuilder> &socket_builder : output_builders_) {
SocketDeclaration &socket_decl = *socket_builder->declaration();
socket_decl.output_field_dependency = OutputFieldDependency::ForDependentField();
socket_builder->reference_pass_all_ = true;
}
}
Vector<int> geometry_inputs;
for (const int i : declaration_.inputs.index_range()) {
if (dynamic_cast<decl::Geometry *>(declaration_.inputs[i].get())) {
geometry_inputs.append(i);
}
}
Vector<int> geometry_outputs;
for (const int i : declaration_.outputs.index_range()) {
if (dynamic_cast<decl::Geometry *>(declaration_.outputs[i].get())) {
geometry_outputs.append(i);
}
}
for (std::unique_ptr<BaseSocketDeclarationBuilder> &socket_builder : input_builders_) {
if (socket_builder->field_on_all_) {
aal::RelationsInNode &relations = this->get_anonymous_attribute_relations();
const int field_input = socket_builder->index_;
for (const int geometry_input : geometry_inputs) {
relations.eval_relations.append({field_input, geometry_input});
}
}
}
for (std::unique_ptr<BaseSocketDeclarationBuilder> &socket_builder : output_builders_) {
if (socket_builder->field_on_all_) {
aal::RelationsInNode &relations = this->get_anonymous_attribute_relations();
const int field_output = socket_builder->index_;
for (const int geometry_output : geometry_outputs) {
relations.available_relations.append({field_output, geometry_output});
}
}
if (socket_builder->reference_pass_all_) {
aal::RelationsInNode &relations = this->get_anonymous_attribute_relations();
const int field_output = socket_builder->index_;
for (const int input_i : declaration_.inputs.index_range()) {
SocketDeclaration &input_socket_decl = *declaration_.inputs[input_i];
if (input_socket_decl.input_field_type != InputSocketFieldType::None) {
relations.reference_relations.append({input_i, field_output});
}
}
}
if (socket_builder->propagate_from_all_) {
aal::RelationsInNode &relations = this->get_anonymous_attribute_relations();
const int geometry_output = socket_builder->index_;
for (const int geometry_input : geometry_inputs) {
relations.propagate_relations.append({geometry_input, geometry_output});
}
}
}
}
namespace anonymous_attribute_lifetime {
bool operator==(const RelationsInNode &a, const RelationsInNode &b)
{
return a.propagate_relations == b.propagate_relations &&
a.reference_relations == b.reference_relations && a.eval_relations == b.eval_relations &&
a.available_relations == b.available_relations &&
a.available_on_none == b.available_on_none;
}
bool operator!=(const RelationsInNode &a, const RelationsInNode &b)
{
return !(a == b);
}
std::ostream &operator<<(std::ostream &stream, const RelationsInNode &relations)
{
stream << "Propagate Relations: " << relations.propagate_relations.size() << "\n";
for (const PropagateRelation &relation : relations.propagate_relations) {
stream << " " << relation.from_geometry_input << " -> " << relation.to_geometry_output
<< "\n";
}
stream << "Reference Relations: " << relations.reference_relations.size() << "\n";
for (const ReferenceRelation &relation : relations.reference_relations) {
stream << " " << relation.from_field_input << " -> " << relation.to_field_output << "\n";
}
stream << "Eval Relations: " << relations.eval_relations.size() << "\n";
for (const EvalRelation &relation : relations.eval_relations) {
stream << " eval " << relation.field_input << " on " << relation.geometry_input << "\n";
}
stream << "Available Relations: " << relations.available_relations.size() << "\n";
for (const AvailableRelation &relation : relations.available_relations) {
stream << " " << relation.field_output << " available on " << relation.geometry_output
<< "\n";
}
stream << "Available on None: " << relations.available_on_none.size() << "\n";
for (const int i : relations.available_on_none) {
stream << " output " << i << " available on none\n";
}
return stream;
}
} // namespace anonymous_attribute_lifetime
bool NodeDeclaration::matches(const bNode &node) const
{
auto check_sockets = [&](ListBase sockets, Span<SocketDeclarationPtr> socket_decls) {