Geometry Nodes: decentralize implicit input definitions
Previously, all implicit inputs where stored in a centralized place. Now the information which nodes have which implicit inputs is stored in the nodes directly.
This commit is contained in:
@@ -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
|
||||
* \{ */
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"));
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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});
|
||||
}
|
||||
|
||||
|
||||
@@ -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});
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
@@ -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"));
|
||||
}
|
||||
|
||||
@@ -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 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();
|
||||
std::function<void(void *)> init_fn = this->get_implicit_input_init_function(bnode,
|
||||
input_bsocket);
|
||||
if (!init_fn) {
|
||||
return false;
|
||||
}
|
||||
|
||||
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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user