diff options
27 files changed, 102 insertions, 77 deletions
diff --git a/source/blender/nodes/NOD_node_declaration.hh b/source/blender/nodes/NOD_node_declaration.hh index 42755b2e8dd..13f8af4ddf5 100644 --- a/source/blender/nodes/NOD_node_declaration.hh +++ b/source/blender/nodes/NOD_node_declaration.hh @@ -65,6 +65,8 @@ struct FieldInferencingInterface { Vector<OutputFieldDependency> outputs; }; +using ImplicitInputValueFn = std::function<void(const bNode &node, void *r_value)>; + /** * Describes a single input or output socket. This is subclassed for different socket types. */ @@ -103,6 +105,10 @@ class SocketDeclaration { /** Utility method to make the socket available if there is a straightforward way to do so. */ std::function<void(bNode &)> make_available_fn_; + /** Some input sockets can have non-trivial values in the case when they are unlinked. This + * callback computes the default input of a values in geometry nodes when nothing is linked. */ + std::unique_ptr<ImplicitInputValueFn> implicit_input_fn_; + friend NodeDeclarationBuilder; template<typename SocketDecl> friend class SocketDeclarationBuilder; @@ -140,6 +146,11 @@ class SocketDeclaration { bool compositor_skip_realization() const; bool compositor_expects_single_value() const; + const ImplicitInputValueFn *implicit_input_fn() const + { + return implicit_input_fn_.get(); + } + protected: void set_common_flags(bNodeSocket &socket) const; bool matches_common_data(const bNodeSocket &socket) const; @@ -225,10 +236,11 @@ class SocketDeclarationBuilder : public BaseSocketDeclarationBuilder { } /** The input supports a field and is a field by default when nothing is connected. */ - Self &implicit_field() + Self &implicit_field(ImplicitInputValueFn fn) { this->hide_value(); decl_->input_field_type_ = InputSocketFieldType::Implicit; + decl_->implicit_input_fn_ = std::make_unique<ImplicitInputValueFn>(std::move(fn)); return *(Self *)this; } @@ -348,6 +360,13 @@ class NodeDeclarationBuilder { eNodeSocketInOut in_out); }; +namespace implicit_field_inputs { +void position(const bNode &node, void *r_value); +void normal(const bNode &node, void *r_value); +void index(const bNode &node, void *r_value); +void id_or_index(const bNode &node, void *r_value); +} // namespace implicit_field_inputs + /* -------------------------------------------------------------------- */ /** \name #OutputFieldDependency Inline Methods * \{ */ diff --git a/source/blender/nodes/function/nodes/node_fn_random_value.cc b/source/blender/nodes/function/nodes/node_fn_random_value.cc index 360695299cb..341a3fbfa75 100644 --- a/source/blender/nodes/function/nodes/node_fn_random_value.cc +++ b/source/blender/nodes/function/nodes/node_fn_random_value.cc @@ -33,7 +33,7 @@ static void fn_node_random_value_declare(NodeDeclarationBuilder &b) .subtype(PROP_FACTOR) .supports_field() .make_available([](bNode &node) { node_storage(node).data_type = CD_PROP_BOOL; }); - b.add_input<decl::Int>(N_("ID")).implicit_field(); + b.add_input<decl::Int>(N_("ID")).implicit_field(implicit_field_inputs::id_or_index); b.add_input<decl::Int>(N_("Seed")).default_value(0).min(-10000).max(10000).supports_field(); b.add_output<decl::Vector>(N_("Value")).dependent_field(); diff --git a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc index c8095c7362b..d03bbbb32e1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_extrude_mesh.cc @@ -24,7 +24,10 @@ 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::Vector>(N_("Offset")).subtype(PROP_TRANSLATION).implicit_field().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::Bool>(N_("Individual")).default_value(true); b.add_output<decl::Geometry>("Mesh"); diff --git a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc index 62d0fe3f9fa..1dd48f437bd 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_image_texture.cc @@ -24,7 +24,7 @@ static void node_declare(NodeDeclarationBuilder &b) { b.add_input<decl::Image>(N_("Image")).hide_label(); b.add_input<decl::Vector>(N_("Vector")) - .implicit_field() + .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(); diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc index d54d082311f..c6f214e72ac 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc @@ -25,7 +25,7 @@ static void node_declare(NodeDeclarationBuilder &b) .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(implicit_field_inputs::id_or_index) .description(N_( "Index of the instance that used for each point. This is only used when Pick Instances " "is on. By default the point index is used")); diff --git a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc index ec2f1b00e6c..d4072a05e5f 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instances_to_points.cc @@ -13,7 +13,7 @@ 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(); + 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) diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc index ce06ccbda75..ceb87c59b8e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_to_points.cc @@ -24,7 +24,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).supports_field().hide_value(); - b.add_input<decl::Vector>(N_("Position")).implicit_field(); + 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) diff --git a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc index 1b906823d04..f453c7cb47a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_proximity.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_proximity.cc @@ -22,7 +22,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input<decl::Geometry>(N_("Target")) .only_realized_data() .supported_type({GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_POINT_CLOUD}); - b.add_input<decl::Vector>(N_("Source Position")).implicit_field(); + 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(); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc index a49b2c70ce2..118d6c2f6c7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_raycast.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_raycast.cc @@ -31,7 +31,7 @@ static void node_declare(NodeDeclarationBuilder &b) 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_("Source Position")).implicit_field(); + b.add_input<decl::Vector>(N_("Source Position")).implicit_field(implicit_field_inputs::position); b.add_input<decl::Vector>(N_("Ray Direction")) .default_value({0.0f, 0.0f, -1.0f}) .supports_field(); diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc index 132b02031dc..95f7c7add3a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest.cc @@ -52,7 +52,7 @@ static void node_declare(NodeDeclarationBuilder &b) { b.add_input<decl::Geometry>(N_("Geometry")) .supported_type({GEO_COMPONENT_TYPE_MESH, GEO_COMPONENT_TYPE_POINT_CLOUD}); - b.add_input<decl::Vector>(N_("Sample Position")).implicit_field(); + b.add_input<decl::Vector>(N_("Sample Position")).implicit_field(implicit_field_inputs::position); b.add_output<decl::Int>(N_("Index")).dependent_field({1}); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc index 9290185aef0..30b3b65f854 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_sample_nearest_surface.cc @@ -35,7 +35,7 @@ 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_input<decl::Vector>(N_("Sample Position")).implicit_field(); + b.add_input<decl::Vector>(N_("Sample Position")).implicit_field(implicit_field_inputs::position); b.add_output<decl::Float>(N_("Value"), "Value_Float").dependent_field({6}); b.add_output<decl::Int>(N_("Value"), "Value_Int").dependent_field({6}); diff --git a/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc b/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc index c70e9c42848..0f3135c799a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_scale_elements.cc @@ -25,7 +25,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Scale"), "Scale").default_value(1.0f).min(0.0f).supports_field(); b.add_input<decl::Vector>(N_("Center")) .subtype(PROP_TRANSLATION) - .implicit_field() + .implicit_field(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")) diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc index e529ddddabe..5610edf7e4c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_curve_handles.cc @@ -17,7 +17,11 @@ 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(); + 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")); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_id.cc b/source/blender/nodes/geometry/nodes/node_geo_set_id.cc index 5864401223b..e308371b1c2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_id.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_id.cc @@ -8,7 +8,7 @@ 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(); + b.add_input<decl::Int>(N_("ID")).implicit_field(implicit_field_inputs::index); b.add_output<decl::Geometry>(N_("Geometry")); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc index 613f140ff0a..e243fe3614c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_set_position.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_set_position.cc @@ -18,7 +18,7 @@ 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(); + 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")); } diff --git a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc index cb296cdd93f..55697478989 100644 --- a/source/blender/nodes/intern/geometry_nodes_lazy_function.cc +++ b/source/blender/nodes/intern/geometry_nodes_lazy_function.cc @@ -1188,70 +1188,27 @@ struct GeometryNodesLazyFunctionGraphBuilder { bool try_add_implicit_input(const bNodeSocket &input_bsocket, lf::InputSocket &input_lf_socket) { const bNode &bnode = input_bsocket.owner_node(); - const NodeDeclaration *node_declaration = bnode.declaration(); - if (node_declaration == nullptr) { + const SocketDeclaration *socket_decl = input_bsocket.runtime->declaration; + if (socket_decl == nullptr) { return false; } - const SocketDeclaration &socket_declaration = - *node_declaration->inputs()[input_bsocket.index()]; - if (socket_declaration.input_field_type() != InputSocketFieldType::Implicit) { + if (socket_decl->input_field_type() != InputSocketFieldType::Implicit) { return false; } - const CPPType &type = input_lf_socket.type(); - std::function<void(void *)> init_fn = this->get_implicit_input_init_function(bnode, - input_bsocket); - if (!init_fn) { + const ImplicitInputValueFn *implicit_input_fn = socket_decl->implicit_input_fn(); + if (implicit_input_fn == nullptr) { return false; } - + std::function<void(void *)> init_fn = [&bnode, implicit_input_fn](void *r_value) { + (*implicit_input_fn)(bnode, r_value); + }; + const CPPType &type = input_lf_socket.type(); auto lazy_function = std::make_unique<LazyFunctionForImplicitInput>(type, std::move(init_fn)); lf::Node &lf_node = lf_graph_->add_function(*lazy_function); lf_graph_info_->functions.append(std::move(lazy_function)); lf_graph_->add_link(lf_node.output(0), input_lf_socket); return true; } - - std::function<void(void *)> get_implicit_input_init_function(const bNode &bnode, - const bNodeSocket &bsocket) - { - const bNodeSocketType &socket_type = *bsocket.typeinfo; - if (socket_type.type == SOCK_VECTOR) { - if (bnode.type == GEO_NODE_SET_CURVE_HANDLES) { - StringRef side = ((NodeGeometrySetCurveHandlePositions *)bnode.storage)->mode == - GEO_NODE_CURVE_HANDLE_LEFT ? - "handle_left" : - "handle_right"; - return [side](void *r_value) { - new (r_value) ValueOrField<float3>(bke::AttributeFieldInput::Create<float3>(side)); - }; - } - else if (bnode.type == GEO_NODE_EXTRUDE_MESH) { - return [](void *r_value) { - new (r_value) - ValueOrField<float3>(Field<float3>(std::make_shared<bke::NormalFieldInput>())); - }; - } - else { - return [](void *r_value) { - new (r_value) ValueOrField<float3>(bke::AttributeFieldInput::Create<float3>("position")); - }; - } - } - else if (socket_type.type == SOCK_INT) { - if (ELEM(bnode.type, FN_NODE_RANDOM_VALUE, GEO_NODE_INSTANCE_ON_POINTS)) { - return [](void *r_value) { - new (r_value) - ValueOrField<int>(Field<int>(std::make_shared<bke::IDAttributeFieldInput>())); - }; - } - else { - return [](void *r_value) { - new (r_value) ValueOrField<int>(Field<int>(std::make_shared<fn::IndexFieldInput>())); - }; - } - } - return {}; - } }; const GeometryNodesLazyFunctionGraphInfo *ensure_geometry_nodes_lazy_function_graph( diff --git a/source/blender/nodes/intern/node_declaration.cc b/source/blender/nodes/intern/node_declaration.cc index 2cd9c6000c0..f323d035668 100644 --- a/source/blender/nodes/intern/node_declaration.cc +++ b/source/blender/nodes/intern/node_declaration.cc @@ -2,6 +2,7 @@ #include "NOD_node_declaration.hh" +#include "BKE_geometry_fields.hh" #include "BKE_node.h" namespace blender::nodes { @@ -81,4 +82,30 @@ bool SocketDeclaration::matches_common_data(const bNodeSocket &socket) const return true; } +namespace implicit_field_inputs { + +void position(const bNode & /*node*/, void *r_value) +{ + new (r_value) fn::ValueOrField<float3>(bke::AttributeFieldInput::Create<float3>("position")); +} + +void normal(const bNode & /*node*/, void *r_value) +{ + new (r_value) + fn::ValueOrField<float3>(fn::Field<float3>(std::make_shared<bke::NormalFieldInput>())); +} + +void index(const bNode & /*node*/, void *r_value) +{ + new (r_value) fn::ValueOrField<int>(fn::Field<int>(std::make_shared<fn::IndexFieldInput>())); +} + +void id_or_index(const bNode & /*node*/, void *r_value) +{ + new (r_value) + fn::ValueOrField<int>(fn::Field<int>(std::make_shared<bke::IDAttributeFieldInput>())); +} + +} // namespace implicit_field_inputs + } // namespace blender::nodes diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc index 9b5b7677b5d..5a7ec408433 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc @@ -13,7 +13,10 @@ namespace blender::nodes::node_shader_tex_brick_cc { static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).min(-10000.0f).max(10000.0f).implicit_field(); + b.add_input<decl::Vector>(N_("Vector")) + .min(-10000.0f) + .max(10000.0f) + .implicit_field(implicit_field_inputs::position); b.add_input<decl::Color>(N_("Color1")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); b.add_input<decl::Color>(N_("Color2")).default_value({0.2f, 0.2f, 0.2f, 1.0f}); b.add_input<decl::Color>(N_("Mortar")).default_value({0.0f, 0.0f, 0.0f, 1.0f}).no_muted_links(); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc index a78103c0f94..fc231d79417 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc @@ -8,7 +8,10 @@ namespace blender::nodes::node_shader_tex_checker_cc { static void sh_node_tex_checker_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).min(-10000.0f).max(10000.0f).implicit_field(); + b.add_input<decl::Vector>(N_("Vector")) + .min(-10000.0f) + .max(10000.0f) + .implicit_field(implicit_field_inputs::position); b.add_input<decl::Color>(N_("Color1")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); b.add_input<decl::Color>(N_("Color2")).default_value({0.2f, 0.2f, 0.2f, 1.0f}); b.add_input<decl::Float>(N_("Scale")) diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc index 37c72ec1f17..bc7837040b7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc @@ -11,7 +11,9 @@ namespace blender::nodes::node_shader_tex_gradient_cc { static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).hide_value().implicit_field(); + b.add_input<decl::Vector>(N_("Vector")) + .hide_value() + .implicit_field(implicit_field_inputs::position); b.add_output<decl::Color>(N_("Color")).no_muted_links(); b.add_output<decl::Float>(N_("Fac")).no_muted_links(); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc index c9588949761..e70539fcf25 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc @@ -8,7 +8,7 @@ namespace blender::nodes::node_shader_tex_image_cc { static void sh_node_tex_image_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).implicit_field(); + b.add_input<decl::Vector>(N_("Vector")).implicit_field(implicit_field_inputs::position); b.add_output<decl::Color>(N_("Color")).no_muted_links(); b.add_output<decl::Float>(N_("Alpha")).no_muted_links(); } diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc index 205d3b89016..86c96cfe70b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc @@ -11,7 +11,7 @@ namespace blender::nodes::node_shader_tex_magic_cc { static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).implicit_field(); + b.add_input<decl::Vector>(N_("Vector")).implicit_field(implicit_field_inputs::position); b.add_input<decl::Float>(N_("Scale")).min(-1000.0f).max(1000.0f).default_value(5.0f); b.add_input<decl::Float>(N_("Distortion")).min(-1000.0f).max(1000.0f).default_value(1.0f); b.add_output<decl::Color>(N_("Color")).no_muted_links(); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc index a2241c2327f..86a79a3f213 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc @@ -15,7 +15,9 @@ NODE_STORAGE_FUNCS(NodeTexMusgrave) static void sh_node_tex_musgrave_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).hide_value().implicit_field(); + b.add_input<decl::Vector>(N_("Vector")) + .hide_value() + .implicit_field(implicit_field_inputs::position); b.add_input<decl::Float>(N_("W")).min(-1000.0f).max(1000.0f).make_available([](bNode &node) { /* Default to 1 instead of 4, because it is much faster. */ node_storage(node).dimensions = 1; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc index 87fb1aeac29..eabe1fa774f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc @@ -15,7 +15,7 @@ NODE_STORAGE_FUNCS(NodeTexNoise) static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).implicit_field(); + b.add_input<decl::Vector>(N_("Vector")).implicit_field(implicit_field_inputs::position); b.add_input<decl::Float>(N_("W")).min(-1000.0f).max(1000.0f).make_available([](bNode &node) { /* Default to 1 instead of 4, because it is much faster. */ node_storage(node).dimensions = 1; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc index 09cda405d72..723cf9322f8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc @@ -15,7 +15,9 @@ NODE_STORAGE_FUNCS(NodeTexVoronoi) static void sh_node_tex_voronoi_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).hide_value().implicit_field(); + b.add_input<decl::Vector>(N_("Vector")) + .hide_value() + .implicit_field(implicit_field_inputs::position); b.add_input<decl::Float>(N_("W")).min(-1000.0f).max(1000.0f).make_available([](bNode &node) { /* Default to 1 instead of 4, because it is much faster. */ node_storage(node).dimensions = 1; diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc index 8475101dbaf..d86b2d820ab 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc @@ -13,7 +13,7 @@ namespace blender::nodes::node_shader_tex_wave_cc { static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).implicit_field(); + b.add_input<decl::Vector>(N_("Vector")).implicit_field(implicit_field_inputs::position); b.add_input<decl::Float>(N_("Scale")).min(-1000.0f).max(1000.0f).default_value(5.0f); b.add_input<decl::Float>(N_("Distortion")).min(-1000.0f).max(1000.0f).default_value(0.0f); b.add_input<decl::Float>(N_("Detail")).min(0.0f).max(15.0f).default_value(2.0f); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc index b738dff413e..d7f985d73fa 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc @@ -13,7 +13,10 @@ namespace blender::nodes::node_shader_tex_white_noise_cc { static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b) { b.is_function_node(); - b.add_input<decl::Vector>(N_("Vector")).min(-10000.0f).max(10000.0f).implicit_field(); + b.add_input<decl::Vector>(N_("Vector")) + .min(-10000.0f) + .max(10000.0f) + .implicit_field(implicit_field_inputs::position); b.add_input<decl::Float>(N_("W")).min(-10000.0f).max(10000.0f).make_available([](bNode &node) { /* Default to 1 instead of 4, because it is faster. */ node.custom1 = 1; |